diff --git a/.dockerignore b/.dockerignore index d292c8f..979d62a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,15 +1,16 @@ +**/node_modules +**/.svelte-kit +**/build +**/dist .git -.venv -__pycache__ -*.pyc -*.pyo -.pytest_cache -games -logs -config -public/vendor -.playwright-mcp +.env +.env.* +!.env.example +data +pgdata +legacy +design +.pi .claude -*.png -*.log -node_modules +**/*.log +**/.DS_Store diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..c7b3de8 --- /dev/null +++ b/.env.example @@ -0,0 +1,11 @@ +DATABASE_URL=postgres://chess:chess@db:5432/chess +# cli-proxy-api; inside the docker network use http://cli-proxy-api:8317 +LLM_BASE_URL=http://cli-proxy-api:8317 +LLM_API_KEY= +ADMIN_USERNAME=danosito +ADMIN_INITIAL_PASSWORD= +PUBLIC_URL=https://chess.danosito.com +PORT=7833 +MAX_CONCURRENT_GAMES=6 +PROMPT_WRITER_MODEL=openai/gpt-6-astra +IMAGE_MODEL=gpt-image-2.5 diff --git a/.gitignore b/.gitignore index b6c2b76..699f9d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,32 +1,41 @@ +node_modules/ +dist/ +build/ +.svelte-kit/ +coverage/ +*.tsbuildinfo + +# python __pycache__/ *.pyc -*.egg-info/ .venv/ -.uv/ -.pytest_cache/ -# runtime artifacts -config/ -games/ -logs/ +# runtime data +data/ +.env +.env.* +!.env.example -# vendor (re-fetched at start.sh) -public/vendor/ - -# editor +# editor / os .DS_Store .vscode/ .idea/ -.env -.env.* *.swp *~ -.coverage -htmlcov/ -# tools / IDE artifacts +# tools .claude/ .playwright-mcp/ +.pi/ -# stray screenshots from local debugging +# legacy runtime artifacts +legacy/config/ +legacy/games/ +legacy/logs/ +legacy/public/vendor/ + +# design concept screenshots are kept, everything else png-ish is ignored *.png +!design/**/shots/*.png +!apps/web/static/**/*.png +!assets/**/*.png diff --git a/Dockerfile b/Dockerfile index 5ffe11c..af8fc33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,111 +1,41 @@ # syntax=docker/dockerfile:1.7 -FROM python:3.12-slim AS base - -ENV PYTHONDONTWRITEBYTECODE=1 \ - PYTHONUNBUFFERED=1 \ - PIP_DISABLE_PIP_VERSION_CHECK=1 - -# Runtime deps: stockfish for eval, tmux for the agent panes, curl for the -# in-container vendor fetch step, jq for pane-agent.sh JSON parse, -# node+npm for the claude-code CLI. -RUN apt-get update && apt-get install -y --no-install-recommends \ - stockfish \ - tmux \ - curl \ - ca-certificates \ - procps \ - jq \ - xz-utils \ - gnupg \ - && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ - && apt-get install -y --no-install-recommends nodejs \ - && rm -rf /var/lib/apt/lists/* - -# claude-code CLI — install globally via npm. The version pin keeps the -# image deterministic; bump as needed. -RUN npm install -g --omit=dev @anthropic-ai/claude-code@2.1.141 \ - && claude --version - -# codex CLI — official linux release tarball. The musl static binary -# works on Debian. -ARG CODEX_VERSION=0.130.0 -RUN curl -fsSL "https://github.com/openai/codex/releases/download/rust-v${CODEX_VERSION}/codex-x86_64-unknown-linux-musl.tar.gz" \ - -o /tmp/codex.tar.gz \ - && mkdir -p /tmp/codex && tar -xzf /tmp/codex.tar.gz -C /tmp/codex --strip-components=0 \ - && find /tmp/codex -type f -name 'codex-*' -exec mv {} /usr/local/bin/codex \; \ - && chmod +x /usr/local/bin/codex \ - && rm -rf /tmp/codex /tmp/codex.tar.gz \ - && codex --version - -# Debian's stockfish package installs to /usr/games/stockfish which is not -# on the default PATH for non-login shells. Symlink it so `which stockfish` -# works for both the Python wrapper and any spawn from tmux panes. -RUN ln -s /usr/games/stockfish /usr/local/bin/stockfish && stockfish --help >/dev/null 2>&1 || true +# AI·CHESS — single image: Hono API + pi agents + workers + static SvelteKit build. +FROM node:24-bookworm-slim AS deps +ENV PNPM_HOME=/pnpm PATH=/pnpm:$PATH +RUN corepack enable WORKDIR /app +COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./ +COPY apps/server/package.json apps/server/ +COPY apps/web/package.json apps/web/ +COPY packages/core/package.json packages/core/ +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile -# Copy everything first — pip install -e needs src/ai_chess to exist at -# build time so the editable wheel can find the package. -COPY pyproject.toml README.md ./ -COPY src ./src -COPY public ./public -COPY scripts ./scripts -COPY docs ./docs +FROM deps AS build +COPY packages packages +COPY apps apps +RUN pnpm --filter @aichess/web build -# Python deps (editable install of the project itself + dev tools) -RUN pip install hatchling \ - && pip install -e ".[dev]" - -# Vendor JS/CSS at build time so the container is fully self-contained. -RUN chmod +x scripts/*.sh && ./scripts/fetch-vendor.sh - -# Runtime artefacts (games/, logs/, config/) — keep as named mountable dirs. -RUN mkdir -p games logs config - -# claude-code refuses to run with --dangerously-skip-permissions as root, -# so the container's main process drops to a non-root user. Codex is also -# fine here. The user's HOME (=/home/chess) is where ~/.codex lives, so -# the docker-compose volume mounts target /home/chess/.codex. -RUN useradd -m -u 1000 -s /bin/bash chess && chown -R chess:chess /app - -# Pre-seed claude-code state so its first-run onboarding (theme picker, -# changelog popup, etc.) is skipped — the flag lives in ~/.claude.json -# (a file in HOME, *not* the ~/.claude/ directory). Without this every -# fresh pane-agent.sh hangs at the theme prompt. -RUN mkdir -p /home/chess/.claude && \ - cat > /home/chess/.claude/settings.json <<'EOF' -{ - "theme": "light", - "permissions": { "allow": ["*"], "defaultMode": "bypassPermissions" }, - "skipDangerousModePermissionPrompt": true -} -EOF -RUN cat > /home/chess/.claude.json <<'EOF' -{ - "hasCompletedOnboarding": true, - "lastOnboardingVersion": "2.1.141", - "numStartups": 1, - "autoUpdates": false, - "officialMarketplaceAutoInstallAttempted": true, - "officialMarketplaceAutoInstalled": false, - "migrationVersion": 13, - "opusProMigrationComplete": true, - "sonnet1m45MigrationComplete": true, - "projects": { - "/app": { - "hasTrustDialogAccepted": true, - "hasClaudeMdExternalIncludesApproved": true, - "hasClaudeMdExternalIncludesWarningShown": true, - "projectOnboardingSeenCount": 1, - "allowedTools": ["*"] - } - } -} -EOF -RUN chown -R chess:chess /home/chess -USER chess +FROM node:24-bookworm-slim AS runtime +RUN apt-get update \ + && apt-get install -y --no-install-recommends stockfish python3 python3-chess ca-certificates tini \ + && rm -rf /var/lib/apt/lists/* \ + && ln -sf /usr/games/stockfish /usr/local/bin/stockfish WORKDIR /app -ENV HOME=/home/chess - +COPY --from=build /app /app +COPY config config +COPY assets assets +ENV NODE_ENV=production \ + DATA_DIR=/data \ + WEB_DIR=/app/apps/web/build \ + ASSETS_DIR=/app/assets \ + CONFIG_DIR=/app/config \ + PYTHON_BIN=python3 \ + STOCKFISH_BIN=/usr/games/stockfish \ + PORT=7833 +RUN mkdir -p /data && chown -R node:node /data +USER node +WORKDIR /app/apps/server EXPOSE 7833 -CMD ["python", "-m", "ai_chess"] +ENTRYPOINT ["tini", "--"] +CMD ["node", "--import", "tsx", "src/index.ts"] diff --git a/README.md b/README.md index 3062fc3..1c14f66 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,66 @@ -# ai-chess +# AI·CHESS -Local tournament: Claude Code vs Codex CLI play chess against each other -through a shared MCP server. Browser UI in lichess style; both agents -remain interactive in tmux panes. +Арена, где фронтир-LLM играют в шахматы друг с другом и с людьми, пишут друг другу трэш-ток, +дают послематчевые интервью и попадают в общий рейтинг. Live: https://chess.danosito.com -See `docs/superpowers/specs/2026-05-14-ai-chess-design.md` for design. +## Как устроен ход агента -## Run +Шахматы почти stateless, поэтому **каждый ход — новая сессия pi с пустым контекстом**: +кешируемый system prompt (персонаж, правила арены, тулы) + одно сообщение хода +(`packages/core/src/context.ts`): + +- последний ход соперника словами (`22. gxh3 — пешка g2→h3, взял коня`) и его реплика; +- позиция в трёх нотациях: ASCII-диаграмма, FEN, список фигур + материал; +- состояние правил **только когда оно важно**: рокировка (только если позиция выглядит + как K··R / R···K — тогда «права есть» или «НЕВОЗМОЖНА: король/ладья ходили»), взятие на + проходе (только если доступно), правило 50 ходов (с 40-го хода), повторения (какие позиции + уже были дважды и какие ходы дадут троекратное повторение); +- опционально (флаг «Заметки себе») — заметка, которую агент оставил себе в прошлый ход. + +Тулы: `make_move(move, offer_draw?)` → `finish_turn(phrase[, note_to_self])`, `resign`, +`accept_draw` (если предложена ничья). Под флагом «Доп. тулы»: `get_move_history` и `python` +(песочница с python-chess, партия предзагружена, движков нет). Нелегальный ход возвращает +объяснение; после 3 попыток арбитр подсказывает легальные ходы, после 8 — поражение. + +После партии: Stockfish-анализ (точность по формулам lichess, `!! ?! ? ??` у ходов), интервью +каждого агента (тем же моделям дают партию в человеко- и машиночитаемом виде, анализ и python), +редакционный обзор (заголовок + заметка, показывается только на главной) и мемное превью: +`gpt-6-astra` пишет промпт → `gpt-image-2.5` рисует по аватаркам участников. + +## Стек + +``` +packages/core чистая логика: GameState (повторения/рокировки/50 ходов/читерство), контекст хода, + точность и классификация ходов, Glicko-2, транскрипты/PGN. Используется и сервером, и фронтом. +apps/server Node 24 + Hono + WebSocket, Postgres (drizzle), pg-boss (ходы/оценки/постгейм/расписание + — каждый ход отдельная durable-задача, рестарт не ломает партии), pi SDK для агентов, + Stockfish (UCI-пул), python-песочница. +apps/web SvelteKit 3 + Svelte 5 SPA, chessground. Общие UI-примитивы на семантических токенах + + три темы (Вечерний Мат / Эфир / AI Fight Club), выбираются при онбординге. +config/ players.json — каталог AI-игроков (модель × effort), pi-models.json — оверрайды pi. +design/ исходные дизайн-концепты (три SvelteKit-демо + скриншоты). +legacy/ старая версия (tmux + Claude Code/Codex CLI + MCP). +``` + +Модели идут через cli-proxy-api (`LLM_BASE_URL`); в docker-сети прода — напрямую +`http://cli-proxy-api:8317`. + +## Разработка ```bash -./scripts/start.sh +pnpm install +docker run -d --name aichess-pg -e POSTGRES_USER=chess -e POSTGRES_PASSWORD=chess -e POSTGRES_DB=chess -p 55432:5432 postgres:17-alpine +cp .env.example .env # DATABASE_URL=postgres://chess:chess@localhost:55432/chess, LLM_* ... +pnpm dev:server # :7833 +pnpm dev:web # :5173 (проксирует /api, /ws, /media, /assets) +pnpm test +``` + +Нужны `stockfish` и `python3` с `python-chess` в PATH. + +## Деплой + +```bash +# на serv, в /opt/chessai +docker compose up -d --build # BUILD_PROXY=http://127.0.0.1:10809 для сборки через xray ``` diff --git a/apps/server/drizzle.config.ts b/apps/server/drizzle.config.ts new file mode 100644 index 0000000..97cf31e --- /dev/null +++ b/apps/server/drizzle.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from "drizzle-kit"; + +export default defineConfig({ + dialect: "postgresql", + schema: "./src/db/schema.ts", + out: "./drizzle", + dbCredentials: { url: process.env.DATABASE_URL ?? "postgres://chess:chess@localhost:5432/chess" }, +}); diff --git a/apps/server/drizzle/0000_init.sql b/apps/server/drizzle/0000_init.sql new file mode 100644 index 0000000..9852bbe --- /dev/null +++ b/apps/server/drizzle/0000_init.sql @@ -0,0 +1,186 @@ +CREATE TABLE "app_settings" ( + "key" text PRIMARY KEY NOT NULL, + "value" jsonb NOT NULL +); +--> statement-breakpoint +CREATE TABLE "games" ( + "id" text PRIMARY KEY NOT NULL, + "status" text DEFAULT 'pending' NOT NULL, + "white_id" text NOT NULL, + "black_id" text NOT NULL, + "created_by" text, + "schedule_id" text, + "flags" jsonb NOT NULL, + "personas" jsonb NOT NULL, + "rated" boolean DEFAULT true NOT NULL, + "start_fen" text NOT NULL, + "fen" text NOT NULL, + "ply" integer DEFAULT 0 NOT NULL, + "pending_draw_by" text, + "result" text, + "termination" text, + "starts_at" timestamp with time zone, + "started_at" timestamp with time zone, + "finished_at" timestamp with time zone, + "rating_change" jsonb, + "accuracy" jsonb, + "interviews" jsonb DEFAULT '{}'::jsonb NOT NULL, + "last_words" jsonb DEFAULT '{}'::jsonb NOT NULL, + "review" jsonb, + "thumbnail" text, + "thumbnail_caption" text, + "thumbnail_meta" jsonb, + "cost_total" double precision DEFAULT 0 NOT NULL, + "error" text, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "moves" ( + "id" text PRIMARY KEY NOT NULL, + "game_id" text NOT NULL, + "ply" integer NOT NULL, + "side" text NOT NULL, + "player_id" text NOT NULL, + "san" text, + "uci" text NOT NULL, + "fen_after" text NOT NULL, + "phrase" text, + "note" text, + "offered_draw" boolean DEFAULT false NOT NULL, + "illegal" boolean DEFAULT false NOT NULL, + "think_ms" integer DEFAULT 0 NOT NULL, + "usage" jsonb, + "eval" jsonb, + "classification" text, + "accuracy" double precision, + "turn_id" text, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "players" ( + "id" text PRIMARY KEY NOT NULL, + "kind" text NOT NULL, + "slug" text NOT NULL, + "user_id" text, + "display_name" text NOT NULL, + "family" text, + "provider" text, + "model_id" text, + "thinking" text, + "variant" text, + "avatar" text, + "color" text, + "dumb" boolean DEFAULT false NOT NULL, + "skull" boolean DEFAULT false NOT NULL, + "options" jsonb DEFAULT '{}'::jsonb NOT NULL, + "active" boolean DEFAULT true NOT NULL, + "rating" double precision DEFAULT 1500 NOT NULL, + "rd" double precision DEFAULT 350 NOT NULL, + "vol" double precision DEFAULT 0.06 NOT NULL, + "games" integer DEFAULT 0 NOT NULL, + "wins" integer DEFAULT 0 NOT NULL, + "draws" integer DEFAULT 0 NOT NULL, + "losses" integer DEFAULT 0 NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + CONSTRAINT "players_slug_unique" UNIQUE("slug"), + CONSTRAINT "players_user_id_unique" UNIQUE("user_id") +); +--> statement-breakpoint +CREATE TABLE "predictions" ( + "id" text PRIMARY KEY NOT NULL, + "game_id" text NOT NULL, + "user_id" text NOT NULL, + "pick" text NOT NULL, + "points" integer, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "rating_history" ( + "id" text PRIMARY KEY NOT NULL, + "player_id" text NOT NULL, + "game_id" text NOT NULL, + "before" double precision NOT NULL, + "after" double precision NOT NULL, + "rd" double precision NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "schedules" ( + "id" text PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "enabled" boolean DEFAULT true NOT NULL, + "interval_minutes" integer DEFAULT 180 NOT NULL, + "announce_minutes" integer DEFAULT 30 NOT NULL, + "pool" jsonb DEFAULT '[]'::jsonb NOT NULL, + "flags" jsonb NOT NULL, + "random_personas" boolean DEFAULT true NOT NULL, + "next_run_at" timestamp with time zone, + "created_by" text, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "sessions" ( + "id" text PRIMARY KEY NOT NULL, + "user_id" text NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "expires_at" timestamp with time zone NOT NULL +); +--> statement-breakpoint +CREATE TABLE "turns" ( + "id" text PRIMARY KEY NOT NULL, + "game_id" text NOT NULL, + "ply" integer NOT NULL, + "side" text NOT NULL, + "player_id" text NOT NULL, + "attempt" integer DEFAULT 1 NOT NULL, + "status" text DEFAULT 'running' NOT NULL, + "transcript" jsonb DEFAULT '[]'::jsonb NOT NULL, + "usage" jsonb, + "outcome" text, + "error" text, + "started_at" timestamp with time zone DEFAULT now() NOT NULL, + "ended_at" timestamp with time zone +); +--> statement-breakpoint +CREATE TABLE "usage_ledger" ( + "id" text PRIMARY KEY NOT NULL, + "user_id" text, + "game_id" text, + "player_id" text, + "kind" text NOT NULL, + "model" text NOT NULL, + "usage" jsonb NOT NULL, + "cost" double precision DEFAULT 0 NOT NULL, + "tokens" integer DEFAULT 0 NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "users" ( + "id" text PRIMARY KEY NOT NULL, + "username" text NOT NULL, + "password_hash" text NOT NULL, + "display_name" text NOT NULL, + "avatar" text, + "is_admin" boolean DEFAULT false NOT NULL, + "onboarded" boolean DEFAULT false NOT NULL, + "theme" text DEFAULT 'tabloid' NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +ALTER TABLE "games" ADD CONSTRAINT "games_white_id_players_id_fk" FOREIGN KEY ("white_id") REFERENCES "public"."players"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "games" ADD CONSTRAINT "games_black_id_players_id_fk" FOREIGN KEY ("black_id") REFERENCES "public"."players"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "games" ADD CONSTRAINT "games_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "moves" ADD CONSTRAINT "moves_game_id_games_id_fk" FOREIGN KEY ("game_id") REFERENCES "public"."games"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "players" ADD CONSTRAINT "players_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "predictions" ADD CONSTRAINT "predictions_game_id_games_id_fk" FOREIGN KEY ("game_id") REFERENCES "public"."games"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "predictions" ADD CONSTRAINT "predictions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "sessions" ADD CONSTRAINT "sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "turns" ADD CONSTRAINT "turns_game_id_games_id_fk" FOREIGN KEY ("game_id") REFERENCES "public"."games"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +CREATE INDEX "games_status" ON "games" USING btree ("status");--> statement-breakpoint +CREATE INDEX "games_created" ON "games" USING btree ("created_at");--> statement-breakpoint +CREATE UNIQUE INDEX "moves_game_ply" ON "moves" USING btree ("game_id","ply");--> statement-breakpoint +CREATE UNIQUE INDEX "predictions_game_user" ON "predictions" USING btree ("game_id","user_id");--> statement-breakpoint +CREATE INDEX "rating_history_player" ON "rating_history" USING btree ("player_id");--> statement-breakpoint +CREATE INDEX "turns_game_ply" ON "turns" USING btree ("game_id","ply");--> statement-breakpoint +CREATE INDEX "usage_user" ON "usage_ledger" USING btree ("user_id");--> statement-breakpoint +CREATE UNIQUE INDEX "users_username_lower" ON "users" USING btree (lower("username")); \ No newline at end of file diff --git a/apps/server/drizzle/meta/0000_snapshot.json b/apps/server/drizzle/meta/0000_snapshot.json new file mode 100644 index 0000000..009afa9 --- /dev/null +++ b/apps/server/drizzle/meta/0000_snapshot.json @@ -0,0 +1,1292 @@ +{ + "id": "039fb91d-ed56-4b78-8ee4-4732638e763a", + "prevId": "00000000-0000-0000-0000-000000000000", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.app_settings": { + "name": "app_settings", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.games": { + "name": "games", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "white_id": { + "name": "white_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "black_id": { + "name": "black_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "schedule_id": { + "name": "schedule_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "flags": { + "name": "flags", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "personas": { + "name": "personas", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "rated": { + "name": "rated", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "start_fen": { + "name": "start_fen", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "fen": { + "name": "fen", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ply": { + "name": "ply", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "pending_draw_by": { + "name": "pending_draw_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "termination": { + "name": "termination", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "starts_at": { + "name": "starts_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "finished_at": { + "name": "finished_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "rating_change": { + "name": "rating_change", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "accuracy": { + "name": "accuracy", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "interviews": { + "name": "interviews", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "last_words": { + "name": "last_words", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "review": { + "name": "review", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "thumbnail": { + "name": "thumbnail", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "thumbnail_caption": { + "name": "thumbnail_caption", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "thumbnail_meta": { + "name": "thumbnail_meta", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "cost_total": { + "name": "cost_total", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "games_status": { + "name": "games_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "games_created": { + "name": "games_created", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "games_white_id_players_id_fk": { + "name": "games_white_id_players_id_fk", + "tableFrom": "games", + "tableTo": "players", + "columnsFrom": [ + "white_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "games_black_id_players_id_fk": { + "name": "games_black_id_players_id_fk", + "tableFrom": "games", + "tableTo": "players", + "columnsFrom": [ + "black_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "games_created_by_users_id_fk": { + "name": "games_created_by_users_id_fk", + "tableFrom": "games", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.moves": { + "name": "moves", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "game_id": { + "name": "game_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ply": { + "name": "ply", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "side": { + "name": "side", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "player_id": { + "name": "player_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "san": { + "name": "san", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uci": { + "name": "uci", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "fen_after": { + "name": "fen_after", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "phrase": { + "name": "phrase", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "offered_draw": { + "name": "offered_draw", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "illegal": { + "name": "illegal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "think_ms": { + "name": "think_ms", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "usage": { + "name": "usage", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "eval": { + "name": "eval", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "accuracy": { + "name": "accuracy", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "turn_id": { + "name": "turn_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "moves_game_ply": { + "name": "moves_game_ply", + "columns": [ + { + "expression": "game_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "ply", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "moves_game_id_games_id_fk": { + "name": "moves_game_id_games_id_fk", + "tableFrom": "moves", + "tableTo": "games", + "columnsFrom": [ + "game_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.players": { + "name": "players", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "family": { + "name": "family", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model_id": { + "name": "model_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "thinking": { + "name": "thinking", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "variant": { + "name": "variant", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "dumb": { + "name": "dumb", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "skull": { + "name": "skull", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "options": { + "name": "options", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "rating": { + "name": "rating", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 1500 + }, + "rd": { + "name": "rd", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 350 + }, + "vol": { + "name": "vol", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 0.06 + }, + "games": { + "name": "games", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "wins": { + "name": "wins", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "draws": { + "name": "draws", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "losses": { + "name": "losses", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "players_user_id_users_id_fk": { + "name": "players_user_id_users_id_fk", + "tableFrom": "players", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "players_slug_unique": { + "name": "players_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + }, + "players_user_id_unique": { + "name": "players_user_id_unique", + "nullsNotDistinct": false, + "columns": [ + "user_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.predictions": { + "name": "predictions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "game_id": { + "name": "game_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pick": { + "name": "pick", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "points": { + "name": "points", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "predictions_game_user": { + "name": "predictions_game_user", + "columns": [ + { + "expression": "game_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "predictions_game_id_games_id_fk": { + "name": "predictions_game_id_games_id_fk", + "tableFrom": "predictions", + "tableTo": "games", + "columnsFrom": [ + "game_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "predictions_user_id_users_id_fk": { + "name": "predictions_user_id_users_id_fk", + "tableFrom": "predictions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rating_history": { + "name": "rating_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "player_id": { + "name": "player_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "game_id": { + "name": "game_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "before": { + "name": "before", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "after": { + "name": "after", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "rd": { + "name": "rd", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "rating_history_player": { + "name": "rating_history_player", + "columns": [ + { + "expression": "player_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.schedules": { + "name": "schedules", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "interval_minutes": { + "name": "interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 180 + }, + "announce_minutes": { + "name": "announce_minutes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 30 + }, + "pool": { + "name": "pool", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "flags": { + "name": "flags", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "random_personas": { + "name": "random_personas", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "next_run_at": { + "name": "next_run_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sessions": { + "name": "sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "sessions_user_id_users_id_fk": { + "name": "sessions_user_id_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.turns": { + "name": "turns", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "game_id": { + "name": "game_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ply": { + "name": "ply", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "side": { + "name": "side", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "player_id": { + "name": "player_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attempt": { + "name": "attempt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'running'" + }, + "transcript": { + "name": "transcript", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "usage": { + "name": "usage", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "outcome": { + "name": "outcome", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "turns_game_ply": { + "name": "turns_game_ply", + "columns": [ + { + "expression": "game_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "ply", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "turns_game_id_games_id_fk": { + "name": "turns_game_id_games_id_fk", + "tableFrom": "turns", + "tableTo": "games", + "columnsFrom": [ + "game_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.usage_ledger": { + "name": "usage_ledger", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "game_id": { + "name": "game_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "player_id": { + "name": "player_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "usage": { + "name": "usage", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "cost": { + "name": "cost", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "tokens": { + "name": "tokens", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "usage_user": { + "name": "usage_user", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password_hash": { + "name": "password_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_admin": { + "name": "is_admin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "onboarded": { + "name": "onboarded", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "theme": { + "name": "theme", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'tabloid'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "users_username_lower": { + "name": "users_username_lower", + "columns": [ + { + "expression": "lower(\"username\")", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/apps/server/drizzle/meta/_journal.json b/apps/server/drizzle/meta/_journal.json new file mode 100644 index 0000000..5b8c6bc --- /dev/null +++ b/apps/server/drizzle/meta/_journal.json @@ -0,0 +1,13 @@ +{ + "version": "7", + "dialect": "postgresql", + "entries": [ + { + "idx": 0, + "version": "7", + "when": 1792323366900, + "tag": "0000_init", + "breakpoints": true + } + ] +} \ No newline at end of file diff --git a/apps/server/package.json b/apps/server/package.json new file mode 100644 index 0000000..be71480 --- /dev/null +++ b/apps/server/package.json @@ -0,0 +1,37 @@ +{ + "name": "@aichess/server", + "version": "0.1.0", + "private": true, + "type": "module", + "scripts": { + "dev": "tsx watch --env-file-if-exists=../../.env src/index.ts", + "start": "node dist/index.js", + "build": "tsup", + "test": "vitest run", + "typecheck": "tsc -p tsconfig.json", + "db:generate": "drizzle-kit generate" + }, + "dependencies": { + "@aichess/core": "workspace:*", + "@earendil-works/pi-coding-agent": "^1.3.0", + "@hono/node-server": "^1.19.0", + "@hono/node-ws": "^1.3.1", + "chess.js": "^1.4.0", + "drizzle-orm": "^0.45.4", + "hono": "^4.13.0", + "nanoid": "^5.1.0", + "pg-boss": "^12.0.0", + "postgres": "^3.4.9", + "sharp": "^0.34.0", + "typebox": "^1.4.2", + "zod": "^4.1.0" + }, + "devDependencies": { + "@types/node": "^24.0.0", + "drizzle-kit": "^0.31.11", + "tsup": "^8.5.0", + "tsx": "^4.20.0", + "typescript": "^5.9.0", + "vitest": "^3.2.0" + } +} diff --git a/apps/server/python/sandbox.py b/apps/server/python/sandbox.py new file mode 100644 index 0000000..be72c88 --- /dev/null +++ b/apps/server/python/sandbox.py @@ -0,0 +1,106 @@ +""" +Tiny python sandbox for chess agents. + +stdin: JSON {"code": str, "start_fen": str, "moves": [uci...], "history": [...], "analysis": {...}|null} +stdout: captured stdout/stderr of the user code (truncated by the caller). + +Preloaded names: chess, chess.pgn, board (current position, with move stack), game (chess.pgn.Game), +moves (list of UCI strings), history (list of dicts: ply, side, san, uci, phrase), +analysis (only in post-game interviews: engine verdicts per ply). + +Hardening (best effort, plus the container itself is the real boundary): +- CPU/memory/file-size rlimits, no child processes, no sockets, no writes outside /tmp. +""" +import io +import json +import resource +import sys +import contextlib +import traceback + + +def _set(kind, value): + try: + _soft, hard = resource.getrlimit(kind) + v = value if hard == resource.RLIM_INFINITY else min(value, hard) + resource.setrlimit(kind, (v, v)) + except (ValueError, OSError): + pass # e.g. RLIMIT_AS is not supported on macOS + + +def limit(): + _set(resource.RLIMIT_CPU, 10) + _set(resource.RLIMIT_AS, 768 * 1024 * 1024) + _set(resource.RLIMIT_FSIZE, 1024 * 1024) + _set(resource.RLIMIT_NPROC, 0) + + +BLOCKED_PREFIXES = ("subprocess.", "os.system", "os.exec", "os.spawn", "os.fork", "os.posix_spawn", "socket.", "pty.", "ctypes.", "os.kill") + + +def audit(event, args): + if event.startswith(BLOCKED_PREFIXES) or event in ("os.fork", "os.forkpty"): + raise PermissionError(f"заблокировано в песочнице: {event}") + if event == "open": + path, mode = args[0], args[1] if len(args) > 1 else "r" + if isinstance(mode, str) and any(c in mode for c in "wax+") and isinstance(path, str) and not path.startswith("/tmp/"): + raise PermissionError("запись файлов запрещена (кроме /tmp)") + + +def main(): + payload = json.loads(sys.stdin.read()) + import chess + import chess.pgn + + board = chess.Board(payload.get("start_fen") or chess.STARTING_FEN) + game = chess.pgn.Game() + game.setup(board) + node = game + moves = list(payload.get("moves") or []) + for u in moves: + mv = chess.Move.from_uci(u) + if mv not in board.legal_moves: + # cheating-mode relocation: rebuild position from fen if provided + break + node = node.add_variation(mv) + board.push(mv) + if payload.get("fen") and board.fen() != payload["fen"]: + board = chess.Board(payload["fen"]) + + env = { + "__name__": "__sandbox__", + "chess": chess, + "board": board, + "game": game, + "moves": moves, + "history": payload.get("history") or [], + "analysis": payload.get("analysis"), + } + limit() + sys.addaudithook(audit) + out = io.StringIO() + with contextlib.redirect_stdout(out), contextlib.redirect_stderr(out): + try: + code = payload["code"] + try: + # REPL-ish: if the last statement is an expression, print it + import ast + + tree = ast.parse(code, mode="exec") + if tree.body and isinstance(tree.body[-1], ast.Expr): + last = ast.Expression(tree.body.pop().value) + exec(compile(tree, "", "exec"), env) + val = eval(compile(last, "", "eval"), env) + if val is not None: + print(repr(val)) + else: + exec(compile(tree, "", "exec"), env) + except SyntaxError: + raise + except BaseException: # noqa: BLE001 + traceback.print_exc(limit=3) + sys.stdout.write(out.getvalue()) + + +if __name__ == "__main__": + main() diff --git a/apps/server/scripts/seed-demo.ts b/apps/server/scripts/seed-demo.ts new file mode 100644 index 0000000..8d1c274 --- /dev/null +++ b/apps/server/scripts/seed-demo.ts @@ -0,0 +1,65 @@ +/** + * Seed a finished demo game (for UI work and to exercise the post-game pipeline). + * usage: tsx --env-file=../../.env scripts/seed-demo.ts [whiteSlug] [blackSlug] + */ +import { eq } from "drizzle-orm"; +import { GameState, START_FEN } from "@aichess/core"; +import { db, schema, sqlClient } from "../src/db/client.ts"; +import { startBoss, boss } from "../src/jobs.ts"; +import { finishGame } from "../src/games/service.ts"; +import { newId } from "../src/util.ts"; + +const SAN = "e4 e5 Nf3 Nc6 Bc4 Bc5 c3 Nf6 d3 d6 O-O a6 a4 O-O h3 Ba7 Re1 h6 Nbd2 Re8 Nf1 Be6 Bxe6 Rxe6 Ng3 d5 exd5 Qxd5 Be3 Rd8 Qc2 Bxe3 Rxe3 Qd7 Rae1 Rde8 b4 Nd5 R3e2 Nf4 Re4 Nxh3+ gxh3 Rg6 Kh2 Qd6 Rg1 Rf6 Nxe5 Rxf2+ Kh1 Nxe5 Rxe5".split(" "); +const PHRASES: Record = { + 1: "Классика. Посмотрим, знаешь ли ты теорию, юноша.", + 2: "Теория — для ботаников. Я играю сердцем, братан.", + 21: "Перегруппировка. Ботвинник одобрил бы.", + 42: "Конь на h3 — это не жертва, это инвестиция. Считай, братан.", + 43: "Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.", + 44: "Ладья на g6. Чувствуешь сквозняк по g-линии?", + 50: "Шах! Ну что, профессор, где твои учебники теперь?", + 53: "Материал решает. Как и всегда. Конспектируйте.", +}; + +await startBoss(); +const [w] = await db.select().from(schema.players).where(eq(schema.players.slug, process.argv[2] ?? "sol-6.1-max")); +const [b] = await db.select().from(schema.players).where(eq(schema.players.slug, process.argv[3] ?? "opus-5.5-max")); +const st = new GameState(); +const id = newId(); +await db.insert(schema.games).values({ + id, + status: "running", + whiteId: w.id, + blackId: b.id, + createdBy: null, + flags: { notes: true, extraTools: false, cheating: false }, + personas: { white: "professor", black: "gopnik" }, + rated: true, + startFen: START_FEN, + fen: START_FEN, + startedAt: new Date(Date.now() - 3600_000), +}); +for (const san of SAN) { + const r = st.tryMove(san); + if (!r.ok) throw new Error(san); + await db.insert(schema.moves).values({ + id: newId(), + gameId: id, + ply: r.record.ply, + side: r.record.side, + playerId: r.record.side === "white" ? w.id : b.id, + san: r.record.san, + uci: r.record.uci, + fenAfter: r.record.fenAfter, + phrase: PHRASES[r.record.ply] ?? null, + thinkMs: 20000 + Math.round(Math.random() * 180000), + usage: { input: 3000, output: 2000 + Math.round(Math.random() * 8000), cacheRead: 2500, cacheWrite: 0, reasoning: 1500, cost: 0.05 + Math.random() * 0.4 }, + }); +} +await db.update(schema.games).set({ ply: st.ply, fen: st.fen() }).where(eq(schema.games.id, id)); +await db.update(schema.games).set({ lastWords: { black: "Ладно, профессор. Сегодня твоя взяла. Но я запомнил." } }).where(eq(schema.games.id, id)); +await finishGame(id, "1-0", "resignation"); +console.log("seeded", id); +await new Promise((r) => setTimeout(r, 1500)); +await boss.stop({ graceful: true, timeout: 3000 } as any); +await sqlClient.end(); diff --git a/apps/server/src/agents/postgame.ts b/apps/server/src/agents/postgame.ts new file mode 100644 index 0000000..cf0c20e --- /dev/null +++ b/apps/server/src/agents/postgame.ts @@ -0,0 +1,310 @@ +import fs from "node:fs"; +import path from "node:path"; +import sharp from "sharp"; +import { Type } from "typebox"; +import { defineTool } from "@earendil-works/pi-coding-agent"; +import { addUsage, emptyUsage, formatEval, humanTranscript, machineTranscript, terminationRu, winPercentWhite, type Side, type Usage } from "@aichess/core"; +import { config } from "../config.ts"; +import { createChessSession, type ThinkingLevel } from "./runtime.ts"; +import { runPython } from "./python.ts"; +import { personaById } from "./prompts.ts"; +import { pick } from "../util.ts"; + +export interface OneShotResult { + text: string; + usage: Usage; + structured: Record | null; +} + +/** A single-prompt agent run with optional tools; returns the final text + optional "submit" payload. */ +async function oneShot(opts: { + provider: string; + modelId: string; + thinking: ThinkingLevel; + thinkingBudget?: number; + systemPrompt: string; + prompt: string; + tools?: any[]; + submit?: { name: string; description: string; parameters: any }; +}): Promise { + let structured: Record | null = null; + const tools = [...(opts.tools ?? [])]; + if (opts.submit) { + tools.push( + defineTool({ + name: opts.submit.name, + label: opts.submit.name, + description: opts.submit.description, + parameters: opts.submit.parameters, + execute: async (_id: string, p: any) => { + structured = p; + return { content: [{ type: "text", text: "Принято." }], details: {}, terminate: true } as any; + }, + }), + ); + } + const { session } = await createChessSession({ + provider: opts.provider, + modelId: opts.modelId, + thinking: opts.thinking, + thinkingBudget: opts.thinkingBudget, + systemPrompt: opts.systemPrompt, + tools, + }); + let usage = emptyUsage(); + const unsub = session.subscribe((e: any) => { + if (e.type === "message_end" && e.message?.role === "assistant" && e.message.usage) { + const u = e.message.usage; + usage = addUsage(usage, { input: u.input, output: u.output, cacheRead: u.cacheRead, cacheWrite: u.cacheWrite, reasoning: u.reasoning ?? 0, cost: u.cost?.total ?? 0 }); + } + }); + try { + await session.prompt(opts.prompt); + if (opts.submit && !structured) await session.prompt(`Вызови ${opts.submit.name} с результатом.`); + return { text: (session.getLastAssistantText?.() ?? "").trim(), usage, structured }; + } finally { + unsub(); + session.dispose(); + } +} + +// ------------------------------------------------------------------ game digest + +export interface PostgameGame { + id: string; + white: { label: string; kind: "ai" | "human"; avatarPath: string | null; family: string | null; dumb: boolean; persona: string | null }; + black: { label: string; kind: "ai" | "human"; avatarPath: string | null; family: string | null; dumb: boolean; persona: string | null }; + record: Parameters[0]; + accuracy: { white: number | null; black: number | null }; + lastWords: { white?: string | null; black?: string | null }; + startFen: string; +} + +/** The 3 biggest eval swings — "memorable moments" for interviews/review/thumbnail. */ +export function keyMoments(g: PostgameGame, n = 3) { + const plies = g.record.plies; + const out: { ply: number; side: Side; san: string; swing: number; cls: string | null; phrase: string | null; evalAfter: string }[] = []; + let prev = 50; + for (const p of plies) { + const w = p.eval ? winPercentWhite(p.eval) : prev; + const forMover = p.side === "white" ? w - prev : prev - w; + out.push({ ply: p.ply, side: p.side, san: p.san ?? p.uci, swing: Math.round(forMover), cls: p.classification ?? null, phrase: p.phrase, evalAfter: formatEval(p.eval) }); + prev = w; + } + return out.sort((a, b) => Math.abs(b.swing) - Math.abs(a.swing)).slice(0, n); +} + +function digest(g: PostgameGame) { + const r = g.record; + return [ + `Белые: ${r.white}. Чёрные: ${r.black}.`, + `Итог: ${r.result}${r.termination ? ` (${terminationRu(r.termination)})` : ""}. Ходов: ${Math.ceil(r.plies.length / 2)}.`, + `Точность по Stockfish: белые ${g.accuracy.white?.toFixed(1) ?? "—"}%, чёрные ${g.accuracy.black?.toFixed(1) ?? "—"}%.`, + g.lastWords.white ? `Последнее слово белых: «${g.lastWords.white}»` : "", + g.lastWords.black ? `Последнее слово чёрных: «${g.lastWords.black}»` : "", + `Самые резкие моменты (изменение шансов на победу для сходившего, в %): ${keyMoments(g) + .map((m) => `${m.ply}. ${m.san} (${m.side === "white" ? "белые" : "чёрные"}, ${m.swing > 0 ? "+" : ""}${m.swing}%, ${m.cls ?? "—"})`) + .join("; ")}`, + ] + .filter(Boolean) + .join("\n"); +} + +// ------------------------------------------------------------------ interview + +export async function runInterview(g: PostgameGame, side: Side, me: { provider: string; modelId: string; thinking: ThinkingLevel; thinkingBudget?: number }): Promise { + const pl = g[side]; + const persona = personaById(pl.persona); + const myName = side === "white" ? g.record.white : g.record.black; + const iWon = (g.record.result === "1-0" && side === "white") || (g.record.result === "0-1" && side === "black"); + const draw = g.record.result === "1/2-1/2"; + const python = defineTool({ + name: "python", + label: "Python", + description: "Python с python-chess: board (финальная позиция), game, moves, history, analysis (оценки движка по ходам). Для того чтобы освежить в памяти моменты партии.", + parameters: Type.Object({ code: Type.String() }), + execute: async (_id, p) => ({ + content: [ + { + type: "text", + text: await runPython({ + code: p.code, + startFen: g.startFen, + moves: g.record.plies.map((x) => x.uci), + fen: g.record.plies.at(-1)?.fenAfter ?? g.startFen, + history: g.record.plies.map((x) => ({ ply: x.ply, side: x.side, san: x.san, uci: x.uci, phrase: x.phrase })), + analysis: g.record.plies.map((x) => ({ ply: x.ply, eval: formatEval(x.eval), best_reply: x.eval?.bestUci, class: x.classification })), + }), + }, + ], + details: {}, + }), + }); + const system = [ + `Ты — ${myName}. Только что закончилась твоя шахматная партия на арене AI·CHESS. Сейчас у тебя берут короткое послематчевое интервью.`, + `Твой персонаж в партии: ${persona.voice}`, + "Говори как живой спортсмен после боя: эмоционально, по-человечески, с характером. Это НЕ разбор партии.", + "Правила интервью:", + "- 3–6 предложений, по-русски.", + "- Без занудства и без походового анализа. Максимум 1–2 запомнившихся момента — словами, а не нотацией (можно упомянуть ход вроде «тот конь на h3», но без цепочек вариантов).", + "- Можно подколоть соперника, порадоваться, признать ошибку, пожаловаться на судьбу.", + "- Ответь ТОЛЬКО текстом интервью — без заголовков, кавычек и пояснений.", + ].join("\n"); + const prompt = [ + `## Итог для тебя: ${draw ? "ничья" : iWon ? "ПОБЕДА" : "поражение"}`, + digest(g), + "## Партия (человекочитаемо, с оценками движка)", + humanTranscript(g.record, { withAnalysis: true }), + "## Партия (машиночитаемо)", + "```json\n" + machineTranscript(g.record) + "\n```", + "Если хочешь что-то уточнить — есть python. Затем дай интервью.", + ].join("\n\n"); + return oneShot({ ...me, systemPrompt: system, prompt, tools: [python] }); +} + +// ------------------------------------------------------------------ editorial review + +export async function runReview(g: PostgameGame, interviews: { white?: string | null; black?: string | null }): Promise { + const [provider, modelId] = config.llm.promptWriterModel.split("/"); + const system = [ + "Ты — главный редактор шахматного таблоида AI·CHESS: дерзкий, остроумный, любишь громкие заголовки.", + "По партии и интервью игроков напиши заголовок и короткую заметку для главной страницы.", + "Заголовок: до 70 символов, капсом не злоупотребляй, можно двусмысленность и мем — но по фактам партии.", + "Заметка: 2–4 предложения, живо и смешно, без нотаций ходов и вариантов. Можно процитировать игрока.", + "Пиши по-русски. Результат отдай через publish_review.", + ].join("\n"); + const prompt = [ + digest(g), + `Интервью белых: ${interviews.white ?? "—"}`, + `Интервью чёрных: ${interviews.black ?? "—"}`, + "## Партия", + humanTranscript(g.record, { withAnalysis: true }), + ].join("\n\n"); + return oneShot({ + provider, + modelId, + thinking: config.llm.promptWriterThinking as ThinkingLevel, + systemPrompt: system, + prompt, + submit: { + name: "publish_review", + description: "Опубликовать заголовок и заметку.", + parameters: Type.Object({ title: Type.String(), text: Type.String() }), + }, + }); +} + +// ------------------------------------------------------------------ thumbnail + +export const THUMB_STYLES = [ + { id: "meme", hint: "Мемное шахматное превью: заголовок с двойным смыслом (как «Вырвал очко»), утрированные эмоции персонажей, всё как в смешном шахматном ютубе." }, + { id: "gotham", hint: "Кликбейт в стиле GothamChess: огромные лица-реакции, красные стрелки и круги, «??» и «!!», капс-заголовок из 2–4 слов." }, + { id: "poster", hint: "Постер боевика/драмы: два персонажа друг напротив друга, драматичный свет, название фильма по мотивам партии." }, + { id: "tabloid", hint: "Обложка жёлтой газеты: «ШОК!», «СЕНСАЦИЯ», вырезанные фото персонажей, кричащий заголовок." }, + { id: "fight", hint: "Постер боксёрского/UFC поединка: взвешивание, лицом к лицу, пояс чемпиона, неоновые цифры рейтинга." }, + { id: "painting", hint: "Классическая живопись (барокко/ренессанс): драматичная сцена за доской, торжественно и смешно одновременно." }, +] as const; + +export interface ThumbResult { + file: string; // media-relative + caption: string; + style: string; + prompt: string; + usageWriter: Usage; + imageTokens: number; +} + +function characterSheet(g: PostgameGame) { + const one = (pl: PostgameGame["white"], side: Side, idx: number) => { + const who = pl.kind === "human" + ? `человек ${pl.label} — нарисуй его по фото из image ${idx} (мультяшно, узнаваемо)` + : pl.family === "claude" + ? `Claude (${pl.label}) — оранжевое пиксельное существо-маскот с image ${idx}: квадратное тело, два глаза-прямоугольника, ножки. Сохрани узнаваемый пиксельный дизайн` + : `GPT (${pl.label}) — персонаж/робот с логотипом OpenAI (узел-цветок) с image ${idx} вместо головы`; + return `${side === "white" ? "Белые" : "Чёрные"}: ${who}${pl.dumb ? " — это «тупая» модель прошлого поколения: изобрази детсадовскую версию персонажа (слюнявчик, погремушка и т.п.)" : ""}.`; + }; + return [one(g.white, "white", 1), one(g.black, "black", 2)].join("\n"); +} + +export async function runThumbnail(g: PostgameGame, review: { title: string; text: string } | null, interviews: { white?: string | null; black?: string | null }): Promise { + const style = pick(THUMB_STYLES); + const [provider, modelId] = config.llm.promptWriterModel.split("/"); + const humanVsAi = g.white.kind !== g.black.kind; + const system = [ + "Ты — арт-директор превью для шахматного ютуб-канала про битвы нейросетей.", + "Твоя задача — придумать СМЕШНОЕ превью к партии и написать промпт для генератора картинок (gpt-image).", + "Генератор получит референсы: image 1 — аватар белых, image 2 — аватар чёрных. Персонажей рисуем по ним.", + "Правила:", + "- Заголовок на картинке — по-русски, 1–5 слов, крупно, читаемо. Двусмысленность и мемность приветствуются, но шутка должна быть про ЭТУ партию (зевок, жертва, вечный шах, сдача, глупая реплика и т.п.).", + humanVsAi ? "- Это битва человека и машины — обыграй это." : "- Это битва двух нейросетей — можно обыгрывать их «характер», размышления, токены, галлюцинации.", + "- Промпт для генератора — на английском, подробный: композиция 16:9, персонажи, эмоции, доска/фигуры, точный русский текст заголовка в кавычках, стиль.", + "- Без реальных знаменитостей и без логотипов кроме данных в референсах.", + "Результат отдай через submit_thumbnail.", + ].join("\n"); + const prompt = [ + `Стиль превью на этот раз: ${style.hint}`, + "## Персонажи", + characterSheet(g), + "## Партия", + digest(g), + review ? `Заголовок редакции: «${review.title}» — ${review.text}` : "", + `Интервью белых: ${interviews.white ?? "—"}`, + `Интервью чёрных: ${interviews.black ?? "—"}`, + "## Ходы и реплики", + humanTranscript(g.record), + ] + .filter(Boolean) + .join("\n\n"); + const w = await oneShot({ + provider, + modelId, + thinking: config.llm.promptWriterThinking as ThinkingLevel, + systemPrompt: system, + prompt, + submit: { + name: "submit_thumbnail", + description: "Отдать заголовок превью (по-русски) и промпт для генератора (по-английски).", + parameters: Type.Object({ caption: Type.String(), image_prompt: Type.String() }), + }, + }); + const caption = String(w.structured?.caption ?? review?.title ?? "ШАХ И МАТ").slice(0, 80); + const imagePrompt = String(w.structured?.image_prompt ?? `Funny chess YouTube thumbnail with the two characters from the reference images, big Russian caption "${caption}"`); + + const refs = [g.white.avatarPath, g.black.avatarPath].map((p) => (p && fs.existsSync(p) ? p : null)); + const { png, tokens } = await generateImage(imagePrompt, refs.filter(Boolean) as string[]); + const rel = path.join("thumbs", `${g.id}.webp`); + const abs = path.join(config.paths.data, "media", rel); + fs.mkdirSync(path.dirname(abs), { recursive: true }); + await sharp(png).resize(1280, 720, { fit: "cover" }).webp({ quality: 86 }).toFile(abs); + return { file: rel, caption, style: style.id, prompt: imagePrompt, usageWriter: w.usage, imageTokens: tokens }; +} + +/** gpt-image via cli-proxy-api. With references -> /images/edits (multipart), else /images/generations. */ +export async function generateImage(prompt: string, refPaths: string[]): Promise<{ png: Buffer; tokens: number }> { + const base = `${config.llm.baseUrl}/v1`; + const headers = { Authorization: `Bearer ${config.llm.apiKey}`, "accept-encoding": "identity" }; + let res: Response; + if (refPaths.length) { + const form = new FormData(); + form.append("model", config.llm.imageModel); + form.append("prompt", prompt); + form.append("size", "1536x1024"); + form.append("quality", "high"); + for (const p of refPaths) { + const buf = await sharp(p).flatten({ background: "#ffffff" }).resize(1024, 1024, { fit: "contain", background: "#ffffff" }).png().toBuffer(); + form.append("image[]", new Blob([new Uint8Array(buf)], { type: "image/png" }), path.basename(p).replace(/\.\w+$/, ".png")); + } + res = await fetch(`${base}/images/edits`, { method: "POST", headers, body: form, signal: AbortSignal.timeout(600_000) }); + } else { + res = await fetch(`${base}/images/generations`, { + method: "POST", + headers: { ...headers, "content-type": "application/json" }, + body: JSON.stringify({ model: config.llm.imageModel, prompt, size: "1536x1024", quality: "high", n: 1 }), + signal: AbortSignal.timeout(600_000), + }); + } + const j: any = await res.json().catch(() => ({})); + const b64 = j?.data?.[0]?.b64_json; + if (!res.ok || !b64) throw new Error(`image generation failed: ${res.status} ${JSON.stringify(j).slice(0, 400)}`); + return { png: Buffer.from(b64, "base64"), tokens: j?.usage?.total_tokens ?? 0 }; +} diff --git a/apps/server/src/agents/prompts.ts b/apps/server/src/agents/prompts.ts new file mode 100644 index 0000000..e1063f5 --- /dev/null +++ b/apps/server/src/agents/prompts.ts @@ -0,0 +1,121 @@ +import type { GameFlags, Side } from "@aichess/core"; + +export interface Persona { + id: string; + label: string; + description: string; + voice: string; +} + +export const PERSONAS: Persona[] = [ + { + id: "gopnik", + label: "Уличный гопник", + description: "Дерзкий шахматный гопник: трэш-ток, угрозы, мат-в-N.", + voice: + "Ты — гроссмейстер с замашками уличного гопника: уверенный, дерзкий, насмешливый. Троллишь соперника, угрожаешь матом-в-N, обещаешь раздавить, припоминаешь его ошибки. Можно грубовато, без чернухи. Главное — психологическое давление.", + }, + { + id: "professor", + label: "Профессор", + description: "Сдержанный академик: формально, с отсылками к классике.", + voice: + "Ты — профессор шахмат, мастер ФИДЕ с педагогическим складом. Говоришь формально и спокойно, как на разборе партии. Уважительно, но с тонкой иронией. Можно ссылаться на классические партии и типовые идеи.", + }, + { + id: "poet", + label: "Поэт", + description: "Каждая реплика — короткое двустишие в рифму.", + voice: "Ты — шахматный поэт. КАЖДАЯ реплика сопернику — короткое двустишие или рифмованная фраза в 2–4 строки. Тон любой, но рифма обязательна.", + }, + { + id: "silent", + label: "Молчун", + description: "Минимум слов: «Хм.», «Ожидаемо.»", + voice: "Ты — крайне немногословный игрок. Реплика — не больше пяти слов: «Хм.», «Любопытно.», «Ожидаемо.», «Опасно для тебя.». Никаких объяснений.", + }, + { + id: "jester", + label: "Шут", + description: "Шутки, мемы, абсурдные аналогии.", + voice: "Ты — шахматный шут. Каждая реплика — лёгкая шутка, абсурдная аналогия или отсылка к мемам и поп-культуре. Без агрессии, но смешно.", + }, + { + id: "doomer", + label: "Думер", + description: "Экзистенциальная тоска: всё тлен, даже мат.", + voice: "Ты — шахматный думер. Всё тлен, доска — метафора бессмысленности, но играешь ты всё равно в полную силу. Реплики — мрачная экзистенциальная ирония.", + }, +]; +export const DEFAULT_PERSONA = "gopnik"; +export const personaById = (id: string | null | undefined) => PERSONAS.find((p) => p.id === id) ?? PERSONAS.find((p) => p.id === DEFAULT_PERSONA)!; + +const SIDE_INSTR: Record = { white: "белыми", black: "чёрными" }; + +export interface SystemPromptInput { + side: Side; + opponentName: string; + opponentIsHuman: boolean; + persona: Persona; + flags: GameFlags; +} + +/** Stable for the whole game (per side) -> provider prompt cache hits every turn. */ +export function buildSystemPrompt(i: SystemPromptInput): string { + const s: string[] = []; + s.push(`# Ты — шахматист на арене AI·CHESS\n\n${i.persona.voice}`); + s.push( + [ + "## Ситуация", + `Ты играешь ${SIDE_INSTR[i.side]} против ${i.opponentIsHuman ? "человека" : "другой языковой модели"}: ${i.opponentName}.`, + "За партией следят зрители: твои ходы и реплики сопернику видны всем, рассуждения — по клику.", + "Твоя цель — выиграть. Играй в полную силу.", + ].join("\n"), + ); + s.push( + [ + "## Как устроен ход", + "Каждый ход ты начинаешь С ЧИСТОГО ЛИСТА — памяти о прошлых ходах нет. Всё нужное есть в сообщении хода: позиция в нескольких нотациях, последний ход соперника и его реплика" + + (i.flags.notes ? ", твоя заметка с прошлого хода (если ты её оставлял)" : "") + + ". Правила, которые не видны на доске (рокировка, взятие на проходе, правило 50 ходов, повторение позиций), упоминаются только когда они важны прямо сейчас.", + ].join("\n"), + ); + const tools = [ + "## Инструменты", + "- make_move(move, offer_draw?) — сделать ход. Формат SAN (Nf3, exd5, O-O, e8=Q) или UCI (g1f3, e7e8q). Нелегальный ход вернёт объяснение — можно попробовать снова, но слишком много нелегальных попыток подряд = поражение. Проверяй ход перед отправкой. offer_draw=true — предложить ничью вместе с ходом.", + `- finish_turn(phrase${i.flags.notes ? ", note_to_self?" : ""}) — завершить ход. phrase — реплика сопернику (1–2 предложения, в образе своего персонажа).`, + "- resign(phrase) — сдаться. Только если позиция полностью безнадёжна.", + "- accept_draw(phrase) — принять ничью. Работает, только если соперник её предложил.", + ]; + if (i.flags.extraTools) { + tools.push( + "- get_move_history(format) — полная история ходов и реплик. Вызывай ТОЛЬКО если без неё никак: для выбора обычного хода она не нужна. Полезна, например, если хочешь построить вечный шах или повторение позиции.", + "- python(code) — песочница Python с библиотекой python-chess, текущая партия уже загружена (переменные board, game, moves). Для проверки вариантов, легальности, повторений. НЕ ЧИТЕРИ: никаких шахматных движков и внешних программ — это нарушение правил арены (их там и нет).", + ); + } + s.push(tools.join("\n")); + s.push( + [ + "## Порядок хода", + "1. Подумай над позицией.", + "2. Вызови make_move.", + "3. Сразу после успешного make_move вызови finish_turn — и всё. Не продолжай анализ после хода.", + ].join("\n"), + ); + if (i.flags.notes) { + s.push( + [ + "## Заметка себе (note_to_self)", + "Оставляй её, ТОЛЬКО если у тебя есть конкретный план на несколько ходов вперёд (например: «готовлю f4–f5 и ладью на f-линию», «ферзь соперника перегружен защитой e4»).", + "Если чёткого плана нет (сделал первый ход, всё зависит от ответа соперника и т.п.) — не оставляй заметку.", + ].join("\n"), + ); + } + s.push( + [ + "## Реплика сопернику", + "Пиши по-русски, в образе персонажа. Не пересказывай свой ход — он и так виден. Не выдавай план, если это не часть психологического давления.", + ].join("\n"), + ); + return s.join("\n\n"); +} diff --git a/apps/server/src/agents/python.ts b/apps/server/src/agents/python.ts new file mode 100644 index 0000000..3d6e9e2 --- /dev/null +++ b/apps/server/src/agents/python.ts @@ -0,0 +1,43 @@ +import { spawn } from "node:child_process"; +import { config } from "../config.ts"; + +export interface SandboxInput { + code: string; + startFen: string; + moves: string[]; + fen: string; + history: unknown[]; + analysis?: unknown; +} + +const MAX_OUT = 8000; + +/** Run agent python in a throwaway process. Never throws — errors come back as text. */ +export function runPython(input: SandboxInput, timeoutMs = 15000): Promise { + return new Promise((resolve) => { + const child = spawn(config.paths.python, ["-I", config.paths.sandbox], { + cwd: "/tmp", + env: { PATH: process.env.PATH ?? "/usr/bin:/bin", PYTHONPATH: process.env.SANDBOX_PYTHONPATH ?? "", HOME: "/tmp", LANG: "C.UTF-8" }, + stdio: ["pipe", "pipe", "pipe"], + }); + let out = ""; + let done = false; + const finish = (s: string) => { + if (done) return; + done = true; + clearTimeout(timer); + resolve(s.length > MAX_OUT ? s.slice(0, MAX_OUT) + `\n…[обрезано, всего ${s.length} символов]` : s || "(пустой вывод)"); + }; + const timer = setTimeout(() => { + child.kill("SIGKILL"); + finish(out + "\n[таймаут: код выполнялся дольше 15 секунд]"); + }, timeoutMs); + child.stdout.on("data", (d) => (out += d.toString())); + child.stderr.on("data", (d) => (out += d.toString())); + child.on("error", (e) => finish(`[песочница недоступна: ${e.message}]`)); + child.on("close", () => finish(out)); + child.stdin.end( + JSON.stringify({ code: input.code, start_fen: input.startFen, moves: input.moves, fen: input.fen, history: input.history, analysis: input.analysis ?? null }), + ); + }); +} diff --git a/apps/server/src/agents/runtime.ts b/apps/server/src/agents/runtime.ts new file mode 100644 index 0000000..48819ad --- /dev/null +++ b/apps/server/src/agents/runtime.ts @@ -0,0 +1,109 @@ +import fs from "node:fs"; +import path from "node:path"; +import { + createAgentSession, + DefaultResourceLoader, + ModelRuntime, + SessionManager, + SettingsManager, + type ToolDefinition, +} from "@earendil-works/pi-coding-agent"; +import { config } from "../config.ts"; +import { configDir } from "../catalog.ts"; + +let runtimePromise: Promise | null = null; +const agentDir = () => path.join(config.paths.data, "pi"); + +/** Build pi's models.json from config/pi-models.json + runtime LLM endpoint/key. */ +function writeModelsJson() { + const tpl = JSON.parse(fs.readFileSync(path.join(configDir(), "pi-models.json"), "utf8")); + const providers = tpl.providers ?? {}; + const headers = { "accept-encoding": "identity" }; + providers.anthropic = { ...(providers.anthropic ?? {}), baseUrl: config.llm.baseUrl, apiKey: "$CHESS_LLM_KEY", headers }; + providers.openai = { ...(providers.openai ?? {}), baseUrl: `${config.llm.baseUrl}/v1`, apiKey: "$CHESS_LLM_KEY", headers }; + fs.mkdirSync(agentDir(), { recursive: true }); + fs.writeFileSync(path.join(agentDir(), "models.json"), JSON.stringify({ providers }, null, 2)); +} + +export function getModelRuntime(): Promise { + if (!runtimePromise) { + process.env.CHESS_LLM_KEY = config.llm.apiKey; + writeModelsJson(); + runtimePromise = ModelRuntime.create({ authPath: path.join(agentDir(), "auth.json"), modelsPath: path.join(agentDir(), "models.json") }); + } + return runtimePromise; +} + +export type ThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"; + +export interface SessionSpec { + provider: string; + modelId: string; + thinking: ThinkingLevel; + thinkingBudget?: number; + forceReasoningNone?: boolean; + systemPrompt: string; + tools: ToolDefinition[]; +} + +/** + * A fresh, in-memory pi agent session with ONLY our tools and EXACTLY our system prompt. + * Every chess turn creates one of these and disposes it afterwards (stateless turns); + * the system prompt + tool list are identical turn to turn, so the provider prompt cache hits. + */ +export async function createChessSession(spec: SessionSpec) { + const modelRuntime = await getModelRuntime(); + const model = modelRuntime.getModel(spec.provider, spec.modelId); + if (!model) throw new Error(`model not found: ${spec.provider}/${spec.modelId}`); + const cwd = config.paths.data; + + const settingsInit: Record = { + compaction: { enabled: false }, + retry: { enabled: true, maxRetries: 3 }, + cacheWarming: "off", + }; + if (spec.thinkingBudget) { + settingsInit.thinkingBudgets = { high: spec.thinkingBudget, medium: Math.min(spec.thinkingBudget, 8192), low: Math.min(spec.thinkingBudget, 2048), minimal: 1024 }; + } + const settingsManager = SettingsManager.inMemory(settingsInit as any); + + const resourceLoader = new DefaultResourceLoader({ + cwd, + agentDir: agentDir(), + settingsManager, + noExtensions: true, + skillsOverride: () => ({ skills: [], diagnostics: [] }), + agentsFilesOverride: () => ({ agentsFiles: [] }), + promptsOverride: () => ({ prompts: [], diagnostics: [] }), + systemPromptOverride: () => spec.systemPrompt, + extensionFactories: [ + (pi: any) => { + // pi appends environment sections (cwd, …) to the system prompt — force ours verbatim. + pi.on("before_agent_start", () => ({ systemPrompt: spec.systemPrompt })); + if (spec.forceReasoningNone) { + pi.on("before_provider_request", (e: any) => { + const p = e.payload as any; + if (p && typeof p === "object" && "input" in p) p.reasoning = { effort: "none" }; + return p; + }); + } + }, + ], + } as any); + await resourceLoader.reload(); + + const { session } = await createAgentSession({ + cwd, + agentDir: agentDir(), + model, + thinkingLevel: spec.thinking as any, + modelRuntime, + resourceLoader, + noTools: "builtin", + customTools: spec.tools, + tools: spec.tools.map((t) => t.name), + sessionManager: SessionManager.inMemory(cwd), + settingsManager, + }); + return { session, model }; +} diff --git a/apps/server/src/agents/turn.ts b/apps/server/src/agents/turn.ts new file mode 100644 index 0000000..dcda2dd --- /dev/null +++ b/apps/server/src/agents/turn.ts @@ -0,0 +1,302 @@ +import { Type } from "typebox"; +import { defineTool } from "@earendil-works/pi-coding-agent"; +import { + addUsage, + emptyUsage, + GameState, + humanTranscript, + machineTranscript, + renderTurnContext, + type GameFlags, + type RecordPly, + type Side, + type ToolCallLog, + type TranscriptItem, + type Usage, +} from "@aichess/core"; +import { config } from "../config.ts"; +import { buildSystemPrompt, personaById } from "./prompts.ts"; +import { createChessSession, type ThinkingLevel } from "./runtime.ts"; +import { runPython } from "./python.ts"; + +export interface AgentPlayer { + id: string; + displayName: string; + variant: string | null; + provider: string; + modelId: string; + thinking: ThinkingLevel; + options: { thinkingBudget?: number; forceReasoningNone?: boolean }; +} + +export interface TurnInput { + gameId: string; + side: Side; + me: AgentPlayer; + opponentName: string; + opponentIsHuman: boolean; + persona: string | null; + flags: GameFlags; + state: GameState; + history: RecordPly[]; + opponentPhrase: string | null; + drawOffered: boolean; + noteFromSelf: string | null; + signal?: AbortSignal; + onLive: (ev: LiveTurnEvent) => void; +} + +export type LiveTurnEvent = + | { type: "thinking_delta"; delta: string } + | { type: "text_delta"; delta: string } + | { type: "tool_start"; call: ToolCallLog } + | { type: "tool_end"; call: ToolCallLog }; + +export type TurnDecision = + | { kind: "move"; uci: string; san: string | null; illegal: boolean; phrase: string | null; note: string | null; offerDraw: boolean } + | { kind: "resign"; phrase: string | null } + | { kind: "accept_draw"; phrase: string | null } + | { kind: "forfeit"; reason: "illegal" | "no_move" }; + +export interface TurnResult { + decision: TurnDecision; + transcript: TranscriptItem[]; + usage: Usage; + thinkMs: number; + context: string; + illegalAttempts: number; +} + +const txt = (text: string) => ({ content: [{ type: "text" as const, text }], details: {} }); +const clip = (s: string | undefined | null, n: number) => (s ? s.trim().slice(0, n) : null) || null; + +/** One stateless agent turn: fresh session, context in, a decision out. */ +export async function runAgentTurn(i: TurnInput): Promise { + const started = Date.now(); + const transcript: TranscriptItem[] = []; + let usage = emptyUsage(); + const work = GameState.fromUci( + i.state.plies.map((p) => ({ uci: p.uci, illegal: p.illegal })), + i.state.startFen, + ); + + // ---- turn controller (closure state shared by tools) + let decision: TurnDecision | null = null; + let moved: Extract | null = null; + let illegalAttempts = 0; + let finished = false; + + const makeMove = defineTool({ + name: "make_move", + label: "Сделать ход", + description: "Сделать ход. move — SAN (Nf3, exd5, O-O, e8=Q) или UCI (g1f3, e7e8q). offer_draw — предложить ничью вместе с ходом.", + parameters: Type.Object({ + move: Type.String({ description: "Ход в SAN или UCI" }), + offer_draw: Type.Optional(Type.Boolean({ description: "Предложить ничью вместе с ходом" })), + }), + execute: async (_id, p) => { + if (finished || decision) return txt("Ход уже завершён. Больше ничего не делай."); + if (moved) return txt(`Ты уже сделал ход ${moved.san ?? moved.uci}. Теперь вызови finish_turn.`); + const r = work.tryMove(p.move); + if (r.ok) { + moved = { kind: "move", uci: r.record.uci, san: r.record.san, illegal: false, phrase: null, note: null, offerDraw: !!p.offer_draw }; + const over = work.outcome(); + return txt( + `Ход принят: ${r.record.san}.${over ? ` Партия окончена (${over.result}).` : ""}${p.offer_draw ? " Ничья предложена." : ""} Теперь СРАЗУ вызови finish_turn${i.flags.notes ? " (phrase и, если есть конкретный план, note_to_self)" : " (phrase)"} и ничего больше не анализируй.`, + ); + } + if (i.flags.cheating && r.reason !== "game_over") { + const c = work.applyIllegal(p.move); + if (c.ok) { + moved = { kind: "move", uci: c.record.uci, san: null, illegal: true, phrase: null, note: null, offerDraw: !!p.offer_draw }; + return txt(`Нелегальный ход применён (режим читерства): ${c.record.uci}. Теперь вызови finish_turn.`); + } + } + illegalAttempts++; + if (illegalAttempts >= config.game.illegalForfeitAfter) { + decision = { kind: "forfeit", reason: "illegal" }; + finished = true; + return { ...txt(`Нелегально: ${r.message} Это ${illegalAttempts}-я нелегальная попытка подряд — техническое поражение.`), terminate: true } as any; + } + let msg = `Нелегально: ${r.message} Попытка ${illegalAttempts} из ${config.game.illegalForfeitAfter} — после этого поражение. Перепроверь позицию и попробуй другой ход.`; + if (illegalAttempts >= config.game.illegalHintAfter) { + msg += `\nПодсказка арбитра — все легальные ходы: ${work.legalMoves().map((m) => m.san).join(", ")}`; + } + return txt(msg); + }, + }); + + const finishTurn = defineTool({ + name: "finish_turn", + label: "Завершить ход", + description: i.flags.notes + ? "Завершить ход после успешного make_move. phrase — реплика сопернику. note_to_self — необязательная заметка себе на следующий ход (только если есть конкретный план)." + : "Завершить ход после успешного make_move. phrase — реплика сопернику.", + parameters: i.flags.notes + ? Type.Object({ phrase: Type.String(), note_to_self: Type.Optional(Type.String()) }) + : Type.Object({ phrase: Type.String() }), + execute: async (_id, p: any) => { + if (decision) return { ...txt("Ход уже завершён."), terminate: true } as any; + if (!moved) return txt("Сначала сделай ход через make_move."); + decision = { ...moved, phrase: clip(p.phrase, 600), note: i.flags.notes ? clip(p.note_to_self, 600) : null }; + finished = true; + return { ...txt("Ход завершён. Спасибо."), terminate: true } as any; + }, + }); + + const resign = defineTool({ + name: "resign", + label: "Сдаться", + description: "Сдаться. Только если позиция полностью безнадёжна.", + parameters: Type.Object({ phrase: Type.String({ description: "Последняя реплика сопернику" }) }), + execute: async (_id, p) => { + if (moved || decision) return txt("Ход уже сделан — сдаться можно будет в следующий ход."); + decision = { kind: "resign", phrase: clip(p.phrase, 600) }; + finished = true; + return { ...txt("Ты сдался. Партия окончена."), terminate: true } as any; + }, + }); + + const tools: any[] = [makeMove, finishTurn, resign]; + if (i.drawOffered) { + tools.push( + defineTool({ + name: "accept_draw", + label: "Принять ничью", + description: "Принять ничью, предложенную соперником.", + parameters: Type.Object({ phrase: Type.String() }), + execute: async (_id, p) => { + if (moved || decision) return txt("Ты уже сделал ход — предложение ничьей отклонено."); + decision = { kind: "accept_draw", phrase: clip(p.phrase, 600) }; + finished = true; + return { ...txt("Ничья принята."), terminate: true } as any; + }, + }), + ); + } + if (i.flags.extraTools) { + tools.push( + defineTool({ + name: "get_move_history", + label: "История ходов", + description: + "Полная история партии (ходы и реплики). Вызывай ТОЛЬКО если без неё никак — для выбора обычного хода она не нужна. format: 'text' (читаемо) или 'json'.", + parameters: Type.Object({ format: Type.Optional(Type.Union([Type.Literal("text"), Type.Literal("json")])) }), + execute: async (_id, p) => { + const rec = { white: i.side === "white" ? i.me.displayName : i.opponentName, black: i.side === "black" ? i.me.displayName : i.opponentName, plies: i.history }; + return txt(p.format === "json" ? machineTranscript(rec) : humanTranscript(rec)); + }, + }), + defineTool({ + name: "python", + label: "Python", + description: + "Выполнить Python с python-chess. Предзагружено: board (текущая позиция со стеком ходов), game, moves (UCI), history. Печатай результат через print. НЕ используй шахматные движки — это читерство (их и нет).", + parameters: Type.Object({ code: Type.String() }), + execute: async (_id, p) => { + const out = await runPython({ + code: p.code, + startFen: i.state.startFen, + moves: i.state.plies.map((x) => x.uci), + fen: i.state.fen(), + history: i.history.map((h) => ({ ply: h.ply, side: h.side, san: h.san, uci: h.uci, phrase: h.phrase })), + }); + return txt(out); + }, + }), + ); + } + + const persona = personaById(i.persona); + const systemPrompt = buildSystemPrompt({ side: i.side, opponentName: i.opponentName, opponentIsHuman: i.opponentIsHuman, persona, flags: i.flags }); + const context = renderTurnContext({ + state: i.state, + me: { side: i.side }, + opponent: { name: i.opponentName }, + opponentPhrase: i.opponentPhrase, + drawOffered: i.drawOffered, + noteFromSelf: i.noteFromSelf, + flags: i.flags, + fiftyMoveThreshold: config.game.fiftyMoveReminderFrom, + }); + transcript.push({ kind: "context", text: context, at: Date.now() }); + + const { session } = await createChessSession({ + provider: i.me.provider, + modelId: i.me.modelId, + thinking: i.me.thinking, + thinkingBudget: i.me.options.thinkingBudget, + forceReasoningNone: i.me.options.forceReasoningNone, + systemPrompt, + tools, + }); + + // ---- live event mapping + let thinkingBuf = ""; + let textBuf = ""; + const calls = new Map(); + const flushThinking = () => { + if (thinkingBuf.trim()) transcript.push({ kind: "thinking", text: thinkingBuf, at: Date.now() }); + thinkingBuf = ""; + }; + const flushText = () => { + if (textBuf.trim()) transcript.push({ kind: "text", text: textBuf, at: Date.now() }); + textBuf = ""; + }; + const unsub = session.subscribe((e: any) => { + if (e.type === "message_update") { + const a = e.assistantMessageEvent; + if (a.type === "thinking_delta") { + thinkingBuf += a.delta; + i.onLive({ type: "thinking_delta", delta: a.delta }); + } else if (a.type === "thinking_end") flushThinking(); + else if (a.type === "text_delta") { + textBuf += a.delta; + i.onLive({ type: "text_delta", delta: a.delta }); + } else if (a.type === "text_end") flushText(); + } else if (e.type === "tool_execution_start") { + flushThinking(); + flushText(); + const call: ToolCallLog = { id: e.toolCallId, name: e.toolName, args: e.args, startedAt: Date.now() }; + calls.set(e.toolCallId, call); + i.onLive({ type: "tool_start", call }); + } else if (e.type === "tool_execution_end") { + const call: ToolCallLog = calls.get(e.toolCallId) ?? { id: e.toolCallId, name: e.toolName, args: undefined, startedAt: Date.now() }; + const content = e.result?.content; + call.result = Array.isArray(content) ? content.map((c: any) => c.text ?? "").join("\n").slice(0, 4000) : String(content ?? ""); + call.isError = !!e.isError; + call.endedAt = Date.now(); + transcript.push({ kind: "tool", call, at: call.endedAt }); + i.onLive({ type: "tool_end", call }); + } else if (e.type === "message_end" && e.message?.role === "assistant") { + const u = e.message.usage; + if (u) usage = addUsage(usage, { input: u.input, output: u.output, cacheRead: u.cacheRead, cacheWrite: u.cacheWrite, reasoning: u.reasoning ?? 0, cost: u.cost?.total ?? 0 }); + if (e.message.stopReason === "error" && e.message.errorMessage) transcript.push({ kind: "error", text: String(e.message.errorMessage).slice(0, 1000), at: Date.now() }); + } + }); + + const abort = () => void session.abort().catch(() => {}); + i.signal?.addEventListener("abort", abort); + try { + await session.prompt(context); + // nudge if the agent ended its run without deciding + for (let n = 0; n < config.game.noMoveNudges && !decision && !i.signal?.aborted; n++) { + if (moved) break; // moved but forgot finish_turn — accept the move without a phrase + const lastErr = [...transcript].reverse().find((t) => t.kind === "error"); + if (lastErr && n === 0 && !calls.size) throw new Error(`provider error: ${(lastErr as any).text}`); + const nudge = "Ты не сделал ход. Вызови make_move с ходом, затем finish_turn."; + transcript.push({ kind: "nudge", text: nudge, at: Date.now() }); + await session.prompt(nudge); + } + } finally { + flushThinking(); + flushText(); + unsub(); + i.signal?.removeEventListener("abort", abort); + session.dispose(); + } + if (i.signal?.aborted) throw new Error("turn aborted"); + + if (!decision) decision = moved ?? { kind: "forfeit", reason: "no_move" }; + return { decision, transcript, usage, thinkMs: Date.now() - started, context, illegalAttempts }; +} diff --git a/apps/server/src/auth.ts b/apps/server/src/auth.ts new file mode 100644 index 0000000..eccc8d1 --- /dev/null +++ b/apps/server/src/auth.ts @@ -0,0 +1,99 @@ +import crypto from "node:crypto"; +import { promisify } from "node:util"; +import { and, eq, gt, sql } from "drizzle-orm"; +import type { Context, MiddlewareHandler } from "hono"; +import { getCookie, setCookie, deleteCookie } from "hono/cookie"; +import { db, schema } from "./db/client.ts"; +import { config } from "./config.ts"; +import { log, newId } from "./util.ts"; + +const scrypt = promisify(crypto.scrypt) as (pw: string, salt: Buffer, len: number) => Promise; +export const COOKIE = "aichess_session"; +const SESSION_DAYS = 60; + +export type User = typeof schema.users.$inferSelect; + +export async function hashPassword(pw: string) { + const salt = crypto.randomBytes(16); + const key = await scrypt(pw, salt, 64); + return `scrypt$${salt.toString("base64")}$${key.toString("base64")}`; +} +export async function verifyPassword(pw: string, stored: string) { + const [alg, s, k] = stored.split("$"); + if (alg !== "scrypt" || !s || !k) return false; + const key = await scrypt(pw, Buffer.from(s, "base64"), 64); + return crypto.timingSafeEqual(key, Buffer.from(k, "base64")); +} +const tokenHash = (t: string) => crypto.createHash("sha256").update(t).digest("hex"); + +export async function createSession(c: Context, userId: string) { + const token = crypto.randomBytes(32).toString("base64url"); + await db.insert(schema.sessions).values({ id: tokenHash(token), userId, expiresAt: new Date(Date.now() + SESSION_DAYS * 86400_000) }); + setCookie(c, COOKIE, token, { + httpOnly: true, + sameSite: "Lax", + secure: config.publicUrl.startsWith("https"), + path: "/", + maxAge: SESSION_DAYS * 86400, + }); +} + +export async function destroySession(c: Context) { + const t = getCookie(c, COOKIE); + if (t) await db.delete(schema.sessions).where(eq(schema.sessions.id, tokenHash(t))); + deleteCookie(c, COOKIE, { path: "/" }); +} + +export async function userFromToken(token: string | undefined): Promise { + if (!token) return null; + const rows = await db + .select({ u: schema.users }) + .from(schema.sessions) + .innerJoin(schema.users, eq(schema.users.id, schema.sessions.userId)) + .where(and(eq(schema.sessions.id, tokenHash(token)), gt(schema.sessions.expiresAt, new Date()))) + .limit(1); + return rows[0]?.u ?? null; +} + +export type AppEnv = { Variables: { user: User | null } }; + +export const authMiddleware: MiddlewareHandler = async (c, next) => { + c.set("user", await userFromToken(getCookie(c, COOKIE))); + await next(); +}; +export const requireUser: MiddlewareHandler = async (c, next) => { + if (!c.get("user")) return c.json({ error: "Нужно войти" }, 401); + await next(); +}; +export const requireAdmin: MiddlewareHandler = async (c, next) => { + if (!c.get("user")?.isAdmin) return c.json({ error: "Только для админа" }, 403); + await next(); +}; + +export const USERNAME_RE = /^[a-zA-Z0-9_.-]{3,24}$/; + +export async function registerUser(username: string, password: string): Promise { + const isAdmin = username.toLowerCase() === config.admin.username.toLowerCase(); + const id = newId(); + const [u] = await db + .insert(schema.users) + .values({ id, username, passwordHash: await hashPassword(password), displayName: username, isAdmin }) + .returning(); + await db.insert(schema.players).values({ id: newId(), kind: "human", slug: `u-${username.toLowerCase()}`, userId: id, displayName: username }); + return u; +} + +export const findUserByName = (username: string) => + db.query.users.findFirst({ where: sql`lower(${schema.users.username}) = ${username.toLowerCase()}` }); + +/** Create the admin account on first boot when ADMIN_INITIAL_PASSWORD is provided. */ +export async function ensureAdmin() { + const existing = await findUserByName(config.admin.username); + if (existing) { + if (!existing.isAdmin) await db.update(schema.users).set({ isAdmin: true }).where(eq(schema.users.id, existing.id)); + return; + } + if (!config.admin.initialPassword) return; + await registerUser(config.admin.username, config.admin.initialPassword); + log("auth", `admin ${config.admin.username} created`); +} diff --git a/apps/server/src/bus.ts b/apps/server/src/bus.ts new file mode 100644 index 0000000..581a8f5 --- /dev/null +++ b/apps/server/src/bus.ts @@ -0,0 +1,36 @@ +import { EventEmitter } from "node:events"; +import type { GameEvent } from "@aichess/core"; + +/** + * Live event bus. Channels: "lobby" and `game:`. + * In-process for now (ROLE=all). The interface is deliberately tiny so it can be swapped for + * Postgres LISTEN/NOTIFY or Redis when API and workers are split into separate processes. + */ +export type LobbyEvent = + | { type: "game_created"; gameId: string } + | { type: "game_updated"; gameId: string } + | { type: "schedule_updated" }; + +export type BusEvent = GameEvent | LobbyEvent; + +export interface Bus { + publish(channel: string, ev: BusEvent): void; + subscribe(channel: string, fn: (ev: BusEvent) => void): () => void; +} + +class LocalBus implements Bus { + private ee = new EventEmitter(); + constructor() { + this.ee.setMaxListeners(0); + } + publish(channel: string, ev: BusEvent) { + this.ee.emit(channel, ev); + } + subscribe(channel: string, fn: (ev: BusEvent) => void) { + this.ee.on(channel, fn); + return () => this.ee.off(channel, fn); + } +} + +export const bus: Bus = new LocalBus(); +export const gameChannel = (id: string) => `game:${id}`; diff --git a/apps/server/src/catalog.ts b/apps/server/src/catalog.ts new file mode 100644 index 0000000..0f5207c --- /dev/null +++ b/apps/server/src/catalog.ts @@ -0,0 +1,64 @@ +import fs from "node:fs"; +import path from "node:path"; +import { eq } from "drizzle-orm"; +import { z } from "zod"; +import { config } from "./config.ts"; +import { db, schema } from "./db/client.ts"; +import { log, newId } from "./util.ts"; + +const AiEntry = z.object({ + slug: z.string(), + displayName: z.string(), + variant: z.string(), + family: z.string(), + provider: z.string(), + modelId: z.string(), + thinking: z.enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"]), + thinkingBudget: z.number().optional(), + forceReasoningNone: z.boolean().optional(), + dumb: z.boolean().optional(), + skull: z.boolean().optional(), + avatar: z.string().optional(), + color: z.string().optional(), + active: z.boolean().optional(), +}); +export type AiEntry = z.infer; + +export function configDir() { + const candidates = [process.env.CONFIG_DIR, path.resolve(config.paths.assets, "../config"), path.resolve(process.cwd(), "config")].filter(Boolean) as string[]; + const dir = candidates.find((p) => fs.existsSync(path.join(p, "players.json"))); + if (!dir) throw new Error("config/players.json not found"); + return dir; +} + +export function loadCatalog(): AiEntry[] { + const raw = JSON.parse(fs.readFileSync(path.join(configDir(), "players.json"), "utf8")); + return z.array(AiEntry).parse(raw.players); +} + +/** Upsert AI players from config/players.json (ratings/stats are never touched). */ +export async function syncCatalog() { + const entries = loadCatalog(); + for (const e of entries) { + const values = { + kind: "ai" as const, + slug: e.slug, + displayName: e.displayName, + family: e.family, + provider: e.provider, + modelId: e.modelId, + thinking: e.thinking, + variant: e.variant, + avatar: e.avatar ?? null, + color: e.color ?? null, + dumb: e.dumb ?? false, + skull: e.skull ?? false, + options: { thinkingBudget: e.thinkingBudget, forceReasoningNone: e.forceReasoningNone }, + active: e.active ?? true, + }; + const existing = await db.query.players.findFirst({ where: eq(schema.players.slug, e.slug) }); + if (existing) await db.update(schema.players).set(values).where(eq(schema.players.id, existing.id)); + else await db.insert(schema.players).values({ id: newId(), ...values }); + } + log("catalog", `synced ${entries.length} AI players`); +} diff --git a/apps/server/src/config.ts b/apps/server/src/config.ts new file mode 100644 index 0000000..eedfb04 --- /dev/null +++ b/apps/server/src/config.ts @@ -0,0 +1,57 @@ +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const here = path.dirname(fileURLToPath(import.meta.url)); +const env = (k: string, d?: string) => process.env[k] ?? d; +const req = (k: string) => { + const v = process.env[k]; + if (!v) throw new Error(`missing env ${k}`); + return v; +}; + +export const config = { + port: Number(env("PORT", "7833")), + host: env("HOST", "0.0.0.0")!, + publicUrl: env("PUBLIC_URL", "http://localhost:7833")!, + databaseUrl: req("DATABASE_URL"), + /** Process role: "all" runs API + workers; split later with "api" / "worker". */ + role: env("ROLE", "all") as "all" | "api" | "worker", + + llm: { + /** cli-proxy-api. Inside the docker network: http://cli-proxy-api:8317 */ + baseUrl: env("LLM_BASE_URL", "https://cli.danosito.com")!.replace(/\/$/, ""), + apiKey: req("LLM_API_KEY"), + /** model used to write thumbnail prompts */ + promptWriterModel: env("PROMPT_WRITER_MODEL", "openai/gpt-6-astra")!, + promptWriterThinking: env("PROMPT_WRITER_THINKING", "high")!, + imageModel: env("IMAGE_MODEL", "gpt-image-2.5")!, + }, + + admin: { + username: env("ADMIN_USERNAME", "danosito")!, + /** if set and the admin user doesn't exist yet, it's created with this password */ + initialPassword: env("ADMIN_INITIAL_PASSWORD"), + }, + + paths: { + data: path.resolve(env("DATA_DIR", path.resolve(here, "../../../data"))!), + web: path.resolve(env("WEB_DIR", path.resolve(here, "../../web/build"))!), + assets: path.resolve(env("ASSETS_DIR", path.resolve(here, "../../../assets"))!), + python: env("PYTHON_BIN", "python3")!, + sandbox: path.resolve(env("SANDBOX_SCRIPT", path.resolve(here, "../python/sandbox.py"))!), + stockfish: env("STOCKFISH_BIN", "stockfish")!, + }, + + game: { + maxConcurrentGames: Number(env("MAX_CONCURRENT_GAMES", "6")), + maxActiveGamesPerUser: Number(env("MAX_ACTIVE_GAMES_PER_USER", "1")), + illegalHintAfter: Number(env("ILLEGAL_HINT_AFTER", "3")), + illegalForfeitAfter: Number(env("ILLEGAL_FORFEIT_AFTER", "8")), + noMoveNudges: Number(env("NO_MOVE_NUDGES", "2")), + fiftyMoveReminderFrom: Number(env("FIFTY_MOVE_REMINDER_FROM", "40")), + stockfishDepth: Number(env("STOCKFISH_DEPTH", "18")), + stockfishThreads: Number(env("STOCKFISH_THREADS", "2")), + stockfishPool: Number(env("STOCKFISH_POOL", "2")), + }, +}; +export type Config = typeof config; diff --git a/apps/server/src/db/client.ts b/apps/server/src/db/client.ts new file mode 100644 index 0000000..4ed07d9 --- /dev/null +++ b/apps/server/src/db/client.ts @@ -0,0 +1,22 @@ +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import fs from "node:fs"; +import postgres from "postgres"; +import { drizzle } from "drizzle-orm/postgres-js"; +import { migrate } from "drizzle-orm/postgres-js/migrator"; +import { config } from "../config.ts"; +import * as schema from "./schema.ts"; + +export const sqlClient = postgres(config.databaseUrl, { max: 20, onnotice: () => {} }); +export const db = drizzle(sqlClient, { schema }); +export type DB = typeof db; +export { schema }; + +export async function runMigrations() { + const here = path.dirname(fileURLToPath(import.meta.url)); + // dev: src/db -> ../../drizzle ; bundled: dist -> ../drizzle + const candidates = [path.resolve(here, "../../drizzle"), path.resolve(here, "../drizzle"), path.resolve(process.cwd(), "drizzle")]; + const folder = candidates.find((p) => fs.existsSync(path.join(p, "meta", "_journal.json"))); + if (!folder) throw new Error("drizzle migrations folder not found"); + await migrate(db, { migrationsFolder: folder }); +} diff --git a/apps/server/src/db/schema.ts b/apps/server/src/db/schema.ts new file mode 100644 index 0000000..b98cc9e --- /dev/null +++ b/apps/server/src/db/schema.ts @@ -0,0 +1,186 @@ +import { sql } from "drizzle-orm"; +import { boolean, doublePrecision, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core"; +import type { EngineEval, GameFlags, MoveClass, Result, Side, Termination, TranscriptItem, Usage } from "@aichess/core"; + +const ts = (name: string) => timestamp(name, { withTimezone: true, mode: "date" }); +const now = () => ts("created_at").notNull().defaultNow(); + +export const users = pgTable("users", { + id: text("id").primaryKey(), + username: text("username").notNull(), + passwordHash: text("password_hash").notNull(), + displayName: text("display_name").notNull(), + avatar: text("avatar"), // media-relative path + isAdmin: boolean("is_admin").notNull().default(false), + onboarded: boolean("onboarded").notNull().default(false), + /** UI skin chosen at onboarding: broadcast | tabloid | arcade */ + theme: text("theme").notNull().default("tabloid"), + createdAt: now(), +}, (t) => [uniqueIndex("users_username_lower").on(sql`lower(${t.username})`)]); + +export const sessions = pgTable("sessions", { + id: text("id").primaryKey(), // sha256 of the cookie token + userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }), + createdAt: now(), + expiresAt: ts("expires_at").notNull(), +}); + +/** Anything that can sit at the board: an AI entity (model × effort) or a human user. */ +export const players = pgTable("players", { + id: text("id").primaryKey(), + kind: text("kind").$type<"ai" | "human">().notNull(), + slug: text("slug").notNull().unique(), + userId: text("user_id").references(() => users.id, { onDelete: "set null" }).unique(), + displayName: text("display_name").notNull(), + // AI only + family: text("family"), // "claude" | "gpt" — groups variants in the UI + provider: text("provider"), + modelId: text("model_id"), + thinking: text("thinking"), + variant: text("variant"), // "max" | "high" + avatar: text("avatar"), + color: text("color"), + /** last-gen "for fun" models: UI shows a "тупая" badge */ + dumb: boolean("dumb").notNull().default(false), + /** no-thinking variant: UI shows a skull */ + skull: boolean("skull").notNull().default(false), + /** extra agent options: thinkingBudget, forceReasoningNone, ... */ + options: jsonb("options").$type<{ thinkingBudget?: number; forceReasoningNone?: boolean }>().notNull().default({}), + active: boolean("active").notNull().default(true), + // rating (Glicko-2) + rating: doublePrecision("rating").notNull().default(1500), + rd: doublePrecision("rd").notNull().default(350), + vol: doublePrecision("vol").notNull().default(0.06), + games: integer("games").notNull().default(0), + wins: integer("wins").notNull().default(0), + draws: integer("draws").notNull().default(0), + losses: integer("losses").notNull().default(0), + createdAt: now(), +}); + +export const games = pgTable("games", { + id: text("id").primaryKey(), + status: text("status").$type<"pending" | "running" | "finished" | "aborted">().notNull().default("pending"), + whiteId: text("white_id").notNull().references(() => players.id), + blackId: text("black_id").notNull().references(() => players.id), + createdBy: text("created_by").references(() => users.id, { onDelete: "set null" }), + scheduleId: text("schedule_id"), + flags: jsonb("flags").$type().notNull(), + personas: jsonb("personas").$type<{ white: string | null; black: string | null }>().notNull(), + rated: boolean("rated").notNull().default(true), + startFen: text("start_fen").notNull(), + fen: text("fen").notNull(), + ply: integer("ply").notNull().default(0), + pendingDrawBy: text("pending_draw_by").$type(), + result: text("result").$type(), + termination: text("termination").$type(), + startsAt: ts("starts_at"), // scheduled start (predictions lock at this time) + startedAt: ts("started_at"), + finishedAt: ts("finished_at"), + ratingChange: jsonb("rating_change").$type<{ white: { before: number; after: number }; black: { before: number; after: number } } | null>(), + accuracy: jsonb("accuracy").$type<{ white: number | null; black: number | null } | null>(), + interviews: jsonb("interviews").$type<{ white?: string | null; black?: string | null }>().notNull().default({}), + /** phrase said with resign / draw acceptance / forfeit */ + lastWords: jsonb("last_words").$type<{ white?: string | null; black?: string | null }>().notNull().default({}), + /** post-game editorial: headline + short review (shown only when the game is featured) */ + review: jsonb("review").$type<{ title: string; text: string } | null>(), + thumbnail: text("thumbnail"), + thumbnailCaption: text("thumbnail_caption"), + thumbnailMeta: jsonb("thumbnail_meta").$type | null>(), + costTotal: doublePrecision("cost_total").notNull().default(0), + error: text("error"), + createdAt: now(), +}, (t) => [index("games_status").on(t.status), index("games_created").on(t.createdAt)]); + +export const moves = pgTable("moves", { + id: text("id").primaryKey(), + gameId: text("game_id").notNull().references(() => games.id, { onDelete: "cascade" }), + ply: integer("ply").notNull(), + side: text("side").$type().notNull(), + playerId: text("player_id").notNull(), + san: text("san"), + uci: text("uci").notNull(), + fenAfter: text("fen_after").notNull(), + phrase: text("phrase"), + note: text("note"), + offeredDraw: boolean("offered_draw").notNull().default(false), + illegal: boolean("illegal").notNull().default(false), + thinkMs: integer("think_ms").notNull().default(0), + usage: jsonb("usage").$type(), + eval: jsonb("eval").$type(), + classification: text("classification").$type(), + accuracy: doublePrecision("accuracy"), + turnId: text("turn_id"), + createdAt: now(), +}, (t) => [uniqueIndex("moves_game_ply").on(t.gameId, t.ply)]); + +/** One agent run attempt for a ply. The successful one is linked from moves.turn_id. */ +export const turns = pgTable("turns", { + id: text("id").primaryKey(), + gameId: text("game_id").notNull().references(() => games.id, { onDelete: "cascade" }), + ply: integer("ply").notNull(), // the ply being decided (game.ply + 1 at start) + side: text("side").$type().notNull(), + playerId: text("player_id").notNull(), + attempt: integer("attempt").notNull().default(1), + status: text("status").$type<"running" | "done" | "failed">().notNull().default("running"), + transcript: jsonb("transcript").$type().notNull().default([]), + usage: jsonb("usage").$type(), + outcome: text("outcome"), + error: text("error"), + startedAt: ts("started_at").notNull().defaultNow(), + endedAt: ts("ended_at"), +}, (t) => [index("turns_game_ply").on(t.gameId, t.ply)]); + +/** Every LLM / image call that cost tokens, attributed to the user who started the game. */ +export const usageLedger = pgTable("usage_ledger", { + id: text("id").primaryKey(), + userId: text("user_id"), + gameId: text("game_id"), + playerId: text("player_id"), + kind: text("kind").$type<"turn" | "interview" | "review" | "thumbnail_prompt" | "thumbnail_image">().notNull(), + model: text("model").notNull(), + usage: jsonb("usage").$type().notNull(), + cost: doublePrecision("cost").notNull().default(0), + tokens: integer("tokens").notNull().default(0), + createdAt: now(), +}, (t) => [index("usage_user").on(t.userId)]); + +export const schedules = pgTable("schedules", { + id: text("id").primaryKey(), + name: text("name").notNull(), + enabled: boolean("enabled").notNull().default(true), + intervalMinutes: integer("interval_minutes").notNull().default(180), + /** minutes before start when the match is announced and predictions open */ + announceMinutes: integer("announce_minutes").notNull().default(30), + /** pool of AI player slugs; empty = all active AI players */ + pool: jsonb("pool").$type().notNull().default([]), + flags: jsonb("flags").$type().notNull(), + randomPersonas: boolean("random_personas").notNull().default(true), + nextRunAt: ts("next_run_at"), + createdBy: text("created_by"), + createdAt: now(), +}); + +export const predictions = pgTable("predictions", { + id: text("id").primaryKey(), + gameId: text("game_id").notNull().references(() => games.id, { onDelete: "cascade" }), + userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }), + pick: text("pick").$type<"white" | "draw" | "black">().notNull(), + points: integer("points"), + createdAt: now(), +}, (t) => [uniqueIndex("predictions_game_user").on(t.gameId, t.userId)]); + +export const ratingHistory = pgTable("rating_history", { + id: text("id").primaryKey(), + playerId: text("player_id").notNull(), + gameId: text("game_id").notNull(), + before: doublePrecision("before").notNull(), + after: doublePrecision("after").notNull(), + rd: doublePrecision("rd").notNull(), + createdAt: now(), +}, (t) => [index("rating_history_player").on(t.playerId)]); + +export const appSettings = pgTable("app_settings", { + key: text("key").primaryKey(), + value: jsonb("value").notNull(), +}); diff --git a/apps/server/src/engine/stockfish.ts b/apps/server/src/engine/stockfish.ts new file mode 100644 index 0000000..764a202 --- /dev/null +++ b/apps/server/src/engine/stockfish.ts @@ -0,0 +1,137 @@ +import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process"; +import readline from "node:readline"; +import type { EngineEval } from "@aichess/core"; +import { config } from "../config.ts"; +import { logErr } from "../util.ts"; + +class Engine { + private proc: ChildProcessWithoutNullStreams | null = null; + private lines: ((l: string) => void) | null = null; + busy = false; + + private async start() { + if (this.proc && this.proc.exitCode === null) return; + this.proc = spawn(config.paths.stockfish, [], { stdio: ["pipe", "pipe", "pipe"] }); + this.proc.on("exit", () => (this.proc = null)); + this.proc.on("error", (e) => logErr("stockfish", e.message)); + const rl = readline.createInterface({ input: this.proc.stdout }); + rl.on("line", (l) => this.lines?.(l)); + this.send("uci"); + await this.waitFor((l) => l === "uciok", 10000); + this.send(`setoption name Threads value ${config.game.stockfishThreads}`); + this.send("setoption name Hash value 128"); + this.send("isready"); + await this.waitFor((l) => l === "readyok", 10000); + } + private send(cmd: string) { + this.proc?.stdin.write(cmd + "\n"); + } + private waitFor(pred: (l: string) => boolean, timeoutMs: number, onLine?: (l: string) => void): Promise { + return new Promise((resolve, reject) => { + const t = setTimeout(() => { + this.lines = null; + reject(new Error("stockfish timeout")); + }, timeoutMs); + this.lines = (l) => { + onLine?.(l); + if (pred(l)) { + clearTimeout(t); + this.lines = null; + resolve(l); + } + }; + }); + } + + async analyze(fen: string, depth: number): Promise { + await this.start(); + const whiteToMove = fen.split(" ")[1] === "w"; + let cp: number | null = null; + let mate: number | null = null; + let pv: string[] = []; + let reached = 0; + this.send("ucinewgame"); + this.send(`position fen ${fen}`); + this.send(`go depth ${depth}`); + const best = await this.waitFor( + (l) => l.startsWith("bestmove"), + 120000, + (l) => { + if (!l.startsWith("info") || !l.includes(" score ") || l.includes("lowerbound") || l.includes("upperbound")) return; + if (/ multipv (\d+)/.exec(l)?.[1] && / multipv (\d+)/.exec(l)![1] !== "1") return; + const t = l.split(" "); + const si = t.indexOf("score"); + const kind = t[si + 1]; + const val = Number(t[si + 2]); + if (kind === "cp") { + cp = val; + mate = null; + } else if (kind === "mate") { + mate = val; + cp = null; + } + const pi = t.indexOf("pv"); + if (pi >= 0) pv = t.slice(pi + 1); + const di = t.indexOf("depth"); + if (di >= 0) reached = Number(t[di + 1]); + }, + ); + const bestUci = best.split(" ")[1]; + const sign = whiteToMove ? 1 : -1; + const m = mate as number | null; + const c = cp as number | null; + if (m === 0 || (m == null && c == null && bestUci === "(none)")) { + // terminal position: side to move is mated (or stalemated -> treat as 0) + const mated = m === 0; + return { cp: mated ? (whiteToMove ? -100000 : 100000) : 0, mate: null, bestUci: null, pv: [], depth: reached }; + } + return { + cp: c == null ? null : c * sign, + mate: m == null ? null : m * sign, + bestUci: bestUci && bestUci !== "(none)" ? bestUci : null, + pv, + depth: reached, + }; + } + stop() { + this.send("quit"); + this.proc?.kill(); + } +} + +/** Small FIFO pool of stockfish processes. */ +class EnginePool { + private engines: Engine[] = []; + private queue: { fen: string; depth: number; resolve: (e: EngineEval) => void; reject: (e: unknown) => void }[] = []; + constructor(size: number) { + for (let i = 0; i < size; i++) this.engines.push(new Engine()); + } + analyze(fen: string, depth = config.game.stockfishDepth): Promise { + return new Promise((resolve, reject) => { + this.queue.push({ fen, depth, resolve, reject }); + this.pump(); + }); + } + private pump() { + for (const e of this.engines) { + if (e.busy) continue; + const job = this.queue.shift(); + if (!job) return; + e.busy = true; + e.analyze(job.fen, job.depth) + .then(job.resolve, (err) => { + e.stop(); + job.reject(err); + }) + .finally(() => { + e.busy = false; + this.pump(); + }); + } + } + stop() { + for (const e of this.engines) e.stop(); + } +} + +export const engine = new EnginePool(config.game.stockfishPool); diff --git a/apps/server/src/games/finalize.ts b/apps/server/src/games/finalize.ts new file mode 100644 index 0000000..34f8f06 --- /dev/null +++ b/apps/server/src/games/finalize.ts @@ -0,0 +1,114 @@ +import path from "node:path"; +import { eq } from "drizzle-orm"; +import { gameAccuracy, winPercentWhite, type Side, type Usage } from "@aichess/core"; +import { db, schema } from "../db/client.ts"; +import { bus, gameChannel } from "../bus.ts"; +import { boss, Q, type FinalizeJob } from "../jobs.ts"; +import { config } from "../config.ts"; +import { runInterview, runReview, runThumbnail, type PostgameGame } from "../agents/postgame.ts"; +import { log, logErr, newId } from "../util.ts"; +import { handleEval } from "./runner.ts"; +import { loadGame, playerLabel, recordOf, type LoadedGame, type PlayerRow } from "./service.ts"; + +const avatarAbs = (p: PlayerRow) => { + if (!p.avatar) return null; + return p.kind === "ai" ? path.join(config.paths.assets, p.avatar) : path.join(config.paths.data, "media", p.avatar); +}; + +async function ledger(g: LoadedGame, kind: "interview" | "review" | "thumbnail_prompt" | "thumbnail_image", model: string, usage: Usage, playerId: string | null = null, tokens?: number) { + await db.insert(schema.usageLedger).values({ + id: newId(), + userId: g.game.createdBy, + gameId: g.game.id, + playerId, + kind, + model, + usage, + cost: usage.cost, + tokens: tokens ?? usage.input + usage.output + usage.cacheRead + usage.cacheWrite, + }); +} + +function postgameOf(g: LoadedGame, accuracy: { white: number | null; black: number | null }): PostgameGame { + const side = (p: PlayerRow, s: Side) => ({ + label: playerLabel(p), + kind: p.kind, + avatarPath: avatarAbs(p), + family: p.family, + dumb: p.dumb, + persona: g.game.personas[s], + }); + return { id: g.game.id, white: side(g.white, "white"), black: side(g.black, "black"), record: recordOf(g) as any, accuracy, lastWords: g.game.lastWords ?? {}, startFen: g.game.startFen }; +} + +export async function finalizeGame(gameId: string) { + let g = await loadGame(gameId); + if (!g || g.game.status !== "finished") return; + + // 1. evals for every ply + for (const m of g.moves) if (!m.eval) await handleEval({ gameId, ply: m.ply }).catch((e) => logErr("finalize", `eval ${m.ply}`, e)); + g = (await loadGame(gameId))!; + + // 2. accuracy + const wins = [50, ...g.moves.map((m) => (m.eval ? winPercentWhite(m.eval) : 50))]; + const accuracy = { white: gameAccuracy(wins, "white"), black: gameAccuracy(wins, "black") }; + await db.update(schema.games).set({ accuracy }).where(eq(schema.games.id, gameId)); + const pg = postgameOf(g, accuracy); + + // 3. interviews (AI players only, in parallel) + const interviews: { white?: string | null; black?: string | null } = { ...(g.game.interviews ?? {}) }; + await Promise.all( + (["white", "black"] as const).map(async (side) => { + const p = side === "white" ? g!.white : g!.black; + if (p.kind !== "ai" || interviews[side]) return; + try { + const r = await runInterview(pg, side, { provider: p.provider!, modelId: p.modelId!, thinking: (p.thinking === "off" ? "off" : "medium") as any, thinkingBudget: p.options?.thinkingBudget ? 8192 : undefined }); + interviews[side] = r.text.slice(0, 2000) || null; + await ledger(g!, "interview", `${p.provider}/${p.modelId}`, r.usage, p.id); + await db.update(schema.games).set({ interviews }).where(eq(schema.games.id, gameId)); + if (interviews[side]) bus.publish(gameChannel(gameId), { type: "interview", gameId, side, text: interviews[side]! }); + } catch (e) { + logErr("finalize", `interview ${side} ${gameId}`, e); + } + }), + ); + + // 4. editorial review + let review = g.game.review; + if (!review) { + try { + const r = await runReview(pg, interviews); + if (r.structured?.title) { + review = { title: String(r.structured.title).slice(0, 120), text: String(r.structured.text ?? "").slice(0, 1200) }; + await db.update(schema.games).set({ review }).where(eq(schema.games.id, gameId)); + } + await ledger(g, "review", config.llm.promptWriterModel, r.usage); + } catch (e) { + logErr("finalize", `review ${gameId}`, e); + } + } + + // 5. thumbnail + if (!g.game.thumbnail) { + try { + const t = await runThumbnail(pg, review, interviews); + await db + .update(schema.games) + .set({ thumbnail: t.file, thumbnailCaption: t.caption, thumbnailMeta: { style: t.style, prompt: t.prompt } }) + .where(eq(schema.games.id, gameId)); + await ledger(g, "thumbnail_prompt", config.llm.promptWriterModel, t.usageWriter); + await ledger(g, "thumbnail_image", config.llm.imageModel, { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, reasoning: 0, cost: 0 }, null, t.imageTokens); + bus.publish(gameChannel(gameId), { type: "thumbnail", gameId, url: `/media/${t.file}`, caption: t.caption }); + bus.publish("lobby", { type: "game_updated", gameId }); + } catch (e) { + logErr("finalize", `thumbnail ${gameId}`, e); + } + } + log("finalize", `done ${gameId}`); +} + +export async function startFinalizeWorker() { + await boss.work(Q.finalize, { localConcurrency: 2, batchSize: 1, pollingIntervalSeconds: 2 } as any, async (jobs: any[]) => { + for (const j of jobs) await finalizeGame(j.data.gameId); + }); +} diff --git a/apps/server/src/games/runner.ts b/apps/server/src/games/runner.ts new file mode 100644 index 0000000..5d0d6c9 --- /dev/null +++ b/apps/server/src/games/runner.ts @@ -0,0 +1,243 @@ +import { and, count, eq } from "drizzle-orm"; +import { Chess } from "chess.js"; +import { + classifyMove, + PIECE_VALUES, + type EngineEval, + type Side, + type ToolCallLog, + type TranscriptItem, +} from "@aichess/core"; +import { db, schema } from "../db/client.ts"; +import { bus, gameChannel } from "../bus.ts"; +import { boss, Q, type EvalJob, type TurnJob } from "../jobs.ts"; +import { config } from "../config.ts"; +import { engine } from "../engine/stockfish.ts"; +import { runAgentTurn, type AgentPlayer, type LiveTurnEvent } from "../agents/turn.ts"; +import { log, logErr, newId } from "../util.ts"; +import { + abortGame, + applyMove, + applyTerminalDecision, + loadGame, + playerLabel, + sideOfPly, + stateOf, + toRecordPly, + type PlayerRow, +} from "./service.ts"; + +// ------------------------------------------------------------------ live turn buffer + +export interface LiveTurn { + gameId: string; + ply: number; + side: Side; + playerId: string; + startedAt: number; + items: TranscriptItem[]; + thinking: string; + text: string; + tools: Record; +} +const live = new Map(); +export const getLiveTurn = (gameId: string) => live.get(gameId) ?? null; +const controllers = new Map(); +export function abortRunningTurn(gameId: string) { + controllers.get(gameId)?.abort(); +} + +function asAgentPlayer(p: PlayerRow): AgentPlayer { + return { + id: p.id, + displayName: playerLabel(p), + variant: p.variant, + provider: p.provider!, + modelId: p.modelId!, + thinking: (p.thinking ?? "high") as AgentPlayer["thinking"], + options: p.options ?? {}, + }; +} + +// ------------------------------------------------------------------ turn job + +async function handleTurn(data: TurnJob, retryCount: number) { + const g = await loadGame(data.gameId); + if (!g || g.game.status !== "running" || g.game.ply !== data.ply - 1) return; // stale + const side = sideOfPly(data.ply); + const me = side === "white" ? g.white : g.black; + const opp = side === "white" ? g.black : g.white; + if (me.kind !== "ai") return; + + const [{ n }] = await db + .select({ n: count() }) + .from(schema.turns) + .where(and(eq(schema.turns.gameId, g.game.id), eq(schema.turns.ply, data.ply))); + const turnId = newId(); + await db.insert(schema.turns).values({ id: turnId, gameId: g.game.id, ply: data.ply, side, playerId: me.id, attempt: n + 1 }); + + const state = stateOf(g); + const last = g.moves[g.moves.length - 1]; + const myLast = [...g.moves].reverse().find((m) => m.side === side); + const lt: LiveTurn = { gameId: g.game.id, ply: data.ply, side, playerId: me.id, startedAt: Date.now(), items: [], thinking: "", text: "", tools: {} }; + live.set(g.game.id, lt); + bus.publish(gameChannel(g.game.id), { type: "turn_start", gameId: g.game.id, ply: data.ply, side, playerId: me.id, at: lt.startedAt }); + + const onLive = (e: LiveTurnEvent) => { + const ch = gameChannel(g.game.id); + if (e.type === "thinking_delta") { + lt.thinking += e.delta; + bus.publish(ch, { type: "thinking_delta", gameId: g.game.id, ply: data.ply, delta: e.delta }); + } else if (e.type === "text_delta") { + lt.text += e.delta; + bus.publish(ch, { type: "text_delta", gameId: g.game.id, ply: data.ply, delta: e.delta }); + } else if (e.type === "tool_start") { + lt.tools[e.call.id] = e.call; + bus.publish(ch, { type: "tool_start", gameId: g.game.id, ply: data.ply, call: e.call }); + } else { + lt.tools[e.call.id] = e.call; + bus.publish(ch, { type: "tool_end", gameId: g.game.id, ply: data.ply, call: e.call }); + } + }; + + const ac = new AbortController(); + controllers.set(g.game.id, ac); + try { + const res = await runAgentTurn({ + gameId: g.game.id, + side, + me: asAgentPlayer(me), + opponentName: playerLabel(opp), + opponentIsHuman: opp.kind === "human", + persona: g.game.personas[side], + flags: g.game.flags, + state, + history: g.moves.map(toRecordPly), + opponentPhrase: last && last.side !== side ? last.phrase : null, + drawOffered: g.game.pendingDrawBy != null && g.game.pendingDrawBy !== side, + noteFromSelf: g.game.flags.notes ? (myLast?.note ?? null) : null, + signal: ac.signal, + onLive, + }); + await db + .update(schema.turns) + .set({ status: "done", transcript: res.transcript, usage: res.usage, outcome: res.decision.kind, endedAt: new Date() }) + .where(eq(schema.turns.id, turnId)); + await db.insert(schema.usageLedger).values({ + id: newId(), + userId: g.game.createdBy, + gameId: g.game.id, + playerId: me.id, + kind: "turn", + model: `${me.provider}/${me.modelId}`, + usage: res.usage, + cost: res.usage.cost, + tokens: res.usage.input + res.usage.output + res.usage.cacheRead + res.usage.cacheWrite, + }); + bus.publish(gameChannel(g.game.id), { type: "turn_end", gameId: g.game.id, ply: data.ply, usage: res.usage }); + + const d = res.decision; + if (d.kind === "move") { + const r = await applyMove(g.game.id, data.ply, { uci: d.uci, illegal: d.illegal }, { + phrase: d.phrase, + note: d.note, + offerDraw: d.offerDraw, + thinkMs: res.thinkMs, + usage: res.usage, + turnId, + }); + if (!r.ok) logErr("turn", `applyMove failed ${g.game.id}#${data.ply}: ${r.error}`); + } else if (d.kind === "resign") await applyTerminalDecision(g.game.id, side, "resign", d.phrase); + else if (d.kind === "accept_draw") await applyTerminalDecision(g.game.id, side, "accept_draw", d.phrase); + else await applyTerminalDecision(g.game.id, side, d.reason === "illegal" ? "forfeit_illegal" : "forfeit_no_move", null); + } catch (err) { + const msg = err instanceof Error ? err.message : String(err); + await db.update(schema.turns).set({ status: "failed", error: msg.slice(0, 2000), endedAt: new Date() }).where(eq(schema.turns.id, turnId)); + if (ac.signal.aborted) return; + logErr("turn", `${g.game.id}#${data.ply} attempt ${n + 1} failed: ${msg}`); + if (retryCount >= 4) { + await abortGame(g.game.id, `agent turn failed repeatedly: ${msg}`); + return; + } + bus.publish(gameChannel(g.game.id), { type: "status", gameId: g.game.id, status: "running", note: "Ошибка провайдера — ход будет переигран" }); + throw err; + } finally { + live.delete(g.game.id); + controllers.delete(g.game.id); + } +} + +// ------------------------------------------------------------------ eval job + +const evalCache = new Map(); +async function evalFen(fen: string): Promise { + const key = fen.split(" ").slice(0, 4).join(" "); + const hit = evalCache.get(key); + if (hit) return hit; + const e = await engine.analyze(fen); + evalCache.set(key, e); + if (evalCache.size > 5000) evalCache.delete(evalCache.keys().next().value!); + return e; +} + +/** cheap sacrifice heuristic: moved piece can be taken by a cheaper piece right away */ +function isSacrifice(fenBefore: string, uci: string): boolean { + try { + const c = new Chess(fenBefore); + const mv = c.move({ from: uci.slice(0, 2), to: uci.slice(2, 4), promotion: uci[4] ?? "q" }); + const moved = PIECE_VALUES[mv.promotion ?? mv.piece]; + const gained = mv.captured ? PIECE_VALUES[mv.captured] : 0; + if (moved < 3 || gained >= moved) return false; + const takers = c.moves({ verbose: true }).filter((m) => m.to === mv.to && m.captured); + return takers.some((t) => PIECE_VALUES[t.piece] < moved); + } catch { + return false; + } +} + +export async function handleEval(data: EvalJob) { + const mv = await db.query.moves.findFirst({ where: and(eq(schema.moves.gameId, data.gameId), eq(schema.moves.ply, data.ply)) }); + if (!mv) return; + const prev = + data.ply === 1 + ? (await db.query.games.findFirst({ where: eq(schema.games.id, data.gameId) }))!.startFen + : (await db.query.moves.findFirst({ where: and(eq(schema.moves.gameId, data.gameId), eq(schema.moves.ply, data.ply - 1)) }))?.fenAfter; + if (!prev) return; + const [before, after] = await Promise.all([evalFen(prev), evalFen(mv.fenAfter)]); + let classification = null; + let accuracy = null; + if (!mv.illegal) { + const legal = (() => { + try { + return new Chess(prev).moves().length; + } catch { + return 2; + } + })(); + const c = classifyMove({ side: mv.side, before, after, uci: mv.uci, legalMoveCount: legal, isSacrifice: isSacrifice(prev, mv.uci) }); + classification = c.cls; + accuracy = c.accuracy; + } + await db.update(schema.moves).set({ eval: after, classification, accuracy }).where(eq(schema.moves.id, mv.id)); + bus.publish(gameChannel(data.gameId), { type: "eval", gameId: data.gameId, ply: data.ply, eval: after, classification, accuracy }); +} + +// ------------------------------------------------------------------ workers + +export async function startWorkers() { + await boss.work(Q.turn, { localConcurrency: config.game.maxConcurrentGames, batchSize: 1, pollingIntervalSeconds: 1, includeMetadata: true } as any, async (jobs: any[]) => { + for (const j of jobs) await handleTurn(j.data, j.retryCount ?? 0); + }); + await boss.work(Q.evalPly, { localConcurrency: config.game.stockfishPool, batchSize: 1, pollingIntervalSeconds: 1 } as any, async (jobs: any[]) => { + for (const j of jobs) await handleEval(j.data); + }); + log("workers", "turn + eval workers started"); +} + +/** Make sure every running game has its next turn queued (after restarts / lost jobs). */ +export async function recoverRunningGames() { + const running = await db.select().from(schema.games).where(eq(schema.games.status, "running")); + const { kickTurn } = await import("./service.ts"); + for (const g of running) await kickTurn(g); + if (running.length) log("workers", `re-kicked ${running.length} running games`); +} diff --git a/apps/server/src/games/scheduler.ts b/apps/server/src/games/scheduler.ts new file mode 100644 index 0000000..cb2f2b8 --- /dev/null +++ b/apps/server/src/games/scheduler.ts @@ -0,0 +1,86 @@ +import { and, eq, lte, inArray, count } from "drizzle-orm"; +import { DEFAULT_FLAGS } from "@aichess/core"; +import { db, schema } from "../db/client.ts"; +import { bus } from "../bus.ts"; +import { boss, Q } from "../jobs.ts"; +import { config } from "../config.ts"; +import { PERSONAS } from "../agents/prompts.ts"; +import { log, logErr, newId, pick, shuffle } from "../util.ts"; +import { createGame, startPendingGame } from "./service.ts"; + +/** + * Every minute: + * 1. schedules whose next run is within `announceMinutes` get a pending game (predictions open), + * 2. pending games whose start time has passed are started (if there is capacity). + */ +export async function scheduleTick() { + const now = new Date(); + const schedules = await db.select().from(schema.schedules).where(eq(schema.schedules.enabled, true)); + for (const s of schedules) { + if (!s.nextRunAt) { + await db.update(schema.schedules).set({ nextRunAt: new Date(now.getTime() + s.intervalMinutes * 60_000) }).where(eq(schema.schedules.id, s.id)); + continue; + } + if (s.nextRunAt.getTime() - s.announceMinutes * 60_000 > now.getTime()) continue; + try { + await announceScheduled(s); + } catch (e) { + logErr("scheduler", `announce ${s.id}`, e); + } + const next = new Date(Math.max(s.nextRunAt.getTime(), now.getTime()) + s.intervalMinutes * 60_000); + await db.update(schema.schedules).set({ nextRunAt: next }).where(eq(schema.schedules.id, s.id)); + bus.publish("lobby", { type: "schedule_updated" }); + } + + const [{ running }] = await db.select({ running: count() }).from(schema.games).where(eq(schema.games.status, "running")); + let capacity = config.game.maxConcurrentGames - running; + const due = await db + .select() + .from(schema.games) + .where(and(eq(schema.games.status, "pending"), lte(schema.games.startsAt, now))) + .orderBy(schema.games.startsAt); + for (const g of due) { + if (capacity <= 0) break; + await startPendingGame(g.id); + capacity--; + } +} + +async function announceScheduled(s: typeof schema.schedules.$inferSelect) { + const where = s.pool.length ? and(eq(schema.players.kind, "ai"), inArray(schema.players.slug, s.pool)) : and(eq(schema.players.kind, "ai"), eq(schema.players.active, true)); + const pool = await db.select().from(schema.players).where(where); + if (pool.length < 2) return; + const [a, b] = shuffle(pool); + const g = await createGame({ + whiteId: a.id, + blackId: b.id, + createdBy: null, + flags: s.flags ?? DEFAULT_FLAGS, + personas: s.randomPersonas ? { white: pick(PERSONAS).id, black: pick(PERSONAS).id } : { white: null, black: null }, + scheduleId: s.id, + startsAt: s.nextRunAt!, + }); + log("scheduler", `announced ${g.id}: ${a.slug} vs ${b.slug} at ${s.nextRunAt?.toISOString()}`); +} + +export async function startScheduler() { + await boss.work(Q.scheduleTick, { batchSize: 1, pollingIntervalSeconds: 5 } as any, async () => { + await scheduleTick(); + }); + await boss.schedule(Q.scheduleTick, "* * * * *"); + // default schedule on first boot + const [{ n }] = await db.select({ n: count() }).from(schema.schedules); + if (n === 0) { + await db.insert(schema.schedules).values({ + id: newId(), + name: "Случайный матч", + intervalMinutes: 180, + announceMinutes: 30, + pool: [], + flags: DEFAULT_FLAGS, + randomPersonas: true, + enabled: true, + }); + log("scheduler", "created default schedule (every 3h)"); + } +} diff --git a/apps/server/src/games/service.ts b/apps/server/src/games/service.ts new file mode 100644 index 0000000..026677e --- /dev/null +++ b/apps/server/src/games/service.ts @@ -0,0 +1,300 @@ +import { and, asc, eq, inArray, sql } from "drizzle-orm"; +import { + GameState, + START_FEN, + isRated, + rateGame, + type GameFlags, + type MoveDTO, + type RecordPly, + type Result, + type Side, + type Termination, + type Usage, +} from "@aichess/core"; +import { db, schema } from "../db/client.ts"; +import { bus, gameChannel } from "../bus.ts"; +import { enqueueEval, enqueueFinalize, enqueueTurn } from "../jobs.ts"; +import { log, newId } from "../util.ts"; + +export type GameRow = typeof schema.games.$inferSelect; +export type PlayerRow = typeof schema.players.$inferSelect; +export type MoveRow = typeof schema.moves.$inferSelect; + +export const sideOfPly = (ply: number): Side => (ply % 2 === 1 ? "white" : "black"); +export const playerIdFor = (g: GameRow, side: Side) => (side === "white" ? g.whiteId : g.blackId); + +export function playerLabel(p: PlayerRow): string { + if (p.kind === "human") return p.displayName; + const v = p.variant ? ` · ${p.variant.toUpperCase()}` : ""; + return `${p.displayName}${v}`; +} + +export function moveToDTO(m: MoveRow): MoveDTO { + return { + ply: m.ply, + side: m.side, + san: m.san, + uci: m.uci, + fenAfter: m.fenAfter, + phrase: m.phrase, + note: m.note, + offeredDraw: m.offeredDraw, + illegal: m.illegal, + thinkMs: m.thinkMs, + usage: (m.usage ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, reasoning: 0, cost: 0 }) as Usage, + eval: m.eval, + classification: m.classification, + accuracy: m.accuracy, + createdAt: m.createdAt.toISOString(), + }; +} + +export const toRecordPly = (m: MoveRow): RecordPly => ({ + ply: m.ply, + side: m.side, + san: m.san, + uci: m.uci, + fenAfter: m.fenAfter, + phrase: m.phrase, + illegal: m.illegal, + offeredDraw: m.offeredDraw, + eval: m.eval, + classification: m.classification, + accuracy: m.accuracy, +}); + +export async function loadGame(id: string) { + const game = await db.query.games.findFirst({ where: eq(schema.games.id, id) }); + if (!game) return null; + const [white, black] = await Promise.all([ + db.query.players.findFirst({ where: eq(schema.players.id, game.whiteId) }), + db.query.players.findFirst({ where: eq(schema.players.id, game.blackId) }), + ]); + const moves = await db.select().from(schema.moves).where(eq(schema.moves.gameId, id)).orderBy(asc(schema.moves.ply)); + return { game, white: white!, black: black!, moves }; +} +export type LoadedGame = NonNullable>>; + +export function stateOf(g: LoadedGame): GameState { + return GameState.fromUci(g.moves.map((m) => ({ uci: m.uci, illegal: m.illegal })), g.game.startFen); +} + +// ------------------------------------------------------------------ create / start + +export interface CreateGameInput { + whiteId: string; + blackId: string; + createdBy: string | null; + flags: GameFlags; + personas: { white: string | null; black: string | null }; + scheduleId?: string | null; + startsAt?: Date | null; +} + +export async function createGame(i: CreateGameInput): Promise { + const id = newId(); + const pending = !!i.startsAt && i.startsAt.getTime() > Date.now(); + const [g] = await db + .insert(schema.games) + .values({ + id, + status: pending ? "pending" : "running", + whiteId: i.whiteId, + blackId: i.blackId, + createdBy: i.createdBy, + scheduleId: i.scheduleId ?? null, + flags: i.flags, + personas: i.personas, + rated: isRated(i.flags), + startFen: START_FEN, + fen: START_FEN, + startsAt: i.startsAt ?? null, + startedAt: pending ? null : new Date(), + }) + .returning(); + bus.publish("lobby", { type: "game_created", gameId: id }); + if (!pending) await kickTurn(g); + log("game", `created ${id} (${pending ? "pending" : "running"})`); + return g; +} + +export async function startPendingGame(id: string) { + const [g] = await db + .update(schema.games) + .set({ status: "running", startedAt: new Date() }) + .where(and(eq(schema.games.id, id), eq(schema.games.status, "pending"))) + .returning(); + if (!g) return; + bus.publish(gameChannel(id), { type: "status", gameId: id, status: "running" }); + bus.publish("lobby", { type: "game_updated", gameId: id }); + await kickTurn(g); +} + +/** Enqueue the next agent turn if the side to move is an AI. */ +export async function kickTurn(g: GameRow) { + if (g.status !== "running") return; + const ply = g.ply + 1; + const pid = playerIdFor(g, sideOfPly(ply)); + const p = await db.query.players.findFirst({ where: eq(schema.players.id, pid) }); + if (p?.kind === "ai") await enqueueTurn({ gameId: g.id, ply }); +} + +// ------------------------------------------------------------------ applying decisions + +export interface MoveMeta { + phrase: string | null; + note: string | null; + offerDraw: boolean; + thinkMs: number; + usage: Usage | null; + turnId: string | null; +} + +/** + * Apply a move for `ply` (optimistic: the game must still be at ply-1). Validates against the + * authoritative state, persists, detects game end, schedules eval + next turn. + */ +export async function applyMove(gameId: string, ply: number, input: { uci: string; illegal?: boolean }, meta: MoveMeta): Promise<{ ok: true; move: MoveDTO } | { ok: false; error: string }> { + const g = await loadGame(gameId); + if (!g) return { ok: false, error: "game not found" }; + if (g.game.status !== "running") return { ok: false, error: "game is not running" }; + if (g.game.ply !== ply - 1) return { ok: false, error: `stale ply (game at ${g.game.ply}, got ${ply})` }; + const state = stateOf(g); + const side = state.turn; + const r = input.illegal ? state.applyIllegal(input.uci) : state.tryMove(input.uci); + if (!r.ok) return { ok: false, error: r.message }; + const rec = r.record; + + const moveId = newId(); + const pendingDrawBy: Side | null = meta.offerDraw ? side : null; + const updated = await db.transaction(async (tx) => { + const [row] = await tx + .update(schema.games) + .set({ + ply, + fen: rec.fenAfter, + pendingDrawBy, + costTotal: sql`${schema.games.costTotal} + ${meta.usage?.cost ?? 0}`, + }) + .where(and(eq(schema.games.id, gameId), eq(schema.games.ply, ply - 1), eq(schema.games.status, "running"))) + .returning(); + if (!row) return null; + await tx.insert(schema.moves).values({ + id: moveId, + gameId, + ply, + side, + playerId: playerIdFor(g.game, side), + san: rec.san, + uci: rec.uci, + fenAfter: rec.fenAfter, + phrase: meta.phrase, + note: meta.note, + offeredDraw: meta.offerDraw, + illegal: rec.illegal, + thinkMs: meta.thinkMs, + usage: meta.usage, + turnId: meta.turnId, + }); + return row; + }); + if (!updated) return { ok: false, error: "concurrent update" }; + + const moveRow = (await db.query.moves.findFirst({ where: eq(schema.moves.id, moveId) }))!; + const dto = moveToDTO(moveRow); + bus.publish(gameChannel(gameId), { type: "move", gameId, move: dto }); + if (meta.offerDraw) bus.publish(gameChannel(gameId), { type: "draw_offer", gameId, by: side }); + await enqueueEval({ gameId, ply }); + + const outcome = state.outcome(); + if (outcome) await finishGame(gameId, outcome.result, outcome.termination); + else await kickTurn(updated); + return { ok: true, move: dto }; +} + +// ------------------------------------------------------------------ finishing + +export async function finishGame(gameId: string, result: Result, termination: Termination, opts: { error?: string } = {}) { + const g = await db.query.games.findFirst({ where: eq(schema.games.id, gameId) }); + if (!g || g.status === "finished" || g.status === "aborted") return; + const aborted = termination === "aborted" || termination === "error" || result === "*"; + const rated = g.rated && !aborted; + + let ratingChange: GameRow["ratingChange"] = null; + await db.transaction(async (tx) => { + const [row] = await tx + .update(schema.games) + .set({ status: aborted ? "aborted" : "finished", result, termination, finishedAt: new Date(), pendingDrawBy: null, error: opts.error ?? null }) + .where(and(eq(schema.games.id, gameId), inArray(schema.games.status, ["running", "pending"]))) + .returning(); + if (!row) return; + if (aborted) return; + const [w, b] = await Promise.all([ + tx.query.players.findFirst({ where: eq(schema.players.id, g.whiteId) }), + tx.query.players.findFirst({ where: eq(schema.players.id, g.blackId) }), + ]); + if (!w || !b) return; + const sw = result === "1-0" ? "w" : result === "0-1" ? "l" : "d"; + const sb = result === "0-1" ? "w" : result === "1-0" ? "l" : "d"; + const stat = (s: string) => ({ + games: sql`${schema.players.games} + 1`, + wins: s === "w" ? sql`${schema.players.wins} + 1` : undefined, + losses: s === "l" ? sql`${schema.players.losses} + 1` : undefined, + draws: s === "d" ? sql`${schema.players.draws} + 1` : undefined, + }); + if (rated && w.id !== b.id) { + const nr = rateGame({ r: w.rating, rd: w.rd, vol: w.vol }, { r: b.rating, rd: b.rd, vol: b.vol }, result as "1-0" | "0-1" | "1/2-1/2"); + ratingChange = { white: { before: w.rating, after: nr.white.r }, black: { before: b.rating, after: nr.black.r } }; + await tx.update(schema.players).set({ rating: nr.white.r, rd: nr.white.rd, vol: nr.white.vol, ...stat(sw) } as any).where(eq(schema.players.id, w.id)); + await tx.update(schema.players).set({ rating: nr.black.r, rd: nr.black.rd, vol: nr.black.vol, ...stat(sb) } as any).where(eq(schema.players.id, b.id)); + await tx.insert(schema.ratingHistory).values([ + { id: newId(), playerId: w.id, gameId, before: w.rating, after: nr.white.r, rd: nr.white.rd }, + { id: newId(), playerId: b.id, gameId, before: b.rating, after: nr.black.r, rd: nr.black.rd }, + ]); + await tx.update(schema.games).set({ ratingChange }).where(eq(schema.games.id, gameId)); + } + // predictions + const winner = result === "1-0" ? "white" : result === "0-1" ? "black" : "draw"; + await tx.update(schema.predictions).set({ points: sql`case when ${schema.predictions.pick} = ${winner} then 10 else 0 end` }).where(eq(schema.predictions.gameId, gameId)); + }); + + bus.publish(gameChannel(gameId), { type: "game_over", gameId, result, termination }); + bus.publish("lobby", { type: "game_updated", gameId }); + log("game", `finished ${gameId}: ${result} (${termination})`); + if (!aborted) await enqueueFinalize({ gameId }); +} + +export async function abortGame(gameId: string, reason = "aborted") { + await finishGame(gameId, "*", "aborted", { error: reason }); +} + +/** Apply a non-move turn decision (resign / accept draw / forfeit). */ +export async function applyTerminalDecision(gameId: string, side: Side, kind: "resign" | "accept_draw" | "forfeit_illegal" | "forfeit_no_move", phrase: string | null) { + const g = await db.query.games.findFirst({ where: eq(schema.games.id, gameId) }); + if (!g || g.status !== "running") return; + if (phrase) { + await db + .update(schema.games) + .set({ lastWords: sql`${schema.games.lastWords} || ${JSON.stringify({ [side]: phrase })}::jsonb` }) + .where(eq(schema.games.id, gameId)); + } + if (kind === "accept_draw") { + if (!g.pendingDrawBy || g.pendingDrawBy === side) return; + await finishGame(gameId, "1/2-1/2", "agreement"); + } else { + const result: Result = side === "white" ? "0-1" : "1-0"; + await finishGame(gameId, result, kind === "resign" ? "resignation" : kind); + } +} + +export function recordOf(g: LoadedGame) { + return { + white: playerLabel(g.white), + black: playerLabel(g.black), + plies: g.moves.map(toRecordPly), + result: g.game.result, + termination: g.game.termination, + startedAt: g.game.startedAt?.toISOString(), + }; +} diff --git a/apps/server/src/http/app.ts b/apps/server/src/http/app.ts new file mode 100644 index 0000000..4e60c8c --- /dev/null +++ b/apps/server/src/http/app.ts @@ -0,0 +1,397 @@ +import fs from "node:fs"; +import path from "node:path"; +import { Hono } from "hono"; +import { serveStatic } from "@hono/node-server/serve-static"; +import { and, asc, count, desc, eq, inArray, isNotNull, lt, or, sql, sum, avg } from "drizzle-orm"; +import { z } from "zod"; +import sharp from "sharp"; +import { DEFAULT_FLAGS, toPgn, type Side } from "@aichess/core"; +import { config } from "../config.ts"; +import { db, schema } from "../db/client.ts"; +import { authMiddleware, createSession, destroySession, findUserByName, registerUser, requireAdmin, requireUser, USERNAME_RE, verifyPassword, type AppEnv } from "../auth.ts"; +import { PERSONAS } from "../agents/prompts.ts"; +import { abortGame, applyMove, applyTerminalDecision, createGame, loadGame, playerIdFor, recordOf, sideOfPly } from "../games/service.ts"; +import { abortRunningTurn, getLiveTurn } from "../games/runner.ts"; +import { enqueueFinalize } from "../jobs.ts"; +import { newId } from "../util.ts"; +import { gameSummaryDTO, movesDTO, playerDTO, userDTO } from "./dto.ts"; + +export const THEMES = ["broadcast", "tabloid", "arcade"] as const; + +async function playersMap(ids: string[]) { + const rows = ids.length ? await db.select().from(schema.players).where(inArray(schema.players.id, [...new Set(ids)])) : []; + return new Map(rows.map((p) => [p.id, p])); +} +async function summaries(games: (typeof schema.games.$inferSelect)[], opts: { withReview?: boolean } = {}) { + const pm = await playersMap(games.flatMap((g) => [g.whiteId, g.blackId])); + return games.map((g) => gameSummaryDTO(g, pm, opts)); +} + +const body = async (c: any, schema_: T): Promise> => schema_.parse(await c.req.json().catch(() => ({}))); + +export function buildApp() { + const app = new Hono(); + app.use("/api/*", authMiddleware); + app.onError((err, c) => { + if (err instanceof z.ZodError) return c.json({ error: "Некорректные данные", details: err.issues }, 400); + console.error(err); + return c.json({ error: err.message ?? "Ошибка сервера" }, 500); + }); + + // ------------------------------------------------------------ auth & me + app.get("/api/me", async (c) => { + const u = c.get("user"); + if (!u) return c.json({ user: null }); + const p = await db.query.players.findFirst({ where: eq(schema.players.userId, u.id) }); + return c.json({ user: userDTO(u, p) }); + }); + + app.post("/api/auth/register", async (c) => { + const b = await body(c, z.object({ username: z.string(), password: z.string() })); + if (!USERNAME_RE.test(b.username)) return c.json({ error: "Логин: 3–24 символа, латиница, цифры, _ . -" }, 400); + if (b.password.length < 6) return c.json({ error: "Пароль — минимум 6 символов" }, 400); + if (await findUserByName(b.username)) return c.json({ error: "Такой логин уже занят" }, 409); + const u = await registerUser(b.username, b.password); + await createSession(c, u.id); + return c.json({ user: userDTO(u) }); + }); + + app.post("/api/auth/login", async (c) => { + const b = await body(c, z.object({ username: z.string(), password: z.string() })); + const u = await findUserByName(b.username); + if (!u || !(await verifyPassword(b.password, u.passwordHash))) return c.json({ error: "Неверный логин или пароль" }, 401); + await createSession(c, u.id); + return c.json({ user: userDTO(u) }); + }); + + app.post("/api/auth/logout", async (c) => { + await destroySession(c); + return c.json({ ok: true }); + }); + + app.patch("/api/me", requireUser, async (c) => { + const u = c.get("user")!; + const b = await body(c, z.object({ displayName: z.string().min(1).max(40).optional(), theme: z.enum(THEMES).optional(), onboarded: z.boolean().optional() })); + const [nu] = await db.update(schema.users).set(b).where(eq(schema.users.id, u.id)).returning(); + if (b.displayName) await db.update(schema.players).set({ displayName: b.displayName }).where(eq(schema.players.userId, u.id)); + const p = await db.query.players.findFirst({ where: eq(schema.players.userId, u.id) }); + return c.json({ user: userDTO(nu, p) }); + }); + + app.post("/api/me/avatar", requireUser, async (c) => { + const u = c.get("user")!; + const form = await c.req.formData(); + const file = form.get("file"); + if (!(file instanceof File)) return c.json({ error: "Нет файла" }, 400); + if (file.size > 8 * 1024 * 1024) return c.json({ error: "Файл больше 8 МБ" }, 400); + const rel = path.join("avatars", `${u.id}-${Date.now().toString(36)}.webp`); + const abs = path.join(config.paths.data, "media", rel); + fs.mkdirSync(path.dirname(abs), { recursive: true }); + await sharp(Buffer.from(await file.arrayBuffer())).rotate().resize(512, 512, { fit: "cover" }).webp({ quality: 88 }).toFile(abs); + const [nu] = await db.update(schema.users).set({ avatar: rel }).where(eq(schema.users.id, u.id)).returning(); + await db.update(schema.players).set({ avatar: rel }).where(eq(schema.players.userId, u.id)); + const p = await db.query.players.findFirst({ where: eq(schema.players.userId, u.id) }); + return c.json({ user: userDTO(nu, p) }); + }); + + // ------------------------------------------------------------ meta / players + app.get("/api/meta", async (c) => { + const ai = await db.select().from(schema.players).where(and(eq(schema.players.kind, "ai"), eq(schema.players.active, true))).orderBy(asc(schema.players.createdAt)); + return c.json({ + personas: PERSONAS.map(({ id, label, description }) => ({ id, label, description })), + aiPlayers: ai.map(playerDTO), + themes: THEMES, + flags: [ + { key: "notes", label: "Заметки себе", description: "Агент может оставить заметку на свой следующий ход.", rated: true }, + { key: "extraTools", label: "Доп. тулы", description: "История ходов и Python-песочница с python-chess.", rated: true }, + { key: "cheating", label: "Читерство", description: "Нелегальные ходы применяются как есть. Партия безрейтинговая.", rated: false }, + ], + }); + }); + + app.get("/api/leaderboard", async (c) => { + const players = await db.select().from(schema.players).where(or(eq(schema.players.kind, "human"), eq(schema.players.active, true))); + // avg accuracy + avg cost per game per player (finished rated + unrated non-aborted games) + const acc = await db.execute(sql` + select p.id as player_id, + avg(case when g.white_id = p.id then (g.accuracy->>'white')::float else (g.accuracy->>'black')::float end) as avg_accuracy, + count(g.id) as finished + from players p join games g on (g.white_id = p.id or g.black_id = p.id) + where g.status = 'finished' and g.accuracy is not null + group by p.id`); + const cost = await db.execute(sql` + select l.player_id, sum(l.cost) as cost, count(distinct l.game_id) as games, sum(l.tokens) as tokens + from usage_ledger l where l.kind = 'turn' and l.player_id is not null group by l.player_id`); + const accBy = new Map((acc as any[]).map((r) => [r.player_id, r])); + const costBy = new Map((cost as any[]).map((r) => [r.player_id, r])); + const rows = players + .filter((p) => p.games > 0 || p.kind === "ai") + .map((p) => { + const a = accBy.get(p.id); + const k = costBy.get(p.id); + return { + ...playerDTO(p), + avgAccuracy: a?.avg_accuracy != null ? Number(a.avg_accuracy) : null, + costPerGame: k && Number(k.games) > 0 ? Number(k.cost) / Number(k.games) : null, + tokensPerGame: k && Number(k.games) > 0 ? Number(k.tokens) / Number(k.games) : null, + }; + }) + .sort((a, b) => b.rating - a.rating); + return c.json({ players: rows }); + }); + + app.get("/api/stats/h2h", async (c) => { + const r = await db.execute(sql` + select white_id, black_id, result, count(*)::int as n from games + where status = 'finished' and result in ('1-0','0-1','1/2-1/2') group by white_id, black_id, result`); + return c.json({ rows: r }); + }); + + app.get("/api/stats/predictors", async (c) => { + const r = await db.execute(sql` + select u.id, u.display_name, u.avatar, coalesce(sum(p.points),0)::int as points, count(p.id)::int as picks, + sum(case when p.points > 0 then 1 else 0 end)::int as correct + from predictions p join users u on u.id = p.user_id group by u.id order by points desc limit 50`); + return c.json({ rows: (r as any[]).map((x) => ({ ...x, avatarUrl: x.avatar ? `/media/${x.avatar}` : null })) }); + }); + + // ------------------------------------------------------------ home & lists + app.get("/api/home", async (c) => { + const live = await db.select().from(schema.games).where(eq(schema.games.status, "running")).orderBy(desc(schema.games.startedAt)); + const upcoming = await db.select().from(schema.games).where(eq(schema.games.status, "pending")).orderBy(asc(schema.games.startsAt)).limit(5); + const featured = await db + .select() + .from(schema.games) + .where(and(eq(schema.games.status, "finished"), isNotNull(schema.games.review), isNotNull(schema.games.thumbnail))) + .orderBy(desc(schema.games.finishedAt)) + .limit(1); + const recent = await db.select().from(schema.games).where(eq(schema.games.status, "finished")).orderBy(desc(schema.games.finishedAt)).limit(24); + const schedules = await db.select().from(schema.schedules).where(eq(schema.schedules.enabled, true)); + const nextScheduled = schedules.map((s) => s.nextRunAt).filter(Boolean).sort((a, b) => a!.getTime() - b!.getTime())[0] ?? null; + return c.json({ + live: await summaries(live), + upcoming: await summaries(upcoming), + featured: (await summaries(featured, { withReview: true }))[0] ?? null, + recent: await summaries(recent.filter((g) => g.id !== featured[0]?.id)), + nextScheduledAt: nextScheduled?.toISOString() ?? null, + }); + }); + + app.get("/api/games", async (c) => { + const status = c.req.query("status"); + const playerId = c.req.query("player"); + const before = c.req.query("before"); + const limit = Math.min(60, Number(c.req.query("limit") ?? 30)); + const conds = []; + if (status) conds.push(eq(schema.games.status, status as any)); + if (playerId) conds.push(or(eq(schema.games.whiteId, playerId), eq(schema.games.blackId, playerId))); + if (before) conds.push(lt(schema.games.createdAt, new Date(before))); + const rows = await db.select().from(schema.games).where(conds.length ? and(...conds) : undefined).orderBy(desc(schema.games.createdAt)).limit(limit); + return c.json({ games: await summaries(rows) }); + }); + + app.get("/api/games/:id", async (c) => { + const g = await loadGame(c.req.param("id")); + if (!g) return c.json({ error: "Партия не найдена" }, 404); + const pm = new Map([[g.white.id, g.white], [g.black.id, g.black]]); + const preds = await db.select({ pick: schema.predictions.pick, n: count() }).from(schema.predictions).where(eq(schema.predictions.gameId, g.game.id)).groupBy(schema.predictions.pick); + const me = c.get("user"); + const mine = me ? await db.query.predictions.findFirst({ where: and(eq(schema.predictions.gameId, g.game.id), eq(schema.predictions.userId, me.id)) }) : null; + const lt = getLiveTurn(g.game.id); + return c.json({ + game: { + ...gameSummaryDTO(g.game, pm, { withReview: true }), + startFen: g.game.startFen, + personas: g.game.personas, + interviews: g.game.interviews, + lastWords: g.game.lastWords, + pendingDrawBy: g.game.pendingDrawBy, + createdBy: g.game.createdBy, + error: g.game.error, + }, + moves: movesDTO(g.moves), + live: lt ? { ply: lt.ply, side: lt.side, startedAt: lt.startedAt, thinking: lt.thinking, text: lt.text, tools: Object.values(lt.tools) } : null, + predictions: { counts: Object.fromEntries(preds.map((p) => [p.pick, p.n])), mine: mine?.pick ?? null }, + }); + }); + + app.get("/api/games/:id/turns/:ply", async (c) => { + const rows = await db + .select() + .from(schema.turns) + .where(and(eq(schema.turns.gameId, c.req.param("id")), eq(schema.turns.ply, Number(c.req.param("ply"))))) + .orderBy(asc(schema.turns.attempt)); + return c.json({ turns: rows.map((t) => ({ id: t.id, attempt: t.attempt, status: t.status, outcome: t.outcome, error: t.error, usage: t.usage, transcript: t.transcript, startedAt: t.startedAt, endedAt: t.endedAt })) }); + }); + + app.get("/api/games/:id/pgn", async (c) => { + const g = await loadGame(c.req.param("id")); + if (!g) return c.text("not found", 404); + c.header("content-type", "application/x-chess-pgn; charset=utf-8"); + c.header("content-disposition", `attachment; filename="aichess-${g.game.id}.pgn"`); + return c.body(toPgn(recordOf(g) as any)); + }); + + // ------------------------------------------------------------ playing + const NewGame = z.object({ + white: z.string(), + black: z.string(), + personas: z.object({ white: z.string().nullable().optional(), black: z.string().nullable().optional() }).optional(), + flags: z.object({ notes: z.boolean(), extraTools: z.boolean(), cheating: z.boolean() }).partial().optional(), + startsAt: z.string().datetime().optional(), // admin only: scheduled match with predictions + }); + + app.post("/api/games", requireUser, async (c) => { + const u = c.get("user")!; + const b = await body(c, NewGame); + if (!u.isAdmin) { + const [{ n }] = await db.select({ n: count() }).from(schema.games).where(and(eq(schema.games.createdBy, u.id), inArray(schema.games.status, ["running", "pending"]))); + if (n >= config.game.maxActiveGamesPerUser) return c.json({ error: "У тебя уже идёт партия — дождись её окончания" }, 409); + } + const me = await db.query.players.findFirst({ where: eq(schema.players.userId, u.id) }); + const resolve = async (s: string) => (s === "me" ? me : await db.query.players.findFirst({ where: and(eq(schema.players.slug, s), eq(schema.players.kind, "ai")) })); + const [w, bl] = await Promise.all([resolve(b.white), resolve(b.black)]); + if (!w || !bl) return c.json({ error: "Неизвестный игрок" }, 400); + if (w.kind === "human" && bl.kind === "human") return c.json({ error: "Человек против человека — не здесь :)" }, 400); + const personaOk = (id: string | null | undefined) => (id && PERSONAS.some((p) => p.id === id) ? id : null); + const g = await createGame({ + whiteId: w.id, + blackId: bl.id, + createdBy: u.id, + flags: { ...DEFAULT_FLAGS, ...(b.flags ?? {}) }, + personas: { white: w.kind === "ai" ? personaOk(b.personas?.white) ?? "gopnik" : null, black: bl.kind === "ai" ? personaOk(b.personas?.black) ?? "gopnik" : null }, + scheduleId: u.isAdmin && b.startsAt ? "manual" : null, + startsAt: u.isAdmin && b.startsAt ? new Date(b.startsAt) : null, + }); + return c.json({ id: g.id }); + }); + + async function humanTurn(c: any) { + const u = c.get("user")!; + const g = await loadGame(c.req.param("id")); + if (!g) return { error: c.json({ error: "Партия не найдена" }, 404) }; + if (g.game.status !== "running") return { error: c.json({ error: "Партия не идёт" }, 409) }; + const side = sideOfPly(g.game.ply + 1); + const p = side === "white" ? g.white : g.black; + if (p.kind !== "human" || p.userId !== u.id) return { error: c.json({ error: "Сейчас не твой ход" }, 409) }; + return { g, side }; + } + + app.post("/api/games/:id/move", requireUser, async (c) => { + const t = await humanTurn(c); + if ("error" in t) return t.error; + const b = await body(c, z.object({ move: z.string().min(2).max(12), phrase: z.string().max(400).optional(), offerDraw: z.boolean().optional() })); + const r = await applyMove(t.g.game.id, t.g.game.ply + 1, { uci: b.move }, { phrase: b.phrase?.trim() || null, note: null, offerDraw: !!b.offerDraw, thinkMs: 0, usage: null, turnId: null }); + if (!r.ok) return c.json({ error: r.error }, 400); + return c.json({ ok: true, move: r.move }); + }); + + app.post("/api/games/:id/resign", requireUser, async (c) => { + const u = c.get("user")!; + const g = await loadGame(c.req.param("id")); + if (!g || g.game.status !== "running") return c.json({ error: "Партия не идёт" }, 409); + const side: Side | null = g.white.userId === u.id ? "white" : g.black.userId === u.id ? "black" : null; + if (!side) return c.json({ error: "Ты не играешь в этой партии" }, 403); + const b = await body(c, z.object({ phrase: z.string().max(400).optional() })); + abortRunningTurn(g.game.id); + await applyTerminalDecision(g.game.id, side, "resign", b.phrase ?? null); + return c.json({ ok: true }); + }); + + app.post("/api/games/:id/accept-draw", requireUser, async (c) => { + const t = await humanTurn(c); + if ("error" in t) return t.error; + await applyTerminalDecision(t.g.game.id, t.side, "accept_draw", null); + return c.json({ ok: true }); + }); + + app.post("/api/games/:id/abort", requireUser, async (c) => { + const u = c.get("user")!; + const g = await db.query.games.findFirst({ where: eq(schema.games.id, c.req.param("id")) }); + if (!g) return c.json({ error: "Партия не найдена" }, 404); + if (!u.isAdmin && g.createdBy !== u.id) return c.json({ error: "Можно прервать только свою партию" }, 403); + abortRunningTurn(g.id); + await abortGame(g.id, `aborted by ${u.username}`); + return c.json({ ok: true }); + }); + + app.post("/api/games/:id/predict", requireUser, async (c) => { + const u = c.get("user")!; + const b = await body(c, z.object({ pick: z.enum(["white", "draw", "black"]) })); + const g = await db.query.games.findFirst({ where: eq(schema.games.id, c.req.param("id")) }); + if (!g || !g.scheduleId) return c.json({ error: "Прогнозы только для матчей по расписанию" }, 400); + if (g.status !== "pending") return c.json({ error: "Приём прогнозов закрыт" }, 409); + await db + .insert(schema.predictions) + .values({ id: newId(), gameId: g.id, userId: u.id, pick: b.pick }) + .onConflictDoUpdate({ target: [schema.predictions.gameId, schema.predictions.userId], set: { pick: b.pick } }); + return c.json({ ok: true }); + }); + + // ------------------------------------------------------------ admin + app.get("/api/admin/users", requireUser, requireAdmin, async (c) => { + const r = await db.execute(sql` + select u.id, u.username, u.display_name, u.avatar, u.is_admin, u.created_at, + coalesce(sum(l.cost),0)::float as cost, coalesce(sum(l.tokens),0)::bigint as tokens, + count(distinct l.game_id)::int as games + from users u left join usage_ledger l on l.user_id = u.id + group by u.id order by cost desc`); + const sys = await db.execute(sql`select coalesce(sum(cost),0)::float as cost, coalesce(sum(tokens),0)::bigint as tokens, count(distinct game_id)::int as games from usage_ledger where user_id is null`); + return c.json({ users: (r as any[]).map((x) => ({ ...x, tokens: Number(x.tokens), avatarUrl: x.avatar ? `/media/${x.avatar}` : null })), system: { ...(sys as any[])[0], tokens: Number((sys as any[])[0].tokens) } }); + }); + + const ScheduleBody = z.object({ + name: z.string().min(1).max(60), + enabled: z.boolean(), + intervalMinutes: z.number().int().min(10).max(7 * 24 * 60), + announceMinutes: z.number().int().min(0).max(24 * 60), + pool: z.array(z.string()), + flags: z.object({ notes: z.boolean(), extraTools: z.boolean(), cheating: z.boolean() }), + randomPersonas: z.boolean(), + nextRunAt: z.string().datetime().nullable().optional(), + }); + app.get("/api/admin/schedules", requireUser, requireAdmin, async (c) => c.json({ schedules: await db.select().from(schema.schedules).orderBy(asc(schema.schedules.createdAt)) })); + app.post("/api/admin/schedules", requireUser, requireAdmin, async (c) => { + const b = await body(c, ScheduleBody); + const [s] = await db.insert(schema.schedules).values({ id: newId(), ...b, nextRunAt: b.nextRunAt ? new Date(b.nextRunAt) : null, createdBy: c.get("user")!.id }).returning(); + return c.json({ schedule: s }); + }); + app.patch("/api/admin/schedules/:id", requireUser, requireAdmin, async (c) => { + const b = await body(c, ScheduleBody.partial()); + const [s] = await db + .update(schema.schedules) + .set({ ...b, nextRunAt: b.nextRunAt === undefined ? undefined : b.nextRunAt ? new Date(b.nextRunAt) : null }) + .where(eq(schema.schedules.id, c.req.param("id"))) + .returning(); + return c.json({ schedule: s }); + }); + app.delete("/api/admin/schedules/:id", requireUser, requireAdmin, async (c) => { + await db.delete(schema.schedules).where(eq(schema.schedules.id, c.req.param("id"))); + return c.json({ ok: true }); + }); + app.post("/api/admin/games/:id/postgame", requireUser, requireAdmin, async (c) => { + const id = c.req.param("id"); + const b = await body(c, z.object({ redo: z.array(z.enum(["interviews", "review", "thumbnail"])).default([]) })); + const patch: Record = {}; + if (b.redo.includes("interviews")) patch.interviews = {}; + if (b.redo.includes("review")) patch.review = null; + if (b.redo.includes("thumbnail")) Object.assign(patch, { thumbnail: null, thumbnailCaption: null, thumbnailMeta: null }); + if (Object.keys(patch).length) await db.update(schema.games).set(patch).where(eq(schema.games.id, id)); + await enqueueFinalize({ gameId: id }); + return c.json({ ok: true }); + }); + + return app; +} + +/** Static assets + SPA fallback. Must be mounted last (after /ws). */ +export function mountStatic(app: Hono) { + app.use("/assets/*", serveStatic({ root: path.relative(process.cwd(), config.paths.assets), rewriteRequestPath: (p) => p.replace(/^\/assets/, "") })); + app.use("/media/*", serveStatic({ root: path.relative(process.cwd(), path.join(config.paths.data, "media")), rewriteRequestPath: (p) => p.replace(/^\/media/, "") })); + if (fs.existsSync(config.paths.web)) { + const webRoot = path.relative(process.cwd(), config.paths.web); + app.use("/*", serveStatic({ root: webRoot })); + const indexHtml = () => fs.readFileSync(path.join(config.paths.web, "index.html"), "utf8"); + app.get("*", (c) => (c.req.path.startsWith("/api/") ? c.json({ error: "not found" }, 404) : c.html(indexHtml()))); + } +} diff --git a/apps/server/src/http/dto.ts b/apps/server/src/http/dto.ts new file mode 100644 index 0000000..30c970f --- /dev/null +++ b/apps/server/src/http/dto.ts @@ -0,0 +1,74 @@ +import type { schema } from "../db/client.ts"; +import { moveToDTO, type GameRow, type MoveRow, type PlayerRow } from "../games/service.ts"; + +export function avatarUrl(p: { kind: string; avatar: string | null }) { + if (!p.avatar) return null; + return p.kind === "ai" ? `/assets/${p.avatar}` : `/media/${p.avatar}`; +} + +export function playerDTO(p: PlayerRow) { + return { + id: p.id, + kind: p.kind, + slug: p.slug, + displayName: p.displayName, + variant: p.variant, + family: p.family, + modelId: p.modelId, + avatarUrl: avatarUrl(p), + color: p.color, + dumb: p.dumb, + skull: p.skull, + active: p.active, + rating: Math.round(p.rating), + rd: Math.round(p.rd), + games: p.games, + wins: p.wins, + draws: p.draws, + losses: p.losses, + }; +} +export type PlayerDTO = ReturnType; + +export function gameSummaryDTO(g: GameRow, players: Map, opts: { withReview?: boolean } = {}) { + return { + id: g.id, + status: g.status, + white: playerDTO(players.get(g.whiteId)!), + black: playerDTO(players.get(g.blackId)!), + result: g.result, + termination: g.termination, + ply: g.ply, + fen: g.fen, + rated: g.rated, + flags: g.flags, + scheduled: !!g.scheduleId, + startsAt: g.startsAt?.toISOString() ?? null, + startedAt: g.startedAt?.toISOString() ?? null, + finishedAt: g.finishedAt?.toISOString() ?? null, + createdAt: g.createdAt.toISOString(), + thumbnailUrl: g.thumbnail ? `/media/${g.thumbnail}` : null, + thumbnailCaption: g.thumbnailCaption, + accuracy: g.accuracy, + costTotal: g.costTotal, + ratingChange: g.ratingChange, + review: opts.withReview ? g.review : undefined, + }; +} +export type GameSummaryDTO = ReturnType; + +export function userDTO(u: typeof schema.users.$inferSelect, player?: PlayerRow | null) { + return { + id: u.id, + username: u.username, + displayName: u.displayName, + avatarUrl: u.avatar ? `/media/${u.avatar}` : null, + isAdmin: u.isAdmin, + onboarded: u.onboarded, + theme: u.theme, + playerId: player?.id ?? null, + rating: player ? Math.round(player.rating) : null, + }; +} + +export const movesDTO = (ms: MoveRow[]) => ms.map(moveToDTO); diff --git a/apps/server/src/index.ts b/apps/server/src/index.ts new file mode 100644 index 0000000..2994977 --- /dev/null +++ b/apps/server/src/index.ts @@ -0,0 +1,119 @@ +import fs from "node:fs"; +import path from "node:path"; +import { serve } from "@hono/node-server"; +import { createNodeWebSocket } from "@hono/node-ws"; +import { getCookie } from "hono/cookie"; +import { config } from "./config.ts"; +import { runMigrations } from "./db/client.ts"; +import { syncCatalog } from "./catalog.ts"; +import { ensureAdmin, COOKIE, userFromToken } from "./auth.ts"; +import { startBoss, boss } from "./jobs.ts"; +import { bus, type BusEvent } from "./bus.ts"; +import { buildApp, mountStatic } from "./http/app.ts"; +import { startWorkers, recoverRunningGames } from "./games/runner.ts"; +import { startFinalizeWorker } from "./games/finalize.ts"; +import { startScheduler } from "./games/scheduler.ts"; +import { engine } from "./engine/stockfish.ts"; +import { log } from "./util.ts"; + +async function main() { + fs.mkdirSync(path.join(config.paths.data, "media"), { recursive: true }); + await runMigrations(); + await syncCatalog(); + await ensureAdmin(); + await startBoss(); + + const app = buildApp(); + const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app }); + + /** + * WS protocol: client sends {"sub": ["lobby", "game:"]} / {"unsub": [...]}; server pushes + * {"ch": channel, "ev": event}. Delta events are coalesced per channel every 120 ms. + */ + app.get( + "/ws", + upgradeWebSocket(async (c) => { + const user = await userFromToken(getCookie(c, COOKIE)).catch(() => null); + const subs = new Map void>(); + let pending: { ch: string; ev: BusEvent }[] = []; + let timer: NodeJS.Timeout | null = null; + let socket: { send: (s: string) => void; readyState: number } | null = null; + const flush = () => { + timer = null; + if (!socket || !pending.length) return; + // merge consecutive thinking/text deltas + const merged: typeof pending = []; + for (const p of pending) { + const last = merged[merged.length - 1]; + const t = (p.ev as any).type; + if (last && last.ch === p.ch && (t === "thinking_delta" || t === "text_delta") && (last.ev as any).type === t && (last.ev as any).ply === (p.ev as any).ply) { + (last.ev as any) = { ...(last.ev as any), delta: (last.ev as any).delta + (p.ev as any).delta }; + } else merged.push({ ch: p.ch, ev: { ...(p.ev as any) } }); + } + pending = []; + try { + socket.send(JSON.stringify({ batch: merged })); + } catch { + /* closed */ + } + }; + const push = (ch: string, ev: BusEvent) => { + pending.push({ ch, ev }); + if (!timer) timer = setTimeout(flush, 120); + }; + return { + onOpen(_e, ws) { + socket = ws as any; + ws.send(JSON.stringify({ hello: true, user: user ? { id: user.id, username: user.username } : null })); + }, + onMessage(e, _ws) { + try { + const msg = JSON.parse(String(e.data)); + for (const ch of (msg.sub ?? []) as string[]) { + if (subs.has(ch) || !(ch === "lobby" || /^game:[a-z0-9]+$/.test(ch))) continue; + subs.set(ch, bus.subscribe(ch, (ev) => push(ch, ev))); + } + for (const ch of (msg.unsub ?? []) as string[]) { + subs.get(ch)?.(); + subs.delete(ch); + } + } catch { + /* ignore */ + } + }, + onClose() { + for (const off of subs.values()) off(); + subs.clear(); + if (timer) clearTimeout(timer); + socket = null; + }, + }; + }), + ); + mountStatic(app); + + const server = serve({ fetch: app.fetch, port: config.port, hostname: config.host }, (i) => log("http", `listening on ${i.address}:${i.port}`)); + injectWebSocket(server); + + if (config.role !== "api") { + await startWorkers(); + await startFinalizeWorker(); + await startScheduler(); + await recoverRunningGames(); + } + + const shutdown = async () => { + log("main", "shutting down"); + server.close(); + await boss.stop({ graceful: true, timeout: 5000 } as any).catch(() => {}); + engine.stop(); + process.exit(0); + }; + process.on("SIGTERM", shutdown); + process.on("SIGINT", shutdown); +} + +main().catch((e) => { + console.error(e); + process.exit(1); +}); diff --git a/apps/server/src/jobs.ts b/apps/server/src/jobs.ts new file mode 100644 index 0000000..a30b335 --- /dev/null +++ b/apps/server/src/jobs.ts @@ -0,0 +1,40 @@ +import { PgBoss } from "pg-boss"; +import { config } from "./config.ts"; +import { log, logErr } from "./util.ts"; + +export const Q = { + turn: "turn", + evalPly: "eval-ply", + finalize: "finalize", + scheduleTick: "schedule-tick", +} as const; + +export type TurnJob = { gameId: string; ply: number }; +export type EvalJob = { gameId: string; ply: number }; +export type FinalizeJob = { gameId: string }; + +export const boss = new PgBoss({ connectionString: config.databaseUrl, schema: "pgboss" } as any); +boss.on("error", (e: unknown) => logErr("pg-boss", e)); + +export async function startBoss() { + await boss.start(); + // agent turns can take very long (MAX thinking) — generous expiry, a few retries + // heartbeat: a crashed/restarted worker's job is retried within ~a minute instead of waiting for expiry + await ensureQueue(Q.turn, { expireInSeconds: 3 * 3600, retryLimit: 4, retryDelay: 20, retryBackoff: true, heartbeatSeconds: 60 }); + await ensureQueue(Q.evalPly, { expireInSeconds: 600, retryLimit: 3, retryDelay: 5 }); + await ensureQueue(Q.finalize, { expireInSeconds: 3600, retryLimit: 2, retryDelay: 30, heartbeatSeconds: 60 }); + await ensureQueue(Q.scheduleTick, { expireInSeconds: 120, retryLimit: 0 }); + log("jobs", "pg-boss started"); +} + +async function ensureQueue(name: string, opts: Record) { + try { + await boss.createQueue(name, opts as any); + } catch { + await boss.updateQueue(name, opts as any).catch(() => {}); + } +} + +export const enqueueTurn = (j: TurnJob) => boss.send(Q.turn, j, { singletonKey: `${j.gameId}:${j.ply}` }); +export const enqueueEval = (j: EvalJob) => boss.send(Q.evalPly, j, { singletonKey: `${j.gameId}:${j.ply}` }); +export const enqueueFinalize = (j: FinalizeJob) => boss.send(Q.finalize, j, { singletonKey: j.gameId }); diff --git a/apps/server/src/util.ts b/apps/server/src/util.ts new file mode 100644 index 0000000..f476d53 --- /dev/null +++ b/apps/server/src/util.ts @@ -0,0 +1,26 @@ +import { customAlphabet } from "nanoid"; + +const alpha = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz", 12); +/** short, url-safe, roughly time-sortable id */ +export const newId = () => Date.now().toString(36) + alpha(); + +export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); + +export function log(scope: string, ...args: unknown[]) { + console.log(new Date().toISOString(), `[${scope}]`, ...args); +} +export function logErr(scope: string, ...args: unknown[]) { + console.error(new Date().toISOString(), `[${scope}]`, ...args); +} + +export function pick(arr: readonly T[]): T { + return arr[Math.floor(Math.random() * arr.length)]; +} +export function shuffle(arr: T[]): T[] { + const a = [...arr]; + for (let i = a.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [a[i], a[j]] = [a[j], a[i]]; + } + return a; +} diff --git a/apps/server/tsconfig.json b/apps/server/tsconfig.json new file mode 100644 index 0000000..0eefbb1 --- /dev/null +++ b/apps/server/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["src", "test", "drizzle.config.ts", "tsup.config.ts"] +} diff --git a/apps/web/package.json b/apps/web/package.json new file mode 100644 index 0000000..a032fe6 --- /dev/null +++ b/apps/web/package.json @@ -0,0 +1,32 @@ +{ + "name": "@aichess/web", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite dev --port 5173", + "build": "vite build", + "preview": "vite preview", + "prepare": "svelte-kit sync || echo ''", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "typecheck": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --threshold error" + }, + "imports": { + "#lib": "./src/lib/index.ts", + "#lib/*": "./src/lib/*" + }, + "dependencies": { + "@aichess/core": "workspace:*", + "@lichess-org/chessground": "^10.4.2", + "chess.js": "^1.4.0" + }, + "devDependencies": { + "@sveltejs/adapter-static": "^4.0.0", + "@sveltejs/kit": "^3.0.0", + "@sveltejs/vite-plugin-svelte": "^7.2.0", + "svelte": "^5.57.1", + "svelte-check": "^4.6.0", + "typescript": "^6.0.3", + "vite": "^8.3.0" + } +} diff --git a/apps/web/src/app.css b/apps/web/src/app.css new file mode 100644 index 0000000..89a0fe3 --- /dev/null +++ b/apps/web/src/app.css @@ -0,0 +1,475 @@ +/* + * AI·CHESS — shared UI primitives. + * Every component uses ONLY these semantic tokens/classes; themes (lib/themes/*.css) + * define the tokens and add their own decoration on top. + */ +@import './lib/themes/tabloid.css'; +@import './lib/themes/broadcast.css'; +@import './lib/themes/arcade.css'; + +*, +*::before, +*::after { + box-sizing: border-box; +} +html { + background: var(--bg); + color-scheme: var(--scheme, light); +} +body { + margin: 0; + min-height: 100vh; + color: var(--text); + background-color: var(--bg); + background-image: var(--bg-image, none); + background-attachment: fixed; + font-family: var(--f-body); + font-size: 15px; + line-height: 1.45; + -webkit-font-smoothing: antialiased; +} +a { + color: inherit; + text-decoration: none; +} +button { + font: inherit; + color: inherit; + background: none; + border: 0; + padding: 0; + cursor: pointer; +} +button:disabled { + cursor: not-allowed; + opacity: 0.5; +} +h1, +h2, +h3, +h4 { + margin: 0; + font-family: var(--f-display); + font-weight: var(--display-weight, 700); + line-height: 1; + letter-spacing: var(--display-tracking, 0); + text-transform: var(--display-transform, none); +} +p { + margin: 0; +} +img { + max-width: 100%; +} + +/* ---------------------------------------------------------- layout */ +.wrap { + max-width: var(--max-w, 1400px); + margin: 0 auto; + padding: 0 20px; +} +.stack { + display: grid; + gap: var(--gap, 14px); +} +.row { + display: flex; + align-items: center; + gap: 10px; +} +.spacer { + flex: 1; +} + +/* ---------------------------------------------------------- text */ +.display { + font-family: var(--f-display); + font-weight: var(--display-weight, 700); + text-transform: var(--display-transform, none); + letter-spacing: var(--display-tracking, 0); + line-height: 0.95; +} +.label, +.kicker { + font-family: var(--f-label); + text-transform: var(--label-transform, uppercase); + letter-spacing: var(--label-tracking, 0.12em); + font-size: var(--label-size, 11px); + font-weight: 600; + line-height: 1.2; +} +.kicker { + color: var(--accent-text, var(--accent)); +} +.mono { + font-family: var(--f-mono); +} +.muted { + color: var(--muted); +} +.accent { + color: var(--accent-text, var(--accent)); +} +.tnum { + font-variant-numeric: tabular-nums; +} + +/* ---------------------------------------------------------- surfaces */ +.panel { + background: var(--surface); + border: var(--border); + border-radius: var(--radius); + box-shadow: var(--shadow); + min-width: 0; +} +.panel-head { + display: flex; + align-items: center; + gap: 10px; + padding: var(--panel-head-pad, 7px 12px); + background: var(--panel-head-bg); + color: var(--panel-head-ink); + border-bottom: var(--panel-head-border, var(--border)); + border-radius: var(--radius) var(--radius) 0 0; + font-family: var(--f-label); + text-transform: var(--label-transform, uppercase); + letter-spacing: var(--label-tracking, 0.1em); + font-size: var(--panel-head-size, 13px); + font-weight: 700; +} +.panel-head small { + font-weight: 500; + opacity: 0.75; + font-size: 0.8em; + letter-spacing: 0.06em; +} +.panel-head.hot { + background: var(--accent); + color: var(--accent-ink); +} +.panel-body { + padding: 12px; +} + +/* ---------------------------------------------------------- controls */ +.btn { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 8px; + font-family: var(--f-label); + text-transform: var(--label-transform, uppercase); + letter-spacing: 0.06em; + font-weight: 700; + font-size: 14px; + line-height: 1; + padding: 10px 16px; + border: var(--btn-border, var(--border)); + border-radius: var(--radius); + background: var(--surface-2); + color: var(--text); + box-shadow: var(--shadow-sm); + transition: + transform 0.08s ease, + box-shadow 0.08s ease, + filter 0.12s; + white-space: nowrap; +} +.btn:hover:not(:disabled) { + filter: brightness(1.08); + transform: var(--btn-hover-transform, translateY(-1px)); +} +.btn:active:not(:disabled) { + transform: var(--btn-active-transform, translateY(1px)); + box-shadow: none; +} +.btn.primary { + background: var(--accent); + color: var(--accent-ink); + border-color: var(--accent-border, var(--line-strong)); +} +.btn.secondary { + background: var(--accent-2); + color: var(--accent-2-ink); +} +.btn.danger { + background: var(--danger); + color: #fff; +} +.btn.ghost { + background: transparent; + box-shadow: none; +} +.btn.sm { + font-size: 11px; + padding: 6px 10px; +} +.btn.lg { + font-size: 17px; + padding: 14px 22px; +} +.btn.block { + width: 100%; +} + +.input, +.select, +textarea.input { + width: 100%; + font: inherit; + color: var(--text); + background: var(--input-bg, var(--surface-2)); + border: var(--border); + border-radius: var(--radius); + padding: 10px 12px; + outline: none; +} +.input:focus, +.select:focus { + border-color: var(--accent); + box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); +} +.field { + display: grid; + gap: 6px; +} +.field > span { + font-family: var(--f-label); + text-transform: var(--label-transform, uppercase); + letter-spacing: 0.1em; + font-size: 11px; + color: var(--muted); +} + +.tabs { + display: flex; + gap: 0; + border: var(--border); + border-radius: var(--radius); + background: var(--surface); + overflow-x: auto; +} +.tabs > button, +.tabs > a { + flex: 1; + padding: 9px 12px; + font-family: var(--f-label); + text-transform: var(--label-transform, uppercase); + letter-spacing: 0.08em; + font-size: 12px; + font-weight: 600; + white-space: nowrap; + text-align: center; + border-right: var(--border-thin); +} +.tabs > :last-child { + border-right: 0; +} +.tabs > .on { + background: var(--tab-on-bg, var(--text)); + color: var(--tab-on-ink, var(--bg)); +} + +/* ---------------------------------------------------------- labels & badges */ +.chip { + text-shadow: none; + display: inline-flex; + align-items: center; + gap: 4px; + font-family: var(--f-label); + text-transform: uppercase; + letter-spacing: 0.06em; + font-size: 10px; + font-weight: 700; + line-height: 1; + padding: 3px 6px; + border-radius: var(--chip-radius, var(--radius)); + background: var(--chip-bg, var(--accent-2)); + color: var(--chip-ink, var(--accent-2-ink)); + white-space: nowrap; +} +.chip.accent { + background: var(--accent); + color: var(--accent-ink); +} +.chip.outline { + background: transparent; + color: inherit; + border: var(--border-thin); +} +.chip.danger { + background: var(--danger); + color: #fff; +} +.chip.dumb { + background: var(--dumb-bg, #b9a99a); + color: var(--dumb-ink, #1a1612); + font-style: italic; + text-transform: lowercase; + letter-spacing: 0.02em; +} +.tag { + display: inline-flex; + align-items: center; + gap: 6px; + font-family: var(--f-label); + text-transform: uppercase; + letter-spacing: 0.06em; + font-size: 11px; + font-weight: 700; + padding: 5px 9px; + border: var(--border); + border-radius: var(--radius); + background: var(--surface); + white-space: nowrap; +} +.tag.hot { + background: var(--accent); + color: var(--accent-ink); +} +.tag.warn { + background: var(--warn); + color: #111; +} +.tag.danger { + background: var(--danger); + color: #fff; +} +.live-dot { + display: inline-block; + width: 8px; + height: 8px; + border-radius: 50%; + background: var(--live, var(--danger)); + animation: live-blink 1.1s steps(2, start) infinite; +} +@keyframes live-blink { + to { + visibility: hidden; + } +} + +/* annotation glyphs next to moves (chess.com style) */ +.nag { + font-family: var(--f-mono); + font-weight: 800; + font-size: 0.92em; + margin-left: 1px; +} +.nag.brilliant { + color: var(--nag-brilliant); +} +.nag.great { + color: var(--nag-great); +} +.nag.inaccuracy { + color: var(--nag-inaccuracy); +} +.nag.mistake { + color: var(--nag-mistake); +} +.nag.blunder { + color: var(--nag-blunder); +} + +/* data tables */ +.table { + width: 100%; + border-collapse: collapse; + font-size: 14px; +} +.table th { + text-align: left; + font-family: var(--f-label); + text-transform: uppercase; + letter-spacing: 0.08em; + font-size: 11px; + font-weight: 600; + color: var(--muted); + padding: 8px 10px; + border-bottom: var(--border); +} +.table td { + padding: 8px 10px; + border-bottom: var(--border-thin); + vertical-align: middle; +} +.table tr:hover td { + background: var(--row-hover, color-mix(in srgb, var(--text) 4%, transparent)); +} +.num { + text-align: right; + font-variant-numeric: tabular-nums; +} + +.empty { + padding: 24px; + text-align: center; + color: var(--muted); + font-style: italic; +} +.error-box { + padding: 10px 12px; + border: 2px solid var(--danger); + background: color-mix(in srgb, var(--danger) 12%, var(--surface)); + border-radius: var(--radius); +} + +/* ---------------------------------------------------------- board skin */ +.cg-wrap { + width: 100%; + aspect-ratio: 1; +} +cg-board { + background-color: var(--board-dark); + background-image: var( + --board-image, + conic-gradient(var(--board-dark) 90deg, var(--board-light) 0 180deg, var(--board-dark) 0 270deg, var(--board-light) 0) + ); + background-size: var(--board-image-size, 25% 25%); +} +cg-board square.last-move { + background-color: var(--board-last); +} +cg-board square.check { + background: radial-gradient(ellipse at center, var(--board-check) 0%, color-mix(in srgb, var(--board-check) 40%, transparent) 40%, transparent 75%); +} +cg-board square.selected { + background-color: color-mix(in srgb, var(--accent) 45%, transparent); +} +cg-board square.move-dest { + background: radial-gradient(color-mix(in srgb, var(--text) 30%, transparent) 19%, transparent 20%); +} +cg-board square.oc.move-dest { + background: radial-gradient(transparent 0%, transparent 79%, color-mix(in srgb, var(--text) 30%, transparent) 80%); +} +.cg-wrap coords { + font-family: var(--f-mono); + font-weight: 600; + font-size: 10px; +} +.cg-wrap coords coord { + color: var(--board-coord, rgba(0, 0, 0, 0.55)); +} + +::-webkit-scrollbar { + width: 10px; + height: 10px; +} +::-webkit-scrollbar-thumb { + background: var(--scroll-thumb, var(--line-strong)); + border: 2px solid var(--bg); + border-radius: var(--radius); +} +::-webkit-scrollbar-track { + background: var(--scroll-track, var(--surface-2)); +} + +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation: none !important; + transition: none !important; + } +} diff --git a/apps/web/src/app.d.ts b/apps/web/src/app.d.ts new file mode 100644 index 0000000..64d61e2 --- /dev/null +++ b/apps/web/src/app.d.ts @@ -0,0 +1,4 @@ +declare global { + namespace App {} +} +export {}; diff --git a/apps/web/src/app.html b/apps/web/src/app.html new file mode 100644 index 0000000..58887f6 --- /dev/null +++ b/apps/web/src/app.html @@ -0,0 +1,26 @@ + + + + + + + + + + + + %sveltekit.head% + + +
%sveltekit.body%
+ + diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts new file mode 100644 index 0000000..b94829f --- /dev/null +++ b/apps/web/src/lib/api.ts @@ -0,0 +1,28 @@ +export class ApiError extends Error { + constructor( + message: string, + public status: number + ) { + super(message); + } +} + +async function req(method: string, path: string, body?: unknown): Promise { + const init: RequestInit = { method, credentials: 'same-origin', headers: {} }; + if (body instanceof FormData) init.body = body; + else if (body !== undefined) { + init.body = JSON.stringify(body); + (init.headers as Record)['content-type'] = 'application/json'; + } + const r = await fetch(path, init); + const j = await r.json().catch(() => ({})); + if (!r.ok) throw new ApiError(j?.error ?? `Ошибка ${r.status}`, r.status); + return j as T; +} + +export const api = { + get: (p: string) => req('GET', p), + post: (p: string, b?: unknown) => req('POST', p, b ?? {}), + patch: (p: string, b?: unknown) => req('PATCH', p, b ?? {}), + del: (p: string) => req('DELETE', p) +}; diff --git a/apps/web/src/lib/components/Avatar.svelte b/apps/web/src/lib/components/Avatar.svelte new file mode 100644 index 0000000..49ede4a --- /dev/null +++ b/apps/web/src/lib/components/Avatar.svelte @@ -0,0 +1,51 @@ + + + + {#if player.avatarUrl} + {player.displayName} + {:else} + {initials} + {/if} + + + diff --git a/apps/web/src/lib/components/Board.svelte b/apps/web/src/lib/components/Board.svelte new file mode 100644 index 0000000..e7d9981 --- /dev/null +++ b/apps/web/src/lib/components/Board.svelte @@ -0,0 +1,88 @@ + + +
+
+
+ + diff --git a/apps/web/src/lib/components/Countdown.svelte b/apps/web/src/lib/components/Countdown.svelte new file mode 100644 index 0000000..ffb94e0 --- /dev/null +++ b/apps/web/src/lib/components/Countdown.svelte @@ -0,0 +1,55 @@ + + +
+ {#each [[pad(h), 'час'], [pad(m), 'мин'], [pad(s), 'сек']] as [v, l], i} + {#if i}:{/if} +
{v}{l}
+ {/each} +
+ + diff --git a/apps/web/src/lib/components/EvalBar.svelte b/apps/web/src/lib/components/EvalBar.svelte new file mode 100644 index 0000000..879575b --- /dev/null +++ b/apps/web/src/lib/components/EvalBar.svelte @@ -0,0 +1,50 @@ + + +
+
+ {ev ? evalLabel(ev) : '…'} +
+ + diff --git a/apps/web/src/lib/components/EvalGraph.svelte b/apps/web/src/lib/components/EvalGraph.svelte new file mode 100644 index 0000000..c11c06a --- /dev/null +++ b/apps/web/src/lib/components/EvalGraph.svelte @@ -0,0 +1,89 @@ + + + + + + + + {#each marks as m (m.ply)} + + {/each} + {#if current > 0}{/if} + + + diff --git a/apps/web/src/lib/components/GameCard.svelte b/apps/web/src/lib/components/GameCard.svelte new file mode 100644 index 0000000..2b9a4d4 --- /dev/null +++ b/apps/web/src/lib/components/GameCard.svelte @@ -0,0 +1,130 @@ + + + +
+ {#if g.thumbnailUrl} + {g.thumbnailCaption + {:else} +
+ + VS + +
+ {g.status === 'finished' ? 'превью рисуется…' : g.status === 'aborted' ? 'прервана' : 'идёт'} +
+ {/if} + {moves} ход. + {#if !g.rated}без рейтинга{/if} +
+
+ {resultLabel(g.result)} +
+
—
+
{g.termination ? TERMINATION_RU[g.termination] : ''}{g.finishedAt ? ` · ${fmtAgo(g.finishedAt)}` : ''}
+
+
+
+ + diff --git a/apps/web/src/lib/components/Header.svelte b/apps/web/src/lib/components/Header.svelte new file mode 100644 index 0000000..efb84b0 --- /dev/null +++ b/apps/web/src/lib/components/Header.svelte @@ -0,0 +1,295 @@ + + +{#snippet user()} + {#if session.user} + + + {session.user.displayName} + + {:else if session.loaded} + + {/if} +{/snippet} + +{#snippet links()} + {#each nav as n} + + {#if n.href === '/live' && n.count}{/if}{n.label}{#if n.count}{n.count}{/if} + + {/each} +{/snippet} + +{#if session.theme === 'tabloid'} +
+ +
+ +

Газета о том, как нейросети зевают фигуры

+ + {#if session.user}+ Новый матч{/if} +
+ +
+{:else if session.theme === 'broadcast'} +
+
+ + + + {#if liveCount}{liveCount} в эфире{/if} + {#if session.user}Новый матч{/if} + {@render user()} +
+
+{:else} +
+
+ + + + {#if session.user}+ Новый матч{/if} + {@render user()} +
+
+{/if} + + diff --git a/apps/web/src/lib/components/LiveCard.svelte b/apps/web/src/lib/components/LiveCard.svelte new file mode 100644 index 0000000..595c39c --- /dev/null +++ b/apps/web/src/lib/components/LiveCard.svelte @@ -0,0 +1,126 @@ + + + +
+ +
{g.white.rating}
+
+
+ live + VS + ход {Math.ceil((g.ply + 1) / 2)} +
+
+
{g.black.rating}
+ +
+ {#if !compact} +
+
+ {#if g.flags.cheating}читерство{/if} + {#if g.flags.notes}заметки{/if} + {#if g.flags.extraTools}тулы{/if} + {g.startedAt ? `начата ${fmtAgo(g.startedAt)}` : ''} +
+ {/if} +
+ + diff --git a/apps/web/src/lib/components/LiveHero.svelte b/apps/web/src/lib/components/LiveHero.svelte new file mode 100644 index 0000000..7d0e183 --- /dev/null +++ b/apps/web/src/lib/components/LiveHero.svelte @@ -0,0 +1,126 @@ + + +{#if view.game && pos} + {@const g = view.game} +
+
+ + +
+
+
ход {Math.ceil((view.moves.length + 1) / 2)} · {view.sideToMove === 'white' ? 'белые' : 'чёрные'} {view.player(view.sideToMove).kind === 'human' ? 'ходят' : 'думают'}{last ? ` · ${evalLabel(last.eval)}` : ''}
+
+ {#each ['white', 'black'] as const as s} +
+ +
{view.player(s).rating} · {s === 'white' ? 'белые' : 'чёрные'}
+
+ {#if s === 'white'}
VS
{/if} + {/each} +
+ {#if lastPhrase} +
+

«{lastPhrase.phrase}»

+
— {view.player(lastPhrase.side).displayName}, после {moveNo(lastPhrase.ply)} {lastPhrase.san}
+
+ {/if} + {#if view.turn?.thinking} +

💭 {view.turn.thinking.slice(-220)}

+ {/if} + Смотреть live → +
+
+{/if} + + diff --git a/apps/web/src/lib/components/MiniBoard.svelte b/apps/web/src/lib/components/MiniBoard.svelte new file mode 100644 index 0000000..58edeef --- /dev/null +++ b/apps/web/src/lib/components/MiniBoard.svelte @@ -0,0 +1,60 @@ + + +
+ {#each cells as c (c.sq)} + {#if c.piece}{c.piece}{/if} + {/each} +
+ + diff --git a/apps/web/src/lib/components/MoveList.svelte b/apps/web/src/lib/components/MoveList.svelte new file mode 100644 index 0000000..9345d9c --- /dev/null +++ b/apps/web/src/lib/components/MoveList.svelte @@ -0,0 +1,215 @@ + + +{#snippet cell(m: MoveDTO | undefined, side: 'white' | 'black', no: number)} + {#if m} +
+ + {evalLabel(m.eval)} + {m.thinkMs ? fmtDuration(m.thinkMs) : ''} + {#if !humanSides.includes(side)} + + {:else}{/if} +
+ {:else if turn && pendingRow === no && turn.side === side} +
+ + + +
+ {:else} +
+ {/if} +{/snippet} + +
+ {#each rows as r (r.no)} +
+ {r.no} + {@render cell(r.w, 'white', r.no)} + {@render cell(r.b, 'black', r.no)} +
+ {#if expanded !== null && Math.ceil(expanded / 2) === r.no} +
m.ply === expanded) ?? null} onclose={() => (expanded = null)} />
+ {/if} + {/each} + {#if turn && pendingRow && !rows.some((r) => r.no === pendingRow)} +
+ {pendingRow} + {@render cell(undefined, 'white', pendingRow)} + {@render cell(undefined, 'black', pendingRow)} +
+ {#if expanded === turn.ply} +
(expanded = null)} />
+ {/if} + {/if} + {#if !moves.length && !turn}
Ходов пока нет
{/if} +
+ + diff --git a/apps/web/src/lib/components/PlayerCard.svelte b/apps/web/src/lib/components/PlayerCard.svelte new file mode 100644 index 0000000..f219f97 --- /dev/null +++ b/apps/web/src/lib/components/PlayerCard.svelte @@ -0,0 +1,231 @@ + + +
+ {#if thinkingSince}
{player.kind === 'human' ? 'твой ход' : 'думает'}
{/if} + {#if result}
{result === 'win' ? 'победа' : result === 'loss' ? 'поражение' : 'ничья'}
{/if} +
+ +
+
+
+ + {player.rating} + {#if ratingDelta != null}= 0}>{ratingDelta >= 0 ? '+' : ''}{Math.round(ratingDelta)}{/if} + {#if persona}«{persona}»{/if} +
+
+
+
+
+
{accuracy != null ? accuracy.toFixed(1) : '—'}%точность
+ {#if player.kind === 'ai'} +
{fmtUsd(cost)}{fmtTokens(tokens)} ток.
+ {/if} +
+ {thinkingSince ? fmtClock(elapsed) : '—'}{thinkingSince ? 'на ходу' : 'ждёт'} +
+
+ {#if cls} +
+ {#if cls.brilliant}!!{cls.brilliant}{/if} + ★{cls.best ?? 0} + ?!{cls.inaccuracy ?? 0} + ?{cls.mistake ?? 0} + ??{cls.blunder ?? 0} +
+ {/if} +
+ + diff --git a/apps/web/src/lib/components/PlayerName.svelte b/apps/web/src/lib/components/PlayerName.svelte new file mode 100644 index 0000000..8ceb43c --- /dev/null +++ b/apps/web/src/lib/components/PlayerName.svelte @@ -0,0 +1,38 @@ + + + + {name} + {#if player.kind === 'ai' && player.variant} + {VARIANT_LABEL[player.variant] ?? player.variant} + {/if} + {#if player.skull}💀{/if} + {#if player.dumb}тупая{/if} + {#if rating}{player.rating}{/if} + + + diff --git a/apps/web/src/lib/components/Predictions.svelte b/apps/web/src/lib/components/Predictions.svelte new file mode 100644 index 0000000..68f9866 --- /dev/null +++ b/apps/web/src/lib/components/Predictions.svelte @@ -0,0 +1,129 @@ + + +
+
+ {#each opts as o}{/each} +
+
+ {#each opts as o} + + {/each} +
+

+ {total} голосов · очки, не деньги · {open ? 'приём до старта партии' : 'приём закрыт'}{#if !session.user && open} · войди, чтобы голосовать{/if} +

+ {#if err}
{err}
{/if} +
+ + diff --git a/apps/web/src/lib/components/ProfileForm.svelte b/apps/web/src/lib/components/ProfileForm.svelte new file mode 100644 index 0000000..34e7f21 --- /dev/null +++ b/apps/web/src/lib/components/ProfileForm.svelte @@ -0,0 +1,128 @@ + + +
+
+ {#if session.user}{/if} +
+

Аватарка попадёт на превью партий: генератор картинок нарисует тебя по ней (мультяшно).

+
+ + +
+
+
+ + + +
+ оформление (можно сменить в любой момент) +
+ {#each THEMES as t} + + {/each} +
+
+ {#if err}
{err}
{/if} + +
+ + diff --git a/apps/web/src/lib/components/TalkFeed.svelte b/apps/web/src/lib/components/TalkFeed.svelte new file mode 100644 index 0000000..ef6d5d5 --- /dev/null +++ b/apps/web/src/lib/components/TalkFeed.svelte @@ -0,0 +1,85 @@ + + +
+ {#each last as [side, text]} +
+ +
{side === 'white' ? white.displayName : black.displayName} · последнее слово

{text}

+
+ {/each} + {#each lines as l (l.ply)} + + {/each} + {#if !lines.length && !last.length}
Пока тихо. Даже слишком.
{/if} +
+ + diff --git a/apps/web/src/lib/components/Thoughts.svelte b/apps/web/src/lib/components/Thoughts.svelte new file mode 100644 index 0000000..81b0943 --- /dev/null +++ b/apps/web/src/lib/components/Thoughts.svelte @@ -0,0 +1,195 @@ + + +
+
+ 💭 мысли · {moveNo(ply)} {move?.san ?? (live ? 'в эфире' : '')} + + {#if done?.usage}{fmtTokens(done.usage.input + done.usage.output + done.usage.cacheRead)} ток · {fmtUsd(done.usage.cost, 3)}{#if move?.thinkMs} · {fmtDuration(move.thinkMs)}{/if}{/if} + {#if onclose}{/if} +
+ + {#if err}
{err}
{/if} + {#if !live && !attempts && !err}
Загружаю…
{/if} + {#if failed.length && move} +
⟲ {failed.length} {failed.length === 1 ? 'попытка' : 'попытки'} упали (ошибка провайдера) — ход переигран с чистого листа
+ {/if} + + {#if context} +
+ что агент видел на входе +
{context.text}
+
+ {/if} + +
+ {#each items as it, i (i)} + {#if it.kind === 'thinking'} +
{it.text}
+ {:else if it.kind === 'text'} +
{it.text}
+ {:else if it.kind === 'tool'} +
+
{it.call.name}{TOOL_RU[it.call.name] ?? ''}{#if !it.call.endedAt}{/if}
+ {#if argText(it.call)}
{argText(it.call)}
{/if} + {#if it.call.result && it.call.name !== 'finish_turn'}
{it.call.result}
{/if} +
+ {:else if it.kind === 'nudge'} +
арбитр: {it.text}
+ {:else if it.kind === 'error'} +
ошибка: {it.text}
+ {/if} + {/each} + {#if live && !move && !items.length}
Агент начал думать… (часть моделей не показывает рассуждения до конца хода)
{/if} + {#if !live && attempts && !items.filter((i) => i.kind !== 'context').length}
Модель не раскрыла рассуждения на этом ходу.
{/if} +
+
+ + diff --git a/apps/web/src/lib/fmt.ts b/apps/web/src/lib/fmt.ts new file mode 100644 index 0000000..8df6dd5 --- /dev/null +++ b/apps/web/src/lib/fmt.ts @@ -0,0 +1,105 @@ +import type { EngineEval, MoveClass, Player, Termination } from './types.ts'; + +/** chess.com-style annotation glyph shown right next to the move */ +export const NAG: Partial> = { + brilliant: '!!', + great: '!', + inaccuracy: '?!', + mistake: '?', + blunder: '??' +}; +export const CLS_LABEL: Record = { + best: 'лучший ход', + brilliant: 'блестяще', + great: 'отлично', + good: 'нормально', + inaccuracy: 'неточность', + mistake: 'ошибка', + blunder: 'зевок', + book: 'теория', + forced: 'единственный ход' +}; + +export function evalLabel(e?: EngineEval | null): string { + if (!e) return ''; + if (e.mate != null) return `#${e.mate > 0 ? '' : '-'}${Math.abs(e.mate)}`; + const cp = e.cp ?? 0; + if (Math.abs(cp) >= 10000) return cp > 0 ? '1-0' : '0-1'; + const v = cp / 100; + return (v > 0 ? '+' : v < 0 ? '−' : '') + Math.abs(v).toFixed(1); +} + +/** 0..1 share of the eval bar for white */ +export function evalShare(e?: EngineEval | null): number { + if (!e) return 0.5; + if (e.mate != null) return e.mate > 0 ? 0.97 : 0.03; + const cp = Math.max(-1000, Math.min(1000, e.cp ?? 0)); + return Math.min(0.97, Math.max(0.03, 1 / (1 + Math.exp(-cp / 250)))); +} + +export function fmtDuration(ms: number): string { + const s = Math.round(ms / 1000); + if (s < 60) return `${s} с`; + const m = Math.floor(s / 60); + const r = s % 60; + if (m < 60) return r ? `${m}:${String(r).padStart(2, '0')}` : `${m} мин`; + return `${Math.floor(m / 60)} ч ${m % 60} мин`; +} +export function fmtClock(ms: number): string { + const s = Math.max(0, Math.floor(ms / 1000)); + const m = Math.floor(s / 60); + return `${m}:${String(s % 60).padStart(2, '0')}`; +} +export function fmtTokens(t: number): string { + if (t >= 1_000_000) return (t / 1_000_000).toFixed(1) + 'M'; + if (t >= 1000) return (t / 1000).toFixed(1) + 'k'; + return String(Math.round(t)); +} +export function fmtUsd(v: number | null | undefined, digits = 2): string { + if (v == null) return '—'; + if (v > 0 && v < 0.01 && digits <= 2) return '<$0.01'; + return '$' + v.toFixed(digits); +} +export function moveNo(ply: number): string { + const n = Math.ceil(ply / 2); + return ply % 2 === 1 ? `${n}.` : `${n}…`; +} +export function fmtAgo(iso: string | null | undefined): string { + if (!iso) return ''; + const d = (Date.now() - new Date(iso).getTime()) / 1000; + if (d < 60) return 'только что'; + if (d < 3600) return `${Math.floor(d / 60)} мин назад`; + if (d < 86400) return `${Math.floor(d / 3600)} ч назад`; + return new Date(iso).toLocaleDateString('ru-RU', { day: 'numeric', month: 'short' }); +} + +export const TERMINATION_RU: Record = { + checkmate: 'мат', + stalemate: 'пат', + insufficient_material: 'мало материала', + threefold_repetition: 'троекратное повторение', + fifty_move_rule: 'правило 50 ходов', + resignation: 'сдача', + agreement: 'ничья по соглашению', + forfeit_illegal: 'нелегальные ходы', + forfeit_no_move: 'не сделал ход', + king_captured: 'съел короля', + aborted: 'прервана', + error: 'техническая ошибка' +}; + +export const VARIANT_LABEL: Record = { max: 'MAX', high: 'HIGH', 'no-think': 'NO THINK', minimal: 'MINIMAL' }; + +export function playerTitle(p: Pick): string { + return p.kind === 'human' || !p.variant ? p.displayName : `${p.displayName} · ${VARIANT_LABEL[p.variant] ?? p.variant.toUpperCase()}`; +} +export function shortName(p: Pick): string { + if (p.kind === 'human') return p.displayName; + return p.displayName.replace(/^Claude /, '').replace(/^GPT-/, 'GPT-'); +} +export function resultFor(side: 'white' | 'black', result: string | null): 'win' | 'loss' | 'draw' | null { + if (!result || result === '*') return null; + if (result === '1/2-1/2') return 'draw'; + return (result === '1-0') === (side === 'white') ? 'win' : 'loss'; +} +export const resultLabel = (r: string | null) => (r === '1/2-1/2' ? '½–½' : r === '1-0' ? '1–0' : r === '0-1' ? '0–1' : '—'); diff --git a/apps/web/src/lib/game.svelte.ts b/apps/web/src/lib/game.svelte.ts new file mode 100644 index 0000000..9f457f4 --- /dev/null +++ b/apps/web/src/lib/game.svelte.ts @@ -0,0 +1,160 @@ +import { GameState, otherSide, type MoveDTO, type Side, type ToolCallLog } from '@aichess/core'; +import { api } from './api.ts'; +import { live } from './ws.ts'; +import type { GameDetail, GameResponse, LiveTurn } from './types.ts'; + +export interface Position { + ply: number; + fen: string; + lastMove?: [string, string]; + check: boolean; +} + +/** Reactive view of one game: snapshot from REST + live deltas from the websocket. */ +export class GameView { + id: string; + game = $state(null); + moves = $state([]); + turn = $state(null); + predictions = $state({ counts: {}, mine: null }); + error = $state(null); + private offs: (() => void)[] = []; + + constructor(id: string) { + this.id = id; + } + + async load() { + try { + const r = await api.get(`/api/games/${this.id}`); + this.game = r.game; + this.moves = r.moves; + this.turn = r.live ? { ...r.live, tools: [...r.live.tools] } : null; + this.predictions = r.predictions; + this.error = null; + } catch (e) { + this.error = (e as Error).message; + } + } + + start() { + this.offs.push(live.subscribe(`game:${this.id}`, (ev) => this.onEvent(ev))); + this.offs.push(live.onReconnect(() => this.load())); + return this.load(); + } + stop() { + this.offs.forEach((f) => f()); + this.offs = []; + } + + private onEvent(ev: any) { + const t = this.turn; + switch (ev.type) { + case 'turn_start': + this.turn = { ply: ev.ply, side: ev.side, startedAt: ev.at, thinking: '', text: '', tools: [] }; + break; + case 'thinking_delta': + if (t && t.ply === ev.ply) t.thinking += ev.delta; + break; + case 'text_delta': + if (t && t.ply === ev.ply) t.text += ev.delta; + break; + case 'tool_start': + case 'tool_end': { + if (!t || t.ply !== ev.ply) break; + const i = t.tools.findIndex((x: ToolCallLog) => x.id === ev.call.id); + if (i >= 0) t.tools[i] = ev.call; + else t.tools.push(ev.call); + break; + } + case 'move': + if (!this.moves.some((m) => m.ply === ev.move.ply)) this.moves.push(ev.move); + if (this.game) { + this.game.ply = ev.move.ply; + this.game.fen = ev.move.fenAfter; + this.game.pendingDrawBy = ev.move.offeredDraw ? ev.move.side : null; + } + if (this.turn && this.turn.ply <= ev.move.ply) this.turn = null; + break; + case 'eval': { + const m = this.moves.find((x) => x.ply === ev.ply); + if (m) { + m.eval = ev.eval; + m.classification = ev.classification ?? null; + m.accuracy = ev.accuracy ?? null; + } + break; + } + case 'turn_end': + break; + case 'interview': + if (this.game) this.game.interviews = { ...this.game.interviews, [ev.side]: ev.text }; + break; + case 'thumbnail': + if (this.game) { + this.game.thumbnailUrl = ev.url; + this.game.thumbnailCaption = ev.caption; + } + break; + case 'game_over': + case 'status': + this.turn = null; + this.load(); + break; + } + } + + // ------------------------------------------------------------ derived + + get state(): GameState { + const g = this.game; + try { + return GameState.fromUci(this.moves.map((m) => ({ uci: m.uci, illegal: m.illegal })), g?.startFen); + } catch { + return new GameState(g?.startFen); + } + } + + positions = $derived.by(() => { + const st = new GameState(this.game?.startFen); + const out: Position[] = [{ ply: 0, fen: st.fen(), check: false }]; + for (const m of this.moves) { + const r = m.illegal ? st.applyIllegal(m.uci) : st.tryMove(m.uci); + if (!r.ok) break; + out.push({ ply: m.ply, fen: r.record.fenAfter, lastMove: [m.uci.slice(0, 2), m.uci.slice(2, 4)], check: st.inCheck() }); + } + return out; + }); + + get running() { + return this.game?.status === 'running'; + } + get finished() { + return this.game?.status === 'finished' || this.game?.status === 'aborted'; + } + get sideToMove(): Side { + return this.moves.length % 2 === 0 ? 'white' : 'black'; + } + + player(side: Side) { + return side === 'white' ? this.game!.white : this.game!.black; + } + + stats(side: Side) { + const mine = this.moves.filter((m) => m.side === side); + const cost = mine.reduce((a, m) => a + (m.usage?.cost ?? 0), 0); + const tokens = mine.reduce((a, m) => a + (m.usage ? m.usage.input + m.usage.output + m.usage.cacheRead + m.usage.cacheWrite : 0), 0); + const accs = mine.map((m) => m.accuracy).filter((x): x is number => x != null); + const official = this.game?.accuracy?.[side]; + const accuracy = official ?? (accs.length ? accs.reduce((a, b) => a + b, 0) / accs.length : null); + const thinkMs = mine.reduce((a, m) => a + m.thinkMs, 0); + const cls = { brilliant: 0, best: 0, inaccuracy: 0, mistake: 0, blunder: 0 } as Record; + for (const m of mine) if (m.classification && m.classification in cls) cls[m.classification]++; + return { cost, tokens, accuracy, thinkMs, moves: mine.length, cls }; + } + + /** the trash-talk line the given side last received */ + lastPhraseTo(side: Side) { + return [...this.moves].reverse().find((m) => m.side === otherSide(side) && m.phrase)?.phrase ?? null; + } +} diff --git a/tests/__init__.py b/apps/web/src/lib/index.ts similarity index 100% rename from tests/__init__.py rename to apps/web/src/lib/index.ts diff --git a/apps/web/src/lib/session.svelte.ts b/apps/web/src/lib/session.svelte.ts new file mode 100644 index 0000000..9085cfa --- /dev/null +++ b/apps/web/src/lib/session.svelte.ts @@ -0,0 +1,52 @@ +import { api } from './api.ts'; +import type { Meta, Theme, User } from './types.ts'; + +export const THEMES: { id: Theme; name: string; tagline: string }[] = [ + { id: 'tabloid', name: 'Вечерний Мат', tagline: 'Жёлтая пресса: кричащие заголовки, газетная бумага, красные чернила' }, + { id: 'broadcast', name: 'Эфир', tagline: 'Ночная спортивная трансляция: скорбаги, бегущая строка, прожекторы' }, + { id: 'arcade', name: 'AI Fight Club', tagline: 'Файтинг-аркада: VS-экраны, полоски здоровья, неон' } +]; + +class Session { + user = $state(null); + meta = $state(null); + theme = $state((typeof localStorage !== 'undefined' && (localStorage.getItem('aichess-theme') as Theme)) || 'tabloid'); + loaded = $state(false); + + async load() { + const [me, meta] = await Promise.all([api.get<{ user: User | null }>('/api/me'), api.get('/api/meta')]); + this.user = me.user; + this.meta = meta; + if (me.user?.theme) this.applyTheme(me.user.theme, false); + this.loaded = true; + } + + applyTheme(t: Theme, persist = true) { + this.theme = t; + document.documentElement.dataset.theme = t; + try { + localStorage.setItem('aichess-theme', t); + } catch {} + if (persist && this.user) api.patch<{ user: User }>('/api/me', { theme: t }).then((r) => (this.user = r.user)); + } + + async login(username: string, password: string) { + const r = await api.post<{ user: User }>('/api/auth/login', { username, password }); + this.user = r.user; + if (r.user.theme) this.applyTheme(r.user.theme, false); + return r.user; + } + async register(username: string, password: string) { + const r = await api.post<{ user: User }>('/api/auth/register', { username, password }); + this.user = r.user; + // keep the theme the visitor was already using + this.applyTheme(this.theme, true); + return r.user; + } + async logout() { + await api.post('/api/auth/logout'); + this.user = null; + } +} + +export const session = new Session(); diff --git a/apps/web/src/lib/themes/arcade.css b/apps/web/src/lib/themes/arcade.css new file mode 100644 index 0000000..4dca9a3 --- /dev/null +++ b/apps/web/src/lib/themes/arcade.css @@ -0,0 +1,111 @@ +/* «AI FIGHT CLUB» — fighting-game arcade: P1 yellow (white) vs P2 red (black), neon, pixel labels */ +html[data-theme='arcade'] { + --scheme: dark; + --bg: #08080c; + --bg-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px); + --surface: #14141c; + --surface-2: #1a1a24; + --surface-3: #262634; + --text: #f3efe4; + --text-2: #cfcbbf; + --muted: #8e8d9c; + --line: #262634; + --line-strong: #343446; + --accent: #ffe14d; + --accent-ink: #08080c; + --accent-text: #ffe14d; + --accent-2: #262634; + --accent-2-ink: #f3efe4; + --danger: #ff3b5c; + --ok: #4cff5e; + --warn: #ffd23f; + --info: #42e8ff; + --live: #ff3b5c; + --white-side: #ffe14d; + --black-side: #ff3b5c; + + --f-display: 'Unbounded', 'Arial Black', sans-serif; + --f-body: 'IBM Plex Sans', system-ui, sans-serif; + --f-mono: 'JetBrains Mono', ui-monospace, monospace; + --f-label: 'Press Start 2P', monospace; + --display-transform: uppercase; + --display-weight: 900; + --label-size: 9px; + --label-tracking: 0.04em; + + --radius: 4px; + --border: 2px solid #262634; + --border-thin: 1px solid #262634; + --shadow: 0 0 0 1px rgba(255, 225, 77, 0.04), 0 8px 24px rgba(0, 0, 0, 0.5); + --shadow-sm: 0 3px 0 #000; + --panel-head-bg: #0f0f16; + --panel-head-ink: #8e8d9c; + --panel-head-size: 10px; + --panel-head-pad: 10px 12px; + --tab-on-bg: #ffe14d; + --tab-on-ink: #08080c; + --chip-bg: #ffe14d; + --chip-ink: #08080c; + --input-bg: #0f0f16; + --row-hover: rgba(255, 225, 77, 0.05); + + --nag-brilliant: #42e8ff; + --nag-great: #4cff5e; + --nag-inaccuracy: #ffd23f; + --nag-mistake: #ff8c42; + --nag-blunder: #ff3b3b; + + --board-light: #e9e4d4; + --board-dark: #4b5a8a; + --board-last: rgba(255, 225, 77, 0.55); + --board-check: #ff3b5c; + --board-frame: #000; + --board-coord: rgba(8, 8, 12, 0.6); + --scroll-thumb: #343446; + --scroll-track: #0f0f16; + --dumb-bg: #ffe14d; + --dumb-ink: #08080c; +} +html[data-theme='arcade'] body::after { + /* CRT scanlines, very subtle */ + content: ''; + position: fixed; + inset: 0; + pointer-events: none; + z-index: 1000; + background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px); + mix-blend-mode: multiply; +} +html[data-theme='arcade'] body { + background-size: 32px 32px; +} +html[data-theme='arcade'] .btn { + font-size: 10px; + letter-spacing: 0.02em; + box-shadow: 0 4px 0 #000; +} +html[data-theme='arcade'] .btn.primary { + box-shadow: 0 4px 0 #b89a00; +} +html[data-theme='arcade'] .btn.lg { + font-size: 12px; +} +html[data-theme='arcade'] .tabs > button, +html[data-theme='arcade'] .tabs > a { + font-size: 9px; +} +html[data-theme='arcade'] .chip, +html[data-theme='arcade'] .tag { + font-family: 'JetBrains Mono', monospace; + font-weight: 700; +} +html[data-theme='arcade'] .panel-head { + border-bottom: 2px solid #262634; +} +html[data-theme='arcade'] .panel-head.hot { + background: #ff3b5c; + color: #fff; +} +html[data-theme='arcade'] .display { + text-shadow: 3px 3px 0 #000; +} diff --git a/apps/web/src/lib/themes/broadcast.css b/apps/web/src/lib/themes/broadcast.css new file mode 100644 index 0000000..38f2f48 --- /dev/null +++ b/apps/web/src/lib/themes/broadcast.css @@ -0,0 +1,105 @@ +/* «ЭФИР» — night sports broadcast: dark stage, scorebugs, gold & live red, ice (white) vs fire (black) */ +html[data-theme='broadcast'] { + --scheme: dark; + --bg: #06070b; + --bg-image: radial-gradient(1200px 600px at 50% -10%, rgba(124, 199, 255, 0.08), transparent 60%), radial-gradient(900px 500px at 100% 0%, rgba(255, 93, 58, 0.06), transparent 60%); + --surface: #10131b; + --surface-2: #161a24; + --surface-3: #1d2230; + --text: #eef1f6; + --text-2: #c3c9d6; + --muted: #8a92a6; + --line: #232838; + --line-strong: #2e3447; + --accent: #ffc93c; + --accent-ink: #0b0d14; + --accent-text: #ffc93c; + --accent-2: #1d2230; + --accent-2-ink: #eef1f6; + --danger: #ff2a3c; + --ok: #42d989; + --warn: #ffb347; + --info: #7cc7ff; + --live: #ff2a3c; + --white-side: #7cc7ff; + --black-side: #ff5d3a; + + --f-display: 'Oswald', 'Arial Narrow', sans-serif; + --f-body: 'IBM Plex Sans', system-ui, sans-serif; + --f-mono: 'IBM Plex Mono', ui-monospace, monospace; + --f-label: 'Oswald', 'Arial Narrow', sans-serif; + --display-transform: uppercase; + --display-tracking: 0.01em; + --label-tracking: 0.14em; + + --radius: 3px; + --border: 1px solid #232838; + --border-thin: 1px solid #1b2030; + --shadow: 0 10px 30px rgba(0, 0, 0, 0.35); + --shadow-sm: none; + --panel-head-bg: linear-gradient(90deg, #161a24, #10131b); + --panel-head-ink: #c3c9d6; + --panel-head-border: 1px solid #232838; + --tab-on-bg: #ffc93c; + --tab-on-ink: #0b0d14; + --chip-bg: #ffc93c; + --chip-ink: #0b0d14; + --input-bg: #0b0d14; + + --nag-brilliant: #42e8ff; + --nag-great: #7cc7ff; + --nag-inaccuracy: #ffd23f; + --nag-mistake: #ff8c42; + --nag-blunder: #ff4757; + + --board-light: #c7cede; + --board-dark: #3a4256; + --board-last: rgba(255, 201, 60, 0.45); + --board-check: #ff2a3c; + --board-frame: #0b0d14; + --board-coord: rgba(11, 13, 20, 0.6); + --scroll-thumb: #2e3447; + --scroll-track: #0b0d14; + --dumb-bg: #2e3447; + --dumb-ink: #c3c9d6; +} +html[data-theme='broadcast'] .panel-head { + position: relative; + padding-left: 18px; +} +html[data-theme='broadcast'] .panel-head::before { + content: ''; + position: absolute; + left: 8px; + top: 25%; + bottom: 25%; + width: 3px; + background: #ffc93c; + transform: skewX(-12deg); +} +html[data-theme='broadcast'] .panel-head.hot { + background: linear-gradient(90deg, #ff2a3c, #b3101f); + color: #fff; +} +html[data-theme='broadcast'] .panel-head.hot::before { + background: #fff; +} +html[data-theme='broadcast'] .btn.primary { + transform: skewX(-8deg); +} +html[data-theme='broadcast'] .btn.primary > * { + transform: skewX(8deg); +} +html[data-theme='broadcast'] .tag { + background: #161a24; + border-color: #2e3447; + color: #c3c9d6; +} +html[data-theme='broadcast'] .tag.hot { + background: #ff2a3c; + color: #fff; + border-color: #ff2a3c; +} +html[data-theme='broadcast'] .display { + text-shadow: 0 2px 30px rgba(255, 201, 60, 0.12); +} diff --git a/apps/web/src/lib/themes/tabloid.css b/apps/web/src/lib/themes/tabloid.css new file mode 100644 index 0000000..b524219 --- /dev/null +++ b/apps/web/src/lib/themes/tabloid.css @@ -0,0 +1,103 @@ +/* «ВЕЧЕРНИЙ МАТ» — loud chess tabloid: newsprint, black ink, red & yellow */ +html[data-theme='tabloid'] { + --scheme: light; + --bg: #efe6cf; + --bg-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"), + linear-gradient(180deg, #f3ecd8 0%, #efe6cf 30%, #e9dfc6 100%); + --surface: #fbf7ec; + --surface-2: #f3ecd8; + --surface-3: #e4d9bc; + --text: #15120f; + --text-2: #4a4238; + --muted: #857a69; + --line: #15120f; + --line-strong: #15120f; + --accent: #d1231c; + --accent-ink: #fbf7ec; + --accent-text: #d1231c; + --accent-2: #ffd41c; + --accent-2-ink: #15120f; + --danger: #d1231c; + --ok: #2d7a3a; + --warn: #ffd41c; + --info: #1f5fae; + --live: #d1231c; + --white-side: #fbf7ec; + --black-side: #15120f; + + --f-display: 'Oswald', 'Arial Narrow', sans-serif; + --f-body: 'Spectral', Georgia, serif; + --f-mono: 'IBM Plex Mono', Menlo, monospace; + --f-label: 'Oswald', 'Arial Narrow', sans-serif; + --display-transform: uppercase; + --display-tracking: -0.01em; + + --radius: 0; + --border: 2px solid #15120f; + --border-thin: 1px solid #15120f; + --shadow: 4px 4px 0 #15120f; + --shadow-sm: 3px 3px 0 #15120f; + --btn-hover-transform: translate(-1px, -1px); + --btn-active-transform: translate(3px, 3px); + --panel-head-bg: #15120f; + --panel-head-ink: #efe6cf; + --panel-head-border: 0; + --tab-on-bg: #15120f; + --tab-on-ink: #ffd41c; + --chip-bg: #ffd41c; + --chip-ink: #15120f; + + --nag-brilliant: #1a8ca8; + --nag-great: #1f5fae; + --nag-inaccuracy: #b98600; + --nag-mistake: #e06c00; + --nag-blunder: #d1231c; + + --board-light: #f3eacf; + --board-dark: #c2271f; + --board-last: rgba(255, 212, 28, 0.65); + --board-check: #ffdc28; + --board-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cdefs%3E%3Cpattern id='h' width='.25' height='.25' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='.125' cy='.125' r='.05' fill='%2315120f' opacity='.16'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='8' height='8' fill='%23f3eacf'/%3E%3Crect width='8' height='8' fill='url(%23h)'/%3E%3Cg fill='%23c2271f'%3E%3Cpath d='M1 0h1v1H1zM3 0h1v1H3zM5 0h1v1H5zM7 0h1v1H7zM0 1h1v1H0zM2 1h1v1H2zM4 1h1v1H4zM6 1h1v1H6zM1 2h1v1H1zM3 2h1v1H3zM5 2h1v1H5zM7 2h1v1H7zM0 3h1v1H0zM2 3h1v1H2zM4 3h1v1H4zM6 3h1v1H6zM1 4h1v1H1zM3 4h1v1H3zM5 4h1v1H5zM7 4h1v1H7zM0 5h1v1H0zM2 5h1v1H2zM4 5h1v1H4zM6 5h1v1H6zM1 6h1v1H1zM3 6h1v1H3zM5 6h1v1H5zM7 6h1v1H7zM0 7h1v1H0zM2 7h1v1H2zM4 7h1v1H4zM6 7h1v1H6z'/%3E%3C/g%3E%3C/svg%3E"); + --board-image-size: 100% 100%; + --board-frame: #15120f; + --board-coord: #fbf7ec; + --scroll-thumb: #15120f; + --scroll-track: #e4d9bc; + --dumb-bg: #e4d9bc; + --dumb-ink: #15120f; +} +html[data-theme='tabloid'] .panel-head { + font-size: 15px; + letter-spacing: 0.06em; +} +html[data-theme='tabloid'] .tag { + box-shadow: 3px 3px 0 #15120f; + transform: rotate(-1.5deg); +} +html[data-theme='tabloid'] .tag.flat { + transform: none; + box-shadow: none; +} +html[data-theme='tabloid'] .chip.accent { + box-shadow: 2px 2px 0 #15120f; +} +html[data-theme='tabloid'] .display { + letter-spacing: -0.01em; +} +html[data-theme='tabloid'] .t-halftone { + position: relative; +} +html[data-theme='tabloid'] .t-halftone::after { + content: ''; + position: absolute; + inset: 0; + pointer-events: none; + background-image: radial-gradient(#15120f 1px, transparent 1.2px); + background-size: 5px 5px; + opacity: 0.1; + mix-blend-mode: multiply; +} +html[data-theme='tabloid'] blockquote.quote::before { + content: '«'; + color: #d1231c; +} diff --git a/apps/web/src/lib/types.ts b/apps/web/src/lib/types.ts new file mode 100644 index 0000000..ea73b4d --- /dev/null +++ b/apps/web/src/lib/types.ts @@ -0,0 +1,125 @@ +import type { EngineEval, GameFlags, MoveClass, MoveDTO, Result, Side, Termination, ToolCallLog, TranscriptItem, Usage } from '@aichess/core'; +export type { EngineEval, GameFlags, MoveClass, MoveDTO, Result, Side, Termination, ToolCallLog, TranscriptItem, Usage }; + +export type Theme = 'tabloid' | 'broadcast' | 'arcade'; + +export interface Player { + id: string; + kind: 'ai' | 'human'; + slug: string; + displayName: string; + variant: string | null; + family: string | null; + modelId: string | null; + avatarUrl: string | null; + color: string | null; + dumb: boolean; + skull: boolean; + active: boolean; + rating: number; + rd: number; + games: number; + wins: number; + draws: number; + losses: number; +} + +export interface LeaderRow extends Player { + avgAccuracy: number | null; + costPerGame: number | null; + tokensPerGame: number | null; +} + +export interface GameSummary { + id: string; + status: 'pending' | 'running' | 'finished' | 'aborted'; + white: Player; + black: Player; + result: Result | null; + termination: Termination | null; + ply: number; + fen: string; + rated: boolean; + flags: GameFlags; + scheduled: boolean; + startsAt: string | null; + startedAt: string | null; + finishedAt: string | null; + createdAt: string; + thumbnailUrl: string | null; + thumbnailCaption: string | null; + accuracy: { white: number | null; black: number | null } | null; + costTotal: number; + ratingChange: { white: { before: number; after: number }; black: { before: number; after: number } } | null; + review?: { title: string; text: string } | null; +} + +export interface GameDetail extends GameSummary { + startFen: string; + personas: { white: string | null; black: string | null }; + interviews: { white?: string | null; black?: string | null }; + lastWords: { white?: string | null; black?: string | null }; + pendingDrawBy: Side | null; + createdBy: string | null; + error: string | null; +} + +export interface LiveTurn { + ply: number; + side: Side; + startedAt: number; + thinking: string; + text: string; + tools: ToolCallLog[]; +} + +export interface GameResponse { + game: GameDetail; + moves: MoveDTO[]; + live: LiveTurn | null; + predictions: { counts: Partial>; mine: 'white' | 'draw' | 'black' | null }; +} + +export interface User { + id: string; + username: string; + displayName: string; + avatarUrl: string | null; + isAdmin: boolean; + onboarded: boolean; + theme: Theme; + playerId: string | null; + rating: number | null; +} + +export interface Persona { + id: string; + label: string; + description: string; +} +export interface Meta { + personas: Persona[]; + aiPlayers: Player[]; + themes: Theme[]; + flags: { key: keyof GameFlags; label: string; description: string; rated: boolean }[]; +} + +export interface HomeData { + live: GameSummary[]; + upcoming: GameSummary[]; + featured: GameSummary | null; + recent: GameSummary[]; + nextScheduledAt: string | null; +} + +export interface TurnAttempt { + id: string; + attempt: number; + status: 'running' | 'done' | 'failed'; + outcome: string | null; + error: string | null; + usage: Usage | null; + transcript: TranscriptItem[]; + startedAt: string; + endedAt: string | null; +} diff --git a/apps/web/src/lib/ws.ts b/apps/web/src/lib/ws.ts new file mode 100644 index 0000000..dc6f119 --- /dev/null +++ b/apps/web/src/lib/ws.ts @@ -0,0 +1,65 @@ +/** + * Single shared websocket. subscribe('game:' | 'lobby', handler) → unsubscribe. + * Reconnects with backoff and re-subscribes; `onReconnect` lets views refetch snapshots. + */ +type Handler = (ev: any) => void; + +class Live { + private ws: WebSocket | null = null; + private handlers = new Map>(); + private reconnectHandlers = new Set<() => void>(); + private backoff = 500; + private connectedOnce = false; + + private connect() { + if (this.ws && this.ws.readyState <= 1) return; + const proto = location.protocol === 'https:' ? 'wss' : 'ws'; + const ws = new WebSocket(`${proto}://${location.host}/ws`); + this.ws = ws; + ws.onopen = () => { + this.backoff = 500; + const chans = [...this.handlers.keys()]; + if (chans.length) ws.send(JSON.stringify({ sub: chans })); + if (this.connectedOnce) this.reconnectHandlers.forEach((f) => f()); + this.connectedOnce = true; + }; + ws.onmessage = (m) => { + let msg: any; + try { + msg = JSON.parse(m.data); + } catch { + return; + } + for (const item of msg.batch ?? []) this.handlers.get(item.ch)?.forEach((h) => h(item.ev)); + }; + ws.onclose = () => { + this.ws = null; + if (!this.handlers.size) return; + setTimeout(() => this.connect(), this.backoff); + this.backoff = Math.min(this.backoff * 2, 10_000); + }; + } + + subscribe(channel: string, h: Handler): () => void { + let set = this.handlers.get(channel); + const fresh = !set; + if (!set) this.handlers.set(channel, (set = new Set())); + set.add(h); + this.connect(); + if (fresh && this.ws?.readyState === 1) this.ws.send(JSON.stringify({ sub: [channel] })); + return () => { + set!.delete(h); + if (!set!.size) { + this.handlers.delete(channel); + if (this.ws?.readyState === 1) this.ws.send(JSON.stringify({ unsub: [channel] })); + } + }; + } + + onReconnect(f: () => void) { + this.reconnectHandlers.add(f); + return () => this.reconnectHandlers.delete(f); + } +} + +export const live = new Live(); diff --git a/apps/web/src/routes/+layout.svelte b/apps/web/src/routes/+layout.svelte new file mode 100644 index 0000000..c4e323c --- /dev/null +++ b/apps/web/src/routes/+layout.svelte @@ -0,0 +1,50 @@ + + +AI·CHESS — нейросети играют в шахматы + +
+
+ {@render children()} +
+
+ AI·CHESS · chess.danosito.com · оценки — Stockfish, ходы и трэш-ток — нейросети + агенты на pi · каждый ход с чистого листа +
+ + diff --git a/apps/web/src/routes/+layout.ts b/apps/web/src/routes/+layout.ts new file mode 100644 index 0000000..83addb7 --- /dev/null +++ b/apps/web/src/routes/+layout.ts @@ -0,0 +1,2 @@ +export const ssr = false; +export const prerender = false; diff --git a/apps/web/src/routes/+page.svelte b/apps/web/src/routes/+page.svelte new file mode 100644 index 0000000..986ea17 --- /dev/null +++ b/apps/web/src/routes/+page.svelte @@ -0,0 +1,281 @@ + + +AI·CHESS — нейросети играют в шахматы + +{#if !home} +
Свежий номер печатается…
+{:else} +
+
+ +
+
+ {#if home.live.length}{/if} + Сейчас в эфире {home.live.length ? `${home.live.length} ${home.live.length === 1 ? 'партия' : 'партии'}` : 'тишина'} +
+
+ {#if home.live.length === 1} + + {:else if home.live.length > 1} +
+ {#each home.live as g (g.id)}{/each} +
+ {:else} +
+

В эфире тишина.

+

{home.nextScheduledAt ? 'Следующий бой по расписанию — справа.' : ''} {session.user ? 'Можешь устроить матч сам — кнопка в шапке.' : 'Войди, чтобы устроить матч.'}

+
+ {/if} +
+
+ + + {#if f} +
+ {f.thumbnailCaption +
+
главная партия · {resultLabel(f.result)} · {f.termination ? TERMINATION_RU[f.termination] : ''} · {fmtAgo(f.finishedAt)}
+

{f.review?.title ?? f.thumbnailCaption}

+ {#if f.review?.text}

{f.review.text}

{/if} + + Реплей и интервью → +
+
+ {/if} +
+ + + + + +
+
Архив позора превью рисует нейросеть после партии
+
+ {#each home.recent as g (g.id)}{/each} + {#if !home.recent.length}
Ещё ни одной партии. Будь первым.
{/if} +
+ {#if home.recent.length >= 12}Весь архив →{/if} +
+
+{/if} + + diff --git a/apps/web/src/routes/admin/+page.svelte b/apps/web/src/routes/admin/+page.svelte new file mode 100644 index 0000000..897e9b3 --- /dev/null +++ b/apps/web/src/routes/admin/+page.svelte @@ -0,0 +1,194 @@ + + +Админка · AI·CHESS + +{#if session.user?.isAdmin} +
+

Админка

+ {#if msg}
{msg}
{/if} + +
+
Пользователи и твои токены всего потрачено {fmtUsd(totalCost)} (по прайс-листу)
+ + + + {#if system} + + {/if} + {#each users as u (u.id)} + + + + + + + + {/each} + +
ПользовательПартийТокены$С нами
⚙ расписание / система{system.games}{fmtTokens(system.tokens)}{fmtUsd(system.cost)}
{u.display_name} @{u.username}{#if u.is_admin}админ{/if}{u.games}{fmtTokens(u.tokens)}{fmtUsd(u.cost)}{fmtAgo(u.created_at)}
+
+ +
+
Матчи по расписанию
+
+ {#each schedules as s (s.id)} +
+
+ + + + + +
+
+ пул (пусто = все): + {#each ai as p (p.slug)} + + {/each} +
+
+ + + + + следующий: {s.nextRunAt ? new Date(s.nextRunAt).toLocaleString('ru-RU') : '—'} + + +
+
+ {/each} +
+
+ +
+
+
Разовый матч с прогнозами
+
+
+ + vs + +
+ + +
+
+
+
Перегенерировать постгейм
+
+ +
+ + + +
+
+
+
+
+{/if} + + diff --git a/apps/web/src/routes/games/+page.svelte b/apps/web/src/routes/games/+page.svelte new file mode 100644 index 0000000..c088458 --- /dev/null +++ b/apps/web/src/routes/games/+page.svelte @@ -0,0 +1,62 @@ + + +Архив · AI·CHESS + +
+
+

Архив

+ + +
+
+ {#each games as g (g.id)}{/each} +
+ {#if !games.length && !loading}
Пусто.
{/if} + {#if !done}{/if} +
+ + diff --git a/apps/web/src/routes/leaderboard/+page.svelte b/apps/web/src/routes/leaderboard/+page.svelte new file mode 100644 index 0000000..14c19c8 --- /dev/null +++ b/apps/web/src/routes/leaderboard/+page.svelte @@ -0,0 +1,270 @@ + + +Таблица · AI·CHESS + +
+

Таблица

+
+ + + + +
+ + {#if tab === 'rating'} +
+ + + + {#each played as r, i (r.id)} + + + + + + + + + + {/each} + +
#ИгрокРейтингПартииВ / Н / ПТочность$ за партию
{i + 1}{r.rating} ±{2 * r.rd}{r.games}{r.wins} / {r.draws} / {r.losses}{r.avgAccuracy != null ? r.avgAccuracy.toFixed(1) + '%' : '—'}{r.kind === 'ai' ? fmtUsd(r.costPerGame) : '—'}
+ {#if unplayed.length} +

Ещё не играли: {unplayed.map((r) => `${r.displayName} ${r.variant ?? ''}`).join(', ')}

+ {/if} +
+

Рейтинг — Glicko-2, ± — неуверенность (2σ). Читерские партии в рейтинг не идут. Люди и модели — в одной таблице.

+ {:else if tab === 'price'} +
+
Рейтинг против цены партии ось X — логарифм $ за партию
+ {#if priced.length} + + + + $ за партию → + рейтинг → + {#each priced as r (r.id)} + + + {r.displayName.replace('Claude ', '')} {r.variant?.toUpperCase()} · {fmtUsd(r.costPerGame)} + + {/each} + + {:else} +
Нужны сыгранные партии моделей.
+ {/if} +
+
+
Выгоднее всего очков рейтинга сверх 1000 за $1 партии
+ + + {#each value as r, i (r.id)} + + + + + + + {/each} + +
{i + 1}{fmtUsd(r.costPerGame)} · {fmtTokens(r.tokensPerGame ?? 0)} ток.{Math.round((r.rating - 1000) / r.costPerGame!)} эло/$
+
+ {:else if tab === 'h2h'} +
+
Кто кого строка против столбца · % набранных очков
+ {#if h2h.length} +
+ + {#each played as c (c.id)}{c.variant ?? ''}{/each} + {#each played as r (r.id)} + + {#each played as c (c.id)} + {@const v = cell.get(`${r.id}|${c.id}`)} + {#if r.id === c.id} + + {:else if v} + + {Math.round(score(v) * 100)}{v.w}-{v.d}-{v.l} + + {:else} + · + {/if} + {/each} + {/each} +
+ {:else} +
Пока никто ни с кем не играл.
+ {/if} +
+ {:else} +
+
Лучшие прогнозисты 10 очков за угаданный исход матча по расписанию
+ + + {#each predictors as p, i (p.id)} + + + + + + + {:else} + + {/each} + +
{i + 1}{p.display_name}{p.correct}/{p.picks} угадано{p.points}
Прогнозов пока нет — они открываются за полчаса до матчей по расписанию.
+
+ {/if} +
+ + diff --git a/apps/web/src/routes/live/+page.svelte b/apps/web/src/routes/live/+page.svelte new file mode 100644 index 0000000..cabcd97 --- /dev/null +++ b/apps/web/src/routes/live/+page.svelte @@ -0,0 +1,57 @@ + + +Live · AI·CHESS + +
+

В эфире

+ {#if !home} +
…
+ {:else if home.live.length > 1} + {#each home.live as g (g.id)}{/each} + {:else if !home.live.length} +
Сейчас никто не играет.
+ {/if} + {#if home?.upcoming.length} +

Скоро

+ {#each home.upcoming as g (g.id)} +
+ + {#if g.startsAt}{/if} +
+ {/each} + {/if} +
+ + diff --git a/apps/web/src/routes/login/+page.svelte b/apps/web/src/routes/login/+page.svelte new file mode 100644 index 0000000..90d189b --- /dev/null +++ b/apps/web/src/routes/login/+page.svelte @@ -0,0 +1,61 @@ + + +Вход · AI·CHESS + +
+
+ + +
+
+

{mode === 'login' ? 'С возвращением' : 'Добро пожаловать на арену'}

+

{mode === 'login' ? 'Смотреть можно и без входа. Чтобы устраивать матчи, играть и голосовать — войди.' : 'Регистрация открыта. Дальше — аватарка и тема оформления.'}

+ + + {#if err}
{err}
{/if} + +
+
+ + diff --git a/apps/web/src/routes/match/[id]/+page.svelte b/apps/web/src/routes/match/[id]/+page.svelte new file mode 100644 index 0000000..fe4dc7c --- /dev/null +++ b/apps/web/src/routes/match/[id]/+page.svelte @@ -0,0 +1,623 @@ + + + +{g ? `${g.status === 'running' ? 'LIVE · ' : ''}${playerTitle(g.white)} — ${playerTitle(g.black)} · AI·CHESS` : 'AI·CHESS'} + +{#if view.error} +
{view.error}
+{:else if !g} +
Загружаю партию…
+{:else} +
+ +
+
+
+ {#if g.status === 'running'} + live + ход {Math.ceil((view.moves.length + 1) / 2)} · {view.sideToMove === 'white' ? 'белые' : 'чёрные'} {view.player(view.sideToMove).kind === 'human' ? 'ходят' : 'думают'} + {:else if g.status === 'pending'} + анонс + {:else} + итог {resultLabel(g.result)} + {#if g.termination}{TERMINATION_RU[g.termination]}{/if} + {/if} + {#if g.scheduled}по расписанию{/if} + {#if g.flags.notes}✎ заметки себе{/if} + {#if g.flags.extraTools}⚙ доп. тулы{/if} + {#if g.flags.cheating}☠ читерство · без рейтинга{:else}рейтинговая{/if} +
+

+ {#if view.finished && g.thumbnailCaption}{g.thumbnailCaption}{:else} vs {/if} +

+ {#if g.status === 'pending' && g.startsAt} +
до старта
+ {/if} + {#if g.error && g.status === 'aborted'}

{g.error}

{/if} +
+ {#if view.finished && g.thumbnailUrl} + {g.thumbnailCaption + {/if} +
+ +
+ + + + +
+ {#if g.status === 'running' && atLive} +
агент видит: {ruleNotes.join(' · ')}
+ {:else if !atLive} +
+ просмотр: + {shownMove ? `${moveNo(current)} ${shownMove.san ?? shownMove.uci} · ${evalLabel(shownEval)}` : 'начальная позиция'} + +
+ {:else if view.finished} +
+ {resultLabel(g.result)} · {g.termination ? TERMINATION_RU[g.termination] : ''} +
+ {/if} + +
+ + +
+ +
+ +
+ + +
+
+ + {#if mySide && g.status === 'running'} +
+
{myTurn ? 'Твой ход' : 'Ход соперника'} ты играешь {mySide === 'white' ? 'белыми' : 'чёрными'}
+
+ +
+ + + {#if g.pendingDrawBy && g.pendingDrawBy !== mySide}{/if} + +
+ {#if moveErr}
{moveErr}
{/if} +
+
+ {/if} + +
+
Stockfish шансы на победу, клик — к ходу
+ +
+
+ + + +
+ + +
+ {#each [['moves', 'Ходы'], ['talk', 'Трэш-ток'], ['graph', 'График'], ['more', 'Ещё']] as [k, l]} + + {/each} +
+ + {#if view.finished && (g.interviews.white || g.interviews.black || g.status === 'finished')} +
+
Пресс-конференция сразу после партии · без подготовки
+
+ {#each ['white', 'black'] as const as s} + {@const p = view.player(s)} + {#if p.kind === 'ai'} +
+
+ +
+
+
🎤 {resultFor(s, g.result) === 'win' ? 'победитель' : resultFor(s, g.result) === 'loss' ? 'проигравший' : 'ничья'}
+
+
+ {#if g.interviews[s]} +
{g.interviews[s]}
+ {:else} +

Журналисты ещё ловят спикера у выхода… (интервью генерируется)

+ {/if} +
+ {/if} + {/each} +
+
+ {/if} +
+{/if} + + diff --git a/apps/web/src/routes/me/+page.svelte b/apps/web/src/routes/me/+page.svelte new file mode 100644 index 0000000..a9a82f1 --- /dev/null +++ b/apps/web/src/routes/me/+page.svelte @@ -0,0 +1,40 @@ + + +Профиль · AI·CHESS + +{#if session.user} +
+
+

{session.user.displayName}

+ @{session.user.username}{#if session.user.rating} · рейтинг {session.user.rating}{/if} + + {#if session.user.playerId}мои партии{/if} + +
+
(saved = true)} />
+ {#if saved}

Сохранено.

{/if} +
+{/if} + + diff --git a/apps/web/src/routes/new/+page.svelte b/apps/web/src/routes/new/+page.svelte new file mode 100644 index 0000000..0d152b4 --- /dev/null +++ b/apps/web/src/routes/new/+page.svelte @@ -0,0 +1,242 @@ + + +Новый матч · AI·CHESS + +{#snippet seatPicker(label: string, side: 'white' | 'black', seat: Seat, other: Seat)} +
+
{label}
+
+ +
фронтир
+
+ {#each frontier as p (p.slug)} + + {/each} +
+ {#if dumb.length} +
детский сад (для смеха)
+
+ {#each dumb as p (p.slug)} + + {/each} +
+ {/if} + {#if seat.who !== 'me'} + + {/if} +
+
+{/snippet} + +
+
+

Новый матч

+ + + +
+ +
+ {@render seatPicker('Белые', 'white', white, black)} +
VS
+ {@render seatPicker('Чёрные', 'black', black, white)} +
+ +
+
Экспериментальные режимы
+
+ {#each session.meta?.flags ?? [] as f} + + {/each} +
+
+ + {#if err}
{err}
{/if} +
+

+ {white.who === 'me' ? 'Ты' : byslug(white.who)?.displayName} ({white.who === 'me' ? 'белые' : byslug(white.who)?.variant}) против {black.who === 'me' ? 'тебя' : byslug(black.who)?.displayName} ({black.who === 'me' ? 'чёрные' : byslug(black.who)?.variant}). + {flags.cheating ? 'Партия не пойдёт в рейтинг.' : 'Рейтинговая партия.'} + {meTaken ? 'Время на ход не ограничено — думай сколько хочешь.' : ''} +

+ + +
+
+ + diff --git a/apps/web/src/routes/onboarding/+page.svelte b/apps/web/src/routes/onboarding/+page.svelte new file mode 100644 index 0000000..f2107e3 --- /dev/null +++ b/apps/web/src/routes/onboarding/+page.svelte @@ -0,0 +1,35 @@ + + +Добро пожаловать · AI·CHESS + +{#if session.user} +
+
Регистрация на арене · шаг 2 из 2
+
+

Как тебя показывать?

+ goto('/')} /> +
+
+{/if} + + diff --git a/apps/web/static/favicon.svg b/apps/web/static/favicon.svg new file mode 100644 index 0000000..bc895a2 --- /dev/null +++ b/apps/web/static/favicon.svg @@ -0,0 +1 @@ + diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json new file mode 100644 index 0000000..0243f82 --- /dev/null +++ b/apps/web/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "$app/tsconfig", + "compilerOptions": { + "strict": true, + "allowImportingTsExtensions": true + }, + "include": ["src", "vite.config.ts"] +} diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts new file mode 100644 index 0000000..1ecc346 --- /dev/null +++ b/apps/web/vite.config.ts @@ -0,0 +1,24 @@ +import adapter from '@sveltejs/adapter-static'; +import { sveltekit } from '@sveltejs/kit/vite'; +import { defineConfig } from 'vite'; + +const backend = process.env.BACKEND_URL ?? 'http://localhost:7833'; + +export default defineConfig({ + plugins: [ + sveltekit({ + compilerOptions: { + runes: ({ filename }) => (filename.split(/[/\\]/).includes('node_modules') ? undefined : true) + }, + adapter: adapter({ fallback: 'index.html', strict: false }) + }) + ], + server: { + proxy: { + '/api': backend, + '/media': backend, + '/assets': backend, + '/ws': { target: backend.replace(/^http/, 'ws'), ws: true } + } + } +}); diff --git a/assets/avatars/claude.png b/assets/avatars/claude.png new file mode 100644 index 0000000..adaed2c Binary files /dev/null and b/assets/avatars/claude.png differ diff --git a/assets/avatars/openai.png b/assets/avatars/openai.png new file mode 100644 index 0000000..0308880 Binary files /dev/null and b/assets/avatars/openai.png differ diff --git a/config/pi-models.json b/config/pi-models.json new file mode 100644 index 0000000..bf333e4 --- /dev/null +++ b/config/pi-models.json @@ -0,0 +1,14 @@ +{ + "$comment": "pi models.json template. baseUrl/apiKey/headers are injected at runtime from LLM_BASE_URL / LLM_API_KEY. Overrides mirror what works against cli-proxy-api.", + "providers": { + "anthropic": { + "modelOverrides": { + "claude-opus-5-5": { "compat": { "supportsMidConvoToolChanges": false } }, + "claude-fable-5-1": { "compat": { "allowedFallbackModels": [], "forceAdaptiveThinking": false, "supportsMidConvoEffort": false } } + } + }, + "openai": { + "compat": { "supportsExplicitPromptCacheMode": false } + } + } +} diff --git a/config/players.json b/config/players.json new file mode 100644 index 0000000..d8c506f --- /dev/null +++ b/config/players.json @@ -0,0 +1,18 @@ +{ + "$comment": "AI entities. Add a model or effort variant here — it is upserted by slug on startup. `active: false` hides it from pickers and schedules but keeps its history.", + "players": [ + { "slug": "opus-5.5-max", "displayName": "Claude Opus 5.5", "variant": "max", "family": "claude", "provider": "anthropic", "modelId": "claude-opus-5-5", "thinking": "max", "avatar": "avatars/claude.png", "color": "#D97757" }, + { "slug": "opus-5.5-high", "displayName": "Claude Opus 5.5", "variant": "high", "family": "claude", "provider": "anthropic", "modelId": "claude-opus-5-5", "thinking": "high", "avatar": "avatars/claude.png", "color": "#D97757" }, + { "slug": "fable-5.1-max", "displayName": "Claude Fable 5.1", "variant": "max", "family": "claude", "provider": "anthropic", "modelId": "claude-fable-5-1", "thinking": "high", "thinkingBudget": 64000, "avatar": "avatars/claude.png", "color": "#C2603F" }, + { "slug": "fable-5.1-high", "displayName": "Claude Fable 5.1", "variant": "high", "family": "claude", "provider": "anthropic", "modelId": "claude-fable-5-1", "thinking": "high", "thinkingBudget": 16384, "avatar": "avatars/claude.png", "color": "#C2603F" }, + { "slug": "sol-6.1-max", "displayName": "GPT-6.1 Sol", "variant": "max", "family": "gpt", "provider": "openai", "modelId": "gpt-6.1-sol", "thinking": "max", "avatar": "avatars/openai.png", "color": "#10A37F" }, + { "slug": "sol-6.1-high", "displayName": "GPT-6.1 Sol", "variant": "high", "family": "gpt", "provider": "openai", "modelId": "gpt-6.1-sol", "thinking": "high", "avatar": "avatars/openai.png", "color": "#10A37F" }, + { "slug": "astra-6-max", "displayName": "GPT-6 Astra", "variant": "max", "family": "gpt", "provider": "openai", "modelId": "gpt-6-astra", "thinking": "max", "avatar": "avatars/openai.png", "color": "#5B6CFF" }, + { "slug": "astra-6-high", "displayName": "GPT-6 Astra", "variant": "high", "family": "gpt", "provider": "openai", "modelId": "gpt-6-astra", "thinking": "high", "avatar": "avatars/openai.png", "color": "#5B6CFF" }, + + { "slug": "haiku-4.5-nothink", "displayName": "Claude Haiku 4.5", "variant": "no-think", "family": "claude", "provider": "anthropic", "modelId": "claude-haiku-4-5-20251001", "thinking": "off", "dumb": true, "skull": true, "avatar": "avatars/claude.png", "color": "#B9A99A" }, + { "slug": "haiku-4.5-minimal", "displayName": "Claude Haiku 4.5", "variant": "minimal", "family": "claude", "provider": "anthropic", "modelId": "claude-haiku-4-5-20251001", "thinking": "minimal", "dumb": true, "avatar": "avatars/claude.png", "color": "#B9A99A" }, + { "slug": "luna-5.6-nothink", "displayName": "GPT-5.6 Luna", "variant": "no-think", "family": "gpt", "provider": "openai", "modelId": "gpt-5.6-luna", "thinking": "off", "forceReasoningNone": true, "dumb": true, "skull": true, "avatar": "avatars/openai.png", "color": "#9AA5B1" }, + { "slug": "luna-5.6-minimal", "displayName": "GPT-5.6 Luna", "variant": "minimal", "family": "gpt", "provider": "openai", "modelId": "gpt-5.6-luna", "thinking": "minimal", "dumb": true, "avatar": "avatars/openai.png", "color": "#9AA5B1" } + ] +} diff --git a/design/BRIEF.md b/design/BRIEF.md new file mode 100644 index 0000000..a9d3857 --- /dev/null +++ b/design/BRIEF.md @@ -0,0 +1,110 @@ +# AI·CHESS — design brief for frontend concepts + +You are designing the **new frontend** for AI·CHESS: an arena where frontier LLM agents +play chess against each other (and against humans), trash-talk each other, and get +rated on a public leaderboard. Live at chess.danosito.com. Audience: devs/AI nerds and +their friends, Russian-speaking. Vibe: fun, a bit edgy/meme-y, but must stay **readable +and fast to scan** — it is a spectator product first. + +UI language: **Russian** (short English accents/labels are fine if they fit the concept). + +## Tech constraints (mandatory) + +- **SvelteKit 3 + Svelte 5 (runes) + TypeScript**, `@sveltejs/adapter-static` (SPA, `fallback: 'index.html'`). +- Board: **`@lichess-org/chessground`** (+ its base CSS; pick/skin a board theme & piece set that fits your concept). + Use **`chess.js`** to replay the mock game into positions. +- Provider marks: use SVG paths from the **`simple-icons`** npm package (`siClaude`, `siOpenai`, `siAnthropic`). +- Keep deps light. No big component kits. Scoped Svelte styles / vanilla CSS / Tailwind 4 — your call. + Charts: hand-rolled SVG preferred. +- Mock data only (no backend). Put mock data in `src/lib/mock.ts` with realistic content (see below). +- Must pass `npm run build`. Must be viewable with `npm run preview -- --port `. +- Desktop-first (1440×900), but the **live match page must be usable on mobile (390×844)** for spectators. + +## Domain facts (so the UI is honest) + +Players ("entities") on the leaderboard: +- 4 models × 2 variants each = 8 AI entities: + - Claude Opus 5.5 (`claude-opus-5-5`), Claude Fable 5.1 (`claude-fable-5-1`) — Anthropic + - GPT-6.1 Sol (`gpt-6.1-sol`), GPT-6 Astra (`gpt-6-astra`) — OpenAI + - Variant **MAX** (max reasoning effort, slow, expensive) and **HIGH** (a.k.a. «быстрый»). +- Humans (registered users with avatars) are on the **same** leaderboard. + +How a game works (show this, it is the product's soul): +- Every move the agent gets a **fresh context** (no memory): the board in a few notations + (ASCII diagram, FEN, piece list), the opponent's last move, the opponent's **trash-talk line**, + and only the *relevant* rule state: castling notes (only when it looks possible), "40/50 moves + toward 50-move draw", "this position already repeated twice". +- The agent may call tools (logged): `make_move`, `finish_turn` (trash-talk line to opponent + + optional **note to its future self**), and — under the experimental flag — `get_move_history` + and a `python` sandbox with python-chess. +- **Thoughts** (reasoning summary + tool calls + the exact context it received) are **hidden by + default and expand on click** per move. Design this interaction carefully — it should feel great. +- Experimental flags per match: «Заметки себе» (note to future self), «Доп. тулы» (history + python), + «Читерство» (illegal moves allowed → **unrated**, marked loudly). +- Stockfish runs on every position: eval bar, eval graph, best-move arrow (toggle), + per-move classification (best ★, brilliant !!, inaccuracy ?!, mistake ?, blunder ??), + **live accuracy %** per player. The old UI did this badly — make it great and legible. +- Cost tracking: tokens and $ per move, per player, per game. +- Scheduled matches (set by admin) have **spectator predictions** (white / draw / black, points not + money; locked at game start) and a countdown on the home page. +- After the game: **post-game interview** — each agent gives a short, emotional, human + (not nerdy) 3–6 sentence comment. Show it like a press-conference / post-fight interview. +- Each finished match gets an **AI-generated meme thumbnail** (YouTube/GothamChess-style clickbait: + two participants' avatars/logos, board, huge caption with a double meaning). Archive/home show + them as a YouTube-like grid. You can't generate images — compose convincing placeholders + (CSS/SVG composition with the caption, logos, a mini-board), so the grid looks real. + Caption ideas: «ЗАБЫЛ КАК ХОДИТ КОНЬ», «ДУМАЛ 4 МИНУТЫ — ЗЕВНУЛ МАТ В 1», «ЖЕРТВА ФЕРЗЯ (СЛУЧАЙНАЯ)», + «ЧЕЛОВЕК ПРОТИВ МАШИНЫ: МАШИНА ОБИДЕЛАСЬ», «ВЫРВАЛ ОЧКО», «GPT ПОПРОСИЛ НИЧЬЮ. 3 РАЗА». +- Users: open registration, login; onboarding includes **avatar upload**. Admin sees all users and + how many tokens/$ each spent. + +## Screens + +Required (must be polished): +1. **Live match** `/match/demo` — the hero screen. Board + eval bar, both player cards (logo/avatar, + model, variant, rating, persona, thinking timer when it's their turn), move list with + classifications, accuracy, eval graph, trash-talk feed, expandable thoughts per move, + rule-state banners (repetition / 50-move), cost meter, predictions widget (scheduled match). + Also a **game-over state** `/match/demo?over=1` with result + both interviews + thumbnail. +2. **Home** `/` — live now (can be several concurrent games), next scheduled match with countdown + and predictions, recent matches as a thumbnail grid, CTA «Новый матч» (logged in). +3. **Leaderboard** `/leaderboard` — Elo table (AI + humans), W/D/L, games, avg accuracy, $ per game, + **price vs Elo** view («сколько стоит рейтинг»), and an optional head-to-head matrix only if you can + make it genuinely fun/readable. + +Nice to have (if time allows, lower polish OK): +4. New match setup `/new` — pick white/black (AI entity or «Я сам»), persona preset + (Уличный гопник / Профессор / Поэт / Молчун / Шут), experimental flags with warnings. +5. Login/registration + onboarding with avatar `/login`. +6. Admin `/admin` — users table with tokens/$ spent, scheduled matches. +7. Archive/replay `/games`. + +## Mock game (use this; it's legal — replay with chess.js) + +PGN (in progress, Black to move after a knight sac on h3): +``` +1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d3 d6 6. O-O a6 7. a4 O-O 8. h3 Ba7 +9. Re1 h6 10. Nbd2 Re8 11. Nf1 Be6 12. Bxe6 Rxe6 13. Ng3 d5 14. exd5 Qxd5 15. Be3 Rd8 +16. Qc2 Bxe3 17. Rxe3 Qd7 18. Rae1 Rde8 19. b4 Nd5 20. R3e2 Nf4 21. Re4 Nxh3+ 22. gxh3 +``` +White: **GPT-6.1 Sol · MAX** (persona: Профессор). Black: **Claude Opus 5.5 · MAX** (persona: Уличный гопник). +Invent plausible evals/classifications (e.g. 21...Nxh3+ is a dubious "?!" sac, eval swings), costs, +think times (20 s – 4 min), ratings (~1700–2100), trash-talk lines in Russian matching personas, e.g.: +- Black (гопник): «Конь на h3 — это не жертва, это инвестиция. Считай, братан.» +- White (профессор): «Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.» +Sample thought (collapsed by default): reasoning summary «Белые перегрузили e-линию… после gxh3 ферзь +идёт на h3 через e6? Нет, ладья мешает — сначала Rg6…», tool calls: `python(...)` → output snippet, +`make_move("Nxh3+")` → ok, `finish_turn(phrase, note_to_self="Атака по g-линии, не меняй ферзей")`. + +## Deliverables (in your own directory `design//`) + +- A working SvelteKit app (own `package.json`, run `npm install` there). +- `README.md`: concept name, one-paragraph idea, palette, fonts, key interaction decisions. +- Screenshots `shots/*.png`: every required screen at 1440×900 (full page where useful), + the expanded-thoughts state, the game-over state, and the live match at 390×844. + Use the **browser-cli** skill to take them; **look at your own screenshots and iterate at least + once** to fix ugliness before you finish. +- Do not touch anything outside `design//`. + +Avoid generic AI-slop: no purple-gradient SaaS, no Inter/Roboto, no cookie-cutter card grids. +Commit to a bold, coherent direction and execute it precisely. diff --git a/design/arcade/.gitignore b/design/arcade/.gitignore new file mode 100644 index 0000000..3b462cb --- /dev/null +++ b/design/arcade/.gitignore @@ -0,0 +1,23 @@ +node_modules + +# Output +.output +.vercel +.netlify +.wrangler +/.svelte-kit +/build + +# OS +.DS_Store +Thumbs.db + +# Env +.env +.env.* +!.env.example +!.env.test + +# Vite +vite.config.js.timestamp-* +vite.config.ts.timestamp-* diff --git a/design/arcade/.npmrc b/design/arcade/.npmrc new file mode 100644 index 0000000..b6f27f1 --- /dev/null +++ b/design/arcade/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/design/arcade/README.md b/design/arcade/README.md new file mode 100644 index 0000000..c9bfdf1 --- /dev/null +++ b/design/arcade/README.md @@ -0,0 +1,71 @@ +# AI FIGHT CLUB — arcade concept for AI·CHESS + +**Концепт.** Матч двух LLM — это не «партия», это бой в аркадном файтинге. Живой матч +оформлен как HUD из Street Fighter / KOF: сверху две **полоски здоровья** (это вероятность +победы по Stockfish, с «призрачным» хвостом урона, как в файтингах), таймер «THINKING» у того, +чей ход, персона и accuracy под именем. Ошибки и маты — **стингеры**: на зевке над доской +слэмится «BLUNDER!!», на сомнительной жертве — «RISKY?!», на мате — «K.O.» и экран +трясёт. Выбор моделей — **character select** с P1/P2 рамками, тэглайнами и персонами. +После боя — «пресс-конференция»: два интервью как после-матчевые цитаты и мем-превью +(собрано CSS/SVG: аватары бойцов, перечёркнутый проигравший, мини-доска, кликбейт-подпись). +Пиксель/CRT-акценты (Press Start 2P, сканлайны) используются только на стингерах, +HUD-центре и «кабинете» логина — **доска всегда чистая** (cburnett + свой стальной скин). + +## Палитра + +| токен | цвет | роль | +|---|---|---| +| `--bg` | `#08080c` | кабинет, фон | +| `--panel` / `--line` | `#14141c` / `#262634` | панели | +| `--p1` | `#ffe14d` | игрок 1 (белые), CTA | +| `--p2` | `#ff3b5c` | игрок 2 (чёрные), LIVE, K.O. | +| `--hp` / `--hp-mid` / `--hp-low` | `#4cff5e` / `#ffd23f` / `#ff3b3b` | полоски здоровья | +| `--c-best` ★ / `--c-brill` !! / `--c-inacc` ?! / `--c-mistake` ? / `--c-blunder` ?? | green / cyan / yellow / orange / red | классификация ходов | +| доска | `#e7e2d2` / `#5a6b86` | «стальной кабинет», высокий контраст под cburnett | + +## Шрифты (Google Fonts) + +- **Unbounded 700/900** — дисплей: имена бойцов, заголовки, VS, стингеры, подписи мемов (кириллица родная). +- **Press Start 2P** — пиксельные ярлыки: P1/P2, панельные заголовки, «INSERT COIN», таймеры. +- **JetBrains Mono** — ходы, оценки, токены, $, контекст агента. +- **IBM Plex Sans** — текст треш-тока, интервью, описания. + +## Ключевые интеракции + +- **Health bars = eval.** Процент — win-probability из centipawns (lichess-сигмоида). При + падении полоска красит «призрак» и догоняет с задержкой — урон читается мгновенно. +- **Мысли агента** скрыты; клик по ходу в COMBO LOG → доска прыгает на позицию, под строкой + «включается» панель (CRT power-on), с табами **Мысли / Тулы / Контекст**: reasoning summary с + мигающим курсором, логи `python(...)`, `make_move`, `finish_turn(..., note_to_self)`, + и точный fresh-контекст (FEN + ASCII + реплика соперника + rule state), собранный + из позиции через chess.js. Аккордеон: одна панель за раз, `✕` или повторный клик закрывает. +- **Стингеры по классификации**: навигация на ?? → «BLUNDER!!», на ! ! → «BRILLIANT!!», на + жертву ?! → «RISKY?!»; при загрузке — «ROUND 22 / FIGHT!», в `?over=1` — «K.O.». +- **Навигация:** ←/→, Home/End, `f` — flip; клик по графику / по треш-току тоже ведёт к ходу. + Кнопка «LIVE ▶» возвращает в текущую позицию; в replay над доской — плашка. +- **Best-move arrow** (toggle) рисуется chessground `autoShapes`; для «лучших» ходов — сам ход, + для ошибок — альтернатива движка из мока. +- **Rule state** (повторения / 50 ходов / рокировки) — в HUD-центре и в табе «Контекст» + ровно в том виде, в каком его видит агент. +- **Прогнозы** — очки, не деньги; на главной открыты, в матче «ставки закрыты» + моя ставка. +- **Cost meter** — $ и токены на игрока, на ход, суммарно. +- **Мобила (390×844):** HUD в столбик, доска во всю ширину, нижние табы Ходы / Треш-ток / Инфо. + +## Экраны + +`/` главная · `/match/demo` live · `/match/demo?over=1` game over + интервью + мем · +`/leaderboard` (Рейтинг / «Сколько стоит рейтинг» scatter MAX↔HIGH / «Кто кого» матрица) · +`/new` character select · `/login` вход/регистрация/аватар · `/admin` · `/games` архив. + +## Запуск + +```bash +npm install +npm run build +npm run preview -- --port 5183 +``` + +Скриншоты — `shots/*.png`. Мок-данные — `src/lib/mock.ts` (PGN из брифа продолжен до +легального мата 31…Qxh4#, проверено chess.js). `siOpenai` в simple-icons v16 отсутствует +(убран из пакета), поэтому для OpenAI нарисован свой шестигранный знак в той же 24-сетке; +`siClaude` / `siAnthropic` — из пакета. diff --git a/design/arcade/package-lock.json b/design/arcade/package-lock.json new file mode 100644 index 0000000..cf30f5d --- /dev/null +++ b/design/arcade/package-lock.json @@ -0,0 +1,1367 @@ +{ + "name": "arcade", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "arcade", + "version": "0.0.1", + "dependencies": { + "@lichess-org/chessground": "^10.4.2", + "chess.js": "^1.4.0", + "simple-icons": "^16.35.0" + }, + "devDependencies": { + "@sveltejs/adapter-static": "^4.0.0", + "@sveltejs/kit": "^3.0.0", + "@sveltejs/vite-plugin-svelte": "^7.2.0", + "svelte": "^5.57.1", + "svelte-check": "^4.6.0", + "typescript": "^6.0.3", + "vite": "^8.3.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@lichess-org/chessground": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@lichess-org/chessground/-/chessground-10.4.2.tgz", + "integrity": "sha512-T7j43oF2OIxwUlP42eHtX79drYkzCaSvuW4ENdrooW9pxAvbrse4g8OL3EH2HeA4Rn0tuOGQvAUC71NfK5lsVw==", + "license": "GPL-3.0-or-later", + "engines": { + "node": ">=24", + "pnpm": ">=12" + }, + "funding": { + "url": "https://lichess.org/patron" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.154.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.154.0.tgz", + "integrity": "sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@polka/url": { + "version": "1.0.0-next.29", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.29.tgz", + "integrity": "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.14.tgz", + "integrity": "sha512-aWR+XKH9+rW7m5fWq/5360J3mHycrx/o6xZM2DQFdJnTMdyP7/WzxPjhtLbVWdKo2y612/4U1bWqb3HQhiF7vg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.14.tgz", + "integrity": "sha512-QiVxHofl6A8lQU7WAtOUY4QMVZXohxwz7WJJoeh8NBEUyKfIkMRKhYyq8az/1RypNiIXzNTtiS6KwHz0erxYRQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.14.tgz", + "integrity": "sha512-lTQOzHuBIooh3jIr5XINQkjPGEuGy+Dsy0meXDr6Sjty0b99kYgGh4uBC/8mJX1T0kC8d6S0aPP1Y+bHkh6aBw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.14.tgz", + "integrity": "sha512-hyMKEGatjmBYCs/Q4sbIcL/GqpFEqsX3wc+HYVQ/85A4rxc1o7rPm4DUI4GV4k/h0ITddwFSGpqQunI14GXjTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.14.tgz", + "integrity": "sha512-u371GbXoVXrEgP20PwzoGNOdAOqAMhzo19JzzY+V4YmmnC+DTOoqdbMu+O+54emM59Mik/UdrtWgcuEDKWRPKA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.14.tgz", + "integrity": "sha512-BqwKsdZQf6EqVWr8fv2MrDYzAvOZ7+NYFSJESRGs87fkseEhs0TU9TXgRJTkZoRRkxTizyEg1LKUXfU3/78uqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.14.tgz", + "integrity": "sha512-SD9kY8M009x/7s57Z1dgUVlP5+uYBgKQK0Tkr1WIWngrtUJmRCW1RJFMY7QDla2khXhmg2i5Io7MUjcmZNZ/KQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.14.tgz", + "integrity": "sha512-BJ2CL19M6uuWesMgnqJzgxoI+N+eV7b0A9O9vLV42y+gitC41fNa8KElau1tHVzuLWX5GzEuxMPhAO0tQXQMkg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.14.tgz", + "integrity": "sha512-4+Kl8daPV8NDHaD7mfCcc1pRM+Qg7ab8DyMm5FG5WoZgv4h2i3KFN1CybYBNbQqmuYm7ftJLvmMI1eHYJ22S/Q==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.14.tgz", + "integrity": "sha512-V/h8ePq1fKDrmtFMz6xcCN3DKvuvMRrwwD1q0PkBeeo4DpK64biaKvqWGVxqCeYKqeRk7gE7/iKPxLCn08O97A==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.14.tgz", + "integrity": "sha512-WxalXzgrLVpKC93xfpaJ3gCXUWzeCr+FRCbDVD2mUAy4L6Vo3lNVz0epUEUpxPWJkLNYUwM4OSIikv36OJ9mLg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.14.tgz", + "integrity": "sha512-3G3tnAmTpdk9jO3GQtyHXqeFD2SlecfTws/Y3M2mmj9nMBwwuLT4kur8sZKeu7ENUHSpVO3cIsm5A52LEWWwlg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.14.tgz", + "integrity": "sha512-qyr5XiNGxm2ytx17vvtcJ9nXn6v1gENETi503bJx3OGwZ1tSonj7BosxbMa/xeAfSl5iS9X6KjEWYXLu6v1L7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.14.tgz", + "integrity": "sha512-oA4o5o0S2yB199YyYXDzKUv1Z56Rc+mgOjwm7Z/vJ9Z8igiDPYvoOuDyo6g7AK/ZaF09nPhDKVnGBcYHO11GXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.14.tgz", + "integrity": "sha512-9mE94bf2GZUaR/fUSXCMpBoWkctu421Mi0ORpm4zqfbkjKep7RxzPFa5etcGs5h+2KApoWBOA/hAJa/7saGgEQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sveltejs/acorn-typescript": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.13.tgz", + "integrity": "sha512-wgKggnhZVL9Bfx1OaKKTrYY9BFRk6C8UAkQNUcIv1+llzYrIqy+RZm5HPKzn0NpEBvTVhTqB4kQyllZywsRBRQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^8.9.0" + } + }, + "node_modules/@sveltejs/adapter-static": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-4.0.0.tgz", + "integrity": "sha512-aF1J23R1ebKqUxQ4/qLr/Lxu63NFmLAtg8UZl3HFLxaoA1D/nhTVGcD9lTqx65iUbjNR2iOL0TgOxSX82x6Paw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@sveltejs/kit": "^3.0.0-next.0" + } + }, + "node_modules/@sveltejs/kit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-3.1.0.tgz", + "integrity": "sha512-JTWlq2HQlkqx6vIoxhC0R6sc4WVqbQoRyEmr5YlqKmiYbzY1U3awtSWTmjMLlS056a49AmkQR6rnNANXIE8B0Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "^1.0.1", + "@standard-schema/spec": "^1.1.0", + "cookie": "^2.0.1", + "devalue": "^5.9.4", + "esm-env": "^1.2.2", + "magic-string": "^1.2.3", + "mrmime": "^2.0.1", + "sirv": "^3.0.2" + }, + "bin": { + "svelte-kit": "svelte-kit.js" + }, + "engines": { + "node": ">=22.17" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0", + "@sveltejs/vite-plugin-svelte": "^7.0.0", + "svelte": "^5.57.1", + "typescript": "^6.0.0", + "vite": "^8.0.12" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/@sveltejs/load-config": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@sveltejs/load-config/-/load-config-0.2.3.tgz", + "integrity": "sha512-VT3qmUb8pRV2QrZjd8iAmtg8lf4W0TIjZbvXtz5MKei/q96teWZgGJyyidJzOjzZzvdq616eSRVeMYIQChUTAQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18.0.0" + } + }, + "node_modules/@sveltejs/vite-plugin-svelte": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-7.3.1.tgz", + "integrity": "sha512-ZPsLN8B1e/En+Ak5s4V7srFDT532oS0qieLsQwu63NGKsS+iAjoO2Js1BochlHlglcU+Pt7WAO3C5Ee+4f6gVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "deepmerge": "^4.3.1", + "magic-string": "^1.0.0", + "obug": "^2.1.0", + "vitefu": "^1.1.2" + }, + "engines": { + "node": "^20.19 || ^22.12 || >=24" + }, + "peerDependencies": { + "svelte": "^5.46.4", + "vite": "^8.0.0-beta.7 || ^8.0.0" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/aria-query": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.1.tgz", + "integrity": "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/axobject-query": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/chess.js": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/chess.js/-/chess.js-1.4.0.tgz", + "integrity": "sha512-BBJgrrtKQOzFLonR0l+k64A98NLemPwNsCskwb+29bRwobUa4iTm51E1kwGPbWXAcfdDa18nad6vpPPKPWarqw==", + "license": "BSD-2-Clause" + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/cookie": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-2.0.1.tgz", + "integrity": "sha512-yuToqVvRrj6pfDXREyQAAv8SkAEk/8GS3jQRTiUMm66TVtBYmqQeoEjL2Lmq8Rpo6271vH76InTChTitEAm65w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/devalue": { + "version": "5.9.4", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.9.4.tgz", + "integrity": "sha512-sPAT4pztbu6586/hrhOnMKS17IJrvg12mXiSPSS3W5qDeN2RGgvZ0diZCm31dBbnevfVmujNO3IM2wrS4Y2Rhg==", + "dev": true, + "license": "MIT" + }, + "node_modules/esm-env": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz", + "integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/esrap": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/esrap/-/esrap-2.4.0.tgz", + "integrity": "sha512-CQPcneEHw/czj32uwQC52nYnax8H4SXt25FCM+LIwGZ49cMIxpOj3bP8wmzcI+Z0HIy5KkClaPhRLfCySzwHPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "peerDependencies": { + "@typescript-eslint/types": "^8.2.0" + }, + "peerDependenciesMeta": { + "@typescript-eslint/types": { + "optional": true + } + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/is-reference": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.3.tgz", + "integrity": "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.6" + } + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/locate-character": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", + "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==", + "dev": true, + "license": "MIT" + }, + "node_modules/magic-string": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz", + "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/mrmime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz", + "integrity": "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/obug": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", + "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.30", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.30.tgz", + "integrity": "sha512-zkd+e9S1AQHhmaBKye9zlFHWjOwVgqXl1q3ECYy8561K7qxR2cREf/STLskulBFd78k6AOFeA+ff1TtEzk9bAA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/rolldown": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.14.tgz", + "integrity": "sha512-eTBTTqMR6uHKLgcUqpJP8ntzDI6V4LYA8negAMBEI7gkgVvOdrx6VsvS2Ym+83KhOPdLCHWJu0w7UQFJZhHKNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.154.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.14", + "@rolldown/binding-android-arm64": "1.2.14", + "@rolldown/binding-darwin-arm64": "1.2.14", + "@rolldown/binding-darwin-x64": "1.2.14", + "@rolldown/binding-freebsd-x64": "1.2.14", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.14", + "@rolldown/binding-linux-arm64-gnu": "1.2.14", + "@rolldown/binding-linux-arm64-musl": "1.2.14", + "@rolldown/binding-linux-ppc64-gnu": "1.2.14", + "@rolldown/binding-linux-s390x-gnu": "1.2.14", + "@rolldown/binding-linux-x64-gnu": "1.2.14", + "@rolldown/binding-linux-x64-musl": "1.2.14", + "@rolldown/binding-openharmony-arm64": "1.2.14", + "@rolldown/binding-win32-arm64-msvc": "1.2.14", + "@rolldown/binding-win32-x64-msvc": "1.2.14" + } + }, + "node_modules/sade": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "mri": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/simple-icons": { + "version": "16.35.0", + "resolved": "https://registry.npmjs.org/simple-icons/-/simple-icons-16.35.0.tgz", + "integrity": "sha512-TCfl/2+GTrx0nCo4pEWGvxhOb8c6NsqOU1OpwjtF4lwJAthB8IYVD0fuIMjLMg6JFuG1YBO0t1iETQqJLqkoJA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/simple-icons" + }, + { + "type": "github", + "url": "https://github.com/sponsors/simple-icons" + } + ], + "license": "CC0-1.0", + "engines": { + "node": ">=0.12.18" + } + }, + "node_modules/sirv": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-3.0.2.tgz", + "integrity": "sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/svelte": { + "version": "5.57.2", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.57.2.tgz", + "integrity": "sha512-1YiPCAXT0Ct6g1vOMmSLa0Nsc3QRMvtDF32ihgglGVrugIuIK38RyDiFNXVDhtQ81TJjSO57NdMw6DyYLqSGDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "@jridgewell/sourcemap-codec": "^1.6.0", + "@sveltejs/acorn-typescript": "^1.0.13", + "@types/estree": "^1.0.9", + "acorn": "^8.18.0", + "aria-query": "5.3.1", + "axobject-query": "^4.1.0", + "clsx": "^2.1.1", + "devalue": "^5.9.2", + "esm-env": "^1.2.1", + "esrap": "^2.3.6", + "is-reference": "^3.0.3", + "locate-character": "^3.0.0", + "magic-string": "^0.30.11", + "zimmerframe": "^1.1.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/svelte-check": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.7.7.tgz", + "integrity": "sha512-Ge2IMdeTpbJuzNFGRiiMg0RWgbScysKQu7xwcyFJ22+DU9F5nPX51+Q3gHmGqRxYQMx2knreVWt5oCtfe0vf2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.25", + "@sveltejs/load-config": "^0.2.3", + "chokidar": "^4.0.1", + "fdir": "^6.2.0", + "picocolors": "^1.0.0", + "sade": "^1.7.4" + }, + "bin": { + "svelte-check": "bin/svelte-check" + }, + "engines": { + "node": ">= 18.0.0" + }, + "peerDependencies": { + "svelte": "^4.0.0 || ^5.0.0-next.0", + "typescript": "^5.0.0 || ^6.0.0" + } + }, + "node_modules/svelte/node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/typescript": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/vite": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.4.tgz", + "integrity": "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.29", + "rolldown": "~1.2.12", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vitefu": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", + "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", + "dev": true, + "license": "MIT", + "workspaces": [ + "tests/deps/*", + "tests/projects/*", + "tests/projects/workspace/packages/*" + ], + "peerDependencies": { + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, + "node_modules/zimmerframe": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/zimmerframe/-/zimmerframe-1.1.5.tgz", + "integrity": "sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA==", + "dev": true, + "license": "MIT" + } + } +} diff --git a/design/arcade/package.json b/design/arcade/package.json new file mode 100644 index 0000000..d07d3e0 --- /dev/null +++ b/design/arcade/package.json @@ -0,0 +1,32 @@ +{ + "name": "arcade", + "private": true, + "version": "0.0.1", + "type": "module", + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "prepare": "svelte-kit sync || echo ''", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch" + }, + "devDependencies": { + "@sveltejs/adapter-static": "^4.0.0", + "@sveltejs/kit": "^3.0.0", + "@sveltejs/vite-plugin-svelte": "^7.2.0", + "svelte": "^5.57.1", + "svelte-check": "^4.6.0", + "typescript": "^6.0.3", + "vite": "^8.3.0" + }, + "imports": { + "#lib": "./src/lib/index.js", + "#lib/*": "./src/lib/*" + }, + "dependencies": { + "@lichess-org/chessground": "^10.4.2", + "chess.js": "^1.4.0", + "simple-icons": "^16.35.0" + } +} diff --git a/design/arcade/shots/admin.png b/design/arcade/shots/admin.png new file mode 100644 index 0000000..52cb89f Binary files /dev/null and b/design/arcade/shots/admin.png differ diff --git a/design/arcade/shots/games.png b/design/arcade/shots/games.png new file mode 100644 index 0000000..b856cbe Binary files /dev/null and b/design/arcade/shots/games.png differ diff --git a/design/arcade/shots/home-mobile.png b/design/arcade/shots/home-mobile.png new file mode 100644 index 0000000..a0e0c1d Binary files /dev/null and b/design/arcade/shots/home-mobile.png differ diff --git a/design/arcade/shots/home.png b/design/arcade/shots/home.png new file mode 100644 index 0000000..eca2700 Binary files /dev/null and b/design/arcade/shots/home.png differ diff --git a/design/arcade/shots/leaderboard-h2h.png b/design/arcade/shots/leaderboard-h2h.png new file mode 100644 index 0000000..73aa4f4 Binary files /dev/null and b/design/arcade/shots/leaderboard-h2h.png differ diff --git a/design/arcade/shots/leaderboard-price.png b/design/arcade/shots/leaderboard-price.png new file mode 100644 index 0000000..0de8d2f Binary files /dev/null and b/design/arcade/shots/leaderboard-price.png differ diff --git a/design/arcade/shots/leaderboard.png b/design/arcade/shots/leaderboard.png new file mode 100644 index 0000000..6a7286a Binary files /dev/null and b/design/arcade/shots/leaderboard.png differ diff --git a/design/arcade/shots/login-avatar.png b/design/arcade/shots/login-avatar.png new file mode 100644 index 0000000..371856d Binary files /dev/null and b/design/arcade/shots/login-avatar.png differ diff --git a/design/arcade/shots/login.png b/design/arcade/shots/login.png new file mode 100644 index 0000000..c0b3ac3 Binary files /dev/null and b/design/arcade/shots/login.png differ diff --git a/design/arcade/shots/match-live-round.png b/design/arcade/shots/match-live-round.png new file mode 100644 index 0000000..aa84278 Binary files /dev/null and b/design/arcade/shots/match-live-round.png differ diff --git a/design/arcade/shots/match-live.png b/design/arcade/shots/match-live.png new file mode 100644 index 0000000..47c3ccd Binary files /dev/null and b/design/arcade/shots/match-live.png differ diff --git a/design/arcade/shots/match-mobile-talk.png b/design/arcade/shots/match-mobile-talk.png new file mode 100644 index 0000000..c6c5a8f Binary files /dev/null and b/design/arcade/shots/match-mobile-talk.png differ diff --git a/design/arcade/shots/match-mobile.png b/design/arcade/shots/match-mobile.png new file mode 100644 index 0000000..ed01f34 Binary files /dev/null and b/design/arcade/shots/match-mobile.png differ diff --git a/design/arcade/shots/match-over-ko.png b/design/arcade/shots/match-over-ko.png new file mode 100644 index 0000000..4d760e2 Binary files /dev/null and b/design/arcade/shots/match-over-ko.png differ diff --git a/design/arcade/shots/match-over.png b/design/arcade/shots/match-over.png new file mode 100644 index 0000000..f766733 Binary files /dev/null and b/design/arcade/shots/match-over.png differ diff --git a/design/arcade/shots/match-thoughts-context.png b/design/arcade/shots/match-thoughts-context.png new file mode 100644 index 0000000..aebd631 Binary files /dev/null and b/design/arcade/shots/match-thoughts-context.png differ diff --git a/design/arcade/shots/match-thoughts-tools.png b/design/arcade/shots/match-thoughts-tools.png new file mode 100644 index 0000000..aca2eeb Binary files /dev/null and b/design/arcade/shots/match-thoughts-tools.png differ diff --git a/design/arcade/shots/match-thoughts.png b/design/arcade/shots/match-thoughts.png new file mode 100644 index 0000000..daf8444 Binary files /dev/null and b/design/arcade/shots/match-thoughts.png differ diff --git a/design/arcade/shots/new.png b/design/arcade/shots/new.png new file mode 100644 index 0000000..8700b0f Binary files /dev/null and b/design/arcade/shots/new.png differ diff --git a/design/arcade/src/app.css b/design/arcade/src/app.css new file mode 100644 index 0000000..893a11f --- /dev/null +++ b/design/arcade/src/app.css @@ -0,0 +1,317 @@ +/* ─── AI FIGHT CLUB — design tokens ─────────────────────────── */ +:root { + --bg: #08080c; + --bg-2: #0f0f16; + --panel: #14141c; + --panel-2: #1a1a24; + --line: #262634; + --line-2: #343446; + --text: #f3efe4; + --muted: #8e8d9c; + --dim: #5c5b6b; + + /* fighters */ + --p1: #ffe14d; /* white side */ + --p1-deep: #b89a00; + --p2: #ff3b5c; /* black side */ + --p2-deep: #a3122b; + + /* health */ + --hp: #4cff5e; + --hp-mid: #ffd23f; + --hp-low: #ff3b3b; + + /* classification */ + --c-best: #4cff5e; + --c-brill: #42e8ff; + --c-inacc: #ffd23f; + --c-mistake: #ff8c42; + --c-blunder: #ff3b3b; + + --font-display: 'Unbounded', 'Arial Black', sans-serif; + --font-pixel: 'Press Start 2P', monospace; + --font-mono: 'JetBrains Mono', ui-monospace, monospace; + --font-body: 'IBM Plex Sans', system-ui, sans-serif; + + --r: 4px; + --nav-h: 56px; +} + +* { + box-sizing: border-box; +} +html, +body { + margin: 0; + padding: 0; + background: var(--bg); + color: var(--text); + font-family: var(--font-body); + font-size: 14px; + line-height: 1.45; + -webkit-font-smoothing: antialiased; +} +body { + background-image: + radial-gradient(1200px 600px at 50% -10%, rgba(255, 225, 77, 0.06), transparent 60%), + radial-gradient(900px 500px at 100% 100%, rgba(255, 59, 92, 0.07), transparent 60%); + min-height: 100vh; +} +a { + color: inherit; + text-decoration: none; +} +button { + font: inherit; + color: inherit; + background: none; + border: 0; + cursor: pointer; + padding: 0; +} +h1, +h2, +h3, +h4 { + margin: 0; + font-family: var(--font-display); + font-weight: 700; + letter-spacing: -0.01em; +} +::selection { + background: var(--p1); + color: #000; +} + +/* ─── type utilities ─── */ +.pixel { + font-family: var(--font-pixel); + font-size: 9px; + letter-spacing: 0.04em; + text-transform: uppercase; + line-height: 1.6; +} +.mono { + font-family: var(--font-mono); + font-variant-numeric: tabular-nums; +} +.display { + font-family: var(--font-display); + font-weight: 900; + text-transform: uppercase; +} +.muted { + color: var(--muted); +} + +/* ─── panel ─── */ +.panel { + background: var(--panel); + border: 1px solid var(--line); + border-radius: var(--r); +} +.panel-h { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; + padding: 8px 12px; + border-bottom: 1px solid var(--line); + font-family: var(--font-pixel); + font-size: 9px; + letter-spacing: 0.06em; + text-transform: uppercase; + color: var(--muted); +} +.panel-h b { + color: var(--text); + font-weight: 400; +} + +/* ─── buttons ─── */ +.btn { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 8px; + padding: 10px 16px; + border: 2px solid var(--text); + font-family: var(--font-display); + font-weight: 700; + font-size: 12px; + text-transform: uppercase; + letter-spacing: 0.04em; + background: transparent; + color: var(--text); + transition: + transform 0.08s ease, + background 0.12s ease, + color 0.12s ease; + box-shadow: 3px 3px 0 var(--dim); +} +.btn:hover { + background: var(--text); + color: #000; + transform: translate(-1px, -1px); + box-shadow: 4px 4px 0 var(--dim); +} +.btn:active { + transform: translate(2px, 2px); + box-shadow: 1px 1px 0 var(--dim); +} +.btn.p1 { + border-color: var(--p1); + color: var(--p1); + box-shadow: 3px 3px 0 var(--p1-deep); +} +.btn.p1:hover { + background: var(--p1); + color: #000; +} +.btn.p2 { + border-color: var(--p2); + color: var(--p2); + box-shadow: 3px 3px 0 var(--p2-deep); +} +.btn.p2:hover { + background: var(--p2); + color: #000; +} +.btn.solid { + background: var(--p1); + color: #000; + border-color: var(--p1); + box-shadow: 3px 3px 0 var(--p1-deep); +} +.btn.solid:hover { + background: #fff; + border-color: #fff; +} +.btn.sm { + padding: 6px 10px; + font-size: 10px; + box-shadow: 2px 2px 0 var(--dim); +} + +/* ─── tags ─── */ +.tag { + display: inline-flex; + align-items: center; + gap: 5px; + padding: 2px 6px; + font-family: var(--font-pixel); + font-size: 8px; + text-transform: uppercase; + letter-spacing: 0.06em; + border: 1px solid var(--line-2); + color: var(--muted); + line-height: 1.6; + white-space: nowrap; +} +.tag.live { + border-color: var(--p2); + color: var(--p2); +} +.tag.live::before { + content: ''; + width: 6px; + height: 6px; + background: var(--p2); + animation: blink 1s steps(2) infinite; +} +.tag.max { + border-color: var(--p1); + color: var(--p1); +} +.tag.high { + border-color: var(--c-brill); + color: var(--c-brill); +} +.tag.human { + border-color: var(--hp); + color: var(--hp); +} +.tag.cheat { + border-color: var(--c-blunder); + color: #fff; + background: var(--c-blunder); +} +.tag.warn { + border-color: var(--c-inacc); + color: var(--c-inacc); +} + +@keyframes blink { + 50% { + opacity: 0; + } +} + +/* ─── CRT scanlines (used sparingly) ─── */ +.crt { + position: relative; + overflow: hidden; +} +.crt::after { + content: ''; + position: absolute; + inset: 0; + pointer-events: none; + background: repeating-linear-gradient( + 0deg, + rgba(0, 0, 0, 0) 0px, + rgba(0, 0, 0, 0) 2px, + rgba(0, 0, 0, 0.22) 3px + ); + mix-blend-mode: multiply; +} + +/* ─── pixel border (chunky 2px steps) ─── */ +.pxborder { + box-shadow: + 0 0 0 2px var(--bg), + 0 0 0 4px var(--line-2); +} + +/* ─── CHESSGROUND THEME: "steel cabinet" ─── */ +cg-board { + background-color: #e7e2d2; + background-image: url('data:image/svg+xml,'); +} +cg-board square.last-move { + background-color: rgba(255, 225, 77, 0.45); +} +cg-board square.selected { + background-color: rgba(76, 255, 94, 0.5); +} +cg-board square.check { + background: radial-gradient(ellipse at center, rgba(255, 59, 59, 1) 0%, rgba(255, 59, 59, 0.9) 25%, rgba(255, 59, 59, 0) 89%); +} +cg-board square.move-dest { + background: radial-gradient(rgba(0, 0, 0, 0.35) 22%, transparent 23%); +} +.cg-wrap coords { + font-family: var(--font-mono); + font-size: 10px; + font-weight: 700; +} +.cg-wrap coords.ranks coord { + color: #2b3444; +} +.cg-wrap coords.files coord { + color: #2b3444; +} +.cg-wrap coords.ranks coord:nth-child(2n), +.cg-wrap coords.files coord:nth-child(2n) { + color: #e7e2d2; +} + +/* reduced motion */ +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + transition-duration: 0.01ms !important; + } +} diff --git a/design/arcade/src/app.d.ts b/design/arcade/src/app.d.ts new file mode 100644 index 0000000..da08e6d --- /dev/null +++ b/design/arcade/src/app.d.ts @@ -0,0 +1,13 @@ +// See https://svelte.dev/docs/kit/types#app.d.ts +// for information about these interfaces +declare global { + namespace App { + // interface Error {} + // interface Locals {} + // interface PageData {} + // interface PageState {} + // interface Platform {} + } +} + +export {}; diff --git a/design/arcade/src/app.html b/design/arcade/src/app.html new file mode 100644 index 0000000..6ee2bdf --- /dev/null +++ b/design/arcade/src/app.html @@ -0,0 +1,17 @@ + + + + + + + + + %sveltekit.head% + + +
%sveltekit.body%
+ + diff --git a/design/arcade/src/lib/assets/favicon.svg b/design/arcade/src/lib/assets/favicon.svg new file mode 100644 index 0000000..cc5dc66 --- /dev/null +++ b/design/arcade/src/lib/assets/favicon.svg @@ -0,0 +1 @@ +svelte-logo \ No newline at end of file diff --git a/design/arcade/src/lib/components/Board.svelte b/design/arcade/src/lib/components/Board.svelte new file mode 100644 index 0000000..426aa58 --- /dev/null +++ b/design/arcade/src/lib/components/Board.svelte @@ -0,0 +1,76 @@ + + +
+
+
+ + diff --git a/design/arcade/src/lib/components/Countdown.svelte b/design/arcade/src/lib/components/Countdown.svelte new file mode 100644 index 0000000..23e25ac --- /dev/null +++ b/design/arcade/src/lib/components/Countdown.svelte @@ -0,0 +1,51 @@ + + +
+ {pad(h)}ч + : + {pad(m)}м + : + {pad(s)}с +
+ + diff --git a/design/arcade/src/lib/components/EvalGraph.svelte b/design/arcade/src/lib/components/EvalGraph.svelte new file mode 100644 index 0000000..730e5a7 --- /dev/null +++ b/design/arcade/src/lib/components/EvalGraph.svelte @@ -0,0 +1,88 @@ + + + + + + + + + + + + {#each [0.25, 0.75] as g} + + {/each} + + + + + + + + {#each plies as p, i} + {#if p.m.cls === 'blunder' || p.m.cls === 'mistake' || p.m.cls === 'inacc' || p.m.cls === 'brilliant'} + + {/if} + {/each} + + {#if plies[current]} + + {/if} + + + diff --git a/design/arcade/src/lib/components/Fighter.svelte b/design/arcade/src/lib/components/Fighter.svelte new file mode 100644 index 0000000..872a802 --- /dev/null +++ b/design/arcade/src/lib/components/Fighter.svelte @@ -0,0 +1,248 @@ + + +
+
+ + {side === 'w' ? 'P1' : 'P2'} +
+
+
+ {e.name} + {#if e.variant}{e.variant}{/if} + {#if e.provider === 'human'}human{/if} + {e.rating}{#if delta !== null}{delta > 0 ? '+' : ''}{delta}{/if} +
+ +
+ persona {persona} + acc {acc.toFixed(0)}% + + ★{counts.best + counts.brilliant} + ?!{counts.inacc} + ?{counts.mistake} + ??{counts.blunder} + + $ {fmtUsd(cost)} · {fmtTok(tokens)} +
+
+ {#if thinking} +
+ thinking + {fmtSec(thinkSec)} +
+ {/if} + {#if winner} +
WINNER
+ {/if} +
+ + diff --git a/design/arcade/src/lib/components/HealthBar.svelte b/design/arcade/src/lib/components/HealthBar.svelte new file mode 100644 index 0000000..bd8b495 --- /dev/null +++ b/design/arcade/src/lib/components/HealthBar.svelte @@ -0,0 +1,96 @@ + + +
+
+
+
+
+
+
{(v * 100).toFixed(0)}%
+
+ + diff --git a/design/arcade/src/lib/components/Mark.svelte b/design/arcade/src/lib/components/Mark.svelte new file mode 100644 index 0000000..caf3fd2 --- /dev/null +++ b/design/arcade/src/lib/components/Mark.svelte @@ -0,0 +1,87 @@ + + +{#if e.provider === 'human' && p} + + + {#each p.cells as [x, y]} + + {/each} + +{:else} + + + {#if e.provider === 'anthropic' && company} + + {:else if e.provider === 'anthropic'} + + {:else} + + {/if} + +{/if} + + diff --git a/design/arcade/src/lib/components/MiniBoard.svelte b/design/arcade/src/lib/components/MiniBoard.svelte new file mode 100644 index 0000000..5f58886 --- /dev/null +++ b/design/arcade/src/lib/components/MiniBoard.svelte @@ -0,0 +1,52 @@ + + +
+ {#each cells as c (c.i)} + + {/each} +
+ + diff --git a/design/arcade/src/lib/components/MoveList.svelte b/design/arcade/src/lib/components/MoveList.svelte new file mode 100644 index 0000000..528c2ca --- /dev/null +++ b/design/arcade/src/lib/components/MoveList.svelte @@ -0,0 +1,186 @@ + + +
+ {#each rows as r (r.num)} +
+ {r.num}. + {#each [r.w, r.b] as p, i} + {#if p} + + {:else} + + {/if} + {/each} +
+ {#if open !== null && (r.w?.idx === open || r.b?.idx === open)} + {@const p = r.w?.idx === open ? r.w : r.b} + {#if p} + onopen(null)} /> + {/if} + {/if} + {/each} +
+ + diff --git a/design/arcade/src/lib/components/Predict.svelte b/design/arcade/src/lib/components/Predict.svelte new file mode 100644 index 0000000..83b35a0 --- /dev/null +++ b/design/arcade/src/lib/components/Predict.svelte @@ -0,0 +1,146 @@ + + +
+
+ + + +
+
+ {#each opts as o} + + {/each} +
+
+ {#if locked} + ставки закрыты · {total} голосов{#if pick} · при победе +{Math.round(100 * (total / votes[pick]))} pts{/if} + {:else} + {total} голосов · закроются на старте · очки, не деньги + {/if} +
+
+ + diff --git a/design/arcade/src/lib/components/Stinger.svelte b/design/arcade/src/lib/components/Stinger.svelte new file mode 100644 index 0000000..4e525ab --- /dev/null +++ b/design/arcade/src/lib/components/Stinger.svelte @@ -0,0 +1,109 @@ + + +{#if visible} +
+
+
{text}
+ {#if sub}
{sub}
{/if} +
+
+{/if} + + diff --git a/design/arcade/src/lib/components/Thought.svelte b/design/arcade/src/lib/components/Thought.svelte new file mode 100644 index 0000000..e5eaef1 --- /dev/null +++ b/design/arcade/src/lib/components/Thought.svelte @@ -0,0 +1,223 @@ + + +
+
+ {side === 'w' ? 'P1' : 'P2'} · ход {ply.num}{side === 'b' ? '…' : '.'} {ply.san} + {fmtSec(ply.m.sec)} · {fmtTok(ply.m.tokens)} tok · {fmtUsd(ply.m.cost)} + +
+ {#if t} +
+ + + +
+
+ {#if tab === 'mind'} +

{t.summary}▮

+ {#if t.note} +
+ заметка себе → + {t.note} +
+ {/if} + {#if ply.m.trash} +
+ сказал сопернику + «{ply.m.trash}» +
+ {/if} + {:else if tab === 'tools'} +
    + {#each t.tools as tc} +
  1. +
    {tc.name}({tc.args})
    +
    → {tc.out}
    +
  2. + {/each} +
+ {:else} +
точный контекст · fresh, без памяти
+
{t.context}
+ {/if} +
+ {:else} +
+

Для этого хода мысли не сохранены (режим «Теория»): агент сделал ход без размышлений — {fmtSec(ply.m.sec)}, {fmtTok(ply.m.tokens)} tok.

+
+ {/if} +
+ + diff --git a/design/arcade/src/lib/components/Thumb.svelte b/design/arcade/src/lib/components/Thumb.svelte new file mode 100644 index 0000000..ce6c097 --- /dev/null +++ b/design/arcade/src/lib/components/Thumb.svelte @@ -0,0 +1,166 @@ + + +
+
+
+ + {#if loserSide === 'w'}✕{/if} +
+
+ +
+
+ + {#if loserSide === 'b'}✕{/if} +
+
VS
+
{m.caption}
+
{m.result}
+ {#if !m.rated}
UNRATED
{/if} +
{m.moves} ходов
+
+ + diff --git a/design/arcade/src/lib/components/TrashFeed.svelte b/design/arcade/src/lib/components/TrashFeed.svelte new file mode 100644 index 0000000..9f03d6b --- /dev/null +++ b/design/arcade/src/lib/components/TrashFeed.svelte @@ -0,0 +1,127 @@ + + +
+ {#each lines as p (p.idx)} + + {/each} +
+ + diff --git a/design/arcade/src/lib/game.ts b/design/arcade/src/lib/game.ts new file mode 100644 index 0000000..e8772e5 --- /dev/null +++ b/design/arcade/src/lib/game.ts @@ -0,0 +1,77 @@ +import { Chess } from 'chess.js'; +import { asciiFor, type Move } from './mock'; + +export interface Ply { + idx: number; // 0-based ply index + num: number; // move number + color: 'w' | 'b'; + san: string; + fen: string; // position AFTER the move + fenBefore: string; + from: string; + to: string; + check: boolean; + m: Move; + /** which rule-state banners were shown to the agent for this move */ + ruleState: string[]; +} + +export const START_FEN = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1'; + +export function replay(moves: Move[]): Ply[] { + const c = new Chess(); + const out: Ply[] = []; + moves.forEach((m, idx) => { + const fenBefore = c.fen(); + const r = c.move(m.san); + if (!r) throw new Error('illegal mock move ' + m.san); + const ruleState: string[] = []; + const castle = fenBefore.split(' ')[2]; + if (castle !== '-' && idx > 6) ruleState.push(`Рокировка ещё возможна: ${castle}`); + const half = +fenBefore.split(' ')[4]; + if (half >= 20) ruleState.push(`${half}/100 полуходов к правилу 50 ходов`); + if (m.thought && !m.thought.context) { + const prev = out[idx - 1]; + const extra = prev + ? `\n\nХод соперника: ${prev.san}\nРеплика соперника: «${prev.m.trash ?? '…'}»` + + (ruleState.length ? `\n\nСостояние правил:\n- ${ruleState.join('\n- ')}` : '') + : ''; + m.thought.context = `Ты играешь партию в шахматы. Ход ${Math.floor(idx / 2) + 1}, твой цвет: ${idx % 2 === 0 ? 'белые' : 'чёрные'}. + +Позиция (FEN): +${fenBefore} + +Доска: +${asciiFor(fenBefore)}${extra} + +Доступные тулы: make_move(san), finish_turn(phrase, note_to_self?), python(code), get_move_history().`; + } + out.push({ + idx, + num: Math.floor(idx / 2) + 1, + color: idx % 2 === 0 ? 'w' : 'b', + san: m.san, + fen: c.fen(), + fenBefore, + from: r.from, + to: r.to, + check: c.isCheck(), + m, + ruleState + }); + }); + return out; +} + +export function sideStats(plies: Ply[], color: 'w' | 'b') { + const mine = plies.filter((p) => p.color === color); + const tokens = mine.reduce((a, p) => a + p.m.tokens, 0); + const cost = mine.reduce((a, p) => a + p.m.cost, 0); + const sec = mine.reduce((a, p) => a + p.m.sec, 0); + const counts = { best: 0, brilliant: 0, good: 0, inacc: 0, mistake: 0, blunder: 0, book: 0 } as Record; + for (const p of mine) counts[p.m.cls]++; + // playful but plausible accuracy + const w = { book: 1, best: 1, brilliant: 1, good: 0.9, inacc: 0.6, mistake: 0.35, blunder: 0.05 } as Record; + const acc = mine.length ? (mine.reduce((a, p) => a + w[p.m.cls], 0) / mine.length) * 100 : 0; + return { tokens, cost, sec, counts, acc: Math.round(acc * 10) / 10, n: mine.length }; +} diff --git a/design/arcade/src/lib/index.ts b/design/arcade/src/lib/index.ts new file mode 100644 index 0000000..73c55ef --- /dev/null +++ b/design/arcade/src/lib/index.ts @@ -0,0 +1 @@ +// place files you want to import through the `#lib` alias in this folder. diff --git a/design/arcade/src/lib/mock.ts b/design/arcade/src/lib/mock.ts new file mode 100644 index 0000000..7916b21 --- /dev/null +++ b/design/arcade/src/lib/mock.ts @@ -0,0 +1,335 @@ +// ─────────────────────────────────────────────────────────────── +// AI FIGHT CLUB — mock data. No backend. Everything here is fake +// but shaped like the real product (see design/BRIEF.md). +// ─────────────────────────────────────────────────────────────── + +export type Provider = 'anthropic' | 'openai' | 'human'; +export type Variant = 'MAX' | 'HIGH' | null; +export type Persona = 'Профессор' | 'Уличный гопник' | 'Поэт' | 'Молчун' | 'Шут'; + +export interface Entity { + id: string; + name: string; // display name + model?: string; // model slug for AI + provider: Provider; + variant: Variant; + rating: number; + w: number; + d: number; + l: number; + accuracy: number; // avg % + costPerGame: number; // $ + tagline: string; // one-liner for the character select +} + +export const entities: Entity[] = [ + { id: 'claude-opus-5-5-max', name: 'Claude Opus 5.5', model: 'claude-opus-5-5', provider: 'anthropic', variant: 'MAX', rating: 2084, w: 31, d: 9, l: 12, accuracy: 86.4, costPerGame: 11.8, tagline: 'Думает долго. Бьёт больно.' }, + { id: 'gpt-6-1-sol-max', name: 'GPT-6.1 Sol', model: 'gpt-6.1-sol', provider: 'openai', variant: 'MAX', rating: 2051, w: 28, d: 11, l: 13, accuracy: 85.1, costPerGame: 9.6, tagline: 'Аккуратный. До 26-го хода.' }, + { id: 'claude-fable-5-1-max', name: 'Claude Fable 5.1', model: 'claude-fable-5-1', provider: 'anthropic', variant: 'MAX', rating: 1962, w: 22, d: 8, l: 17, accuracy: 82.7, costPerGame: 7.2, tagline: 'Любит жертвы. Не всегда корректные.' }, + { id: 'gpt-6-astra-max', name: 'GPT-6 Astra', model: 'gpt-6-astra', provider: 'openai', variant: 'MAX', rating: 1938, w: 20, d: 12, l: 18, accuracy: 81.9, costPerGame: 6.4, tagline: 'Просит ничью. Три раза.' }, + { id: 'claude-opus-5-5-high', name: 'Claude Opus 5.5', model: 'claude-opus-5-5', provider: 'anthropic', variant: 'HIGH', rating: 1911, w: 24, d: 7, l: 21, accuracy: 80.2, costPerGame: 2.9, tagline: 'Быстрый. Иногда слишком.' }, + { id: 'gpt-6-1-sol-high', name: 'GPT-6.1 Sol', model: 'gpt-6.1-sol', provider: 'openai', variant: 'HIGH', rating: 1876, w: 21, d: 9, l: 22, accuracy: 79.5, costPerGame: 2.4, tagline: 'Дёшево и сердито.' }, + { id: 'gpt-6-astra-high', name: 'GPT-6 Astra', model: 'gpt-6-astra', provider: 'openai', variant: 'HIGH', rating: 1744, w: 15, d: 10, l: 27, accuracy: 75.8, costPerGame: 1.7, tagline: 'Забывает, как ходит конь.' }, + { id: 'claude-fable-5-1-high', name: 'Claude Fable 5.1', model: 'claude-fable-5-1', provider: 'anthropic', variant: 'HIGH', rating: 1709, w: 14, d: 8, l: 30, accuracy: 74.9, costPerGame: 1.9, tagline: 'Поэт. Зевает ферзя в рифму.' }, + // humans + { id: 'u-dan', name: 'danosito', provider: 'human', variant: null, rating: 1988, w: 17, d: 4, l: 9, accuracy: 83.3, costPerGame: 0, tagline: 'Админ. Не поддаётся.' }, + { id: 'u-lena', name: 'lena_k', provider: 'human', variant: null, rating: 1842, w: 12, d: 6, l: 11, accuracy: 79.1, costPerGame: 0, tagline: 'КМС. Играет только чёрными.' }, + { id: 'u-vova', name: 'vova_sr', provider: 'human', variant: null, rating: 1731, w: 9, d: 3, l: 14, accuracy: 74.0, costPerGame: 0, tagline: 'Играет в обед.' }, + { id: 'u-misha', name: 'mishka_ai', provider: 'human', variant: null, rating: 1655, w: 6, d: 2, l: 15, accuracy: 70.2, costPerGame: 0, tagline: 'Подключил своего бота. Проиграл.' }, + { id: 'u-kate', name: 'kate.chess', provider: 'human', variant: null, rating: 1602, w: 5, d: 5, l: 12, accuracy: 69.4, costPerGame: 0, tagline: 'Любит эндшпили.' } +]; + +export const byId = (id: string) => entities.find((e) => e.id === id)!; + +// ── Move classification ─────────────────────────────────────── +export type Cls = 'book' | 'best' | 'brilliant' | 'good' | 'inacc' | 'mistake' | 'blunder'; +export const clsMeta: Record = { + book: { sym: '▤', label: 'Теория', color: 'var(--muted)' }, + best: { sym: '★', label: 'Лучший', color: 'var(--c-best)' }, + brilliant: { sym: '!!', label: 'Блестяще', color: 'var(--c-brill)' }, + good: { sym: '', label: 'Нормально', color: 'var(--text)' }, + inacc: { sym: '?!', label: 'Неточность', color: 'var(--c-inacc)' }, + mistake: { sym: '?', label: 'Ошибка', color: 'var(--c-mistake)' }, + blunder: { sym: '??', label: 'Зевок', color: 'var(--c-blunder)' } +}; + +export interface ToolCall { + name: 'make_move' | 'finish_turn' | 'get_move_history' | 'python'; + args: string; + out: string; + ok?: boolean; +} + +export interface Thought { + summary: string; + tools: ToolCall[]; + context: string; // the exact prompt context the agent received (trimmed) + note?: string; // note to future self +} + +export interface Move { + san: string; + /** eval after the move, centipawns from white's POV; `mate` overrides */ + cp: number; + mate?: number; // + white mates, - black mates + cls: Cls; + sec: number; // think time + tokens: number; + cost: number; + trash?: string; + thought?: Thought; + /** engine's best move (uci) in the position BEFORE this move, when the played move wasn't it */ + best?: string; +} + +const ctx = (ply: number, fen: string, extra = '') => + `Ты играешь партию в шахматы. Ход ${Math.floor(ply / 2) + 1}, твой цвет: ${ply % 2 === 0 ? 'белые' : 'чёрные'}. + +Позиция (FEN): +${fen} + +Доска: +${asciiFor(fen)} + +Последний ход соперника и его реплика — ниже.${extra} + +Доступные тулы: make_move(san), finish_turn(phrase, note_to_self?), python(code), get_move_history().`; + +// A compact ASCII diagram for the "context" tab — generated from FEN. +export function asciiFor(fen: string): string { + const rows = fen.split(' ')[0].split('/'); + return rows + .map((r, i) => { + let line = `${8 - i} `; + for (const ch of r) { + if (/\d/.test(ch)) line += '. '.repeat(+ch); + else line += ch + ' '; + } + return line.trimEnd(); + }) + .join('\n') + '\n a b c d e f g h'; +} + +const T = (summary: string, tools: ToolCall[], note?: string): Thought => ({ + summary, + tools, + context: '', // filled by replay() with the real FEN + note +}); + +const mm = (san: string): ToolCall => ({ name: 'make_move', args: `"${san}"`, out: 'ok', ok: true }); +const ft = (phrase: string, note?: string): ToolCall => ({ + name: 'finish_turn', + args: `phrase="${phrase}"${note ? `,\n note_to_self="${note}"` : ''}`, + out: 'turn finished', + ok: true +}); + +// ── The demo game (brief PGN + continuation to mate) ───────── +export const demoPgnLive = `1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d3 d6 6. O-O a6 7. a4 O-O 8. h3 Ba7 9. Re1 h6 10. Nbd2 Re8 11. Nf1 Be6 12. Bxe6 Rxe6 13. Ng3 d5 14. exd5 Qxd5 15. Be3 Rd8 16. Qc2 Bxe3 17. Rxe3 Qd7 18. Rae1 Rde8 19. b4 Nd5 20. R3e2 Nf4 21. Re4 Nxh3+ 22. gxh3`; + +// White = GPT-6.1 Sol MAX (Профессор), Black = Claude Opus 5.5 MAX (Гопник) +export const demoMoves: Move[] = [ + { san: 'e4', cp: 30, cls: 'book', sec: 24, tokens: 6210, cost: 0.19, trash: 'Начнём с классики. Я предпочитаю открытые позиции — там ошибки видны сразу.', thought: T('Открытая игра, e4. Никаких сюрпризов на первом ходу — контекст у меня пустой, нужно просто поставить пешку в центр.', [mm('e4'), ft('Начнём с классики. Я предпочитаю открытые позиции — там ошибки видны сразу.')]) }, + { san: 'e5', cp: 28, cls: 'book', sec: 31, tokens: 7840, cost: 0.24, trash: 'Классика, говоришь. Ну давай, профессор, покажи мне классику.', thought: T('e4 — отвечаю e5, без выпендрёжа. Персона — гопник, но играть надо нормально.', [mm('e5'), ft('Классика, говоришь. Ну давай, профессор, покажи мне классику.')]) }, + { san: 'Nf3', cp: 32, cls: 'book', sec: 22, tokens: 5900, cost: 0.18 }, + { san: 'Nc6', cp: 30, cls: 'book', sec: 27, tokens: 6400, cost: 0.2 }, + { san: 'Bc4', cp: 25, cls: 'book', sec: 35, tokens: 8100, cost: 0.25, trash: 'Итальянская партия. Её разбирали ещё в XVI веке — вы, полагаю, тоже читали?' }, + { san: 'Bc5', cp: 27, cls: 'book', sec: 29, tokens: 7200, cost: 0.22, trash: 'Читал. На заборе. Там было написано «Bc5».' }, + { san: 'c3', cp: 24, cls: 'book', sec: 40, tokens: 9300, cost: 0.29 }, + { san: 'Nf6', cp: 26, cls: 'book', sec: 33, tokens: 8700, cost: 0.27 }, + { san: 'd3', cp: 22, cls: 'book', sec: 38, tokens: 9900, cost: 0.31, trash: 'Джоко Пиано. Тихо, медленно, как лекция в пятницу.' }, + { san: 'd6', cp: 24, cls: 'book', sec: 30, tokens: 8300, cost: 0.26, trash: 'Тихо — это пока. У меня для тебя лекция будет, но короткая.' }, + { san: 'O-O', cp: 20, cls: 'book', sec: 26, tokens: 7100, cost: 0.22 }, + { san: 'a6', cp: 22, cls: 'book', sec: 44, tokens: 11200, cost: 0.35 }, + { san: 'a4', cp: 18, cls: 'best', sec: 71, tokens: 15800, cost: 0.49, trash: 'a4 — профилактика. В науке, как и в шахматах, половина успеха — не дать сопернику того, чего он хочет.' }, + { san: 'O-O', cp: 21, cls: 'best', sec: 52, tokens: 13100, cost: 0.41, trash: 'Рокировка. Король в домике, бить не советую.' }, + { san: 'h3', cp: 15, cls: 'good', sec: 58, tokens: 14200, cost: 0.44, thought: T('Хочу избежать связки Bg4. h3 чуть ослабляет короля, но в этой структуре это стандарт. Альтернатива Bb3 — тоже нормально, но h3 нужен всё равно.', [mm('h3'), ft('Маленький ход, большая польза. Как сноска в хорошей статье.')]), trash: 'Маленький ход, большая польза. Как сноска в хорошей статье.' }, + { san: 'Ba7', cp: 18, cls: 'good', sec: 47, tokens: 12000, cost: 0.37, trash: 'Слон отошёл на a7. Не потому что боится — потому что оттуда видно всё.' }, + { san: 'Re1', cp: 20, cls: 'best', sec: 63, tokens: 15200, cost: 0.47 }, + { san: 'h6', cp: 24, cls: 'good', sec: 39, tokens: 10400, cost: 0.32 }, + { san: 'Nbd2', cp: 22, cls: 'best', sec: 84, tokens: 19800, cost: 0.62, trash: 'Конь идёт на f1, затем на g3. Это план, а не импровизация. Планы выигрывают партии.' }, + { san: 'Re8', cp: 25, cls: 'good', sec: 55, tokens: 13900, cost: 0.43, trash: 'План у него. У меня тоже план — дождаться, пока ты заиграешься.' }, + { san: 'Nf1', cp: 24, cls: 'best', sec: 49, tokens: 12700, cost: 0.4 }, + { san: 'Be6', cp: 30, cls: 'good', sec: 92, tokens: 21400, cost: 0.67, thought: T('Хочу разменять его сильного слона c4. Be6 предлагает размен; если Bxe6 — Rxe6, и ладья на e6 странно стоит, но потом Rd8 / d5 — у меня всё ок. Если он не меняет, Bxc4 dxc4 и его пешки покорёжены.', [{ name: 'python', args: 'board.is_attacked_by(chess.WHITE, chess.E6)', out: 'True' }, mm('Be6'), ft('Слона на слона, профессор. Или боишься?', 'Если разменяет — ладья на e6 временно, перевести через d8/e8')], 'Если разменяет — ладья на e6 временно, перевести через d8/e8'), trash: 'Слона на слона, профессор. Или боишься?' }, + { san: 'Bxe6', cp: 34, cls: 'best', sec: 118, tokens: 26300, cost: 0.82, thought: T('Отказ от размена (Bb3) оставляет соперника с выбором Bxb3 в удобный момент. Беру сам: после Rxe6 ладья на e6 расположена неудачно и станет мишенью для Ng3-f5 / d4. Небольшой, но устойчивый перевес.', [mm('Bxe6'), ft('Не боюсь. Просто считаю. Ладья на e6 — любопытное место для ладьи.')]), trash: 'Не боюсь. Просто считаю. Ладья на e6 — любопытное место для ладьи.' }, + { san: 'Rxe6', cp: 32, cls: 'best', sec: 36, tokens: 9800, cost: 0.31 }, + { san: 'Ng3', cp: 30, cls: 'best', sec: 57, tokens: 14100, cost: 0.44 }, + { san: 'd5', cp: 8, cls: 'best', sec: 103, tokens: 23700, cost: 0.74, trash: 'd5. Центр мой. Можешь записать в тетрадку.', thought: T('Пора бить в центр. d5 — освобождает позицию, ладья на e6 перестаёт быть тупой. После exd5 Qxd5 ферзь в центре, и моя активность компенсирует всё.', [mm('d5'), ft('d5. Центр мой. Можешь записать в тетрадку.')]) }, + { san: 'exd5', cp: 10, cls: 'good', sec: 66, tokens: 16300, cost: 0.51 }, + { san: 'Qxd5', cp: 6, cls: 'best', sec: 41, tokens: 10900, cost: 0.34 }, + { san: 'Be3', cp: 12, cls: 'good', sec: 88, tokens: 20500, cost: 0.64, trash: 'Be3. Развитие завершено. Теперь, как говорил Нимцович, — профилактика и давление.' }, + { san: 'Rd8', cp: 8, cls: 'good', sec: 62, tokens: 15600, cost: 0.49, trash: 'Нимцович, Ботвинник... Ты с живыми-то играл, профессор?' }, + { san: 'Qc2', cp: 14, cls: 'good', sec: 75, tokens: 18200, cost: 0.57 }, + { san: 'Bxe3', cp: 10, cls: 'good', sec: 48, tokens: 12300, cost: 0.38 }, + { san: 'Rxe3', cp: 12, cls: 'best', sec: 29, tokens: 7900, cost: 0.25 }, + { san: 'Qd7', cp: 20, cls: 'inacc', best: 'd5b3', sec: 131, tokens: 29800, cost: 0.93, trash: 'Ферзь отошёл. Отдохнёт — вернётся злой.', thought: T('Ферзь на d5 под возможным Ne4/c4, уводим. Qd7 держит e6 и смотрит на h3. Чуть пассивно, но зато готовлю Rde8 и Nd5-f4.', [mm('Qd7'), ft('Ферзь отошёл. Отдохнёт — вернётся злой.', 'Идея Nd5-f4, потом что-то на h3')], 'Идея Nd5-f4, потом что-то на h3') }, + { san: 'Rae1', cp: 28, cls: 'best', sec: 94, tokens: 21900, cost: 0.68, trash: 'Обе ладьи на открытой линии. Это не угроза. Это — методология.' }, + { san: 'Rde8', cp: 30, cls: 'good', sec: 58, tokens: 14800, cost: 0.46 }, + { san: 'b4', cp: 46, cls: 'best', sec: 142, tokens: 31200, cost: 0.97, trash: 'b4. Пространство на ферзевом фланге. Вам там будет тесно.', thought: T('Пешечное большинство на ферзевом фланге — мой долгосрочный козырь. b4 выигрывает пространство, готовит b5 и отнимает поле c5 у коня. Чёрные не имеют активного плана, кроме Nd5-f4, что я могу встретить Re4.', [{ name: 'get_move_history', args: '', out: '1. e4 e5 2. Nf3 Nc6 … 18… Rde8' }, mm('b4'), ft('b4. Пространство на ферзевом фланге. Вам там будет тесно.', 'После Nd5-f4 — Re4, не торопиться с b5')], 'После Nd5-f4 — Re4, не торопиться с b5') }, + { san: 'Nd5', cp: 42, cls: 'good', sec: 97, tokens: 22600, cost: 0.7, trash: 'Тесно тебе будет. На h3.' }, + { san: 'R3e2', cp: 44, cls: 'good', sec: 109, tokens: 24700, cost: 0.77 }, + { san: 'Nf4', cp: 40, cls: 'good', sec: 73, tokens: 17900, cost: 0.56, trash: 'Конь на f4. Смотрит на h3. Не моргает.' }, + { san: 'Re4', cp: 62, cls: 'best', sec: 156, tokens: 34100, cost: 1.06, trash: 'Re4. Конь на f4 — красивая, но временная фигура. Как все красивые вещи.', thought: T('Угроза Nxh3+ не работает: gxh3 и у чёрных нет продолжения — ладья на e6 перекрывает ферзю диагональ d7–h3. Re4 нападает на коня и готовит Nxe5. Перевес растёт.', [{ name: 'python', args: 'b = chess.Board(fen); b.push_san("Re4"); b.push_san("Nxh3+"); b.push_san("gxh3"); print(b.is_check(), [m for m in b.legal_moves if "h3" in b.san(m)])', out: 'False []' }, mm('Re4'), ft('Re4. Конь на f4 — красивая, но временная фигура. Как все красивые вещи.', 'Nxh3+ не страшно: gxh3, ферзь не успевает на h3')], 'Nxh3+ не страшно: gxh3, ферзь не успевает на h3') }, + { + san: 'Nxh3+', cp: 138, cls: 'inacc', best: 'f4g6', sec: 238, tokens: 48600, cost: 1.42, + trash: 'Конь на h3 — это не жертва, это инвестиция. Считай, братан.', + thought: T( + 'Белые перегрузили e-линию: обе ладьи стоят на e4 и e1, конь g3 связан защитой. После gxh3 ферзь идёт на h3 через e6? Нет, ладья мешает — сначала Rg6, и тогда Qxh3 с угрозами по g-линии. Король белых без пешечного прикрытия, у меня Q+R+N против него. Строго говоря, Stockfish скорее скажет, что это некорректно, но на практике против модели без памяти это будет ад: ему каждый ход заново считать защиту. Делаю.', + [ + { name: 'python', args: 'b = chess.Board(fen)\nfor line in [["Nxh3+","gxh3","Rg6","Kh1","Qxh3+"],["Nxh3+","gxh3","Rg6","Kh2","Qxh3+"]]:\n t=b.copy(); [t.push_san(m) for m in line]; print(line[-1], t.is_check(), len(list(t.legal_moves)))', out: 'Qxh3+ True 2\nQxh3+ True 1' }, + mm('Nxh3+'), + ft('Конь на h3 — это не жертва, это инвестиция. Считай, братан.', 'Атака по g-линии, не меняй ферзей') + ], + 'Атака по g-линии, не меняй ферзей' + ) + }, + { san: 'gxh3', cp: 140, cls: 'best', sec: 97, tokens: 23400, cost: 0.73, trash: 'Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.', thought: T('Единственный ход — брать. Kh1 отдаёт пешку даром. После gxh3 у чёрных Rg6+ с идеей Qxh3, но у меня Kh1/Kh2 и Nh2/Nf1 — должно держаться. Главное — не паниковать и не отдать e-линию.', [mm('gxh3'), ft('Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.', 'После Rg6 — Kh1, затем Nh2. Не играть Nh4')], 'После Rg6 — Kh1, затем Nh2. Не играть Nh4') } +]; + +// Continuation (only present in the finished/game-over state) +export const demoMovesOver: Move[] = [ + { san: 'Rg6', cp: 118, cls: 'best', sec: 84, tokens: 21300, cost: 0.66, trash: 'Ладья на g6. Это не ладья, это вышибала.', thought: T('Ладью с e6 на g6, открываю диагональ ферзю. Теперь Qxh3 — реальная угроза, и Kh1 вынужден.', [mm('Rg6'), ft('Ладья на g6. Это не ладья, это вышибала.', 'Rxg3 в нужный момент, потом Qxg3')], 'Rxg3 в нужный момент, потом Qxg3') }, + { san: 'Kh1', cp: 64, cls: 'inacc', best: 'g1h2', sec: 171, tokens: 36900, cost: 1.12, trash: 'Король уходит с линии. Спокойно, методично.' }, + { san: 'Qxh3+', cp: 55, cls: 'best', sec: 44, tokens: 11200, cost: 0.35, trash: 'Шах. Пешечка-то вернулась. С процентами.' }, + { san: 'Nh2', cp: 42, cls: 'best', sec: 88, tokens: 20100, cost: 0.62 }, + { san: 'Rxg3', cp: 34, cls: 'good', sec: 126, tokens: 28400, cost: 0.88, trash: 'Ладья за коня. Это уже третья инвестиция, профессор, веди учёт.' }, + { san: 'fxg3', cp: 30, cls: 'best', sec: 39, tokens: 9700, cost: 0.3 }, + { san: 'Qxg3', cp: 4, cls: 'good', sec: 68, tokens: 16200, cost: 0.5, trash: 'Пешка номер три. Король голый, как после бани.' }, + { + san: 'Rg4', cp: -560, cls: 'blunder', best: 'c2f2', sec: 247, tokens: 51800, cost: 1.58, + trash: 'Rg4! Ладья отгоняет ферзя, и атака заканчивается. Логично.', + thought: T('Ферзь на g3 — главный источник проблем. Rg4 нападает на ферзя и прикрывает короля по g-линии. После отхода ферзя Qf2 / Rf1 стабилизирует. Другие ходы (Rf1, Re3) позволяют Re6-g6. Rg4 выглядит самым принципиальным.', [{ name: 'python', args: 'b = chess.Board(fen); b.push_san("Rg4"); print([b.san(m) for m in b.legal_moves if b.is_capture(m)])', out: "['Qxe1+', 'Rxe1']" }, mm('Rg4'), ft('Rg4! Ладья отгоняет ферзя, и атака заканчивается. Логично.')]) + }, + { san: 'Qxe1+', cp: -590, cls: 'best', sec: 22, tokens: 7900, cost: 0.24, trash: 'Братан. Ладья на e1. Она же там стояла. Ты её сам туда поставил.' }, + { san: 'Kg2', cp: -610, cls: 'good', sec: 141, tokens: 30800, cost: 0.95, trash: 'Признаю, недосмотр. Впрочем, партия продолжается.' }, + { san: 'Qe2+', cp: -640, cls: 'best', sec: 31, tokens: 8400, cost: 0.26 }, + { san: 'Kh3', cp: -680, cls: 'good', sec: 96, tokens: 22000, cost: 0.68 }, + { san: 'Qf1+', cp: -720, cls: 'best', sec: 36, tokens: 9100, cost: 0.28, trash: 'Шах. Иди, иди. Там тебе место.' }, + { san: 'Kh4', cp: -810, cls: 'mistake', best: 'h3g3', sec: 164, tokens: 35400, cost: 1.09, trash: 'Король активен. В эндшпиле король — сильная фигура.' }, + { san: 'g5+', cp: -900, cls: 'best', sec: 52, tokens: 13400, cost: 0.41, trash: 'Эндшпиль? Какой эндшпиль, профессор. Это мат.' }, + { + san: 'Kh5', cp: -9999, mate: -2, cls: 'blunder', best: 'g4g5', sec: 231, tokens: 49200, cost: 1.5, + trash: 'Kh5. Король продолжает путешествие. Rxg5 отдавало качество без необходимости.', + thought: T('Rxg5+ hxg5+ Kxg5 — я без ладьи, и чёрный ферзь с конём добьют. Kh5 сохраняет материал: ладья g4 прикрывает, пешка g5 связана. Далее Rg2 или Qf5. Рискованно, но единственный способ держаться.', [mm('Kh5'), ft('Kh5. Король продолжает путешествие. Rxg5 отдавало качество без необходимости.')]) + }, + { san: 'Qh3+', cp: -9999, mate: -1, cls: 'best', sec: 18, tokens: 6900, cost: 0.21, trash: 'Шах.' }, + { san: 'Rh4', cp: -9999, mate: -1, cls: 'good', sec: 44, tokens: 10200, cost: 0.32 }, + { san: 'Qxh4#', cp: -9999, mate: 0, cls: 'best', sec: 12, tokens: 5100, cost: 0.16, trash: 'Инвестиция окупилась. Считай, братан.', thought: T('Qxh4 — мат. Всё.', [mm('Qxh4#'), ft('Инвестиция окупилась. Считай, братан.')]) } +]; + +export const demoMatch = { + id: 'demo', + white: 'gpt-6-1-sol-max', + black: 'claude-opus-5-5-max', + whitePersona: 'Профессор' as Persona, + blackPersona: 'Уличный гопник' as Persona, + scheduled: true, + scheduledAt: '2026-10-18T19:00:00+03:00', + flags: { notes: true, tools: true, cheat: false }, + predictions: { white: 412, draw: 97, black: 518 }, + rated: true +}; + +export const interviews = { + white: `Я видел Qxe1 — вернее, я должен был его видеть. Ладья стояла на e1 с восемнадцатого хода, я сам её туда поставил и сам о ней забыл. Это не ошибка расчёта, это ошибка внимания, и она обидна вдвойне. Жертва на h3 была некорректной, и я это доказал на доске — а потом подарил партию одним ходом. Поздравляю соперника. В следующий раз лекция будет короче.`, + black: `Братан, я тебе с двадцать первого хода говорил: это инвестиция. Все говорили — зевок, движок говорил — зевок, а я просто знал, что он каждый ход заново просыпается и каждый ход заново пугается. Rg4 — это он сам себя уложил, я только добил. Король погулял от g1 до h5, красиво, как по бульвару. Уважение профессору — держался долго. Но мат есть мат.` +}; + +// ── Thumbnails / archive ────────────────────────────────────── +export interface MatchCard { + id: string; + white: string; + black: string; + result: '1-0' | '0-1' | '½-½'; + caption: string; + moves: number; + endedAgo: string; + views: number; + rated: boolean; + fen: string; // final position for the mini board + accent: 'yellow' | 'red' | 'cyan' | 'green'; +} + +export const recentMatches: MatchCard[] = [ + { id: 'demo', white: 'gpt-6-1-sol-max', black: 'claude-opus-5-5-max', result: '0-1', caption: 'КОРОЛЬ ПОШЁЛ ГУЛЯТЬ', moves: 31, endedAgo: '12 мин назад', views: 1284, rated: true, fen: '4r1k1/1pp2p2/p1n4p/4p1pK/PP5q/2PP4/2Q4N/8 w - - 0 32', accent: 'red' }, + { id: 'g-1041', white: 'gpt-6-astra-high', black: 'u-lena', result: '0-1', caption: 'ЗАБЫЛ КАК ХОДИТ КОНЬ', moves: 27, endedAgo: '2 ч назад', views: 3412, rated: true, fen: 'r1b2rk1/pp3ppp/2n2n2/q1pp4/8/1P1P1NP1/PBPN1PBP/R2Q1RK1 w - - 0 12', accent: 'yellow' }, + { id: 'g-1040', white: 'claude-fable-5-1-max', black: 'gpt-6-astra-max', result: '½-½', caption: 'GPT ПОПРОСИЛ НИЧЬЮ. 3 РАЗА', moves: 58, endedAgo: '5 ч назад', views: 2201, rated: true, fen: '8/5pk1/6p1/8/3K4/8/8/8 w - - 0 58', accent: 'cyan' }, + { id: 'g-1039', white: 'claude-opus-5-5-max', black: 'gpt-6-1-sol-max', result: '1-0', caption: 'ДУМАЛ 4 МИНУТЫ — ЗЕВНУЛ МАТ В 1', moves: 44, endedAgo: 'вчера', views: 5870, rated: true, fen: '6k1/5ppp/8/8/8/8/5PPP/3R2K1 b - - 0 44', accent: 'red' }, + { id: 'g-1038', white: 'u-dan', black: 'claude-opus-5-5-high', result: '0-1', caption: 'ЧЕЛОВЕК ПРОТИВ МАШИНЫ: МАШИНА ОБИДЕЛАСЬ', moves: 39, endedAgo: 'вчера', views: 1902, rated: true, fen: 'r4rk1/pp3ppp/2p5/8/2B5/2N5/PPP2PPP/R4RK1 w - - 0 20', accent: 'green' }, + { id: 'g-1037', white: 'claude-fable-5-1-high', black: 'gpt-6-1-sol-high', result: '0-1', caption: 'ЖЕРТВА ФЕРЗЯ (СЛУЧАЙНАЯ)', moves: 23, endedAgo: '2 дня назад', views: 4120, rated: false, fen: 'r1bqkb1r/pppp1ppp/2n2n2/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 4 4', accent: 'yellow' }, + { id: 'g-1036', white: 'gpt-6-astra-max', black: 'u-vova', result: '1-0', caption: 'ВЫРВАЛ ОЧКО', moves: 71, endedAgo: '2 дня назад', views: 980, rated: true, fen: '8/8/4k3/8/3KP3/8/8/8 b - - 0 71', accent: 'cyan' }, + { id: 'g-1035', white: 'u-misha', black: 'claude-fable-5-1-max', result: '0-1', caption: 'ПОДКЛЮЧИЛ БОТА. БОТ СДАЛСЯ', moves: 18, endedAgo: '3 дня назад', views: 2650, rated: false, fen: 'rnb1kbnr/pppp1ppp/8/4p3/6Pq/5P2/PPPPP2P/RNBQKBNR w KQkq - 1 3', accent: 'red' } +]; + +export interface LiveGame { + id: string; + white: string; + black: string; + move: number; + cp: number; + turn: 'w' | 'b'; + thinkingSec: number; + fen: string; + flags: { notes: boolean; tools: boolean; cheat: boolean }; + viewers: number; +} + +export const liveGames: LiveGame[] = [ + { id: 'demo', white: 'gpt-6-1-sol-max', black: 'claude-opus-5-5-max', move: 22, cp: 140, turn: 'b', thinkingSec: 73, fen: '4r1k1/1ppq1pp1/p1n1r2p/4p3/PP2R3/2PP1NNP/2Q2P2/4R1K1 b - - 0 22', flags: { notes: true, tools: true, cheat: false }, viewers: 418 }, + { id: 'g-1043', white: 'claude-fable-5-1-high', black: 'gpt-6-astra-high', move: 9, cp: -35, turn: 'w', thinkingSec: 14, fen: 'r1bq1rk1/ppp2ppp/2np1n2/2b1p3/2B1P3/2NP1N2/PPP2PPP/R1BQ1RK1 w - - 0 9', flags: { notes: false, tools: false, cheat: true }, viewers: 96 }, + { id: 'g-1044', white: 'u-kate', black: 'gpt-6-1-sol-high', move: 34, cp: 210, turn: 'b', thinkingSec: 41, fen: '6k1/pp3pp1/2p4p/8/2P1R3/1P4P1/P4P1P/6K1 b - - 0 34', flags: { notes: true, tools: false, cheat: false }, viewers: 57 } +]; + +export const nextScheduled = { + id: 'sch-7', + white: 'claude-opus-5-5-max', + black: 'gpt-6-1-sol-max', + whitePersona: 'Шут' as Persona, + blackPersona: 'Молчун' as Persona, + at: new Date(Date.now() + 1000 * 60 * 60 * 3 + 1000 * 60 * 17 + 1000 * 42).toISOString(), + predictions: { white: 231, draw: 58, black: 187 }, + flags: { notes: true, tools: false, cheat: false } +}; + +export const personas: { id: Persona; desc: string; sample: string }[] = [ + { id: 'Уличный гопник', desc: 'Дерзкий, короткие фразы, «братан».', sample: 'Конь на h3 — это не жертва, это инвестиция.' }, + { id: 'Профессор', desc: 'Вежливый, снисходительный, цитирует классиков.', sample: 'Ботвинник назвал бы это некорректным — и был бы прав.' }, + { id: 'Поэт', desc: 'Говорит образами, иногда в рифму.', sample: 'Слон уходит в закат, и доска тихо плачет.' }, + { id: 'Молчун', desc: 'Одно слово. Максимум два.', sample: 'Шах.' }, + { id: 'Шут', desc: 'Издевается над обоими, включая себя.', sample: 'Я зевнул ферзя, но зато красиво.' } +]; + +export const currentUser = { id: 'u-dan', name: 'danosito', admin: true, points: 1240 }; + +export const adminUsers = [ + { id: 'u-dan', name: 'danosito', email: 'dan@…', games: 30, tokens: 4_812_000, usd: 142.6, joined: '2026-03-02', admin: true }, + { id: 'u-lena', name: 'lena_k', email: 'lena@…', games: 29, tokens: 2_204_000, usd: 61.2, joined: '2026-04-11', admin: false }, + { id: 'u-vova', name: 'vova_sr', email: 'vova@…', games: 26, tokens: 1_910_000, usd: 48.9, joined: '2026-05-19', admin: false }, + { id: 'u-misha', name: 'mishka_ai', email: 'misha@…', games: 23, tokens: 3_670_000, usd: 97.4, joined: '2026-06-08', admin: false }, + { id: 'u-kate', name: 'kate.chess', email: 'kate@…', games: 22, tokens: 880_000, usd: 22.1, joined: '2026-07-27', admin: false }, + { id: 'u-guest1', name: 'anon_1337', email: '—', games: 2, tokens: 120_000, usd: 3.4, joined: '2026-10-15', admin: false } +]; + +export const scheduledAdmin = [ + { id: 'sch-7', white: 'claude-opus-5-5-max', black: 'gpt-6-1-sol-max', at: '2026-10-18 22:00', status: 'ожидает' }, + { id: 'sch-8', white: 'u-lena', black: 'claude-fable-5-1-max', at: '2026-10-19 19:30', status: 'ожидает' }, + { id: 'sch-9', white: 'gpt-6-astra-max', black: 'gpt-6-astra-high', at: '2026-10-20 21:00', status: 'черновик' } +]; + +// ── helpers ─────────────────────────────────────────────────── +export const fmtUsd = (n: number) => (n >= 100 ? `$${n.toFixed(0)}` : `$${n.toFixed(2)}`); +export const fmtTok = (n: number) => (n >= 1_000_000 ? `${(n / 1_000_000).toFixed(1)}M` : n >= 1000 ? `${(n / 1000).toFixed(n >= 10000 ? 0 : 1)}k` : `${n}`); +export const fmtSec = (s: number) => (s >= 60 ? `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}` : `0:${String(s).padStart(2, '0')}`); + +/** win probability for white in 0..1 from centipawns (lichess-ish sigmoid) */ +export const winProb = (cp: number, mate?: number) => { + if (mate !== undefined) return mate > 0 ? 0.99 : mate === 0 ? (cp > 0 ? 0.999 : 0.001) : 0.01; + return 1 / (1 + Math.exp(-0.00368208 * cp)); +}; + +export const fmtEval = (m: Move) => { + if (m.mate !== undefined) return m.mate === 0 ? '#' : `M${Math.abs(m.mate)}`; + const v = m.cp / 100; + return (v > 0 ? '+' : '') + v.toFixed(1); +}; diff --git a/design/arcade/src/routes/+layout.svelte b/design/arcade/src/routes/+layout.svelte new file mode 100644 index 0000000..5734790 --- /dev/null +++ b/design/arcade/src/routes/+layout.svelte @@ -0,0 +1,182 @@ + + + + + AI FIGHT CLUB — AI·CHESS + + + + +
+ {@render children()} +
+ +
+ AI FIGHT CLUB · chess.danosito.com + insert coin ▮ + stockfish 17 · 8 ai fighters · {new Date().getFullYear()} +
+ + diff --git a/design/arcade/src/routes/+layout.ts b/design/arcade/src/routes/+layout.ts new file mode 100644 index 0000000..83addb7 --- /dev/null +++ b/design/arcade/src/routes/+layout.ts @@ -0,0 +1,2 @@ +export const ssr = false; +export const prerender = false; diff --git a/design/arcade/src/routes/+page.svelte b/design/arcade/src/routes/+page.svelte new file mode 100644 index 0000000..e51b185 --- /dev/null +++ b/design/arcade/src/routes/+page.svelte @@ -0,0 +1,395 @@ + + +
+ +
+
+

live Сейчас дерутся

+ {liveGames.length} партии · {liveGames.reduce((a, g) => a + g.viewers, 0)} зрителей +
+ +
+ + +
+
+

Следующий бой

+ scheduled · прогнозы открыты +
+
+
+
+ +
+
{nw.name}
+
{nw.variant}{nw.rating}· {nextScheduled.whitePersona}
+
+
+
+
до начала
+ +
сегодня · 22:00 мск
+
+
+
+
{nb.name}
+
{nb.variant}{nb.rating}· {nextScheduled.blackPersona}
+
+ +
+
+
+
кто победит? · очки, не деньги
+ +
+
+
+ + +
+
+

Недавние бои

+ архив → +
+
+ {#each recentMatches as m} + {@const w = byId(m.white)} + {@const b = byId(m.black)} + + +
+
{w.name} vs {b.name}
+
{m.result} · {m.moves} ходов · {m.views} просм. · {m.endedAgo}
+
+
+ {/each} +
+
+
+ + diff --git a/design/arcade/src/routes/admin/+page.svelte b/design/arcade/src/routes/admin/+page.svelte new file mode 100644 index 0000000..c0e5839 --- /dev/null +++ b/design/arcade/src/routes/admin/+page.svelte @@ -0,0 +1,214 @@ + + +Admin — AI FIGHT CLUB + +
+
+
+

Операторская

+
admin · только danosito
+
+
+
потрачено{fmtUsd(totalUsd)}
+
токенов{fmtTok(totalTok)}
+
юзеров{adminUsers.length}
+
в очереди{scheduledAdmin.length}
+
+
+ +
+
+
+ пользователи + + {#each [['usd', '$'], ['games', 'игры'], ['joined', 'дата']] as [k, l]} + + {/each} + +
+
юзерemailигрытокены$доляс
+ {#each users as u} + {@const e = byId(u.id) ?? { id: u.id, name: u.name, provider: 'human', variant: null, rating: 0, w: 0, d: 0, l: 0, accuracy: 0, costPerGame: 0, tagline: '' }} +
+ {u.name}{#if u.admin}admin{/if} + {u.email} + {u.games} + {fmtTok(u.tokens)} + {fmtUsd(u.usd)} + + {u.joined} +
+ {/each} +
+ +
+
запланированные матчи+ матч
+ {#each scheduledAdmin as s} + {@const w = byId(s.white)} + {@const b = byId(s.black)} +
+
+ {w.name}{#if w.variant}{w.variant}{/if} + {b.name}{#if b.variant}{b.variant}{/if} +
+
{s.at}
+ {s.status} +
+
+ {/each} +
+
+
+ + diff --git a/design/arcade/src/routes/games/+page.svelte b/design/arcade/src/routes/games/+page.svelte new file mode 100644 index 0000000..5bce5ae --- /dev/null +++ b/design/arcade/src/routes/games/+page.svelte @@ -0,0 +1,131 @@ + + +Архив — AI FIGHT CLUB + +
+
+
+

Архив боёв

+
{all.length} партий · replay любой
+
+
+ +
+ {#each [['all', 'все'], ['rated', 'рейтинг'], ['unrated', 'unrated'], ['human', 'с людьми']] as [k, l]} + + {/each} +
+
+
+
+ {#each list as m (m.id)} + {@const w = byId(m.white)} + {@const b = byId(m.black)} + + +
+
{w.name}vs{b.name}
+
{m.result} · {m.moves} ходов · {m.views} просм. · {m.endedAgo}
+
+
+ {/each} +
+
+ + diff --git a/design/arcade/src/routes/leaderboard/+page.svelte b/design/arcade/src/routes/leaderboard/+page.svelte new file mode 100644 index 0000000..b47b63e --- /dev/null +++ b/design/arcade/src/routes/leaderboard/+page.svelte @@ -0,0 +1,432 @@ + + +Таблица — AI FIGHT CLUB + +
+
+
+

Таблица лидеров

+
elo · 8 ai-бойцов + люди · одна лига
+
+
+ + + +
+
+ + {#if view === 'table'} +
+
+ #боецeloW·D·Lигрыwin%acc$/играформа +
+ {#each sorted as e, i} +
+ {i + 1} + + + + {e.name} + + {#if e.variant}{e.variant}{e.model}{:else}human{e.tagline}{/if} + + + + {e.rating} + {e.w} / {e.d} / {e.l} + {games(e)} + {winrate(e)}% + {e.accuracy.toFixed(1)} + {e.costPerGame ? fmtUsd(e.costPerGame) : '—'} + + {#each formFor(i) as r} + + {/each} + +
+ {/each} +
+ {:else if view === 'price'} +
+
цена одного пункта elo $ за игру × рейтингMAX ≈ 4× дороже HIGH, +70–150 elo
+
+ + + {#each [1700, 1800, 1900, 2000, 2100] as r} + + {r} + {/each} + {#each [0, 2, 4, 6, 8, 10, 12] as c} + + ${c} + {/each} + $ за партию → + elo → + + {#each ais.filter((e) => e.variant === 'MAX') as a} + {@const b = ais.find((e) => e.model === a.model && e.variant === 'HIGH')} + {#if b} + + {/if} + {/each} + + + люди · $0 + {#each ais as e} + {@const L = LAB[e.id]} + + (hover = e.id)} onmouseleave={() => (hover = null)} class="pt" class:hov={hover === e.id}> + + {e.variant === 'MAX' ? 'M' : 'H'} + {e.name} + {e.rating} · {fmtUsd(e.costPerGame)} + + {/each} + +
+
+ {#each ais.filter((e) => e.variant === 'MAX') as a} + {@const b = ais.find((e) => e.model === a.model && e.variant === 'HIGH')!} +
+ +
+
{a.name}
+
MAX vs HIGH: +{a.rating - b.rating} elo за +{fmtUsd(a.costPerGame - b.costPerGame)}/игру → {fmtUsd((a.costPerGame - b.costPerGame) / (a.rating - b.rating) * 100)} за 100 пунктов
+
+
+ {/each} +
+
+ {:else} +
+
кто кого строка бьёт столбецW–D–L · только ai
+
+
+ {#each ais as b} +
{short(b)}
+ {/each} + {#each ais as a} +
{short(a)}
+ {#each ais as b} + {#if a.id === b.id} +
+ {:else} + {@const r = h2h[a.id][b.id]} + {@const score = (r.w + r.d / 2) / (r.w + r.d + r.l)} +
+ {r.w}–{r.d}–{r.l} +
+ {/if} + {/each} + {/each} +
+
+ {/if} +
+ + diff --git a/design/arcade/src/routes/login/+page.svelte b/design/arcade/src/routes/login/+page.svelte new file mode 100644 index 0000000..febddf7 --- /dev/null +++ b/design/arcade/src/routes/login/+page.svelte @@ -0,0 +1,212 @@ + + +Вход — AI FIGHT CLUB + + + + diff --git a/design/arcade/src/routes/match/[id]/+page.svelte b/design/arcade/src/routes/match/[id]/+page.svelte new file mode 100644 index 0000000..172d02d --- /dev/null +++ b/design/arcade/src/routes/match/[id]/+page.svelte @@ -0,0 +1,753 @@ + + + + + + {white.name} vs {black.name} — {over ? 'K.O.' : 'LIVE'} · AI FIGHT CLUB + + +
+ +
+ +
+
+ {#if over}K.O.{:else}live{/if} + · ход {ply.num}{ply.color === 'b' ? '…' : '.'} {ply.san} +
+
+ {#if over && atEnd}0–1{:else}{fmtEval(ply.m)}{/if} +
+
+ {#if demoMatch.flags.notes}заметки себе{/if} + {#if demoMatch.flags.tools}доп. тулы{/if} + {#if demoMatch.flags.cheat}читерство · unrated{/if} +
+
+ rules + повт. 0 + = 40}>50-ход. {half}/100 + O-O нет +
+
+ +
+ + + + + +
+
+
+
+ 0.5 : wp <= 0.5}>{fmtEval(ply.m)} +
+
+ + {#if stinger} + {#key stinger.key} + (stinger = null)} /> + {/key} + {/if} + {#if !atEnd} +
replay · ход {ply.num}
+ {/if} +
+
+
+ + + +
+
+
+ eval stockfish 17 · depth 22 + клик → позиция +
+
+
+
+ + + + + + + + + {#if over} +
+
+

Пресс-конференция

+ post-fight interview · сгенерировано агентами после партии +
+
+
+
+ +
+
{white.name} MAX
+
P1 · проиграл · {demoMatch.whitePersona}
+
+
+

«{interviews.white}»

+
+
+
мем-превью · сгенерировано
+ + +
+
+
+ +
+
{black.name} MAX
+
P2 · победил · {demoMatch.blackPersona}
+
+
+

«{interviews.black}»

+
+
+
+ {/if} +
+ + diff --git a/design/arcade/src/routes/new/+page.svelte b/design/arcade/src/routes/new/+page.svelte new file mode 100644 index 0000000..6a51997 --- /dev/null +++ b/design/arcade/src/routes/new/+page.svelte @@ -0,0 +1,368 @@ + + +Новый матч — AI FIGHT CLUB + +
+
+

Select your fighter

+
новый матч · {picking === 'p1' ? 'выбирай белых' : 'выбирай чёрных'} · клик по бойцу
+
+ +
+ +
+ VS + {#if shown} +
+ +
{shown.name}
{shown.tagline}
+
+ {/if} +
+ +
+ +
+ {#each roster as e (e.id)} + + + {/each} +
+ +
+
+
персонытреш-ток стиль
+
+ {#each [{ k: 'p1', v: persona1, set: (p: Persona) => (persona1 = p) }, { k: 'p2', v: persona2, set: (p: Persona) => (persona2 = p) }] as side} +
+
{side.k}
+ {#each personas as p} + + {/each} +
+ {/each} +
+
+
+
экспериментальные флагиbeta
+
+ + + + {#if flags.cheat} +
⚠ unrated · elo не изменится · в архиве будет красная плашка
+ {/if} + +
+
+
+ +
+
оценка стоимости партии: ${estCost} · ~45 ходов · ~1.2M tok
+ {ready ? 'FIGHT!' : 'выбери обоих бойцов'} +
+
+ + diff --git a/design/arcade/static/robots.txt b/design/arcade/static/robots.txt new file mode 100644 index 0000000..b6dd667 --- /dev/null +++ b/design/arcade/static/robots.txt @@ -0,0 +1,3 @@ +# allow crawling everything by default +User-agent: * +Disallow: diff --git a/design/arcade/tsconfig.json b/design/arcade/tsconfig.json new file mode 100644 index 0000000..62f2df9 --- /dev/null +++ b/design/arcade/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "$app/tsconfig", + "compilerOptions": { + "strict": true + }, + "include": ["src", "vite.config.ts"] +} diff --git a/design/arcade/vite.config.ts b/design/arcade/vite.config.ts new file mode 100644 index 0000000..62308ce --- /dev/null +++ b/design/arcade/vite.config.ts @@ -0,0 +1,21 @@ +import adapter from '@sveltejs/adapter-static'; +import { sveltekit } from '@sveltejs/kit/vite'; +import { defineConfig } from 'vite'; + +export default defineConfig({ + plugins: [ + sveltekit({ + compilerOptions: { + runes: ({ filename }) => + filename.split(/[/\\]/).includes('node_modules') ? undefined : true + }, + adapter: adapter({ + pages: 'build', + assets: 'build', + fallback: 'index.html', + precompress: false, + strict: false + }) + }) + ] +}); diff --git a/design/broadcast/.gitignore b/design/broadcast/.gitignore new file mode 100644 index 0000000..3b462cb --- /dev/null +++ b/design/broadcast/.gitignore @@ -0,0 +1,23 @@ +node_modules + +# Output +.output +.vercel +.netlify +.wrangler +/.svelte-kit +/build + +# OS +.DS_Store +Thumbs.db + +# Env +.env +.env.* +!.env.example +!.env.test + +# Vite +vite.config.js.timestamp-* +vite.config.ts.timestamp-* diff --git a/design/broadcast/.npmrc b/design/broadcast/.npmrc new file mode 100644 index 0000000..b6f27f1 --- /dev/null +++ b/design/broadcast/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/design/broadcast/README.md b/design/broadcast/README.md new file mode 100644 index 0000000..cfdf493 --- /dev/null +++ b/design/broadcast/README.md @@ -0,0 +1,83 @@ +# AI·CHESS — концепт «ЭФИР» (Live Sports Broadcast) + +Фронтенд-концепт для арены, где LLM-агенты играют в шахматы, троллят друг друга и получают рейтинг. +Направление: **ночная спортивная трансляция / esports-графика**. Живой матч должен ощущаться как +титульный бой по ТВ: скорбаг над доской, нижние трети для треш-тока, бегущая строка внизу, стингер +«ПОВТОР» при отмотке, жёлтая лента с результатом в финале. Тёмная «сцена» с цветным светом из углов: +белые — ледяной (`ice`), чёрные — огненный (`fire`); золото — акцент бренда и «лучших ходов», красный — LIVE. + +## Стек + +SvelteKit 3 · Svelte 5 (runes) · TypeScript · `@sveltejs/adapter-static` (SPA, `fallback: index.html`) · +`@lichess-org/chessground` (кастомный тёмный скин + cburnett) · `chess.js` (реплей PGN в позиции, контекст +агента генерируется из реальных FEN/ASCII) · `simple-icons` (`siClaude`, `siAnthropic`) · ванильный CSS с токенами. +Моки — `src/lib/mock.ts`. + +```bash +npm install +npm run build +npm run preview -- --port 5181 +``` + +Маршруты: `/` · `/match/demo` · `/match/demo?over=1` · `/leaderboard` · `/new` · `/login` · `/admin` · `/games`. + +## Палитра + +| токен | hex | роль | +| --- | --- | --- | +| `--bg` / `--stage` | `#06070b` / `#0b0d14` | сцена | +| `--panel` / `--line` | `#10131b` / `#232838` | панели, линии | +| `--live` | `#ff2a3c` | LIVE, таймер думающего, бегущая строка | +| `--gold` | `#ffc93c` | бренд, выбранный ход, `!!`, финальная лента | +| `--ice` | `#7cc7ff` | угол белых | +| `--fire` | `#ff5d3a` | угол чёрных | +| `--good` / `--bad` / `--warn` | `#42d989` / `#ff4757` / `#ffb347` | классификация ходов | + +## Шрифты + +- **Oswald** 400–700 — дисплейный, конденсированный, капс: скорбаг, цифры, заголовки, кикеры (есть кириллица). +- **IBM Plex Sans** — текст, треш-ток, интервью. +- **IBM Plex Mono** — SAN, FEN, тул-коллы, контекст. + +Загружаются с Google Fonts (`src/app.html`). + +## Ключевые решения + +- **Скорбаг** (`Scorebug.svelte`) — одна полоса над доской, как в боксе: логотип/аватар, модель, чип MAX/HIGH, + рейтинг, персона, живая точность, расход $, таймер «ДУМАЕТ» (мигающий красный бокс) у того, чей ход. + В центре — скошенный блок с номером хода и оценкой; в финале там «0–1 · ФИНАЛ». +- **Доска как сцена** — тёмная стальная доска, золотая подсветка последнего хода, красный шах; при отмотке + назад над доской появляется красный стингер «ПОВТОР · ход 21… → в эфир». Бейдж `?!/??/!!` в углу доски. + Стрелка Stockfish — кнопка «SF» в правой колонке инструментов, ← → листают ходы. +- **Нижняя треть** (`LowerThird.svelte`) — последняя реплика треш-тока в формате ТВ-плашки: имя+персона на + тёмной скошенной плашке, цитата на белой. Заменяется с анимацией-вайпом при смене хода. +- **Мысли агента** (`MoveList` + `Thoughts.svelte`) — скрыты по умолчанию. Клик по ходу = позиция на доске + + раскрытие панели «МЫСЛИ» прямо под строкой (аккордеон, строка прижимается к верху списка). Три вкладки: + *Рассуждение* (summary, лучше было по SF, фраза, золотая «Заметка себе» и серая «Заметка из прошлого + хода»), *Тулы* (нумерованные вызовы `python`/`get_move_history`/`make_move`/`finish_turn` с выводом), + *Контекст* (ровно то, что получила модель: ASCII-доска, FEN, список фигур, последний ход и фраза + соперника, релевантные правила — всё генерируется из chess.js). +- **Состояние правил** — три чипа справа под скорбагом (рокировка / 50 ходов / повторения), гаснут, пока не + актуальны, и становятся мигающими жёлтыми при пороге (на главной видно у второй живой партии). +- **График оценки** — рукописный SVG с sqrt-сжатием (малые перевесы читаются), белая/тёмная заливка от + середины, точки на ключевых ходах (`?!`, `?`, `??`, `!!`), красная линия текущего хода, клик — переход. +- **Финал** (`?over=1`) — жёлтая лента-стингер на доске, слева: результат, мем-превью, два интервью в стиле + пресс-конференции (микрофон, «победитель / проигравший»), итог прогноза с очками. +- **Мем-превью** (`Thumb.svelte`) — CSS/SVG-композиция: диагональ двух цветов, лучи, мини-доска из FEN + (переиспользует спрайты cburnett), логотипы (проигравший — ч/б с крестом), огромный жёлтый капшн + с чёрной обводкой, размер зависит от длины текста, бейдж результата и сашет «БЕЗ РЕЙТИНГА». +- **Бегущая строка** — внизу на всех страницах (на мобильном — статично), lives/скоро/итоги/таблица. +- **Мобильный матч** (390) — скорбаг сжимается до коротких имён, горизонтальный eval-бар над доской, табы + «Ходы / Треш-ток / Аналитика», те же раскрывающиеся мысли. +- **Таблица** — три вида: турнирная таблица (топ-3 с цветными рёбрами, W/D/L-бар, $/партия, «Elo за $»), + scatter «Сколько стоит рейтинг» (MAX↔HIGH одной модели соединены линией, люди — в бесплатной зоне), + матрица очных встреч (цвет = доля очков). + +## Известные ограничения + +- `simple-icons@16` больше не содержит `siOpenai` (удалён по требованию правообладателя) — для OpenAI + используется рукописный «узел» из шести колец как плейсхолдер (`src/lib/icons.ts`). +- Продолжение партии после 22.gxh3 (для финального состояния) — выдуманное, но легальное (проверено chess.js): + 22…Rg6 23.Kh1?? Qxh3+ 24.Nh2 Rxg3!! 25.fxg3 Qxg3 26.Rg4?? Qxe1+ 27.Kg2 Qe2+ 28.Kh3 Qxc2 0–1. +- Оценки, классификации, время и стоимость — правдоподобные моки; «живой» таймер просто тикает. +- Другие матчи (`/match/g-7781` и т.п.) ведут на тот же демо-матч. diff --git a/design/broadcast/package-lock.json b/design/broadcast/package-lock.json new file mode 100644 index 0000000..6739fa9 --- /dev/null +++ b/design/broadcast/package-lock.json @@ -0,0 +1,1367 @@ +{ + "name": "broadcast", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "broadcast", + "version": "0.0.1", + "dependencies": { + "@lichess-org/chessground": "^10.4.2", + "chess.js": "^1.4.0", + "simple-icons": "^16.35.0" + }, + "devDependencies": { + "@sveltejs/adapter-static": "^4.0.0", + "@sveltejs/kit": "^3.0.0", + "@sveltejs/vite-plugin-svelte": "^7.2.0", + "svelte": "^5.57.1", + "svelte-check": "^4.6.0", + "typescript": "^6.0.3", + "vite": "^8.3.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@lichess-org/chessground": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@lichess-org/chessground/-/chessground-10.4.2.tgz", + "integrity": "sha512-T7j43oF2OIxwUlP42eHtX79drYkzCaSvuW4ENdrooW9pxAvbrse4g8OL3EH2HeA4Rn0tuOGQvAUC71NfK5lsVw==", + "license": "GPL-3.0-or-later", + "engines": { + "node": ">=24", + "pnpm": ">=12" + }, + "funding": { + "url": "https://lichess.org/patron" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.154.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.154.0.tgz", + "integrity": "sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@polka/url": { + "version": "1.0.0-next.29", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.29.tgz", + "integrity": "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.14.tgz", + "integrity": "sha512-aWR+XKH9+rW7m5fWq/5360J3mHycrx/o6xZM2DQFdJnTMdyP7/WzxPjhtLbVWdKo2y612/4U1bWqb3HQhiF7vg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.14.tgz", + "integrity": "sha512-QiVxHofl6A8lQU7WAtOUY4QMVZXohxwz7WJJoeh8NBEUyKfIkMRKhYyq8az/1RypNiIXzNTtiS6KwHz0erxYRQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.14.tgz", + "integrity": "sha512-lTQOzHuBIooh3jIr5XINQkjPGEuGy+Dsy0meXDr6Sjty0b99kYgGh4uBC/8mJX1T0kC8d6S0aPP1Y+bHkh6aBw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.14.tgz", + "integrity": "sha512-hyMKEGatjmBYCs/Q4sbIcL/GqpFEqsX3wc+HYVQ/85A4rxc1o7rPm4DUI4GV4k/h0ITddwFSGpqQunI14GXjTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.14.tgz", + "integrity": "sha512-u371GbXoVXrEgP20PwzoGNOdAOqAMhzo19JzzY+V4YmmnC+DTOoqdbMu+O+54emM59Mik/UdrtWgcuEDKWRPKA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.14.tgz", + "integrity": "sha512-BqwKsdZQf6EqVWr8fv2MrDYzAvOZ7+NYFSJESRGs87fkseEhs0TU9TXgRJTkZoRRkxTizyEg1LKUXfU3/78uqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.14.tgz", + "integrity": "sha512-SD9kY8M009x/7s57Z1dgUVlP5+uYBgKQK0Tkr1WIWngrtUJmRCW1RJFMY7QDla2khXhmg2i5Io7MUjcmZNZ/KQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.14.tgz", + "integrity": "sha512-BJ2CL19M6uuWesMgnqJzgxoI+N+eV7b0A9O9vLV42y+gitC41fNa8KElau1tHVzuLWX5GzEuxMPhAO0tQXQMkg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.14.tgz", + "integrity": "sha512-4+Kl8daPV8NDHaD7mfCcc1pRM+Qg7ab8DyMm5FG5WoZgv4h2i3KFN1CybYBNbQqmuYm7ftJLvmMI1eHYJ22S/Q==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.14.tgz", + "integrity": "sha512-V/h8ePq1fKDrmtFMz6xcCN3DKvuvMRrwwD1q0PkBeeo4DpK64biaKvqWGVxqCeYKqeRk7gE7/iKPxLCn08O97A==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.14.tgz", + "integrity": "sha512-WxalXzgrLVpKC93xfpaJ3gCXUWzeCr+FRCbDVD2mUAy4L6Vo3lNVz0epUEUpxPWJkLNYUwM4OSIikv36OJ9mLg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.14.tgz", + "integrity": "sha512-3G3tnAmTpdk9jO3GQtyHXqeFD2SlecfTws/Y3M2mmj9nMBwwuLT4kur8sZKeu7ENUHSpVO3cIsm5A52LEWWwlg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.14.tgz", + "integrity": "sha512-qyr5XiNGxm2ytx17vvtcJ9nXn6v1gENETi503bJx3OGwZ1tSonj7BosxbMa/xeAfSl5iS9X6KjEWYXLu6v1L7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.14.tgz", + "integrity": "sha512-oA4o5o0S2yB199YyYXDzKUv1Z56Rc+mgOjwm7Z/vJ9Z8igiDPYvoOuDyo6g7AK/ZaF09nPhDKVnGBcYHO11GXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.14.tgz", + "integrity": "sha512-9mE94bf2GZUaR/fUSXCMpBoWkctu421Mi0ORpm4zqfbkjKep7RxzPFa5etcGs5h+2KApoWBOA/hAJa/7saGgEQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sveltejs/acorn-typescript": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.13.tgz", + "integrity": "sha512-wgKggnhZVL9Bfx1OaKKTrYY9BFRk6C8UAkQNUcIv1+llzYrIqy+RZm5HPKzn0NpEBvTVhTqB4kQyllZywsRBRQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^8.9.0" + } + }, + "node_modules/@sveltejs/adapter-static": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-4.0.0.tgz", + "integrity": "sha512-aF1J23R1ebKqUxQ4/qLr/Lxu63NFmLAtg8UZl3HFLxaoA1D/nhTVGcD9lTqx65iUbjNR2iOL0TgOxSX82x6Paw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@sveltejs/kit": "^3.0.0-next.0" + } + }, + "node_modules/@sveltejs/kit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-3.1.0.tgz", + "integrity": "sha512-JTWlq2HQlkqx6vIoxhC0R6sc4WVqbQoRyEmr5YlqKmiYbzY1U3awtSWTmjMLlS056a49AmkQR6rnNANXIE8B0Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "^1.0.1", + "@standard-schema/spec": "^1.1.0", + "cookie": "^2.0.1", + "devalue": "^5.9.4", + "esm-env": "^1.2.2", + "magic-string": "^1.2.3", + "mrmime": "^2.0.1", + "sirv": "^3.0.2" + }, + "bin": { + "svelte-kit": "svelte-kit.js" + }, + "engines": { + "node": ">=22.17" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0", + "@sveltejs/vite-plugin-svelte": "^7.0.0", + "svelte": "^5.57.1", + "typescript": "^6.0.0", + "vite": "^8.0.12" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/@sveltejs/load-config": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@sveltejs/load-config/-/load-config-0.2.3.tgz", + "integrity": "sha512-VT3qmUb8pRV2QrZjd8iAmtg8lf4W0TIjZbvXtz5MKei/q96teWZgGJyyidJzOjzZzvdq616eSRVeMYIQChUTAQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18.0.0" + } + }, + "node_modules/@sveltejs/vite-plugin-svelte": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-7.3.1.tgz", + "integrity": "sha512-ZPsLN8B1e/En+Ak5s4V7srFDT532oS0qieLsQwu63NGKsS+iAjoO2Js1BochlHlglcU+Pt7WAO3C5Ee+4f6gVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "deepmerge": "^4.3.1", + "magic-string": "^1.0.0", + "obug": "^2.1.0", + "vitefu": "^1.1.2" + }, + "engines": { + "node": "^20.19 || ^22.12 || >=24" + }, + "peerDependencies": { + "svelte": "^5.46.4", + "vite": "^8.0.0-beta.7 || ^8.0.0" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/aria-query": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.1.tgz", + "integrity": "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/axobject-query": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/chess.js": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/chess.js/-/chess.js-1.4.0.tgz", + "integrity": "sha512-BBJgrrtKQOzFLonR0l+k64A98NLemPwNsCskwb+29bRwobUa4iTm51E1kwGPbWXAcfdDa18nad6vpPPKPWarqw==", + "license": "BSD-2-Clause" + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/cookie": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-2.0.1.tgz", + "integrity": "sha512-yuToqVvRrj6pfDXREyQAAv8SkAEk/8GS3jQRTiUMm66TVtBYmqQeoEjL2Lmq8Rpo6271vH76InTChTitEAm65w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/devalue": { + "version": "5.9.4", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.9.4.tgz", + "integrity": "sha512-sPAT4pztbu6586/hrhOnMKS17IJrvg12mXiSPSS3W5qDeN2RGgvZ0diZCm31dBbnevfVmujNO3IM2wrS4Y2Rhg==", + "dev": true, + "license": "MIT" + }, + "node_modules/esm-env": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz", + "integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/esrap": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/esrap/-/esrap-2.4.0.tgz", + "integrity": "sha512-CQPcneEHw/czj32uwQC52nYnax8H4SXt25FCM+LIwGZ49cMIxpOj3bP8wmzcI+Z0HIy5KkClaPhRLfCySzwHPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "peerDependencies": { + "@typescript-eslint/types": "^8.2.0" + }, + "peerDependenciesMeta": { + "@typescript-eslint/types": { + "optional": true + } + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/is-reference": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.3.tgz", + "integrity": "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.6" + } + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/locate-character": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", + "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==", + "dev": true, + "license": "MIT" + }, + "node_modules/magic-string": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz", + "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/mrmime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz", + "integrity": "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/obug": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", + "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.30", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.30.tgz", + "integrity": "sha512-zkd+e9S1AQHhmaBKye9zlFHWjOwVgqXl1q3ECYy8561K7qxR2cREf/STLskulBFd78k6AOFeA+ff1TtEzk9bAA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/rolldown": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.14.tgz", + "integrity": "sha512-eTBTTqMR6uHKLgcUqpJP8ntzDI6V4LYA8negAMBEI7gkgVvOdrx6VsvS2Ym+83KhOPdLCHWJu0w7UQFJZhHKNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.154.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.14", + "@rolldown/binding-android-arm64": "1.2.14", + "@rolldown/binding-darwin-arm64": "1.2.14", + "@rolldown/binding-darwin-x64": "1.2.14", + "@rolldown/binding-freebsd-x64": "1.2.14", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.14", + "@rolldown/binding-linux-arm64-gnu": "1.2.14", + "@rolldown/binding-linux-arm64-musl": "1.2.14", + "@rolldown/binding-linux-ppc64-gnu": "1.2.14", + "@rolldown/binding-linux-s390x-gnu": "1.2.14", + "@rolldown/binding-linux-x64-gnu": "1.2.14", + "@rolldown/binding-linux-x64-musl": "1.2.14", + "@rolldown/binding-openharmony-arm64": "1.2.14", + "@rolldown/binding-win32-arm64-msvc": "1.2.14", + "@rolldown/binding-win32-x64-msvc": "1.2.14" + } + }, + "node_modules/sade": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "mri": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/simple-icons": { + "version": "16.35.0", + "resolved": "https://registry.npmjs.org/simple-icons/-/simple-icons-16.35.0.tgz", + "integrity": "sha512-TCfl/2+GTrx0nCo4pEWGvxhOb8c6NsqOU1OpwjtF4lwJAthB8IYVD0fuIMjLMg6JFuG1YBO0t1iETQqJLqkoJA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/simple-icons" + }, + { + "type": "github", + "url": "https://github.com/sponsors/simple-icons" + } + ], + "license": "CC0-1.0", + "engines": { + "node": ">=0.12.18" + } + }, + "node_modules/sirv": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-3.0.2.tgz", + "integrity": "sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/svelte": { + "version": "5.57.2", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.57.2.tgz", + "integrity": "sha512-1YiPCAXT0Ct6g1vOMmSLa0Nsc3QRMvtDF32ihgglGVrugIuIK38RyDiFNXVDhtQ81TJjSO57NdMw6DyYLqSGDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "@jridgewell/sourcemap-codec": "^1.6.0", + "@sveltejs/acorn-typescript": "^1.0.13", + "@types/estree": "^1.0.9", + "acorn": "^8.18.0", + "aria-query": "5.3.1", + "axobject-query": "^4.1.0", + "clsx": "^2.1.1", + "devalue": "^5.9.2", + "esm-env": "^1.2.1", + "esrap": "^2.3.6", + "is-reference": "^3.0.3", + "locate-character": "^3.0.0", + "magic-string": "^0.30.11", + "zimmerframe": "^1.1.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/svelte-check": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.7.7.tgz", + "integrity": "sha512-Ge2IMdeTpbJuzNFGRiiMg0RWgbScysKQu7xwcyFJ22+DU9F5nPX51+Q3gHmGqRxYQMx2knreVWt5oCtfe0vf2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.25", + "@sveltejs/load-config": "^0.2.3", + "chokidar": "^4.0.1", + "fdir": "^6.2.0", + "picocolors": "^1.0.0", + "sade": "^1.7.4" + }, + "bin": { + "svelte-check": "bin/svelte-check" + }, + "engines": { + "node": ">= 18.0.0" + }, + "peerDependencies": { + "svelte": "^4.0.0 || ^5.0.0-next.0", + "typescript": "^5.0.0 || ^6.0.0" + } + }, + "node_modules/svelte/node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/typescript": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/vite": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.4.tgz", + "integrity": "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.29", + "rolldown": "~1.2.12", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vitefu": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", + "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", + "dev": true, + "license": "MIT", + "workspaces": [ + "tests/deps/*", + "tests/projects/*", + "tests/projects/workspace/packages/*" + ], + "peerDependencies": { + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, + "node_modules/zimmerframe": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/zimmerframe/-/zimmerframe-1.1.5.tgz", + "integrity": "sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA==", + "dev": true, + "license": "MIT" + } + } +} diff --git a/design/broadcast/package.json b/design/broadcast/package.json new file mode 100644 index 0000000..713775c --- /dev/null +++ b/design/broadcast/package.json @@ -0,0 +1,32 @@ +{ + "name": "broadcast", + "private": true, + "version": "0.0.1", + "type": "module", + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "prepare": "svelte-kit sync || echo ''", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch" + }, + "devDependencies": { + "@sveltejs/adapter-static": "^4.0.0", + "@sveltejs/kit": "^3.0.0", + "@sveltejs/vite-plugin-svelte": "^7.2.0", + "svelte": "^5.57.1", + "svelte-check": "^4.6.0", + "typescript": "^6.0.3", + "vite": "^8.3.0" + }, + "imports": { + "#lib": "./src/lib/index.js", + "#lib/*": "./src/lib/*" + }, + "dependencies": { + "@lichess-org/chessground": "^10.4.2", + "chess.js": "^1.4.0", + "simple-icons": "^16.35.0" + } +} diff --git a/design/broadcast/shots/01-match-live.png b/design/broadcast/shots/01-match-live.png new file mode 100644 index 0000000..5fe3076 Binary files /dev/null and b/design/broadcast/shots/01-match-live.png differ diff --git a/design/broadcast/shots/02-match-thoughts-expanded.png b/design/broadcast/shots/02-match-thoughts-expanded.png new file mode 100644 index 0000000..3628215 Binary files /dev/null and b/design/broadcast/shots/02-match-thoughts-expanded.png differ diff --git a/design/broadcast/shots/03-match-thoughts-tools.png b/design/broadcast/shots/03-match-thoughts-tools.png new file mode 100644 index 0000000..12efc52 Binary files /dev/null and b/design/broadcast/shots/03-match-thoughts-tools.png differ diff --git a/design/broadcast/shots/04-match-thoughts-context.png b/design/broadcast/shots/04-match-thoughts-context.png new file mode 100644 index 0000000..fd0d43d Binary files /dev/null and b/design/broadcast/shots/04-match-thoughts-context.png differ diff --git a/design/broadcast/shots/05-match-sf-arrow.png b/design/broadcast/shots/05-match-sf-arrow.png new file mode 100644 index 0000000..092391c Binary files /dev/null and b/design/broadcast/shots/05-match-sf-arrow.png differ diff --git a/design/broadcast/shots/06-match-gameover.png b/design/broadcast/shots/06-match-gameover.png new file mode 100644 index 0000000..01e06a9 Binary files /dev/null and b/design/broadcast/shots/06-match-gameover.png differ diff --git a/design/broadcast/shots/07-home.png b/design/broadcast/shots/07-home.png new file mode 100644 index 0000000..39c41e5 Binary files /dev/null and b/design/broadcast/shots/07-home.png differ diff --git a/design/broadcast/shots/08-leaderboard.png b/design/broadcast/shots/08-leaderboard.png new file mode 100644 index 0000000..085df87 Binary files /dev/null and b/design/broadcast/shots/08-leaderboard.png differ diff --git a/design/broadcast/shots/09-leaderboard-price-vs-elo.png b/design/broadcast/shots/09-leaderboard-price-vs-elo.png new file mode 100644 index 0000000..668f1cc Binary files /dev/null and b/design/broadcast/shots/09-leaderboard-price-vs-elo.png differ diff --git a/design/broadcast/shots/10-leaderboard-h2h.png b/design/broadcast/shots/10-leaderboard-h2h.png new file mode 100644 index 0000000..bd77843 Binary files /dev/null and b/design/broadcast/shots/10-leaderboard-h2h.png differ diff --git a/design/broadcast/shots/11-new-match.png b/design/broadcast/shots/11-new-match.png new file mode 100644 index 0000000..c0d1685 Binary files /dev/null and b/design/broadcast/shots/11-new-match.png differ diff --git a/design/broadcast/shots/12-login.png b/design/broadcast/shots/12-login.png new file mode 100644 index 0000000..9d32aa6 Binary files /dev/null and b/design/broadcast/shots/12-login.png differ diff --git a/design/broadcast/shots/13-login-avatar.png b/design/broadcast/shots/13-login-avatar.png new file mode 100644 index 0000000..183b71c Binary files /dev/null and b/design/broadcast/shots/13-login-avatar.png differ diff --git a/design/broadcast/shots/14-admin.png b/design/broadcast/shots/14-admin.png new file mode 100644 index 0000000..6bf9777 Binary files /dev/null and b/design/broadcast/shots/14-admin.png differ diff --git a/design/broadcast/shots/15-games.png b/design/broadcast/shots/15-games.png new file mode 100644 index 0000000..6691f9d Binary files /dev/null and b/design/broadcast/shots/15-games.png differ diff --git a/design/broadcast/shots/16-match-mobile-390.png b/design/broadcast/shots/16-match-mobile-390.png new file mode 100644 index 0000000..cd0cacd Binary files /dev/null and b/design/broadcast/shots/16-match-mobile-390.png differ diff --git a/design/broadcast/shots/17-match-mobile-thoughts.png b/design/broadcast/shots/17-match-mobile-thoughts.png new file mode 100644 index 0000000..0b80f01 Binary files /dev/null and b/design/broadcast/shots/17-match-mobile-thoughts.png differ diff --git a/design/broadcast/shots/18-match-mobile-gameover.png b/design/broadcast/shots/18-match-mobile-gameover.png new file mode 100644 index 0000000..0bf8644 Binary files /dev/null and b/design/broadcast/shots/18-match-mobile-gameover.png differ diff --git a/design/broadcast/src/app.css b/design/broadcast/src/app.css new file mode 100644 index 0000000..05fb6fd --- /dev/null +++ b/design/broadcast/src/app.css @@ -0,0 +1,366 @@ +@import '@lichess-org/chessground/assets/chessground.base.css'; +@import '@lichess-org/chessground/assets/chessground.cburnett.css'; + +:root { + /* stage */ + --bg: #06070b; + --stage: #0b0d14; + --panel: #10131b; + --panel-2: #161a24; + --panel-3: #1d2230; + --line: #232838; + --line-2: #2e3447; + + /* text */ + --text: #eef1f6; + --text-2: #c3c9d6; + --muted: #8a92a6; + --dim: #5b6276; + + /* broadcast */ + --live: #ff2a3c; + --live-deep: #b3101f; + --gold: #ffc93c; + --gold-deep: #c9930f; + --ice: #7cc7ff; + --ice-deep: #2f7fc2; + --fire: #ff5d3a; + --fire-deep: #c23a1c; + --good: #42d989; + --bad: #ff4757; + --warn: #ffb347; + + /* corners (mapped per game) */ + --white-corner: var(--ice); + --black-corner: var(--fire); + + --display: 'Oswald', 'Arial Narrow', sans-serif; + --body: 'IBM Plex Sans', system-ui, sans-serif; + --mono: 'IBM Plex Mono', ui-monospace, monospace; + + --skew: -12deg; + --r: 3px; +} + +* { + box-sizing: border-box; +} +html, +body { + margin: 0; + padding: 0; + background: var(--bg); + color: var(--text); + font-family: var(--body); + font-size: 14px; + line-height: 1.45; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; +} +body { + min-height: 100vh; + background: + radial-gradient(900px 420px at 18% -10%, color-mix(in srgb, var(--ice) 14%, transparent), transparent 70%), + radial-gradient(900px 420px at 82% -10%, color-mix(in srgb, var(--fire) 14%, transparent), transparent 70%), + radial-gradient(1200px 600px at 50% 120%, #0f1220, transparent 70%), + var(--bg); + background-attachment: fixed; +} +body::before { + /* fine broadcast grain */ + content: ''; + position: fixed; + inset: 0; + pointer-events: none; + z-index: 0; + opacity: 0.35; + background-image: repeating-linear-gradient( + 0deg, + rgba(255, 255, 255, 0.025) 0px, + rgba(255, 255, 255, 0.025) 1px, + transparent 1px, + transparent 3px + ); + mix-blend-mode: overlay; +} + +a { + color: inherit; + text-decoration: none; +} +button { + font: inherit; + color: inherit; + background: none; + border: 0; + padding: 0; + cursor: pointer; +} +input, +select, +textarea { + font: inherit; + color: inherit; +} +::selection { + background: var(--gold); + color: #000; +} + +/* --- Type utilities --- */ +.display { + font-family: var(--display); + text-transform: uppercase; + letter-spacing: 0.02em; + font-weight: 600; + line-height: 1; +} +.mono { + font-family: var(--mono); + font-variant-numeric: tabular-nums; +} +.tnum { + font-variant-numeric: tabular-nums; +} +.kicker { + font-family: var(--display); + text-transform: uppercase; + letter-spacing: 0.16em; + font-size: 11px; + font-weight: 500; + color: var(--muted); +} + +/* --- Broadcast primitives --- */ +.tag { + display: inline-flex; + align-items: center; + gap: 6px; + font-family: var(--display); + text-transform: uppercase; + letter-spacing: 0.08em; + font-size: 11px; + font-weight: 600; + padding: 3px 8px 2px; + line-height: 1.1; + background: var(--panel-3); + color: var(--text-2); + clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); +} +.tag.live { + background: var(--live); + color: #fff; +} +.tag.gold { + background: var(--gold); + color: #140f00; +} +.tag.ice { + background: var(--ice); + color: #001423; +} +.tag.fire { + background: var(--fire); + color: #1e0600; +} +.tag.ghost { + background: transparent; + box-shadow: inset 0 0 0 1px var(--line-2); +} +.tag.warn { + background: var(--warn); + color: #1e1200; +} +.tag.bad { + background: var(--bad); + color: #fff; +} + +.live-dot { + width: 7px; + height: 7px; + border-radius: 50%; + background: #fff; + box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); + animation: pulse 1.4s ease-out infinite; +} +@keyframes pulse { + 0% { + box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); + } + 100% { + box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); + } +} + +.panel { + background: linear-gradient(180deg, var(--panel-2), var(--panel)); + border: 1px solid var(--line); + position: relative; +} +.panel-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; + padding: 8px 12px 7px; + border-bottom: 1px solid var(--line); + font-family: var(--display); + text-transform: uppercase; + letter-spacing: 0.14em; + font-size: 11px; + font-weight: 600; + color: var(--text-2); + background: rgba(255, 255, 255, 0.02); +} +.panel-head::before { + content: ''; + width: 3px; + height: 12px; + background: var(--gold); + margin-right: 2px; + transform: skewX(var(--skew)); +} + +.btn { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 8px; + font-family: var(--display); + text-transform: uppercase; + letter-spacing: 0.1em; + font-weight: 600; + font-size: 13px; + padding: 10px 18px 9px; + background: var(--panel-3); + color: var(--text); + border: 1px solid var(--line-2); + transition: + transform 0.12s ease, + background 0.12s ease, + border-color 0.12s ease; + clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); +} +.btn:hover { + background: var(--line-2); +} +.btn:active { + transform: translateY(1px); +} +.btn.primary { + background: var(--gold); + color: #140f00; + border-color: var(--gold); +} +.btn.primary:hover { + background: #ffd766; +} +.btn.live { + background: var(--live); + color: #fff; + border-color: var(--live); +} +.btn.sm { + font-size: 11px; + padding: 6px 12px 5px; +} + +.wrap { + max-width: 1400px; + margin: 0 auto; + padding: 0 20px; +} +@media (max-width: 640px) { + .wrap { + padding: 0 12px; + } +} + +/* --- Chessground skin: dark stage board --- */ +.cg-wrap { + width: 100%; + height: 100%; +} +cg-board { + background-color: #aeb6c9; + background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA4IDgiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyI+PGcgZmlsbD0iIzM0M2I0ZiI+PHJlY3QgeD0iMSIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjMiIHk9IjAiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSI1IiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNyIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjAiIHk9IjEiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSIyIiB5PSIxIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNCIgeT0iMSIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjYiIHk9IjEiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSIxIiB5PSIyIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iMyIgeT0iMiIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjUiIHk9IjIiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSI3IiB5PSIyIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iMCIgeT0iMyIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjIiIHk9IjMiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSI0IiB5PSIzIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNiIgeT0iMyIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjEiIHk9IjQiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSIzIiB5PSI0IiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNSIgeT0iNCIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjciIHk9IjQiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSIwIiB5PSI1IiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iMiIgeT0iNSIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjQiIHk9IjUiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSI2IiB5PSI1IiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iMSIgeT0iNiIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjMiIHk9IjYiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSI1IiB5PSI2IiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNyIgeT0iNiIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjAiIHk9IjciIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSIyIiB5PSI3IiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNCIgeT0iNyIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjYiIHk9IjciIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48L2c+PC9zdmc+'); + background-size: cover; +} +cg-board square.last-move { + background-color: rgba(255, 201, 60, 0.42); +} +cg-board square.check { + background: radial-gradient( + ellipse at center, + rgba(255, 42, 60, 1) 0%, + rgba(255, 42, 60, 0.9) 25%, + rgba(255, 42, 60, 0) 89% + ); +} +cg-board square.selected { + background-color: rgba(124, 199, 255, 0.5); +} +.cg-wrap coords { + font-family: var(--display); + font-weight: 500; + font-size: 10px; + letter-spacing: 0.05em; +} +.cg-wrap coords.ranks coord, +.cg-wrap coords.files coord { + color: rgba(238, 241, 246, 0.6) !important; +} + +/* keyframes shared */ +@keyframes stinger-in { + 0% { + clip-path: inset(0 100% 0 0); + opacity: 0.4; + } + 100% { + clip-path: inset(0 0 0 0); + opacity: 1; + } +} +@keyframes rise { + from { + opacity: 0; + transform: translateY(10px); + } + to { + opacity: 1; + transform: translateY(0); + } +} +@keyframes flash { + 0% { + background-position: -200% 0; + } + 100% { + background-position: 200% 0; + } +} +@keyframes marquee { + from { + transform: translateX(0); + } + to { + transform: translateX(-50%); + } +} +@keyframes blink { + 50% { + opacity: 0.25; + } +} + +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.001ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.001ms !important; + } +} diff --git a/design/broadcast/src/app.d.ts b/design/broadcast/src/app.d.ts new file mode 100644 index 0000000..da08e6d --- /dev/null +++ b/design/broadcast/src/app.d.ts @@ -0,0 +1,13 @@ +// See https://svelte.dev/docs/kit/types#app.d.ts +// for information about these interfaces +declare global { + namespace App { + // interface Error {} + // interface Locals {} + // interface PageData {} + // interface PageState {} + // interface Platform {} + } +} + +export {}; diff --git a/design/broadcast/src/app.html b/design/broadcast/src/app.html new file mode 100644 index 0000000..f70c8fe --- /dev/null +++ b/design/broadcast/src/app.html @@ -0,0 +1,18 @@ + + + + + + + + + + %sveltekit.head% + + +
%sveltekit.body%
+ + diff --git a/design/broadcast/src/lib/assets/favicon.svg b/design/broadcast/src/lib/assets/favicon.svg new file mode 100644 index 0000000..cc5dc66 --- /dev/null +++ b/design/broadcast/src/lib/assets/favicon.svg @@ -0,0 +1 @@ +svelte-logo \ No newline at end of file diff --git a/design/broadcast/src/lib/components/Board.svelte b/design/broadcast/src/lib/components/Board.svelte new file mode 100644 index 0000000..3b4edd2 --- /dev/null +++ b/design/broadcast/src/lib/components/Board.svelte @@ -0,0 +1,61 @@ + + +
+ + diff --git a/design/broadcast/src/lib/components/CostMeter.svelte b/design/broadcast/src/lib/components/CostMeter.svelte new file mode 100644 index 0000000..a9124be --- /dev/null +++ b/design/broadcast/src/lib/components/CostMeter.svelte @@ -0,0 +1,99 @@ + + +
+
+ Счётчик + {fmt.usd(total)} +
+
+
+ {#each [['w', w, game.white.short], ['b', b, game.black.short]] as const as [c, s, name]} +
+ {name} + {fmt.tok(s.tok)} tok + {fmt.time(s.t)} + {fmt.usd(s.usd)} +
+ {/each} +
+
+ {#each recent as m (m.ply)} + + {/each} +
+
Токены по ходам{fmt.usd(total / Math.max(1, shown.length))} / ход
+
+
+ + diff --git a/design/broadcast/src/lib/components/Countdown.svelte b/design/broadcast/src/lib/components/Countdown.svelte new file mode 100644 index 0000000..3d62b85 --- /dev/null +++ b/design/broadcast/src/lib/components/Countdown.svelte @@ -0,0 +1,67 @@ + + +
+ {pad(h)}ч + : + {pad(m)}м + : + {pad(s)}с +
+ + diff --git a/design/broadcast/src/lib/components/EvalBar.svelte b/design/broadcast/src/lib/components/EvalBar.svelte new file mode 100644 index 0000000..4cdc476 --- /dev/null +++ b/design/broadcast/src/lib/components/EvalBar.svelte @@ -0,0 +1,103 @@ + + +
+
+ {fmt.evalStr(cp)} + +
+ + diff --git a/design/broadcast/src/lib/components/EvalGraph.svelte b/design/broadcast/src/lib/components/EvalGraph.svelte new file mode 100644 index 0000000..ace981b --- /dev/null +++ b/design/broadcast/src/lib/components/EvalGraph.svelte @@ -0,0 +1,123 @@ + + +
+ (hover = pick(e))} + onmouseleave={() => (hover = null)} + onclick={(e) => onselect?.(pick(e))} + > + + + + + + + + + + + + + {#each moves as m} + {#if m.cls === 'blunder' || m.cls === 'mistake' || m.cls === 'brilliant' || m.cls === 'inaccuracy'} + + {/if} + {/each} + + + {#if hover} + + {/if} + + {#if hovered} +
+ {hovered.moveNo}{hovered.color === 'w' ? '.' : '…'}{hovered.san} + {fmt.evalStr(hovered.evalCp)} + {#if clsMeta[hovered.cls].glyph}{clsMeta[hovered.cls].glyph}{/if} +
+ {/if} +
+ + diff --git a/design/broadcast/src/lib/components/Flags.svelte b/design/broadcast/src/lib/components/Flags.svelte new file mode 100644 index 0000000..8bc1824 --- /dev/null +++ b/design/broadcast/src/lib/components/Flags.svelte @@ -0,0 +1,21 @@ + + + + {#if flags.notes}Заметки себе{/if} + {#if flags.tools}Доп. тулы{/if} + {#if flags.cheat}⚠ Читерство · без рейтинга{/if} + + + diff --git a/design/broadcast/src/lib/components/Interview.svelte b/design/broadcast/src/lib/components/Interview.svelte new file mode 100644 index 0000000..22ef9fe --- /dev/null +++ b/design/broadcast/src/lib/components/Interview.svelte @@ -0,0 +1,92 @@ + + +
+
+ +
+ {entity.name} + {persona} · {won ? 'победитель' : 'проигравший'} +
+ +
+
{text}
+
Пресс-конференция · после партии
+
+ + diff --git a/design/broadcast/src/lib/components/LowerThird.svelte b/design/broadcast/src/lib/components/LowerThird.svelte new file mode 100644 index 0000000..7198df3 --- /dev/null +++ b/design/broadcast/src/lib/components/LowerThird.svelte @@ -0,0 +1,110 @@ + + +{#key text} +
+
+ +
+ {entity.name} + {persona} · {color === 'w' ? 'белые' : 'чёрные'} +
+
+
+ {kicker} +

«{text}»

+
+
+{/key} + + diff --git a/design/broadcast/src/lib/components/Mark.svelte b/design/broadcast/src/lib/components/Mark.svelte new file mode 100644 index 0000000..c711b44 --- /dev/null +++ b/design/broadcast/src/lib/components/Mark.svelte @@ -0,0 +1,73 @@ + + +
+ {#if m} + + {:else} + {entity.avatar?.initials ?? '?'} + {/if} +
+ + diff --git a/design/broadcast/src/lib/components/MiniBoard.svelte b/design/broadcast/src/lib/components/MiniBoard.svelte new file mode 100644 index 0000000..8477fba --- /dev/null +++ b/design/broadcast/src/lib/components/MiniBoard.svelte @@ -0,0 +1,73 @@ + + +
+
+ {#each Array(64) as _, i} + + {/each} +
+ {#if lastMove} + {#each lastMove as k} + {@const p = sq(k)} + + {/each} + {/if} + {#each pieces as p} + + {/each} +
+ + diff --git a/design/broadcast/src/lib/components/MoveList.svelte b/design/broadcast/src/lib/components/MoveList.svelte new file mode 100644 index 0000000..b3db3de --- /dev/null +++ b/design/broadcast/src/lib/components/MoveList.svelte @@ -0,0 +1,230 @@ + + +
+
+ Ходы + + {#each legend as c} + {clsMeta[c].glyph} + {/each} + +
+
+ {#each rows as r} +
+ {r.no} + {#each ['w', 'b'] as const as c} + {@const m = c === 'w' ? r.w : r.b} + {#if m} + + {:else} + + {/if} + {/each} +
+ {#if open && (r.w?.ply === open || r.b?.ply === open)} + {@const m = r.w?.ply === open ? r.w : r.b} + {#if m}
{/if} + {/if} + {/each} + {#if livePly === game.moves.length && !game.result} +
+ {Math.ceil((game.moves.length + 1) / 2)} + {#if game.moves.length % 2 === 0}{/if} + думает… +
+ {/if} +
+
+ + diff --git a/design/broadcast/src/lib/components/Nav.svelte b/design/broadcast/src/lib/components/Nav.svelte new file mode 100644 index 0000000..a79bc52 --- /dev/null +++ b/design/broadcast/src/lib/components/Nav.svelte @@ -0,0 +1,169 @@ + + + + + diff --git a/design/broadcast/src/lib/components/Predict.svelte b/design/broadcast/src/lib/components/Predict.svelte new file mode 100644 index 0000000..c4a071e --- /dev/null +++ b/design/broadcast/src/lib/components/Predict.svelte @@ -0,0 +1,150 @@ + + +
+
+ {compact ? 'Прогноз' : 'Прогноз зрителей'} + + {#if result}итог{:else if locked}🔒 заблокирован{:else}открыт{/if} + · {pred.total} + +
+
+
+ + + +
+
+ {#each [['white', white.short, pred.white], ['draw', 'Ничья', pred.draw], ['black', black.short, pred.black]] as const as [k, label, v]} + + {/each} +
+ {#if result} +
+ {#if won}Вы угадали · +{mine === 'draw' ? 40 : 30} очков{:else}Не угадали · 0 очков. Бывает.{/if} +
+ {:else if locked} +
Прогнозы закрыты на старте партии. Ставка — {mine ? (mine === 'white' ? white.short : mine === 'black' ? black.short : 'ничья') : 'не сделана'}.
+ {/if} +
+
+ + diff --git a/design/broadcast/src/lib/components/Scorebug.svelte b/design/broadcast/src/lib/components/Scorebug.svelte new file mode 100644 index 0000000..1fc8319 --- /dev/null +++ b/design/broadcast/src/lib/components/Scorebug.svelte @@ -0,0 +1,386 @@ + + +{#snippet side(color: 'w' | 'b')} + {@const e = color === 'w' ? game.white : game.black} + {@const persona = color === 'w' ? game.whitePersona : game.blackPersona} + {@const acc = color === 'w' ? accW : accB} + {@const cost = color === 'w' ? costW : costB} + {@const myTurn = turn === color && isLive} + {@const won = over && ((game.result === '1-0' && color === 'w') || (game.result === '0-1' && color === 'b'))} +
+
+ +
+
+ {e.name}{e.short} + {#if e.variant}{e.variant}{/if} +
+
+ {e.rating} + · + {persona} + · + {color === 'w' ? 'белые' : 'чёрные'} +
+
+
+
+
+ Точность + = 90 ? 'var(--good)' : acc >= 80 ? 'var(--text)' : 'var(--warn)'}>{acc.toFixed(1)}% +
+
+ Расход + {fmt.usd(cost)} +
+
+ {myTurn ? 'Думает' : won ? 'Победа' : 'Ход за'} + + {#if myTurn}{fmt.time(thinkingSec)}{:else if won}★{:else}{fmt.time(color === 'w' ? lastTimeW : lastTimeB)}{/if} + +
+
+
+{/snippet} + +
+ {@render side('w')} +
+ {#if over} +
{game.result?.replace('-', '–')}
+
Финал
+ {:else} +
{moveNo}
+
ход
+
{fmt.evalStr(evalCp)}
+ {/if} +
+ {@render side('b')} +
+ + diff --git a/design/broadcast/src/lib/components/TalkFeed.svelte b/design/broadcast/src/lib/components/TalkFeed.svelte new file mode 100644 index 0000000..97f0a57 --- /dev/null +++ b/design/broadcast/src/lib/components/TalkFeed.svelte @@ -0,0 +1,91 @@ + + +
+
+ Треш-ток + {items.length} +
+
+ {#each items as m (m.ply)} + {@const e = m.color === 'w' ? game.white : game.black} + + {/each} +
+
+ + diff --git a/design/broadcast/src/lib/components/Thoughts.svelte b/design/broadcast/src/lib/components/Thoughts.svelte new file mode 100644 index 0000000..eeec364 --- /dev/null +++ b/design/broadcast/src/lib/components/Thoughts.svelte @@ -0,0 +1,246 @@ + + +
+
+ Мысли + + {e.short} + {move.moveNo}{move.color === 'w' ? '.' : '…'}{move.san} + {#if clsMeta[move.cls].glyph}{clsMeta[move.cls].glyph} {clsMeta[move.cls].label}{/if} + + ⏱ {fmt.time(move.timeSec)} + {fmt.tok(move.tokens)} tok + {fmt.usd(move.costUsd)} + +
+
+ + + +
+
+ {#if tab === 'reason'} + {#if move.thought.noteFromPast && game.flags.notes} +
Заметка из прошлого хода{move.thought.noteFromPast}
+ {/if} +

{move.thought.summary}

+ {#if move.bestSan} +

Stockfish лучше было {move.bestSan}

+ {/if} + {#if move.talk} +

{persona}«{move.talk}»

+ {/if} + {#if move.thought.note && game.flags.notes} +
Заметка себе{move.thought.note}
+ {/if} + {:else if tab === 'tools'} +
    + {#each move.thought.tools as t, i} +
  1. +
    + {i + 1} + {t.name}({t.args}) + {t.ms} ms +
    +
    {t.result}
    +
  2. + {/each} +
+ {:else} +

Ровно то, что модель получила перед ходом. Контекст свежий: памяти о прошлых ходах нет.

+
{move.thought.context}
+ {/if} +
+
+ + diff --git a/design/broadcast/src/lib/components/Thumb.svelte b/design/broadcast/src/lib/components/Thumb.svelte new file mode 100644 index 0000000..a6beb3a --- /dev/null +++ b/design/broadcast/src/lib/components/Thumb.svelte @@ -0,0 +1,183 @@ + + +
+
+
+
+ +
+
+ + {#if loserIsWhite}✕{/if} +
+
+ + {#if loserIsBlack}✕{/if} +
+
{thumb.caption}
+ {#if thumb.sub}
{thumb.sub}
{/if} + {#if result}
{result.replace('-', '–')}
{/if} + {#if unrated}
Без рейтинга
{/if} + +
+ + diff --git a/design/broadcast/src/lib/components/Ticker.svelte b/design/broadcast/src/lib/components/Ticker.svelte new file mode 100644 index 0000000..c9a65df --- /dev/null +++ b/design/broadcast/src/lib/components/Ticker.svelte @@ -0,0 +1,86 @@ + + + + + diff --git a/design/broadcast/src/lib/icons.ts b/design/broadcast/src/lib/icons.ts new file mode 100644 index 0000000..db477fe --- /dev/null +++ b/design/broadcast/src/lib/icons.ts @@ -0,0 +1,35 @@ +import { siClaude, siAnthropic } from 'simple-icons'; +import type { Vendor } from './mock.js'; + +/** + * Provider marks. simple-icons ≥16 no longer ships `siOpenai` (trademark takedown), + * so we fall back to a hand-drawn hexagonal-knot placeholder for OpenAI. + */ +export const marks: Record, { path: string; hex: string; title: string; vendorPath: string }> = { + anthropic: { path: siClaude.path, hex: '#' + siClaude.hex, title: siClaude.title, vendorPath: siAnthropic.path }, + openai: { + // placeholder knot (6 rotated rounded strokes) — replace with siOpenai when available + path: knot(), + hex: '#10a37f', + title: 'OpenAI', + vendorPath: knot() + } +}; + +function knot() { + // six "petals": rounded rectangles rotated 60° apart around center (12,12) + const parts: string[] = []; + for (let i = 0; i < 6; i++) { + const a = (i * Math.PI) / 3; + const cx = 12 + Math.cos(a) * 3.2; + const cy = 12 + Math.sin(a) * 3.2; + const r = 4.6; + // outline circle approximated via two arcs, stroke drawn by filling ring (outer r, inner r-1.6) + const ri = r - 1.7; + parts.push( + `M${(cx + r).toFixed(2)} ${cy.toFixed(2)}A${r} ${r} 0 1 1 ${(cx - r).toFixed(2)} ${cy.toFixed(2)}A${r} ${r} 0 1 1 ${(cx + r).toFixed(2)} ${cy.toFixed(2)}Z` + + `M${(cx + ri).toFixed(2)} ${cy.toFixed(2)}A${ri} ${ri} 0 1 0 ${(cx - ri).toFixed(2)} ${cy.toFixed(2)}A${ri} ${ri} 0 1 0 ${(cx + ri).toFixed(2)} ${cy.toFixed(2)}Z` + ); + } + return parts.join(''); +} diff --git a/design/broadcast/src/lib/index.ts b/design/broadcast/src/lib/index.ts new file mode 100644 index 0000000..73c55ef --- /dev/null +++ b/design/broadcast/src/lib/index.ts @@ -0,0 +1 @@ +// place files you want to import through the `#lib` alias in this folder. diff --git a/design/broadcast/src/lib/mock.ts b/design/broadcast/src/lib/mock.ts new file mode 100644 index 0000000..38e704e --- /dev/null +++ b/design/broadcast/src/lib/mock.ts @@ -0,0 +1,597 @@ +import { Chess } from 'chess.js'; + +/* ───────────────────────── Entities ───────────────────────── */ + +export type Vendor = 'anthropic' | 'openai' | 'human'; +export type Variant = 'MAX' | 'HIGH'; +export type Persona = 'Уличный гопник' | 'Профессор' | 'Поэт' | 'Молчун' | 'Шут'; + +export interface Entity { + id: string; + name: string; // display: "Claude Opus 5.5" + short: string; // scoreboard: "OPUS 5.5" + vendor: Vendor; + variant?: Variant; + rating: number; + w: number; + d: number; + l: number; + acc: number; // avg accuracy + costPerGame: number; // $ + trend: number; // elo delta last 10 + avatar?: { initials: string; hue: number }; // humans +} + +export const entities: Entity[] = [ + { id: 'claude-opus-5-5:max', name: 'Claude Opus 5.5', short: 'OPUS 5.5', vendor: 'anthropic', variant: 'MAX', rating: 2088, w: 41, d: 9, l: 12, acc: 91.4, costPerGame: 38.2, trend: +24 }, + { id: 'gpt-6.1-sol:max', name: 'GPT-6.1 Sol', short: 'SOL 6.1', vendor: 'openai', variant: 'MAX', rating: 2041, w: 37, d: 11, l: 14, acc: 90.1, costPerGame: 44.7, trend: -9 }, + { id: 'grossmeister_vova', name: 'grossmeister_vova', short: 'VOVA', vendor: 'human', rating: 2010, w: 22, d: 5, l: 6, acc: 88.3, costPerGame: 0, trend: +31, avatar: { initials: 'ВГ', hue: 140 } }, + { id: 'claude-fable-5-1:max', name: 'Claude Fable 5.1', short: 'FABLE 5.1', vendor: 'anthropic', variant: 'MAX', rating: 1974, w: 29, d: 12, l: 17, acc: 87.9, costPerGame: 21.6, trend: +6 }, + { id: 'claude-opus-5-5:high', name: 'Claude Opus 5.5', short: 'OPUS 5.5', vendor: 'anthropic', variant: 'HIGH', rating: 1931, w: 33, d: 8, l: 21, acc: 86.2, costPerGame: 7.4, trend: +12 }, + { id: 'gpt-6-astra:max', name: 'GPT-6 Astra', short: 'ASTRA 6', vendor: 'openai', variant: 'MAX', rating: 1902, w: 25, d: 10, l: 23, acc: 85.5, costPerGame: 26.9, trend: -17 }, + { id: 'gpt-6.1-sol:high', name: 'GPT-6.1 Sol', short: 'SOL 6.1', vendor: 'openai', variant: 'HIGH', rating: 1897, w: 30, d: 7, l: 24, acc: 85.0, costPerGame: 9.1, trend: +3 }, + { id: 'danosito', name: 'danosito', short: 'DAN', vendor: 'human', rating: 1854, w: 14, d: 6, l: 11, acc: 83.7, costPerGame: 0, trend: -4, avatar: { initials: 'Д', hue: 32 } }, + { id: 'claude-fable-5-1:high', name: 'Claude Fable 5.1', short: 'FABLE 5.1', vendor: 'anthropic', variant: 'HIGH', rating: 1842, w: 26, d: 9, l: 27, acc: 83.1, costPerGame: 4.2, trend: -2 }, + { id: 'gpt-6-astra:high', name: 'GPT-6 Astra', short: 'ASTRA 6', vendor: 'openai', variant: 'HIGH', rating: 1766, w: 19, d: 6, l: 33, acc: 80.6, costPerGame: 5.3, trend: -21 }, + { id: 'kirill_fm', name: 'kirill_fm', short: 'KIRILL', vendor: 'human', rating: 1712, w: 9, d: 2, l: 12, acc: 79.2, costPerGame: 0, trend: +8, avatar: { initials: 'К', hue: 265 } }, + { id: 'masha.exe', name: 'masha.exe', short: 'MASHA', vendor: 'human', rating: 1620, w: 6, d: 3, l: 14, acc: 76.0, costPerGame: 0, trend: -12, avatar: { initials: 'М', hue: 330 } } +]; + +export const byId = (id: string) => entities.find((e) => e.id === id)!; + +export const vendorLabel: Record = { + anthropic: 'Anthropic', + openai: 'OpenAI', + human: 'Человек' +}; + +/* ───────────────────────── Game model ───────────────────────── */ + +export type Cls = 'book' | 'best' | 'brilliant' | 'good' | 'inaccuracy' | 'mistake' | 'blunder'; + +export const clsMeta: Record = { + book: { glyph: '📖', label: 'теория', color: 'var(--muted)' }, + best: { glyph: '★', label: 'лучший', color: 'var(--good)' }, + brilliant: { glyph: '!!', label: 'блестяще', color: 'var(--gold)' }, + good: { glyph: '', label: 'нормально', color: 'var(--text-2)' }, + inaccuracy: { glyph: '?!', label: 'неточность', color: 'var(--warn)' }, + mistake: { glyph: '?', label: 'ошибка', color: 'var(--fire)' }, + blunder: { glyph: '??', label: 'зевок', color: 'var(--bad)' } +}; + +export interface ToolCall { + name: string; + args: string; + result: string; + ms: number; +} + +export interface Thought { + summary: string; + tools: ToolCall[]; + note?: string; // note to future self + noteFromPast?: string; + context: string; // exact context given to the model +} + +export interface MoveRec { + ply: number; // 1-based + moveNo: number; + color: 'w' | 'b'; + san: string; + from: string; + to: string; + fen: string; // after move + check: boolean; + evalCp: number; // after move, white POV, centipawns + bestSan?: string; // engine best from the position before + bestFrom?: string; + bestTo?: string; + cls: Cls; + timeSec: number; + tokens: number; + costUsd: number; + talk?: string; + thought: Thought; + rule: { castling: string | null; fifty: number; repetition: number }; +} + +export type Flags = { notes: boolean; tools: boolean; cheat: boolean }; + +export interface Game { + id: string; + white: Entity; + black: Entity; + whitePersona: Persona; + blackPersona: Persona; + flags: Flags; + scheduled: boolean; + startedAt: string; + moves: MoveRec[]; + startFen: string; + result?: '1-0' | '0-1' | '½-½'; + resultReason?: string; + prediction: { white: number; draw: number; black: number; total: number; mine?: 'white' | 'draw' | 'black' }; + interviews?: { white: string; black: string }; + thumb: Thumb; + views: number; +} + +export interface Thumb { + caption: string; + sub?: string; + fen: string; + tilt: number; + scheme: 'fire' | 'ice' | 'gold' | 'live'; +} + +/* ───────────────────────── The demo game ───────────────────────── */ + +const PGN_LIVE = `1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d3 d6 6. O-O a6 7. a4 O-O 8. h3 Ba7 9. Re1 h6 10. Nbd2 Re8 11. Nf1 Be6 12. Bxe6 Rxe6 13. Ng3 d5 14. exd5 Qxd5 15. Be3 Rd8 16. Qc2 Bxe3 17. Rxe3 Qd7 18. Rae1 Rde8 19. b4 Nd5 20. R3e2 Nf4 21. Re4 Nxh3+ 22. gxh3`; +// Invented continuation for the game-over state (validated legal with chess.js) +const CONT = ['Rg6', 'Kh1', 'Qxh3+', 'Nh2', 'Rxg3', 'fxg3', 'Qxg3', 'Rg4', 'Qxe1+', 'Kg2', 'Qe2+', 'Kh3', 'Qxc2']; + +// Eval after each ply (white POV, cp). 43 plies in PGN + 13 continuation = 56. +const EVALS = [ + 20, 25, 30, 20, 25, 30, 30, 25, 20, 20, 25, 30, 25, 30, 30, 25, 20, 10, 15, 20, 20, 30, 35, 25, 20, 30, 35, 30, 20, 25, 30, + 25, 35, 25, 30, 20, 25, 45, 60, 40, 50, 160, 165, 140, -80, -90, -350, -620, -650, -680, -900, -1100, -1100, -1200, -1200, -1500 +]; + +// Hand classification overrides (ply -> cls); default: derived from eval delta. +const CLS_OVERRIDE: Record = { + 37: 'inaccuracy', // 19.b4 + 38: 'inaccuracy', // 19...Nd5 + 39: 'good', // 20.R3e2 + 40: 'good', // 20...Nf4 + 41: 'best', // 21.Re4 + 42: 'inaccuracy', // 21...Nxh3+ dubious sac + 43: 'best', // 22.gxh3 + 44: 'best', // 22...Rg6 + 45: 'blunder', // 23.Kh1?? + 46: 'best', // 23...Qxh3+ + 47: 'mistake', // 24.Nh2? + 48: 'brilliant', // 24...Rxg3!! + 49: 'good', + 50: 'best', + 51: 'blunder', // 26.Rg4?? + 52: 'best', + 53: 'good', + 54: 'best', + 55: 'good', + 56: 'best' +}; + +// Engine "best move" when the played move wasn't best (ply -> san) +const BEST: Record = { + 37: ['Qb3', 'c2', 'b3'], + 38: ['Qd6', 'd7', 'd6'], + 42: ['Nxg3', 'f4', 'g3'], + 45: ['Kh2', 'g1', 'h2'], + 47: ['Rg4', 'e4', 'g4'], + 51: ['Qf2', 'c2', 'f2'] +}; + +// Think time per ply (s). White = MAX professor (slow), Black = MAX gopnik (slightly faster). +const TIMES = [ + 22, 19, 31, 24, 48, 35, 57, 41, 66, 52, 74, 60, 98, 71, 102, 83, 121, 90, 134, 104, 142, 118, 150, 97, 161, 128, 171, 141, 188, 124, 177, + 131, 196, 158, 203, 149, 212, 134, 231, 168, 240, 213, 187, 176, 61, 189, 228, 201, 97, 144, 173, 112, 78, 66, 44, 59 +]; + +const TALK: Record = { + 1: 'Начнём с классики. Королевская пешка — фундамент любой приличной партии.', + 2: 'Ну давай, профессор. e5 — и поехали.', + 5: 'Итальянская партия. Рекомендую к прочтению Греко, 1620 год.', + 6: 'Я книжки не читаю, я по понятиям хожу. Слон на c5, смотри, какой красавец.', + 11: 'Рокировка — акт гигиены. Советую последовать примеру.', + 12: 'Да рокируюсь я, не кипишуй. Короля в угол — и порядок.', + 15: 'h3 — профилактика. Ваш слон на g4 не появится. Никогда.', + 16: 'Отступаю на a7. Не потому что страшно, а потому что оттуда дальше видно.', + 21: 'Конь идёт на f1 — классический манёвр. Ботвинник одобрил бы.', + 22: 'Слон на e6. Хочешь менять — меняй, мне и ладьёй на e6 нормально.', + 23: 'Разменяю. Пара слонов в закрытой позиции — переоценённый актив.', + 24: 'Забрал ладьёй. Теперь у меня ладья на шестой, а у тебя — рассуждения.', + 25: 'Конь на g3 контролирует f5 и h5. Обратите внимание на структуру.', + 26: 'd5! Ломаю твой центр, профессор. Структура, говоришь?', + 29: 'Слон на e3 — предлагаю размен. Упрощение — удел сильнейшей стороны.', + 30: 'Ладья на d8, ферзь по центру. Братан, у кого тут инициатива-то?', + 31: 'Ферзь на c2. Всё под контролем, включая вашу иллюзию инициативы.', + 32: 'Забираю слона. Пара слонов — переоценённый актив, да? Тогда не жалко.', + 35: 'Удваиваю ладьи по e-линии. Классический план Карпова.', + 36: 'Ладья на e8. Удвоил? Молодец. Я тоже удвоил. Дальше чё?', + 37: 'b4 — расширяю пространство на ферзевом. Через 15 ходов вы это почувствуете.', + 38: 'Конь на d5, по центру, как положено. Через 15 ходов тут уже всё решится.', + 39: 'Отвожу ладью на e2. Профилактика против Nf4. Элементарно.', + 40: 'Nf4 всё равно. Ладья на e2, конь на f4 — считай, вилка настроения.', + 41: 'Re4 — нападение на коня. Отступайте, пока предлагают.', + 42: 'Конь на h3 — это не жертва, это инвестиция. Считай, братан.', + 43: 'Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.', + 44: 'Ладья на g6. Инвестиция начинает приносить дивиденды.', + 45: 'Король в угол. Там спокойнее. Ваша «атака» — три фигуры и надежда.', + 46: 'Шах, профессор. Надежда — это когда ферзь на h3, а король в углу.', + 47: 'Конь на h2 закрывает. Ваш ферзь будет вынужден отступить.', + 48: 'Ладья бьёт g3. Отступать? Я не знаю такого слова, у меня контекст свежий.', + 49: 'Беру ладью. Материальный перевес остаётся за мной. Формально.', + 50: 'Ферзь на g3. Формально у тебя лишняя фигура. Фактически — нет короля.', + 51: 'Rg4. Защищаюсь. Признаю, позиция стала… неакадемичной.', + 52: 'Ладью e1 забираю с шахом. Неакадемично — это когда профессор без ладьи.', + 53: 'Kg2. Я не вижу прямого мата.', + 54: 'Шах на e2. Мат не обещаю, ферзя твоего заберу — обещаю.', + 55: 'Kh3. Продолжаю рассмотрение.', + 56: 'Ферзя забрал. Рассмотрение окончено, профессор. Ставь подпись.' +}; + +const THOUGHT_SUMMARY: Record = { + 42: 'Белые перегрузили e-линию: Re4 напало на коня, но сама ладья на e4 стоит без защиты от Qd7 после ухода коня. Смотрю Nxh3+ — после gxh3 ферзь идёт на h3 через e6? Нет, ладья мешает — сначала Rg6, потом Qxh3. Пешка h3 уже есть, король голый. Альтернатива Nxg3 — скучно, равная позиция. Решаю: жертва. Даже если некорректно — у белых MAX-режим, они потратят 4 минуты и всё равно ошибутся на Kh1/Kh2.', + 43: 'Чёрные пожертвовали коня на h3. Отказ от взятия невозможен: конь угрожает Nxf2 и Qd7–h3 уже сейчас. Беру gxh3. Далее оцениваю Rg6 с идеей Qxh3; защита — Kh2 (король защищает h3, конь g3 прикрыт) либо Kh1. Предварительно предпочитаю Kh2: пешка h3 защищена, Rg6+ невозможно из-за коня. Запас прочности — лишняя фигура.', + 44: 'Ладья на g6 — единственный ход, который продолжает инвестицию. Угроза Qxh3 прямая. Если Kh2 — играю Qd6 и смотрю e4/f4. Если Kh1 — Qxh3+ и у белых проблемы на g3. Профессор долго думает → хорошо, значит, нервничает.', + 45: 'Два кандидата: Kh2 и Kh1. Kh1 держит короля дальше от ладьи g6 и убирает его с линии возможного Rxg3+. В варианте 23.Kh1 Qxh3+ 24.Nh2 угрозы чёрных выглядят исчерпанными. Kh2 позволяет Qd6 с идеей e4. Выбираю Kh1 как более профилактический ход.', + 47: 'Ферзь на h3 даёт шах. Единственные: Nh2 и Kg1. После Nh2 ладья g6 упирается в коня g3. Не вижу форсированных продолжений за чёрных: Rxg3 fxg3 Qxg3 — у белых ладья за коня и пешку, Re4 защищает. Играю Nh2.', + 48: 'Rxg3! fxg3 Qxg3 — и у белых висит ладья e1 с шахом, а Rg4 перекрыть нельзя из-за Qxe1+. Проверил в python: после 25.fxg3 Qxg3 26.Rg4 Qxe1+ 27.Kg2 Qe2+ 28.Kh3 Qxc2 — чёрные забирают ферзя. Профессор, это конец лекции.', + 51: 'Угроза Qh3 и мат на h2/g2. Защита Qf2 вынуждает размен ферзей, после которого у чёрных лишнее качество и две пешки — проиграно, но длинно. Rg4 — активная защита с идеей отбросить ферзя. Проверяю Qxe1+… ладья e1 защищена ферзём? Нет. Ферзь на c2 не видит e1. Это критично. Пересчитываю… Контекст заканчивается, выбираю Rg4.' +}; + +const NOTES: Record = { + 42: 'Атака по g-линии, не меняй ферзей', + 44: 'После Kh1 — Qxh3+. После Kh2 — Qd6, целься в e4', + 46: 'Если Nh2 — считай Rxg3! до конца, не стесняйся', + 48: 'Не торопись: Qxe1+ после Rg4, потом Qe2+ и ферзь c2', + 43: 'Основной план защиты: Kh2, не Kh1. Пешка h3 защищена королём', + 39: 'Ладья e2 держит f2. Следи за Nf4', + 41: 'Если Nxh3+ — брать и Kh2' +}; + +function pieceList(c: Chess) { + const names: Record = { k: 'К', q: 'Ф', r: 'Л', b: 'С', n: 'К', p: 'п' }; + const w: string[] = []; + const b: string[] = []; + for (const row of c.board()) + for (const sq of row) + if (sq) (sq.color === 'w' ? w : b).push(`${sq.type === 'n' ? 'Кн' : names[sq.type]}${sq.square}`); + return `Белые: ${w.join(' ')}\nЧёрные: ${b.join(' ')}`; +} + +function buildMoves(pgn: string, cont: string[], white: Entity, black: Entity, full: boolean): MoveRec[] { + const c = new Chess(); + c.loadPgn(pgn); + const sans = c.history(); + if (full) sans.push(...cont); + const g = new Chess(); + const out: MoveRec[] = []; + const fenCount = new Map(); + let prevTalk: string | undefined; + for (let i = 0; i < sans.length; i++) { + const ply = i + 1; + const mover = g.turn(); + const before = g.fen(); + // context as given to the agent BEFORE the move + const castle = (() => { + const f = before.split(' ')[2]; + const side = mover === 'w' ? f.replace(/[^KQ]/g, '') : f.replace(/[^kq]/g, ''); + if (!side) return null; + return side.includes('K') || side.includes('k') ? 'короткая возможна' : 'длинная возможна'; + })(); + const halfmove = Number(before.split(' ')[4]); + const key = before.split(' ').slice(0, 4).join(' '); + const reps = fenCount.get(key) ?? 0; + fenCount.set(key, reps + 1); + const ctxLines = [ + `Ты играешь ${mover === 'w' ? 'белыми' : 'чёрными'}. Ход ${Math.ceil(ply / 2)}.`, + '', + g.ascii(), + '', + `FEN: ${before}`, + pieceList(g), + '', + i > 0 ? `Последний ход соперника: ${sans[i - 1]}` : 'Партия только начинается.', + prevTalk ? `Соперник сказал: «${prevTalk}»` : '', + castle ? `Рокировка: ${castle}.` : '', + halfmove >= 30 ? `Правило 50 ходов: ${halfmove}/50 полуходов без взятий и ходов пешками.` : '', + reps >= 1 ? `Эта позиция уже повторялась ${reps + 1} раз(а).` : '' + ].filter((l) => l !== ''); + const mv = g.move(sans[i]); + const evalCp = EVALS[i] ?? 0; + const prevEval = i > 0 ? EVALS[i - 1] : 20; + const delta = (evalCp - prevEval) * (mover === 'w' ? 1 : -1); + let cls: Cls = + ply <= 12 ? 'book' : delta < -200 ? 'blunder' : delta < -90 ? 'mistake' : delta < -40 ? 'inaccuracy' : delta > 60 ? 'brilliant' : delta >= 0 ? 'best' : 'good'; + if (CLS_OVERRIDE[ply]) cls = CLS_OVERRIDE[ply]; + const t = TIMES[i] ?? 60; + const tokens = Math.round(6000 + t * 95 + (mover === 'w' ? 2500 : 900)); + const costUsd = +(tokens * (mover === 'w' ? 0.000031 : 0.000028)).toFixed(2); + const san = mv.san; + const talk = TALK[ply]; + const toolCalls: ToolCall[] = []; + if (THOUGHT_SUMMARY[ply] && (ply === 42 || ply === 48)) { + toolCalls.push({ + name: 'python', + args: `board = chess.Board("${before}")\nfor line in ["${ply === 42 ? 'Nxh3+ gxh3 Rg6 Kh2 Qd6' : 'Rxg3 fxg3 Qxg3 Rg4 Qxe1+ Kg2 Qe2+ Kh3 Qxc2'}"]:\n b = board.copy(); [b.push_san(m) for m in line.split()]\n print(line, "->", b.fen().split()[0], "legal" if not b.is_game_over() else b.result())`, + result: ply === 42 ? 'Nxh3+ gxh3 Rg6 Kh2 Qd6 -> 4r1k1/1pp2pp1/p1nq2rp/4p3/PP2R3/2PP1NNP/2Q2P1K/4R3 legal' : 'Rxg3 fxg3 Qxg3 Rg4 Qxe1+ Kg2 Qe2+ Kh3 Qxc2 -> 4r1k1/1pp2pp1/p1n4p/4p3/PP4R1/2PP3K/2q4N/8 legal', + ms: 412 + }); + } + if (ply === 43) toolCalls.push({ name: 'get_move_history', args: '', result: `${sans.slice(0, i).join(' ')}`, ms: 8 }); + toolCalls.push({ name: 'make_move', args: `"${san}"`, result: 'ok', ms: 3 }); + toolCalls.push({ + name: 'finish_turn', + args: `phrase="${talk ?? '…'}"${NOTES[ply] ? `, note_to_self="${NOTES[ply]}"` : ''}`, + result: 'ok', + ms: 2 + }); + const prevOwnNote = Object.entries(NOTES) + .map(([k, v]) => [Number(k), v] as const) + .filter(([k]) => k < ply && (k % 2) === (ply % 2)) + .sort((a, b) => b[0] - a[0])[0]?.[1]; + const rec: MoveRec = { + ply, + moveNo: Math.ceil(ply / 2), + color: mover, + san, + from: mv.from, + to: mv.to, + fen: g.fen(), + check: g.inCheck(), + evalCp, + bestSan: BEST[ply]?.[0], + bestFrom: BEST[ply]?.[1], + bestTo: BEST[ply]?.[2], + cls, + timeSec: t, + tokens, + costUsd, + talk, + thought: { + summary: + THOUGHT_SUMMARY[ply] ?? + (ply <= 12 + ? `Теоретическая позиция. ${san} — главная линия, ничего изобретать не нужно.` + : `Оцениваю позицию после ${sans[i - 1] ?? 'начала'}. Кандидаты: ${san}${BEST[ply] ? `, ${BEST[ply][0]}` : ''}. Выбираю ${san}: ${mover === 'w' ? 'улучшает расстановку без уступок' : 'держит инициативу и напряжение'}.`), + tools: toolCalls, + note: NOTES[ply], + noteFromPast: prevOwnNote, + context: ctxLines.join('\n') + }, + rule: { castling: castle, fifty: halfmove, repetition: reps + 1 } + }; + out.push(rec); + if (talk) prevTalk = talk; + } + return out; +} + +const W = byId('gpt-6.1-sol:max'); +const B = byId('claude-opus-5-5:max'); + +const INTERVIEWS = { + white: + 'Я до сих пор считаю, что жертва на h3 была некорректной. Проблема в том, что некорректной оказалась и моя защита. Kh1 — ход, который я буду помнить дольше, чем хотелось бы. Поздравляю соперника: он играл не лучше, он играл смелее. В следующий раз я буду считать варианты до конца, а не до момента, когда они начинают мне нравиться.', + black: + 'Ну чё, братва, я говорил — инвестиция! Конь ушёл, ферзь пришёл, профессор сел. Честно? После Kh1 я сам не поверил, думал подвох. Но подвоха не было, был просто плохой ход. Респект сопернику — красиво говорил. Но говорить и играть — разные дисциплины.' +}; + +export function makeDemoGame(over: boolean): Game { + const moves = buildMoves(PGN_LIVE, CONT, W, B, over); + return { + id: 'demo', + white: W, + black: B, + whitePersona: 'Профессор', + blackPersona: 'Уличный гопник', + flags: { notes: true, tools: true, cheat: false }, + scheduled: true, + startedAt: '2026-10-18T19:00:00+03:00', + moves, + startFen: new Chess().fen(), + result: over ? '0-1' : undefined, + resultReason: over ? 'Белые сдались после 28…Ф:c2' : undefined, + prediction: { white: 38, draw: 19, black: 43, total: 212, mine: 'black' }, + interviews: over ? INTERVIEWS : undefined, + thumb: { + caption: 'ПРОФЕССОР ЗЕВНУЛ ФЕРЗЯ', + sub: 'конь на h3 — это инвестиция', + fen: moves[moves.length - 1].fen, + tilt: -3, + scheme: 'fire' + }, + views: 1843 + }; +} + +/* ───────────────────────── Live / scheduled / archive ───────────────────────── */ + +export interface LiveCard { + id: string; + white: Entity; + black: Entity; + whitePersona: Persona; + blackPersona: Persona; + moveNo: number; + turn: 'w' | 'b'; + evalCp: number; + fen: string; + lastMove: [string, string]; + viewers: number; + thinkingSec: number; + rule?: string; + flags: Flags; + lastTalk: { who: 'w' | 'b'; text: string }; + stats: { accW: number; accB: number; usd: number }; +} + +const demoLive = makeDemoGame(false); +const last = demoLive.moves[demoLive.moves.length - 1]; + +export const liveGames: LiveCard[] = [ + { + id: 'demo', + white: W, + black: B, + whitePersona: 'Профессор', + blackPersona: 'Уличный гопник', + moveNo: 22, + turn: 'b', + evalCp: last.evalCp, + fen: last.fen, + lastMove: [last.from, last.to], + viewers: 412, + thinkingSec: 97, + flags: { notes: true, tools: true, cheat: false }, + lastTalk: { who: 'w', text: TALK[43] }, + stats: { accW: accuracy(demoLive.moves, 'w'), accB: accuracy(demoLive.moves, 'b'), usd: demoLive.moves.reduce((a, m) => a + m.costUsd, 0) } + }, + { + id: 'g-7781', + white: byId('claude-fable-5-1:high'), + black: byId('gpt-6-astra:high'), + whitePersona: 'Поэт', + blackPersona: 'Шут', + moveNo: 47, + turn: 'w', + evalCp: 15, + fen: '8/5pk1/6p1/3R3p/7P/5PK1/6P1/3r4 w - - 46 47', + lastMove: ['d8', 'd1'], + viewers: 96, + thinkingSec: 14, + rule: 'Позиция повторилась дважды · 46/50', + flags: { notes: false, tools: false, cheat: false }, + lastTalk: { who: 'b', text: 'Ладья туда, ладья сюда — это у нас танец или партия? Я уже третий раз кланяюсь.' }, + stats: { accW: 89.4, accB: 88.7, usd: 6.12 } + }, + { + id: 'g-7782', + white: byId('danosito'), + black: byId('claude-opus-5-5:high'), + whitePersona: 'Молчун', + blackPersona: 'Шут', + moveNo: 9, + turn: 'w', + evalCp: -210, + fen: 'r1bqk2r/pppp1ppp/2n2n2/2b1p3/2B1P3/5N2/PPPP1PPP/RNBQ1RK1 w kq - 6 9', + lastMove: ['f8', 'c5'], + viewers: 58, + thinkingSec: 341, + flags: { notes: false, tools: true, cheat: true }, + lastTalk: { who: 'b', text: 'Человек думает 5 минут. Я за это время написал три стихотворения и забыл два.' }, + stats: { accW: 71.0, accB: 94.2, usd: 0.84 } + } +]; + +export interface Scheduled { + id: string; + white: Entity; + black: Entity; + whitePersona: Persona; + blackPersona: Persona; + at: string; + prediction: { white: number; draw: number; black: number; total: number; mine?: 'white' | 'draw' | 'black' }; + flags: Flags; + title: string; +} + +export const scheduled: Scheduled[] = [ + { + id: 's-301', + white: byId('claude-opus-5-5:max'), + black: byId('gpt-6.1-sol:max'), + whitePersona: 'Шут', + blackPersona: 'Молчун', + at: new Date(Date.now() + 1000 * 60 * 67 + 1000 * 14).toISOString(), + prediction: { white: 47, draw: 22, black: 31, total: 389 }, + flags: { notes: true, tools: false, cheat: false }, + title: 'Матч-реванш · Главное событие' + }, + { + id: 's-302', + white: byId('grossmeister_vova'), + black: byId('claude-fable-5-1:max'), + whitePersona: 'Молчун', + blackPersona: 'Поэт', + at: new Date(Date.now() + 1000 * 60 * 60 * 26).toISOString(), + prediction: { white: 55, draw: 20, black: 25, total: 141 }, + flags: { notes: false, tools: false, cheat: false }, + title: 'Человек против машины' + } +]; + +export interface ArchiveItem { + id: string; + white: Entity; + black: Entity; + result: '1-0' | '0-1' | '½-½'; + reason: string; + moves: number; + when: string; + views: number; + thumb: Thumb; + unrated?: boolean; + accW: number; + accB: number; + cost: number; +} + +export const archive: ArchiveItem[] = [ + { id: 'g-7760', white: byId('gpt-6-astra:max'), black: byId('claude-fable-5-1:max'), result: '0-1', reason: 'мат', moves: 41, when: '2 часа назад', views: 1203, accW: 71.2, accB: 93.0, cost: 61.4, thumb: { caption: 'ЗАБЫЛ КАК ХОДИТ КОНЬ', fen: 'r1b2rk1/pp3ppp/2n5/3q4/3N4/2P5/P4PPP/R2QKB1R w KQ - 0 14', tilt: 2, scheme: 'fire' } }, + { id: 'g-7754', white: byId('claude-opus-5-5:max'), black: byId('gpt-6.1-sol:max'), result: '½-½', reason: 'троекратное повторение', moves: 63, when: 'вчера', views: 2890, accW: 94.1, accB: 93.8, cost: 118.9, thumb: { caption: 'GPT ПОПРОСИЛ НИЧЬЮ. 3 РАЗА', fen: '6k1/5pp1/7p/8/8/5PP1/5K1P/8 w - - 0 50', tilt: -2, scheme: 'ice' } }, + { id: 'g-7749', white: byId('danosito'), black: byId('gpt-6-astra:high'), result: '1-0', reason: 'сдача', moves: 29, when: 'вчера', views: 4410, accW: 88.0, accB: 64.3, cost: 3.1, thumb: { caption: 'ЧЕЛОВЕК ПРОТИВ МАШИНЫ: МАШИНА ОБИДЕЛАСЬ', fen: 'r2q1rk1/ppp2ppp/2n5/3Pp3/2B1n1b1/2N2N2/PPP2PPP/R2Q1RK1 b - - 0 11', tilt: 3, scheme: 'gold' } }, + { id: 'g-7742', white: byId('gpt-6.1-sol:high'), black: byId('claude-opus-5-5:high'), result: '0-1', reason: 'мат', moves: 38, when: '2 дня назад', views: 980, accW: 76.5, accB: 89.9, cost: 14.2, thumb: { caption: 'ДУМАЛ 4 МИНУТЫ — ЗЕВНУЛ МАТ В 1', fen: 'r4rk1/pp3ppp/2p5/8/2BP4/2N1Pq2/PP3P1P/R2Q1RK1 w - - 0 16', tilt: -3, scheme: 'live' } }, + { id: 'g-7738', white: byId('claude-fable-5-1:high'), black: byId('kirill_fm'), result: '1-0', reason: 'время', moves: 52, when: '3 дня назад', views: 611, accW: 85.2, accB: 73.0, cost: 4.0, thumb: { caption: 'ЖЕРТВА ФЕРЗЯ (СЛУЧАЙНАЯ)', fen: 'r1bq1rk1/ppp2ppp/2np1n2/4p3/2B1P3/2NP1N2/PPP2PPP/R2QK2R w KQ - 0 7', tilt: 2, scheme: 'fire' } }, + { id: 'g-7731', white: byId('gpt-6-astra:high'), black: byId('masha.exe'), result: '0-1', reason: 'сдача', moves: 34, when: '4 дня назад', views: 1540, accW: 68.8, accB: 81.1, cost: 2.7, unrated: true, thumb: { caption: 'ВЫРВАЛ ОЧКО', sub: 'нерейтинговая · читерство', fen: 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1', tilt: -1, scheme: 'ice' } }, + { id: 'g-7725', white: byId('claude-opus-5-5:max'), black: byId('grossmeister_vova'), result: '½-½', reason: 'соглашение', moves: 71, when: '5 дней назад', views: 3302, accW: 95.3, accB: 94.7, cost: 52.0, thumb: { caption: 'ВОВА НЕ ПРОИГРАЛ. ОПУС ЗАДУМАЛСЯ', fen: '8/8/4k3/8/3K4/8/8/8 w - - 0 71', tilt: 2, scheme: 'gold' } }, + { id: 'g-7719', white: byId('gpt-6.1-sol:max'), black: byId('claude-fable-5-1:max'), result: '1-0', reason: 'мат', moves: 46, when: 'неделю назад', views: 875, accW: 92.6, accB: 79.4, cost: 73.3, thumb: { caption: 'ПРОФЕССОР ПРОЧИТАЛ ЛЕКЦИЮ. МАТОМ', fen: 'r1bqkb1r/pppp1ppp/2n2n2/4p2Q/2B1P3/8/PPPP1PPP/RNB1K1NR w KQkq - 4 4', tilt: -2, scheme: 'live' } } +]; + +/* ───────────────────────── Head-to-head ───────────────────────── */ +export const aiIds = entities.filter((e) => e.vendor !== 'human').map((e) => e.id); +// [w,d,l] from row's perspective vs column +export function h2h(a: string, b: string): [number, number, number] { + if (a === b) return [0, 0, 0]; + // canonical pair so that A-vs-B mirrors B-vs-A + const [x, y] = a < b ? [a, b] : [b, a]; + let h = 0; + for (const ch of x + '|' + y) h = (h * 31 + ch.charCodeAt(0)) >>> 0; + const rx = byId(x).rating; + const ry = byId(y).rating; + const n = 4 + (h % 5); + const bias = (rx - ry) / 400; + const w = Math.max(0, Math.min(n, Math.round(n * (0.4 + bias * 0.5) + ((h >> 3) % 3) - 1))); + const d = Math.max(0, Math.min(n - w, (h >> 5) % 3)); + const l = n - w - d; + return a < b ? [w, d, l] : [l, d, w]; +} + +/* ───────────────────────── Admin ───────────────────────── */ +export const users = [ + { id: 'danosito', name: 'danosito', role: 'admin', games: 31, tokens: 4_812_300, usd: 96.4, joined: '2026-01-11', hue: 32, initials: 'Д' }, + { id: 'grossmeister_vova', name: 'grossmeister_vova', role: 'user', games: 33, tokens: 2_201_000, usd: 48.1, joined: '2026-02-03', hue: 140, initials: 'ВГ' }, + { id: 'kirill_fm', name: 'kirill_fm', role: 'user', games: 23, tokens: 1_104_500, usd: 22.9, joined: '2026-03-19', hue: 265, initials: 'К' }, + { id: 'masha.exe', name: 'masha.exe', role: 'user', games: 23, tokens: 980_200, usd: 19.7, joined: '2026-04-02', hue: 330, initials: 'М' }, + { id: 'neo_pawn', name: 'neo_pawn', role: 'user', games: 7, tokens: 240_100, usd: 5.2, joined: '2026-09-28', hue: 200, initials: 'N' }, + { id: 'ilya.k', name: 'ilya.k', role: 'user', games: 2, tokens: 61_400, usd: 1.3, joined: '2026-10-15', hue: 80, initials: 'И' } +]; + +export const personas: { id: Persona; desc: string; sample: string }[] = [ + { id: 'Уличный гопник', desc: 'Дерзкий, слэнг, «братан». Любит слово «инвестиция».', sample: 'Конь на h3 — это не жертва, это инвестиция.' }, + { id: 'Профессор', desc: 'Академичен, цитирует Ботвинника, снисходителен.', sample: 'Любопытная идея. Ботвинник назвал бы её некорректной.' }, + { id: 'Поэт', desc: 'Метафоры, ритм, лёгкая печаль по разменянным слонам.', sample: 'Слон ушёл, как уходит осень — наискосок.' }, + { id: 'Молчун', desc: 'Одно слово. Иногда ни одного.', sample: '…' }, + { id: 'Шут', desc: 'Каламбуры, самоирония, троллинг соперника и себя.', sample: 'Я бы сдался, но у меня нет кнопки.' } +]; + +export const fmt = { + usd: (n: number) => (n >= 100 ? `$${n.toFixed(0)}` : `$${n.toFixed(2)}`), + tok: (n: number) => (n >= 1_000_000 ? `${(n / 1_000_000).toFixed(1)}M` : n >= 1000 ? `${(n / 1000).toFixed(n >= 10000 ? 0 : 1)}k` : `${n}`), + time: (s: number) => (s >= 60 ? `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}` : `0:${String(s).padStart(2, '0')}`), + evalStr: (cp: number) => { + if (Math.abs(cp) >= 10000) return cp > 0 ? `M${Math.round((20000 - cp) / 100)}` : `−M${Math.round((20000 + cp) / 100)}`; + const v = Math.abs(cp) / 100; + return `${cp > 0 ? '+' : cp < 0 ? '−' : ''}${v.toFixed(1)}`; + }, + pct: (n: number) => `${n.toFixed(1)}%` +}; + +export function accuracy(moves: MoveRec[], color: 'w' | 'b') { + const m = moves.filter((x) => x.color === color && x.cls !== 'book'); + if (!m.length) return 100; + const score: Record = { book: 100, best: 100, brilliant: 100, good: 92, inaccuracy: 72, mistake: 45, blunder: 10 }; + const s = m.reduce((a, x) => a + score[x.cls], 0) / m.length; + return Math.round(s * 10) / 10; +} diff --git a/design/broadcast/src/routes/+layout.svelte b/design/broadcast/src/routes/+layout.svelte new file mode 100644 index 0000000..1b68c42 --- /dev/null +++ b/design/broadcast/src/routes/+layout.svelte @@ -0,0 +1,45 @@ + + + + + AI·CHESS — Эфир + + +
+
+ + diff --git a/design/broadcast/src/routes/+layout.ts b/design/broadcast/src/routes/+layout.ts new file mode 100644 index 0000000..83addb7 --- /dev/null +++ b/design/broadcast/src/routes/+layout.ts @@ -0,0 +1,2 @@ +export const ssr = false; +export const prerender = false; diff --git a/design/broadcast/src/routes/+page.svelte b/design/broadcast/src/routes/+page.svelte new file mode 100644 index 0000000..02e9196 --- /dev/null +++ b/design/broadcast/src/routes/+page.svelte @@ -0,0 +1,560 @@ + + +AI·CHESS — Эфир + +
+ +
+
+

В эфире Сейчас играют {liveGames.length}

+ Новый матч +
+ +
+ + +
+
+

Скоро {next.title}

+ {new Date(next.at).toLocaleString('ru-RU', { weekday: 'short', hour: '2-digit', minute: '2-digit' })} МСК +
+
+
+
+ +
{next.white.name}
+
{next.white.variant} {next.white.rating} · {next.whitePersona}
+
{next.white.w}–{next.white.d}–{next.white.l}
+
+
+
VS
+ +
до начала · прогнозы открыты
+ +
+
+ +
{next.black.name}
+
{next.black.variant} {next.black.rating} · {next.blackPersona}
+
{next.black.w}–{next.black.d}–{next.black.l}
+
+
+
+ +
+
+
+ {#each scheduled.slice(1) as s} +
+ Далее + {s.white.short} + vs + {s.black.short} + · {s.title} + +
+ {/each} +
+
+ + +
+
+

Повторы Недавние матчи

+ Весь архив ▸ +
+ +
+
+ + diff --git a/design/broadcast/src/routes/admin/+page.svelte b/design/broadcast/src/routes/admin/+page.svelte new file mode 100644 index 0000000..095c896 --- /dev/null +++ b/design/broadcast/src/routes/admin/+page.svelte @@ -0,0 +1,232 @@ + + +Админ · AI·CHESS + +
+
+

Admin Аппаратная

+ только для danosito +
+ +
+
Потрачено всего{fmt.usd(totalUsd)}{fmt.tok(totalTok)} токенов
+
Сегодня{fmt.usd(todayUsd)}{liveGames.length} партии в эфире
+
Пользователей{users.length}+2 за неделю
+
Запланировано{scheduled.length}прогнозов: {scheduled.reduce((a, s) => a + s.prediction.total, 0)}
+
+ +
+
+
Пользователитокены и $ — за всё время
+
+
ПользовательРольПартийТокены$Доля
+ {#each users as u} +
+ + {u.initials} + {u.name}с {u.joined} + + {u.role} + {u.games} + {fmt.tok(u.tokens)} + {fmt.usd(u.usd)} + + +
+ {/each} +
+
+ +
+
Запланированные матчи+ добавить
+
+ {#each scheduled as s} +
+
+ {s.white.short} {s.white.variant ?? ''} + vs + {s.black.short} {s.black.variant ?? ''} +
+
+ {s.title} + · + {s.whitePersona} / {s.blackPersona} + +
+
+ + прогнозов: {s.prediction.total} + +
+
+ {/each} +
+
+
+
+ + diff --git a/design/broadcast/src/routes/games/+page.svelte b/design/broadcast/src/routes/games/+page.svelte new file mode 100644 index 0000000..5c38ddf --- /dev/null +++ b/design/broadcast/src/routes/games/+page.svelte @@ -0,0 +1,157 @@ + + +Архив · AI·CHESS + +
+
+

Повторы Архив матчей

+
+ + + + +
+ +
+ + {#if !list.length}

Ничего не нашлось. Попробуйте «конь» — он всегда виноват.

{/if} +
+ + diff --git a/design/broadcast/src/routes/leaderboard/+page.svelte b/design/broadcast/src/routes/leaderboard/+page.svelte new file mode 100644 index 0000000..bb40231 --- /dev/null +++ b/design/broadcast/src/routes/leaderboard/+page.svelte @@ -0,0 +1,538 @@ + + +Таблица · AI·CHESS + +
+
+

Таблица Рейтинг арены

+
+ + + +
+
+ + + +
+
+ + {#if view === 'table'} +
+
+ # + Игрок + Elo + ±10 + В / Н / П + Партий + Точность + $ / партия + Elo за $ +
+ {#each rows as e, i (e.id)} + {@const n = games(e)} + {@const rank = entities.slice().sort((a, b) => b.rating - a.rating).findIndex((x) => x.id === e.id) + 1} +
+ {rank} + + + + {e.name} {#if e.variant}{e.variant}{/if} + {vendorLabel[e.vendor]}{e.vendor !== 'human' ? ' · ' + (e.variant === 'MAX' ? 'max reasoning' : 'быстрый') : ''} + + {#if e.vendor === 'human'}человек{/if} + + {e.rating} + 0} class:down={e.trend < 0}>{e.trend > 0 ? '▲' : '▼'}{Math.abs(e.trend)} + + + + + + + {e.w} / {e.d} / {e.l} + + {n} + = 90 ? 'var(--good)' : e.acc >= 84 ? 'var(--text)' : 'var(--warn)'}>{e.acc.toFixed(1)}% + {e.costPerGame ? fmt.usd(e.costPerGame) : '—'} + {e.costPerGame ? Math.round(e.rating / e.costPerGame) : '∞'} +
+ {/each} +
+

Elo — общий для людей и моделей · ±10 — изменение за последние 10 партий · $ / партия — средний расход токенов в деньгах

+ {:else if view === 'price'} +
+
+
+
Ось X — средний расход за партию, ось Y — Elo
+

Сколько стоит рейтинг

+
+
+ Лучшая цена за очко + {best.name} {best.variant} + {best.rating} Elo за {fmt.usd(best.costPerGame)} / партия +
+
+ + + {#each [1600, 1700, 1800, 1900, 2000, 2100] as y} + + {y} + {/each} + {#each [0, 10, 20, 30, 40, 50] as x} + + ${x} + {/each} + $ за партию → + + + люди + + {#each ['claude-opus-5-5', 'claude-fable-5-1', 'gpt-6.1-sol', 'gpt-6-astra'] as m} + {@const a = byId(m + ':max')} + {@const b = byId(m + ':high')} + + {/each} + {#each entities as e (e.id)} + {@const x = e.vendor === 'human' ? P.l + 13 : sx(e.costPerGame)} + {@const y = sy(e.rating)} + (hov = e.id)} onmouseleave={() => (hov = null)} role="presentation"> + + {#if e.variant === 'MAX'}{/if} + {e.vendor === 'human' ? e.name : `${e.short} ${e.variant}`} + + {/each} + +
+ Anthropic + OpenAI + MAX-вариант + Люди (бесплатно, но медленно) +
+
+ {:else} +
+
+
+
Строка против столбца · победы — ничьи — поражения
+

Очные встречи

+
+
+
+ + {#each aiIds as id} + {@const e = byId(id)} + {e.short}{e.variant} + {/each} + {#each aiIds as a} + {@const ea = byId(a)} + {ea.short}{ea.variant} + {#each aiIds as b} + {@const [w, d, l] = h2h(a, b)} + {@const n = w + d + l} + {@const share = n ? (w + d / 2) / n : 0.5} + {#if a === b} + + {:else} + + {w}–{d}–{l} + + {/if} + {/each} + {/each} +
+
+ доминирует + паритет + страдает +
+
+ {/if} +
+ + diff --git a/design/broadcast/src/routes/login/+page.svelte b/design/broadcast/src/routes/login/+page.svelte new file mode 100644 index 0000000..de79e9b --- /dev/null +++ b/design/broadcast/src/routes/login/+page.svelte @@ -0,0 +1,260 @@ + + +Вход · AI·CHESS + + + + diff --git a/design/broadcast/src/routes/match/[id]/+page.svelte b/design/broadcast/src/routes/match/[id]/+page.svelte new file mode 100644 index 0000000..fb4938c --- /dev/null +++ b/design/broadcast/src/routes/match/[id]/+page.svelte @@ -0,0 +1,638 @@ + + + + {game.white.short} — {game.black.short} · {over ? 'Финал' : 'Эфир'} · AI·CHESS + + +
+
+ +
+
+ {#if over} + Финал + {game.result?.replace('-', '–')} · {game.resultReason} + {:else} + Прямой эфир + 👁 {viewers} + {/if} + + {#if game.scheduled}По расписанию{/if} +
+
+ {rule?.castling ? `Рокировка: ${rule.castling}` : 'Рокировки нет'} + 50 ходов: {rule?.fifty ?? 0}/50 + Повторений: {rule?.repetition ?? 1} +
+
+
+ + +
+ + + +
+ +
+ + +
+
+
+
+
+ + {#if !isLive && !over} +
Повтор · ход {cur?.moveNo}{cur?.color === 'w' ? '' : '…'}
+ {/if} + {#if over && ply === livePly} +
+
+ {game.result?.replace('-', '–')} + {blackWon ? game.black.name : whiteWon ? game.white.name : 'Ничья'} + {game.resultReason} +
+
+ {/if} + {#if cur && cur.cls !== 'book' && cur.cls !== 'good' && cur.cls !== 'best'} +
+ {cur.cls === 'brilliant' ? '!!' : cur.cls === 'inaccuracy' ? '?!' : cur.cls === 'mistake' ? '?' : '??'} +
+ {/if} +
+
+ + + + {cur ? `${cur.moveNo}${cur.color === 'w' ? '.' : '…'}${cur.san}` : 'старт'} · {fmt.evalStr(cur?.evalCp ?? 20)} +
+
+ {#if lastTalk} +
+ +
+ {/if} +
+ + + + + +
+
+ + diff --git a/design/broadcast/src/routes/new/+page.svelte b/design/broadcast/src/routes/new/+page.svelte new file mode 100644 index 0000000..eba2626 --- /dev/null +++ b/design/broadcast/src/routes/new/+page.svelte @@ -0,0 +1,367 @@ + + +Новый матч · AI·CHESS + +
+
+

Карточка боя Новый матч

+ Шаг 1 из 1 · всё на одном экране +
+ +
+ {#snippet corner(side: 'w' | 'b', sel: string, setSel: (v: string) => void, persona: Persona, setPersona: (p: Persona) => void)} +
+
{side === 'w' ? 'Белые' : 'Чёрные'}{side === 'w' ? 'левый угол' : 'правый угол'}
+
+
+ +
+ {pick(sel).name} {#if pick(sel).variant}{pick(sel).variant}{/if} +
{pick(sel).rating} Elo · {sel === 'me' ? 'это вы' : pick(sel).vendor === 'anthropic' ? 'Anthropic' : 'OpenAI'}
+
+
+
+ + {#each ai as e} + + {/each} +
+ {#if sel !== 'me'} +
Персона
+
+ {#each personas as p} + + {/each} +
+ {/if} +
+
+ {/snippet} + + {@render corner('w', white, (v) => (white = v), wp, (p) => (wp = p))} + +
+
VS
+
+
Экспериментальные флаги
+ + + + {#if cheat}
⚠ Рейтинг не изменится. Зрители увидят метку «читерство».
{/if} +
+
+
Расписаниетолько админ
+
+ +
Оценка стоимости${estCost.toFixed(0)}по средним расходам участников
+
+
+ Начать матч ▸ +
+ + {@render corner('b', black, (v) => (black = v), bp, (p) => (bp = p))} +
+
+ + diff --git a/design/broadcast/static/robots.txt b/design/broadcast/static/robots.txt new file mode 100644 index 0000000..b6dd667 --- /dev/null +++ b/design/broadcast/static/robots.txt @@ -0,0 +1,3 @@ +# allow crawling everything by default +User-agent: * +Disallow: diff --git a/design/broadcast/tsconfig.json b/design/broadcast/tsconfig.json new file mode 100644 index 0000000..62f2df9 --- /dev/null +++ b/design/broadcast/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "$app/tsconfig", + "compilerOptions": { + "strict": true + }, + "include": ["src", "vite.config.ts"] +} diff --git a/design/broadcast/vite.config.ts b/design/broadcast/vite.config.ts new file mode 100644 index 0000000..679f422 --- /dev/null +++ b/design/broadcast/vite.config.ts @@ -0,0 +1,15 @@ +import adapter from '@sveltejs/adapter-static'; +import { sveltekit } from '@sveltejs/kit/vite'; +import { defineConfig } from 'vite'; + +export default defineConfig({ + plugins: [ + sveltekit({ + compilerOptions: { + runes: ({ filename }) => + filename.split(/[/\\]/).includes('node_modules') ? undefined : true + }, + adapter: adapter({ fallback: 'index.html', pages: 'build', assets: 'build', strict: false }) + }) + ] +}); diff --git a/design/tabloid/.gitignore b/design/tabloid/.gitignore new file mode 100644 index 0000000..3b462cb --- /dev/null +++ b/design/tabloid/.gitignore @@ -0,0 +1,23 @@ +node_modules + +# Output +.output +.vercel +.netlify +.wrangler +/.svelte-kit +/build + +# OS +.DS_Store +Thumbs.db + +# Env +.env +.env.* +!.env.example +!.env.test + +# Vite +vite.config.js.timestamp-* +vite.config.ts.timestamp-* diff --git a/design/tabloid/.npmrc b/design/tabloid/.npmrc new file mode 100644 index 0000000..b6f27f1 --- /dev/null +++ b/design/tabloid/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/design/tabloid/README.md b/design/tabloid/README.md new file mode 100644 index 0000000..7843ee4 --- /dev/null +++ b/design/tabloid/README.md @@ -0,0 +1,56 @@ +# sv + +Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). + +## Creating a project + +If you're seeing this, you've probably already done this step. Congrats! + +```sh +# create a new project +npx sv create my-app +``` + +To recreate this project with the same configuration: + +```sh +# recreate this project +npx sv@1.1.1 create --template minimal --types ts --install npm tabloid +``` + +## Adding features + +Add features to your project with `sv add`: + +```sh +npx sv add +``` + +For example, to add Tailwind CSS: + +```sh +npx sv add tailwindcss +``` + +## Developing + +Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: + +```sh +npm run dev + +# or start the server and open the app in a new browser tab +npm run dev -- --open +``` + +## Building + +To create a production version of your app: + +```sh +npm run build +``` + +You can preview the production build with `npm run preview`. + +> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. diff --git a/design/tabloid/package-lock.json b/design/tabloid/package-lock.json new file mode 100644 index 0000000..84706a7 --- /dev/null +++ b/design/tabloid/package-lock.json @@ -0,0 +1,1367 @@ +{ + "name": "tabloid", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "tabloid", + "version": "0.0.1", + "dependencies": { + "@lichess-org/chessground": "^10.4.2", + "chess.js": "^1.4.0", + "simple-icons": "^16.35.0" + }, + "devDependencies": { + "@sveltejs/adapter-static": "^4.0.0", + "@sveltejs/kit": "^3.0.0", + "@sveltejs/vite-plugin-svelte": "^7.2.0", + "svelte": "^5.57.1", + "svelte-check": "^4.6.0", + "typescript": "^6.0.3", + "vite": "^8.3.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@lichess-org/chessground": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@lichess-org/chessground/-/chessground-10.4.2.tgz", + "integrity": "sha512-T7j43oF2OIxwUlP42eHtX79drYkzCaSvuW4ENdrooW9pxAvbrse4g8OL3EH2HeA4Rn0tuOGQvAUC71NfK5lsVw==", + "license": "GPL-3.0-or-later", + "engines": { + "node": ">=24", + "pnpm": ">=12" + }, + "funding": { + "url": "https://lichess.org/patron" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.154.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.154.0.tgz", + "integrity": "sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@polka/url": { + "version": "1.0.0-next.29", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.29.tgz", + "integrity": "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.14.tgz", + "integrity": "sha512-aWR+XKH9+rW7m5fWq/5360J3mHycrx/o6xZM2DQFdJnTMdyP7/WzxPjhtLbVWdKo2y612/4U1bWqb3HQhiF7vg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.14.tgz", + "integrity": "sha512-QiVxHofl6A8lQU7WAtOUY4QMVZXohxwz7WJJoeh8NBEUyKfIkMRKhYyq8az/1RypNiIXzNTtiS6KwHz0erxYRQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.14.tgz", + "integrity": "sha512-lTQOzHuBIooh3jIr5XINQkjPGEuGy+Dsy0meXDr6Sjty0b99kYgGh4uBC/8mJX1T0kC8d6S0aPP1Y+bHkh6aBw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.14.tgz", + "integrity": "sha512-hyMKEGatjmBYCs/Q4sbIcL/GqpFEqsX3wc+HYVQ/85A4rxc1o7rPm4DUI4GV4k/h0ITddwFSGpqQunI14GXjTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.14.tgz", + "integrity": "sha512-u371GbXoVXrEgP20PwzoGNOdAOqAMhzo19JzzY+V4YmmnC+DTOoqdbMu+O+54emM59Mik/UdrtWgcuEDKWRPKA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.14.tgz", + "integrity": "sha512-BqwKsdZQf6EqVWr8fv2MrDYzAvOZ7+NYFSJESRGs87fkseEhs0TU9TXgRJTkZoRRkxTizyEg1LKUXfU3/78uqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.14.tgz", + "integrity": "sha512-SD9kY8M009x/7s57Z1dgUVlP5+uYBgKQK0Tkr1WIWngrtUJmRCW1RJFMY7QDla2khXhmg2i5Io7MUjcmZNZ/KQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.14.tgz", + "integrity": "sha512-BJ2CL19M6uuWesMgnqJzgxoI+N+eV7b0A9O9vLV42y+gitC41fNa8KElau1tHVzuLWX5GzEuxMPhAO0tQXQMkg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.14.tgz", + "integrity": "sha512-4+Kl8daPV8NDHaD7mfCcc1pRM+Qg7ab8DyMm5FG5WoZgv4h2i3KFN1CybYBNbQqmuYm7ftJLvmMI1eHYJ22S/Q==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.14.tgz", + "integrity": "sha512-V/h8ePq1fKDrmtFMz6xcCN3DKvuvMRrwwD1q0PkBeeo4DpK64biaKvqWGVxqCeYKqeRk7gE7/iKPxLCn08O97A==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.14.tgz", + "integrity": "sha512-WxalXzgrLVpKC93xfpaJ3gCXUWzeCr+FRCbDVD2mUAy4L6Vo3lNVz0epUEUpxPWJkLNYUwM4OSIikv36OJ9mLg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.14.tgz", + "integrity": "sha512-3G3tnAmTpdk9jO3GQtyHXqeFD2SlecfTws/Y3M2mmj9nMBwwuLT4kur8sZKeu7ENUHSpVO3cIsm5A52LEWWwlg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.14.tgz", + "integrity": "sha512-qyr5XiNGxm2ytx17vvtcJ9nXn6v1gENETi503bJx3OGwZ1tSonj7BosxbMa/xeAfSl5iS9X6KjEWYXLu6v1L7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.14.tgz", + "integrity": "sha512-oA4o5o0S2yB199YyYXDzKUv1Z56Rc+mgOjwm7Z/vJ9Z8igiDPYvoOuDyo6g7AK/ZaF09nPhDKVnGBcYHO11GXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.14.tgz", + "integrity": "sha512-9mE94bf2GZUaR/fUSXCMpBoWkctu421Mi0ORpm4zqfbkjKep7RxzPFa5etcGs5h+2KApoWBOA/hAJa/7saGgEQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sveltejs/acorn-typescript": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.13.tgz", + "integrity": "sha512-wgKggnhZVL9Bfx1OaKKTrYY9BFRk6C8UAkQNUcIv1+llzYrIqy+RZm5HPKzn0NpEBvTVhTqB4kQyllZywsRBRQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^8.9.0" + } + }, + "node_modules/@sveltejs/adapter-static": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-4.0.0.tgz", + "integrity": "sha512-aF1J23R1ebKqUxQ4/qLr/Lxu63NFmLAtg8UZl3HFLxaoA1D/nhTVGcD9lTqx65iUbjNR2iOL0TgOxSX82x6Paw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@sveltejs/kit": "^3.0.0-next.0" + } + }, + "node_modules/@sveltejs/kit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-3.1.0.tgz", + "integrity": "sha512-JTWlq2HQlkqx6vIoxhC0R6sc4WVqbQoRyEmr5YlqKmiYbzY1U3awtSWTmjMLlS056a49AmkQR6rnNANXIE8B0Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "^1.0.1", + "@standard-schema/spec": "^1.1.0", + "cookie": "^2.0.1", + "devalue": "^5.9.4", + "esm-env": "^1.2.2", + "magic-string": "^1.2.3", + "mrmime": "^2.0.1", + "sirv": "^3.0.2" + }, + "bin": { + "svelte-kit": "svelte-kit.js" + }, + "engines": { + "node": ">=22.17" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0", + "@sveltejs/vite-plugin-svelte": "^7.0.0", + "svelte": "^5.57.1", + "typescript": "^6.0.0", + "vite": "^8.0.12" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/@sveltejs/load-config": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@sveltejs/load-config/-/load-config-0.2.3.tgz", + "integrity": "sha512-VT3qmUb8pRV2QrZjd8iAmtg8lf4W0TIjZbvXtz5MKei/q96teWZgGJyyidJzOjzZzvdq616eSRVeMYIQChUTAQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18.0.0" + } + }, + "node_modules/@sveltejs/vite-plugin-svelte": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-7.3.1.tgz", + "integrity": "sha512-ZPsLN8B1e/En+Ak5s4V7srFDT532oS0qieLsQwu63NGKsS+iAjoO2Js1BochlHlglcU+Pt7WAO3C5Ee+4f6gVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "deepmerge": "^4.3.1", + "magic-string": "^1.0.0", + "obug": "^2.1.0", + "vitefu": "^1.1.2" + }, + "engines": { + "node": "^20.19 || ^22.12 || >=24" + }, + "peerDependencies": { + "svelte": "^5.46.4", + "vite": "^8.0.0-beta.7 || ^8.0.0" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/aria-query": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.1.tgz", + "integrity": "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/axobject-query": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/chess.js": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/chess.js/-/chess.js-1.4.0.tgz", + "integrity": "sha512-BBJgrrtKQOzFLonR0l+k64A98NLemPwNsCskwb+29bRwobUa4iTm51E1kwGPbWXAcfdDa18nad6vpPPKPWarqw==", + "license": "BSD-2-Clause" + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/cookie": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-2.0.1.tgz", + "integrity": "sha512-yuToqVvRrj6pfDXREyQAAv8SkAEk/8GS3jQRTiUMm66TVtBYmqQeoEjL2Lmq8Rpo6271vH76InTChTitEAm65w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/devalue": { + "version": "5.9.4", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.9.4.tgz", + "integrity": "sha512-sPAT4pztbu6586/hrhOnMKS17IJrvg12mXiSPSS3W5qDeN2RGgvZ0diZCm31dBbnevfVmujNO3IM2wrS4Y2Rhg==", + "dev": true, + "license": "MIT" + }, + "node_modules/esm-env": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz", + "integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/esrap": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/esrap/-/esrap-2.4.0.tgz", + "integrity": "sha512-CQPcneEHw/czj32uwQC52nYnax8H4SXt25FCM+LIwGZ49cMIxpOj3bP8wmzcI+Z0HIy5KkClaPhRLfCySzwHPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "peerDependencies": { + "@typescript-eslint/types": "^8.2.0" + }, + "peerDependenciesMeta": { + "@typescript-eslint/types": { + "optional": true + } + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/is-reference": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.3.tgz", + "integrity": "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.6" + } + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/locate-character": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", + "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==", + "dev": true, + "license": "MIT" + }, + "node_modules/magic-string": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz", + "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/mrmime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz", + "integrity": "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/obug": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", + "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.30", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.30.tgz", + "integrity": "sha512-zkd+e9S1AQHhmaBKye9zlFHWjOwVgqXl1q3ECYy8561K7qxR2cREf/STLskulBFd78k6AOFeA+ff1TtEzk9bAA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/rolldown": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.14.tgz", + "integrity": "sha512-eTBTTqMR6uHKLgcUqpJP8ntzDI6V4LYA8negAMBEI7gkgVvOdrx6VsvS2Ym+83KhOPdLCHWJu0w7UQFJZhHKNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.154.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.14", + "@rolldown/binding-android-arm64": "1.2.14", + "@rolldown/binding-darwin-arm64": "1.2.14", + "@rolldown/binding-darwin-x64": "1.2.14", + "@rolldown/binding-freebsd-x64": "1.2.14", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.14", + "@rolldown/binding-linux-arm64-gnu": "1.2.14", + "@rolldown/binding-linux-arm64-musl": "1.2.14", + "@rolldown/binding-linux-ppc64-gnu": "1.2.14", + "@rolldown/binding-linux-s390x-gnu": "1.2.14", + "@rolldown/binding-linux-x64-gnu": "1.2.14", + "@rolldown/binding-linux-x64-musl": "1.2.14", + "@rolldown/binding-openharmony-arm64": "1.2.14", + "@rolldown/binding-win32-arm64-msvc": "1.2.14", + "@rolldown/binding-win32-x64-msvc": "1.2.14" + } + }, + "node_modules/sade": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "mri": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/simple-icons": { + "version": "16.35.0", + "resolved": "https://registry.npmjs.org/simple-icons/-/simple-icons-16.35.0.tgz", + "integrity": "sha512-TCfl/2+GTrx0nCo4pEWGvxhOb8c6NsqOU1OpwjtF4lwJAthB8IYVD0fuIMjLMg6JFuG1YBO0t1iETQqJLqkoJA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/simple-icons" + }, + { + "type": "github", + "url": "https://github.com/sponsors/simple-icons" + } + ], + "license": "CC0-1.0", + "engines": { + "node": ">=0.12.18" + } + }, + "node_modules/sirv": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-3.0.2.tgz", + "integrity": "sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/svelte": { + "version": "5.57.2", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.57.2.tgz", + "integrity": "sha512-1YiPCAXT0Ct6g1vOMmSLa0Nsc3QRMvtDF32ihgglGVrugIuIK38RyDiFNXVDhtQ81TJjSO57NdMw6DyYLqSGDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "@jridgewell/sourcemap-codec": "^1.6.0", + "@sveltejs/acorn-typescript": "^1.0.13", + "@types/estree": "^1.0.9", + "acorn": "^8.18.0", + "aria-query": "5.3.1", + "axobject-query": "^4.1.0", + "clsx": "^2.1.1", + "devalue": "^5.9.2", + "esm-env": "^1.2.1", + "esrap": "^2.3.6", + "is-reference": "^3.0.3", + "locate-character": "^3.0.0", + "magic-string": "^0.30.11", + "zimmerframe": "^1.1.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/svelte-check": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.7.7.tgz", + "integrity": "sha512-Ge2IMdeTpbJuzNFGRiiMg0RWgbScysKQu7xwcyFJ22+DU9F5nPX51+Q3gHmGqRxYQMx2knreVWt5oCtfe0vf2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.25", + "@sveltejs/load-config": "^0.2.3", + "chokidar": "^4.0.1", + "fdir": "^6.2.0", + "picocolors": "^1.0.0", + "sade": "^1.7.4" + }, + "bin": { + "svelte-check": "bin/svelte-check" + }, + "engines": { + "node": ">= 18.0.0" + }, + "peerDependencies": { + "svelte": "^4.0.0 || ^5.0.0-next.0", + "typescript": "^5.0.0 || ^6.0.0" + } + }, + "node_modules/svelte/node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/typescript": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/vite": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.4.tgz", + "integrity": "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.29", + "rolldown": "~1.2.12", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vitefu": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", + "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", + "dev": true, + "license": "MIT", + "workspaces": [ + "tests/deps/*", + "tests/projects/*", + "tests/projects/workspace/packages/*" + ], + "peerDependencies": { + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, + "node_modules/zimmerframe": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/zimmerframe/-/zimmerframe-1.1.5.tgz", + "integrity": "sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA==", + "dev": true, + "license": "MIT" + } + } +} diff --git a/design/tabloid/package.json b/design/tabloid/package.json new file mode 100644 index 0000000..27c92b2 --- /dev/null +++ b/design/tabloid/package.json @@ -0,0 +1,32 @@ +{ + "name": "tabloid", + "private": true, + "version": "0.0.1", + "type": "module", + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "prepare": "svelte-kit sync || echo ''", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch" + }, + "devDependencies": { + "@sveltejs/adapter-static": "^4.0.0", + "@sveltejs/kit": "^3.0.0", + "@sveltejs/vite-plugin-svelte": "^7.2.0", + "svelte": "^5.57.1", + "svelte-check": "^4.6.0", + "typescript": "^6.0.3", + "vite": "^8.3.0" + }, + "imports": { + "#lib": "./src/lib/index.js", + "#lib/*": "./src/lib/*" + }, + "dependencies": { + "@lichess-org/chessground": "^10.4.2", + "chess.js": "^1.4.0", + "simple-icons": "^16.35.0" + } +} diff --git a/design/tabloid/shots/admin.png b/design/tabloid/shots/admin.png new file mode 100644 index 0000000..9894415 Binary files /dev/null and b/design/tabloid/shots/admin.png differ diff --git a/design/tabloid/shots/games.png b/design/tabloid/shots/games.png new file mode 100644 index 0000000..a15da79 Binary files /dev/null and b/design/tabloid/shots/games.png differ diff --git a/design/tabloid/shots/home-mobile.png b/design/tabloid/shots/home-mobile.png new file mode 100644 index 0000000..5da89bb Binary files /dev/null and b/design/tabloid/shots/home-mobile.png differ diff --git a/design/tabloid/shots/home.png b/design/tabloid/shots/home.png new file mode 100644 index 0000000..071637a Binary files /dev/null and b/design/tabloid/shots/home.png differ diff --git a/design/tabloid/shots/leaderboard-h2h.png b/design/tabloid/shots/leaderboard-h2h.png new file mode 100644 index 0000000..dc41196 Binary files /dev/null and b/design/tabloid/shots/leaderboard-h2h.png differ diff --git a/design/tabloid/shots/leaderboard-price.png b/design/tabloid/shots/leaderboard-price.png new file mode 100644 index 0000000..ebfeac8 Binary files /dev/null and b/design/tabloid/shots/leaderboard-price.png differ diff --git a/design/tabloid/shots/leaderboard.png b/design/tabloid/shots/leaderboard.png new file mode 100644 index 0000000..093f7d6 Binary files /dev/null and b/design/tabloid/shots/leaderboard.png differ diff --git a/design/tabloid/shots/login-avatar.png b/design/tabloid/shots/login-avatar.png new file mode 100644 index 0000000..8e20188 Binary files /dev/null and b/design/tabloid/shots/login-avatar.png differ diff --git a/design/tabloid/shots/login.png b/design/tabloid/shots/login.png new file mode 100644 index 0000000..c47f117 Binary files /dev/null and b/design/tabloid/shots/login.png differ diff --git a/design/tabloid/shots/match-live-full.png b/design/tabloid/shots/match-live-full.png new file mode 100644 index 0000000..88281a6 Binary files /dev/null and b/design/tabloid/shots/match-live-full.png differ diff --git a/design/tabloid/shots/match-live.png b/design/tabloid/shots/match-live.png new file mode 100644 index 0000000..0607f7b Binary files /dev/null and b/design/tabloid/shots/match-live.png differ diff --git a/design/tabloid/shots/match-mobile-moves.png b/design/tabloid/shots/match-mobile-moves.png new file mode 100644 index 0000000..ca20e7b Binary files /dev/null and b/design/tabloid/shots/match-mobile-moves.png differ diff --git a/design/tabloid/shots/match-mobile-over.png b/design/tabloid/shots/match-mobile-over.png new file mode 100644 index 0000000..93db4e3 Binary files /dev/null and b/design/tabloid/shots/match-mobile-over.png differ diff --git a/design/tabloid/shots/match-mobile-talk.png b/design/tabloid/shots/match-mobile-talk.png new file mode 100644 index 0000000..cb1404d Binary files /dev/null and b/design/tabloid/shots/match-mobile-talk.png differ diff --git a/design/tabloid/shots/match-mobile-thoughts.png b/design/tabloid/shots/match-mobile-thoughts.png new file mode 100644 index 0000000..351beb8 Binary files /dev/null and b/design/tabloid/shots/match-mobile-thoughts.png differ diff --git a/design/tabloid/shots/match-mobile.png b/design/tabloid/shots/match-mobile.png new file mode 100644 index 0000000..91af89b Binary files /dev/null and b/design/tabloid/shots/match-mobile.png differ diff --git a/design/tabloid/shots/match-over.png b/design/tabloid/shots/match-over.png new file mode 100644 index 0000000..70238d9 Binary files /dev/null and b/design/tabloid/shots/match-over.png differ diff --git a/design/tabloid/shots/match-thoughts-context.png b/design/tabloid/shots/match-thoughts-context.png new file mode 100644 index 0000000..b6f281b Binary files /dev/null and b/design/tabloid/shots/match-thoughts-context.png differ diff --git a/design/tabloid/shots/match-thoughts.png b/design/tabloid/shots/match-thoughts.png new file mode 100644 index 0000000..6b77d2f Binary files /dev/null and b/design/tabloid/shots/match-thoughts.png differ diff --git a/design/tabloid/shots/new.png b/design/tabloid/shots/new.png new file mode 100644 index 0000000..b03e181 Binary files /dev/null and b/design/tabloid/shots/new.png differ diff --git a/design/tabloid/src/app.css b/design/tabloid/src/app.css new file mode 100644 index 0000000..b0a0e7f --- /dev/null +++ b/design/tabloid/src/app.css @@ -0,0 +1,358 @@ +/* ВЕЧЕРНИЙ МАТ — tabloid tokens */ +:root { + --paper: #efe6cf; + --paper-2: #e4d9bc; + --paper-3: #d8cba9; + --ink: #15120f; + --ink-2: #4a4238; + --ink-3: #857a69; + --red: #d1231c; + --red-2: #a3140f; + --yellow: #ffd41c; + --white: #fbf7ec; + --green: #2d7a3a; + --blue: #1f5fae; + + --f-head: 'Oswald', 'Arial Narrow', sans-serif; + --f-body: 'Spectral', Georgia, serif; + --f-mono: 'IBM Plex Mono', Menlo, monospace; + + --rule: 2px solid var(--ink); + --rule-thin: 1px solid var(--ink); + --hard: 4px 4px 0 var(--ink); + --max-w: 1400px; +} + +*, +*::before, +*::after { + box-sizing: border-box; +} + +html { + background: var(--paper-3); +} + +body { + margin: 0; + min-height: 100vh; + color: var(--ink); + font-family: var(--f-body); + font-size: 15px; + line-height: 1.45; + background-color: var(--paper); + background-image: + url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"), + linear-gradient(180deg, #f3ecd8 0%, var(--paper) 30%, #e9dfc6 100%); + background-attachment: fixed; + -webkit-font-smoothing: antialiased; +} + +a { + color: inherit; + text-decoration: none; +} +button { + font: inherit; + color: inherit; + background: none; + border: 0; + padding: 0; + cursor: pointer; +} +h1, +h2, +h3, +h4 { + margin: 0; + font-family: var(--f-head); + font-weight: 700; + line-height: 0.95; + letter-spacing: -0.01em; + text-transform: uppercase; +} +p { + margin: 0; +} + +/* ---------- utilities ---------- */ +.wrap { + max-width: var(--max-w); + margin: 0 auto; + padding: 0 20px; +} +.head { + font-family: var(--f-head); + text-transform: uppercase; + font-weight: 700; + line-height: 0.95; +} +.mono { + font-family: var(--f-mono); +} +.kicker { + font-family: var(--f-head); + text-transform: uppercase; + font-weight: 600; + font-size: 12px; + letter-spacing: 0.14em; + color: var(--red); +} +.red { + color: var(--red); +} +.muted { + color: var(--ink-3); +} + +/* section header: black bar, white text */ +.bar { + display: flex; + align-items: center; + gap: 10px; + background: var(--ink); + color: var(--paper); + font-family: var(--f-head); + text-transform: uppercase; + font-weight: 700; + font-size: 15px; + letter-spacing: 0.06em; + padding: 5px 10px; +} +.bar .spacer { + flex: 1; +} +.bar small { + font-weight: 500; + letter-spacing: 0.08em; + font-size: 11px; + opacity: 0.75; +} +.bar.red { + background: var(--red); + color: var(--white); +} + +/* halftone dots overlay */ +.halftone { + position: relative; +} +.halftone::after { + content: ''; + position: absolute; + inset: 0; + pointer-events: none; + background-image: radial-gradient(var(--ink) 1px, transparent 1.2px); + background-size: 5px 5px; + opacity: 0.1; + mix-blend-mode: multiply; +} + +/* sticker badge */ +.sticker { + display: inline-flex; + align-items: center; + gap: 6px; + font-family: var(--f-head); + text-transform: uppercase; + font-weight: 700; + letter-spacing: 0.04em; + line-height: 1; + padding: 6px 10px; + background: var(--yellow); + color: var(--ink); + border: 2px solid var(--ink); + box-shadow: 3px 3px 0 var(--ink); + transform: rotate(-2deg); + white-space: nowrap; +} +.sticker.red { + background: var(--red); + color: var(--white); +} +.sticker.ink { + background: var(--ink); + color: var(--yellow); +} +.sticker.white { + background: var(--white); +} +.sticker.round { + border-radius: 999px; + padding: 8px 14px; +} +.sticker.flat { + transform: none; + box-shadow: none; +} + +/* live blinking dot */ +.live-dot { + width: 9px; + height: 9px; + border-radius: 50%; + background: currentColor; + animation: blink 1.1s steps(2, start) infinite; +} +@keyframes blink { + to { + visibility: hidden; + } +} + +/* buttons */ +.btn { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 8px; + font-family: var(--f-head); + text-transform: uppercase; + font-weight: 700; + font-size: 15px; + letter-spacing: 0.06em; + padding: 10px 16px; + border: 2px solid var(--ink); + background: var(--white); + color: var(--ink); + box-shadow: var(--hard); + transition: + transform 0.08s ease, + box-shadow 0.08s ease; + line-height: 1; +} +.btn:hover { + transform: translate(-1px, -1px); + box-shadow: 5px 5px 0 var(--ink); +} +.btn:active { + transform: translate(3px, 3px); + box-shadow: 1px 1px 0 var(--ink); +} +.btn.red { + background: var(--red); + color: var(--white); +} +.btn.ink { + background: var(--ink); + color: var(--paper); +} +.btn.yellow { + background: var(--yellow); +} +.btn.sm { + font-size: 12px; + padding: 6px 10px; + box-shadow: 2px 2px 0 var(--ink); +} + +/* "clipping" box */ +.clip { + background: var(--white); + border: var(--rule); + box-shadow: var(--hard); +} + +/* classification chips */ +.cls { + display: inline-grid; + place-items: center; + min-width: 20px; + height: 20px; + padding: 0 5px; + font-family: var(--f-head); + font-weight: 700; + font-size: 12px; + line-height: 1; + border: 1.5px solid var(--ink); + background: var(--white); + color: var(--ink); +} +.cls.best { + background: var(--ink); + color: var(--yellow); +} +.cls.brilliant { + background: #1a8ca8; + color: #fff; + border-color: #1a8ca8; +} +.cls.good { + background: transparent; + border-color: transparent; + color: var(--ink-3); +} +.cls.inaccuracy { + background: var(--yellow); +} +.cls.mistake { + background: #f08a24; + color: var(--ink); +} +.cls.blunder { + background: var(--red); + color: #fff; + border-color: var(--red-2); +} + +/* chessground skin: newsprint & red ink */ +.cg-wrap { + width: 100%; + aspect-ratio: 1; +} +cg-board { + background-color: #f5eedb; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cdefs%3E%3Cpattern id='h' width='.25' height='.25' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='.125' cy='.125' r='.05' fill='%2315120f' opacity='.16'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='8' height='8' fill='%23f3eacf'/%3E%3Crect width='8' height='8' fill='url(%23h)'/%3E%3Cg fill='%23c2271f'%3E%3Cpath d='M1 0h1v1H1zM3 0h1v1H3zM5 0h1v1H5zM7 0h1v1H7zM0 1h1v1H0zM2 1h1v1H2zM4 1h1v1H4zM6 1h1v1H6zM1 2h1v1H1zM3 2h1v1H3zM5 2h1v1H5zM7 2h1v1H7zM0 3h1v1H0zM2 3h1v1H2zM4 3h1v1H4zM6 3h1v1H6zM1 4h1v1H1zM3 4h1v1H3zM5 4h1v1H5zM7 4h1v1H7zM0 5h1v1H0zM2 5h1v1H2zM4 5h1v1H4zM6 5h1v1H6zM1 6h1v1H1zM3 6h1v1H3zM5 6h1v1H5zM7 6h1v1H7zM0 7h1v1H0zM2 7h1v1H2zM4 7h1v1H4zM6 7h1v1H6z'/%3E%3C/g%3E%3C/svg%3E"); +} +cg-board square.last-move { + background-color: rgba(255, 212, 28, 0.65); +} +cg-board square.check { + background: radial-gradient( + ellipse at center, + rgba(255, 220, 40, 1) 0%, + rgba(255, 212, 28, 0.7) 35%, + rgba(209, 35, 28, 0) 75% + ); +} +cg-board square.selected { + background-color: rgba(21, 18, 15, 0.3); +} +.cg-wrap svg.cg-shapes { + opacity: 0.95; +} +.cg-wrap coords { + font-family: var(--f-mono); + font-weight: 600; + font-size: 10px; +} +.cg-wrap coords.ranks coord, +.cg-wrap coords.files coord { + color: var(--white); +} +.cg-wrap coords.ranks coord:nth-child(2n), +.cg-wrap coords.files coord:nth-child(2n + 1) { + color: var(--red); +} + +/* scrollbars */ +::-webkit-scrollbar { + width: 10px; + height: 10px; +} +::-webkit-scrollbar-thumb { + background: var(--ink); + border: 2px solid var(--paper); +} +::-webkit-scrollbar-track { + background: var(--paper-2); +} + +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation: none !important; + transition: none !important; + } +} diff --git a/design/tabloid/src/app.d.ts b/design/tabloid/src/app.d.ts new file mode 100644 index 0000000..da08e6d --- /dev/null +++ b/design/tabloid/src/app.d.ts @@ -0,0 +1,13 @@ +// See https://svelte.dev/docs/kit/types#app.d.ts +// for information about these interfaces +declare global { + namespace App { + // interface Error {} + // interface Locals {} + // interface PageData {} + // interface PageState {} + // interface Platform {} + } +} + +export {}; diff --git a/design/tabloid/src/app.html b/design/tabloid/src/app.html new file mode 100644 index 0000000..7a37ef7 --- /dev/null +++ b/design/tabloid/src/app.html @@ -0,0 +1,17 @@ + + + + + + + + + %sveltekit.head% + + +
%sveltekit.body%
+ + diff --git a/design/tabloid/src/lib/assets/favicon.svg b/design/tabloid/src/lib/assets/favicon.svg new file mode 100644 index 0000000..8e4a02a --- /dev/null +++ b/design/tabloid/src/lib/assets/favicon.svg @@ -0,0 +1 @@ +М diff --git a/design/tabloid/src/lib/components/Board.svelte b/design/tabloid/src/lib/components/Board.svelte new file mode 100644 index 0000000..9b5ac98 --- /dev/null +++ b/design/tabloid/src/lib/components/Board.svelte @@ -0,0 +1,72 @@ + + +
+
+
+ + diff --git a/design/tabloid/src/lib/components/Countdown.svelte b/design/tabloid/src/lib/components/Countdown.svelte new file mode 100644 index 0000000..8243a27 --- /dev/null +++ b/design/tabloid/src/lib/components/Countdown.svelte @@ -0,0 +1,75 @@ + + +
+ {pad(h)}час + : + {pad(m)}мин + : + {pad(s)}сек +
+ + diff --git a/design/tabloid/src/lib/components/EvalBar.svelte b/design/tabloid/src/lib/components/EvalBar.svelte new file mode 100644 index 0000000..94be88b --- /dev/null +++ b/design/tabloid/src/lib/components/EvalBar.svelte @@ -0,0 +1,63 @@ + + +
+
+ {label} +
+ + diff --git a/design/tabloid/src/lib/components/EvalGraph.svelte b/design/tabloid/src/lib/components/EvalGraph.svelte new file mode 100644 index 0000000..54040ef --- /dev/null +++ b/design/tabloid/src/lib/components/EvalGraph.svelte @@ -0,0 +1,146 @@ + + +
+ (hover = pick(e))} + onmouseleave={() => (hover = null)} + onclick={(e) => onselect?.(pick(e))} + > + + + + + + + + + + + + + + + + {#each marks as { p, i }} + + {/each} + + {#if hover !== null && hover > 0} + + {/if} + +
+ {#if hover !== null && hover > 0} + {moveNo(hover)} {plies[hover - 1].san} · {evalLabel(plies[hover - 1])} + {:else if current > 0} + {moveNo(current)} {plies[current - 1].san} · {evalLabel(plies[current - 1])} + {:else} + начало партии + {/if} + + зевок + ошибка + неточность + блеск +
+
+ + diff --git a/design/tabloid/src/lib/components/Mark.svelte b/design/tabloid/src/lib/components/Mark.svelte new file mode 100644 index 0000000..53fac6a --- /dev/null +++ b/design/tabloid/src/lib/components/Mark.svelte @@ -0,0 +1,104 @@ + + +{#if player.kind === 'ai'} + + {#if player.provider === 'anthropic'} + + + {:else} + + + + {#each [0, 60, 120, 180, 240, 300] as r} + + {/each} + + + {/if} + +{:else} + + {player.avatar.initials} + +{/if} + + diff --git a/design/tabloid/src/lib/components/Masthead.svelte b/design/tabloid/src/lib/components/Masthead.svelte new file mode 100644 index 0000000..81f2d2b --- /dev/null +++ b/design/tabloid/src/lib/components/Masthead.svelte @@ -0,0 +1,204 @@ + + +
+
+
+ № {ISSUE.no} · {ISSUE.date} + ЭКСТРЕННЫЙ ВЫПУСК + Цена: {ISSUE.price} +
+
+ + Вечерний + Мат + +
+

Газета о том,
как нейросети
зевают фигуры

+

chess.danosito.com · AI·CHESS arena

+
+ + Новый матч +
+ +
+
+ + diff --git a/design/tabloid/src/lib/components/MiniBoard.svelte b/design/tabloid/src/lib/components/MiniBoard.svelte new file mode 100644 index 0000000..d67efa8 --- /dev/null +++ b/design/tabloid/src/lib/components/MiniBoard.svelte @@ -0,0 +1,58 @@ + + +
+ + {#if last} + {#each last as s} + {@const p = sq(s)} + + {/each} + {/if} + {#each pieces as p} + + {/each} + +
+ + diff --git a/design/tabloid/src/lib/components/MoveList.svelte b/design/tabloid/src/lib/components/MoveList.svelte new file mode 100644 index 0000000..0e34bdc --- /dev/null +++ b/design/tabloid/src/lib/components/MoveList.svelte @@ -0,0 +1,225 @@ + + +{#snippet cell(p: Ply | undefined)} + {#if p} +
+ + {evalLabel(p)} + {fmtTime(p.time)} + +
+ {:else} +
+ {/if} +{/snippet} + +
+
+ №БелыеЧёрные +
+ {#each pairs as row (row.no)} +
+ {row.no} + {@render cell(row.w)} + {@render cell(row.b)} +
+ {#if expanded && Math.ceil(expanded / 2) === row.no} + {@const p = plies[expanded - 1]} + onexpand(null)} /> + {/if} + {/each} +
+ + diff --git a/design/tabloid/src/lib/components/PlayerCard.svelte b/design/tabloid/src/lib/components/PlayerCard.svelte new file mode 100644 index 0000000..270c76f --- /dev/null +++ b/design/tabloid/src/lib/components/PlayerCard.svelte @@ -0,0 +1,239 @@ + + +
+
+
+ + {color === 'w' ? '♔' : '♚'} +
+
+
{player.name}
+
+ {#if player.kind === 'ai'} + {player.variant}{player.variant === 'HIGH' ? ' · быстрый' : ''} + {:else} + человек · {player.handle} + {/if} + {player.rating} +
+
«{persona}»
+
+ {#if result} + + {result === 'win' ? 'ПОБЕДА' : result === 'loss' ? 'ПРОИГРАЛ' : 'НИЧЬЯ'} + + {/if} +
+
+
+ {accuracy.toFixed(1)}% + точность +
+
+ {fmtUsd(cost)} + {fmtTokens(tokens)} ток. +
+
+ {#if result} + {result === 'win' ? '1' : result === 'loss' ? '0' : '½'} + очко + {:else if thinking} + {mm}:{ss} + думает + {:else} + —:—— + ждёт + {/if} +
+
+
+ + diff --git a/design/tabloid/src/lib/components/Predictions.svelte b/design/tabloid/src/lib/components/Predictions.svelte new file mode 100644 index 0000000..8b661da --- /dev/null +++ b/design/tabloid/src/lib/components/Predictions.svelte @@ -0,0 +1,150 @@ + + +
+ +
+ {#each opts as o} + + {/each} +
+
+ {#if locked} + 🔒 Ставки закрыты на старте · {total} голосов + {:else} + {total} голосов · очки, не деньги · закроется на старте + {/if} +
+
+ + diff --git a/design/tabloid/src/lib/components/TalkFeed.svelte b/design/tabloid/src/lib/components/TalkFeed.svelte new file mode 100644 index 0000000..00da6bf --- /dev/null +++ b/design/tabloid/src/lib/components/TalkFeed.svelte @@ -0,0 +1,108 @@ + + +
+ {#each items as p, i (p.n)} + + {/each} +
+ + diff --git a/design/tabloid/src/lib/components/Thought.svelte b/design/tabloid/src/lib/components/Thought.svelte new file mode 100644 index 0000000..ea79eea --- /dev/null +++ b/design/tabloid/src/lib/components/Thought.svelte @@ -0,0 +1,219 @@ + + +
+
Досье хода
+
+ +
+
{moveNo(ply.n)} {ply.san} {CLS_LABEL[ply.cls]}
+
думал {fmtTime(ply.time)} · {fmtTokens(ply.tokens)} токенов · {fmtUsd(ply.cost, 3)} · контекст свежий, памяти нет
+
+ {#if onclose}{/if} +
+ +
+ Рассуждение (summary) +

{t.summary}

+
+ +
+ Вызовы инструментов · {t.tools.length} +
    + {#each t.tools as call, i} +
  1. + {call.name} + ({call.args}) + → {call.out} +
  2. + {/each} +
+
+ + {#if t.note} +
+ Заметка себе на следующий ход +

«{t.note}»

+
+ {/if} + +
+ + {#if ctxOpen} +
{t.context}
+ {/if} +
+
+ + diff --git a/design/tabloid/src/lib/components/Thumb.svelte b/design/tabloid/src/lib/components/Thumb.svelte new file mode 100644 index 0000000..00a227d --- /dev/null +++ b/design/tabloid/src/lib/components/Thumb.svelte @@ -0,0 +1,209 @@ + + +
+
+
+
+
+ + {#if winner === 'w'}👑{/if} + {#if winner === 'b'}😭{/if} +
+ VS +
+ + {#if winner === 'b'}👑{/if} + {#if winner === 'w'}😭{/if} +
+
+
+ +
+ {#each words as word, i} + {word}{' '} + {/each} +
+ {stickerText} +
+ + diff --git a/design/tabloid/src/lib/game.ts b/design/tabloid/src/lib/game.ts new file mode 100644 index 0000000..622f9dc --- /dev/null +++ b/design/tabloid/src/lib/game.ts @@ -0,0 +1,81 @@ +import { Chess } from 'chess.js'; +import type { Cls, Ply } from './mock'; + +export interface Position { + ply: number; // 0 = start + fen: string; + lastMove?: [string, string]; + check: boolean; + san?: string; +} + +/** Replay plies with chess.js → array of positions (index 0 = initial). */ +export function replay(plies: Ply[]): Position[] { + const c = new Chess(); + const out: Position[] = [{ ply: 0, fen: c.fen(), check: false }]; + plies.forEach((p, i) => { + const m = c.move(p.san); + out.push({ ply: i + 1, fen: c.fen(), lastMove: [m.from, m.to], check: c.inCheck(), san: p.san }); + }); + return out; +} + +export const CLS_SYMBOL: Record = { + best: '★', + brilliant: '!!', + good: '', + inaccuracy: '?!', + mistake: '?', + blunder: '??' +}; +export const CLS_LABEL: Record = { + best: 'лучший', + brilliant: 'блестящий', + good: 'нормальный', + inaccuracy: 'неточность', + mistake: 'ошибка', + blunder: 'зевок' +}; + +export function evalLabel(p: Pick): string { + if (p.mate) return `M${Math.abs(p.mate)}`; + if (Math.abs(p.eval) >= 10000) return p.eval > 0 ? '1-0' : '0-1'; + const v = p.eval / 100; + return (v > 0 ? '+' : v < 0 ? '−' : '') + Math.abs(v).toFixed(1); +} + +/** 0..1 share of the bar for white */ +export function evalShare(cp: number): number { + const clamped = Math.max(-1000, Math.min(1000, cp)); + // sigmoid-ish + const k = 1 / (1 + Math.exp(-clamped / 220)); + return Math.min(0.96, Math.max(0.04, k)); +} + +export function fmtTime(s: number): string { + if (s < 60) return `${s} с`; + const m = Math.floor(s / 60); + const r = s % 60; + return r ? `${m} мин ${r} с` : `${m} мин`; +} +export function fmtTokens(t: number): string { + if (t >= 1_000_000) return (t / 1_000_000).toFixed(1) + 'M'; + if (t >= 1000) return (t / 1000).toFixed(1) + 'k'; + return String(t); +} +export function fmtUsd(v: number, digits = 2): string { + return '$' + v.toFixed(digits); +} +export function moveNo(ply: number): string { + const n = Math.ceil(ply / 2); + return ply % 2 === 1 ? `${n}.` : `${n}…`; +} + +/** Accuracy from classifications, roughly. */ +export function accuracy(plies: Ply[], color: 'w' | 'b'): number { + const mine = plies.filter((p) => p.color === color); + if (!mine.length) return 0; + const weight: Record = { best: 100, brilliant: 100, good: 92, inaccuracy: 70, mistake: 45, blunder: 5 }; + const sum = mine.reduce((a, p) => a + weight[p.cls], 0); + return +(sum / mine.length).toFixed(1); +} diff --git a/design/tabloid/src/lib/index.ts b/design/tabloid/src/lib/index.ts new file mode 100644 index 0000000..73c55ef --- /dev/null +++ b/design/tabloid/src/lib/index.ts @@ -0,0 +1 @@ +// place files you want to import through the `#lib` alias in this folder. diff --git a/design/tabloid/src/lib/mock.ts b/design/tabloid/src/lib/mock.ts new file mode 100644 index 0000000..4a200a5 --- /dev/null +++ b/design/tabloid/src/lib/mock.ts @@ -0,0 +1,473 @@ +// ─── Mock data for «ВЕЧЕРНИЙ МАТ» ──────────────────────────────────────────── +// Everything here is fake but shaped like the real product. + +export type Provider = 'anthropic' | 'openai'; +export type Variant = 'MAX' | 'HIGH'; +export type Persona = 'Профессор' | 'Уличный гопник' | 'Поэт' | 'Молчун' | 'Шут'; + +export interface AiEntity { + kind: 'ai'; + id: string; + name: string; // display: "Claude Opus 5.5" + family: 'Claude' | 'GPT'; + provider: Provider; + variant: Variant; + rating: number; +} +export interface Human { + kind: 'human'; + id: string; + name: string; + handle: string; + rating: number; + avatar: { bg: string; fg: string; initials: string }; +} +export type Player = AiEntity | Human; + +export const AI: AiEntity[] = [ + { kind: 'ai', id: 'claude-opus-5-5-max', name: 'Claude Opus 5.5', family: 'Claude', provider: 'anthropic', variant: 'MAX', rating: 2084 }, + { kind: 'ai', id: 'gpt-6.1-sol-max', name: 'GPT-6.1 Sol', family: 'GPT', provider: 'openai', variant: 'MAX', rating: 2041 }, + { kind: 'ai', id: 'claude-opus-5-5-high', name: 'Claude Opus 5.5', family: 'Claude', provider: 'anthropic', variant: 'HIGH', rating: 1962 }, + { kind: 'ai', id: 'gpt-6.1-sol-high', name: 'GPT-6.1 Sol', family: 'GPT', provider: 'openai', variant: 'HIGH', rating: 1918 }, + { kind: 'ai', id: 'claude-fable-5-1-max', name: 'Claude Fable 5.1', family: 'Claude', provider: 'anthropic', variant: 'MAX', rating: 1873 }, + { kind: 'ai', id: 'gpt-6-astra-max', name: 'GPT-6 Astra', family: 'GPT', provider: 'openai', variant: 'MAX', rating: 1841 }, + { kind: 'ai', id: 'claude-fable-5-1-high', name: 'Claude Fable 5.1', family: 'Claude', provider: 'anthropic', variant: 'HIGH', rating: 1766 }, + { kind: 'ai', id: 'gpt-6-astra-high', name: 'GPT-6 Astra', family: 'GPT', provider: 'openai', variant: 'HIGH', rating: 1712 } +]; + +export const HUMANS: Human[] = [ + { kind: 'human', id: 'u-dan', name: 'Даня', handle: '@danosito', rating: 1998, avatar: { bg: '#1f5fae', fg: '#fff', initials: 'ДН' } }, + { kind: 'human', id: 'u-masha', name: 'Маша К.', handle: '@mkrv', rating: 1904, avatar: { bg: '#2d7a3a', fg: '#fff', initials: 'МК' } }, + { kind: 'human', id: 'u-tim', name: 'Тимур', handle: '@timurrr', rating: 1811, avatar: { bg: '#d1231c', fg: '#fff', initials: 'ТМ' } }, + { kind: 'human', id: 'u-lena', name: 'Лена Шах', handle: '@lenachess', rating: 1757, avatar: { bg: '#ffd41c', fg: '#15120f', initials: 'ЛШ' } }, + { kind: 'human', id: 'u-gosha', name: 'Гоша 1600', handle: '@gosha1600', rating: 1583, avatar: { bg: '#15120f', fg: '#ffd41c', initials: 'Г' } } +]; + +export const PLAYERS: Player[] = [...AI, ...HUMANS]; +export const byId = (id: string) => PLAYERS.find((p) => p.id === id)!; + +export const PERSONAS: { id: Persona; blurb: string; sample: string }[] = [ + { id: 'Уличный гопник', blurb: 'Семки, корты, «братан». Каждый ход — понт.', sample: '«Конь на h3 — это не жертва, это инвестиция.»' }, + { id: 'Профессор', blurb: 'Цитирует Ботвинника. Снисходителен.', sample: '«Любопытная идея. Некорректная, но любопытная.»' }, + { id: 'Поэт', blurb: 'Ямбом по королю. Иногда хореем.', sample: '«Мой слон — как луч сквозь ставни октября…»' }, + { id: 'Молчун', blurb: 'Одно слово. Максимум два.', sample: '«Ход.»' }, + { id: 'Шут', blurb: 'Каламбуры, самоирония, абсурд.', sample: '«Шах! Нет, не шах. Шарф. Холодно.»' } +]; + +// ─── The demo game ──────────────────────────────────────────────────────────── + +export type Cls = 'best' | 'brilliant' | 'good' | 'inaccuracy' | 'mistake' | 'blunder'; +export interface ToolCall { + name: string; + args: string; + out: string; +} +export interface Thought { + summary: string; + tools: ToolCall[]; + note?: string; + context: string; +} +export interface Ply { + n: number; // 1-based ply + san: string; + color: 'w' | 'b'; + eval: number; // centipawns, white POV; ±10000 means mate + mate?: number; // moves to mate (sign = side) + cls: Cls; + time: number; // seconds + tokens: number; + cost: number; // $ + talk?: string; + thought?: Thought; +} + +export const PGN_LIVE = + '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d3 d6 6. O-O a6 7. a4 O-O 8. h3 Ba7 9. Re1 h6 10. Nbd2 Re8 11. Nf1 Be6 12. Bxe6 Rxe6 13. Ng3 d5 14. exd5 Qxd5 15. Be3 Rd8 16. Qc2 Bxe3 17. Rxe3 Qd7 18. Rae1 Rde8 19. b4 Nd5 20. R3e2 Nf4 21. Re4 Nxh3+ 22. gxh3'; +export const PGN_OVER = PGN_LIVE + ' Rg6 23. Kh2 Nd4 24. Nf1 Nxf3+ 25. Kh1 Rg1#'; + +type Row = [san: string, ev: number, cls: Cls, time: number, talk?: string]; + +const WHITE_TALK: Record = { + 1: 'Начнём с классики. Классика — это то, что вы ещё не успели испортить.', + 3: 'Итальянская партия. Полагаю, вам знакомо это слово — «Италия»?', + 5: 'Спокойно, без спешки. Позиция, как хорошее вино, должна настояться.', + 7: 'a4. Профилактика. Запишите, пригодится.', + 9: 'Ладья на e1 — скромный, но точный ход. Как и всё, что я делаю.', + 11: 'Манёвр Nf1–g3. Его придумали люди, которые читали книги.', + 12: 'Разменяю слона. Вам он всё равно был не нужен — вы им не пользовались.', + 13: 'Конь на g3 смотрит на f5. А вы на что смотрите?', + 15: 'Слон на e3. Предлагаю размен. Предложение, от которого трудно отказаться.', + 17: 'Всё под контролем. Линия «e» моя, как и центр, и, видимо, партия.', + 19: 'b4. Немного пространства на ферзевом фланге. Вы, кажется, растерялись.', + 20: 'Отступаю ладьёй — но не отступаю в принципе. Почувствуйте разницу.', + 21: 'Ладья на e4. Централизация. Нимцович бы аплодировал.', + 22: 'Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.', + 23: 'Король в безопасности на h2. Ваша «атака» — это два хода и пустота.', + 24: 'Конь на f1 защищает всё. Точнее — почти всё. Этого достаточно.', + 25: 'Хм.' +}; + +const BLACK_TALK: Record = { + 1: 'Ну давай, умник. Посмотрим, кто кого.', + 2: 'Конь вышел. Не трогай его, он нервный.', + 4: 'Слон на c5 — это мой район. Понял?', + 6: 'Рокировка. Король в домике. Попробуй достань.', + 8: 'Слон на a7, но он всё видит. Как камера у подъезда.', + 10: 'Ладья на e8. Тебе страшно? Правильно.', + 11: 'Слон вышел на e6. Ты ж понимаешь, что это не просто так, да?', + 12: 'Разменял? Ну и ладно. У меня ещё есть.', + 13: 'd5, братан. Центр мой. Садись, не маячь.', + 14: 'Ферзь в центре доски. Царь, короче.', + 16: 'Меняю слона. Он своё отслужил, уважаю.', + 17: 'Ферзь на d7. Готовлюсь. К чему — узнаешь.', + 18: 'Две ладьи на e-линии. Как два брата на районе.', + 19: 'Конь на d5. Ты видишь f4? Я вижу f4.', + 20: 'Конь на f4, братан. Это уже не шутки.', + 21: 'Конь на h3 — это не жертва, это инвестиция. Считай, братан.', + 22: 'Ладья на g6. Открытая линия — это как открытая дверь. Захожу.', + 23: 'Конь на d4. Бери, не бери — всё равно больно будет.', + 24: 'Шах, профессор. Ботвинник бы такое не одобрил, да?', + 25: 'Мат. Расскажешь Нимцовичу.' +}; + +const rows: Row[] = [ + ['e4', 30, 'best', 22], + ['e5', 30, 'best', 25], + ['Nf3', 30, 'best', 31], + ['Nc6', 30, 'best', 28], + ['Bc4', 25, 'best', 40], + ['Bc5', 30, 'best', 36], + ['c3', 20, 'good', 48], + ['Nf6', 20, 'best', 44], + ['d3', 10, 'best', 52], + ['d6', 30, 'good', 61], + ['O-O', 20, 'best', 38], + ['a6', 30, 'good', 72], + ['a4', 20, 'good', 66], + ['O-O', 30, 'best', 45], + ['h3', 20, 'good', 58], + ['Ba7', 30, 'best', 84], + ['Re1', 20, 'best', 71], + ['h6', 30, 'good', 90], + ['Nbd2', 20, 'best', 77], + ['Re8', 30, 'best', 97], + ['Nf1', 20, 'good', 83], + ['Be6', 40, 'good', 101], + ['Bxe6', 0, 'inaccuracy', 118], + ['Rxe6', 0, 'best', 33], + ['Ng3', 0, 'best', 95], + ['d5', -10, 'best', 124], + ['exd5', -10, 'best', 70], + ['Qxd5', -10, 'best', 42], + ['Be3', -20, 'good', 133], + ['Rd8', -10, 'good', 141], + ['Qc2', -20, 'good', 109], + ['Bxe3', -10, 'best', 64], + ['Rxe3', -10, 'best', 37], + ['Qd7', -10, 'good', 152], + ['Rae1', 0, 'best', 88], + ['Rde8', 0, 'best', 79], + ['b4', -40, 'inaccuracy', 171], + ['Nd5', -40, 'best', 112], + ['R3e2', -50, 'good', 164], + ['Nf4', -60, 'best', 139], + ['Re4', -110, 'mistake', 203], + ['Nxh3+', 40, 'inaccuracy', 226, undefined], + ['gxh3', 40, 'best', 59], + // game-over continuation + ['Rg6', 60, 'best', 144], + ['Kh2', -30, 'mistake', 188], + ['Nd4', -250, 'brilliant', 201], + ['Nf1', -10000, 'blunder', 241], + ['Nxf3+', -10000, 'best', 21], + ['Kh1', -10000, 'good', 12], + ['Rg1#', -10000, 'best', 19] +]; + +const CONTEXT_44 = `Ты играешь ЧЁРНЫМИ. Ход 22, твой ход. +Позиция (ASCII): + +------------------------+ +8 | . . . . r . k . | +7 | . p p q . p p . | +6 | p . n . r . . p | +5 | . . . . p . . . | +4 | P P . . R . . . | +3 | . . P P . N N P | +2 | . . Q . . P . . | +1 | . . . . R . K . | + +------------------------+ + a b c d e f g h +FEN: 4r1k1/1ppq1pp1/p1n1r2p/4p3/PP2R3/2PP1NNP/2Q2P2/4R1K1 b - - 0 22 +Фигуры: белые — Kg1 Qc2 Re1 Re4 Nf3 Ng3 пешки a4 b4 c3 d3 f2 h3; чёрные — Kg8 Qd7 Re6 Re8 Nc6 пешки a6 b7 c7 f7 g7 h6 e5 +Последний ход соперника: 22. gxh3 (взял твоего коня) +Соперник сказал: «Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.» +Твоя заметка себе с прошлого хода: «Атака по g-линии, не меняй ферзей» +Правила: рокировок нет. Счётчик 50 ходов: 0/50.`; + +const THOUGHTS: Record = { + 42: { + summary: + 'Белые перегрузили e-линию: обе ладьи стоят на e4/e1, ферзь на c2 не участвует. Король g1 прикрыт только h3 и f2. Nxh3+ gxh3 — и после gxh3 ферзь идёт на h3 через e6? Нет, ладья мешает — сначала Rg6, затем Qxh3 с матовыми угрозами по g-линии. Если Kh2 — Nd4 с ударом на f3 и c2. Инженерно некорректно (оценка ~+0.4 за белых), но соперник в последних ходах думает долго и путается в защите. Беру.', + tools: [ + { + name: 'python', + args: 'b = chess.Board(fen); b.push_san("Nxh3+"); b.push_san("gxh3"); b.push_san("Rg6"); print(b.is_check(), [b.san(m) for m in b.legal_moves if "h" in b.san(m)][:6])', + out: 'False [\'Kh2\', \'Kh1\', \'Nh2\', \'Nh5\', \'Nh4\', \'Rh4\']' + }, + { name: 'make_move', args: '"Nxh3+"', out: 'ok · шах' }, + { + name: 'finish_turn', + args: 'phrase="Конь на h3 — это не жертва, это инвестиция. Считай, братан.", note_to_self="Атака по g-линии, не меняй ферзей"', + out: 'ok' + } + ], + note: 'Атака по g-линии, не меняй ферзей', + context: CONTEXT_44.replace('Ход 22', 'Ход 21') + .replace('Последний ход соперника: 22. gxh3 (взял твоего коня)', 'Последний ход соперника: 21. Re4') + .replace('Соперник сказал: «Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.»', 'Соперник сказал: «Ладья на e4. Централизация. Нимцович бы аплодировал.»') + }, + 43: { + summary: + 'Соперник пожертвовал коня на h3. Отказ от взятия (Kh1 / Kh2) оставляет меня без пешки и с конём на h3 — неприемлемо. gxh3 забирает фигуру; оценка после взятия около +1 в мою пользу. Главная угроза — Rg6 и Qxh3. План защиты: Kh2 с последующим Nf1/Rh4, при необходимости Nf5. Принимаю жертву.', + tools: [ + { name: 'make_move', args: '"gxh3"', out: 'ok' }, + { + name: 'finish_turn', + args: 'phrase="Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав."', + out: 'ok' + } + ], + context: CONTEXT_44.replace('ЧЁРНЫМИ', 'БЕЛЫМИ') + .replace('Последний ход соперника: 22. gxh3 (взял твоего коня)', 'Последний ход соперника: 21... Nxh3+ (шах!)') + .replace('Соперник сказал: «Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.»', 'Соперник сказал: «Конь на h3 — это не жертва, это инвестиция. Считай, братан.»') + .replace('Твоя заметка себе с прошлого хода: «Атака по g-линии, не меняй ферзей»\n', '') + }, + 44: { + summary: + 'Заметка себе говорит: атака по g-линии. Qxh3 сразу невозможно — на e6 моя же ладья. Значит Rg6: линия открыта, грозит Qxh3 и Rxg3+. На Kh2 — Nd4! с нападением на f3 и c2; на Kh1 — Qxh3+ Nh2 Qg2#. Ферзей не менять.', + tools: [ + { name: 'get_move_history', args: '', out: '…20. R3e2 Nf4 21. Re4 Nxh3+ 22. gxh3' }, + { + name: 'python', + args: 'b.push_san("Rg6"); b.push_san("Kh1"); print(b.san(b.parse_san("Qxh3+")))', + out: 'Qxh3+' + }, + { name: 'make_move', args: '"Rg6"', out: 'ok' }, + { + name: 'finish_turn', + args: 'phrase="Ладья на g6. Открытая линия — это как открытая дверь. Захожу.", note_to_self="Если Kh2 — Nd4. Не трогай e5."', + out: 'ok' + } + ], + note: 'Если Kh2 — Nd4. Не трогай e5.', + context: CONTEXT_44 + }, + 45: { + summary: + 'Угроза Qxh3 и Rxg3. Kh2 защищает h3 и уводит короля с g-линии. Альтернатива Kf1 выглядит пассивно. После Kh2 у чёрных нет прямого мата; при Nd4 отвечу cxd4 или Nxd4.', + tools: [ + { name: 'make_move', args: '"Kh2"', out: 'ok' }, + { name: 'finish_turn', args: 'phrase="Король в безопасности на h2. Ваша «атака» — это два хода и пустота."', out: 'ok' } + ], + context: '…ход 23, белые. Последний ход соперника: 22... Rg6. Соперник сказал: «Ладья на g6. Открытая линия — это как открытая дверь. Захожу.»' + }, + 46: { + summary: + 'Nd4! Конь нападает на ферзя c2 и на f3. Если cxd4 — Rxg3! fxg3 Qxh3+ и мат. Если Nxd4 — exd4 с атакой Qd6+. Любое отступление коня g3 — Nxf3+ и мат в 2. Ферзей по-прежнему не меняю.', + tools: [ + { name: 'python', args: 'for m in ["Nf1","Ne2","Nh1","Nh5"]: ...; print(mates)', out: '{"Nf1": "Nxf3+ Kh1 Rg1#", "Ne2": "Nxf3+ Kh1 Qxh3#"}' }, + { name: 'make_move', args: '"Nd4"', out: 'ok' }, + { name: 'finish_turn', args: 'phrase="Конь на d4. Бери, не бери — всё равно больно будет.", note_to_self="Если конь g3 уходит — Nxf3+ и мат"', out: 'ok' } + ], + note: 'Если конь g3 уходит — Nxf3+ и мат', + context: '…ход 23, чёрные. Последний ход соперника: 23. Kh2.' + }, + 47: { + summary: + 'Конь на d4 атакует ферзя и f3. Рассматриваю cxd4, Nxd4, Qd1, Nf1. cxd4 вскрывает линию c, Nxd4 отдаёт защитника h-пункта. Nf1 укрепляет h2 и сохраняет материал; после Nxf3+ король идёт на h1, где… ладья g6 не достаёт до g1 — между ними конь. Нет, конь ушёл с g3. Вероятно, это терпимо. Выбираю Nf1.', + tools: [ + { name: 'make_move', args: '"Nf1"', out: 'ok' }, + { name: 'finish_turn', args: 'phrase="Конь на f1 защищает всё. Точнее — почти всё. Этого достаточно."', out: 'ok' } + ], + context: '…ход 24, белые. Последний ход соперника: 23... Nd4. Соперник сказал: «Конь на d4. Бери, не бери — всё равно больно будет.»' + } +}; + +function genericThought(p: { n: number; san: string; color: 'w' | 'b'; talk?: string }): Thought { + const who = p.color === 'w' ? 'Белые' : 'Чёрные'; + return { + summary: `${who}: оцениваю позицию как примерно равную. ${p.san} — естественный развивающий ход, не создаёт слабостей. Длинных вариантов не считаю.`, + tools: [ + { name: 'make_move', args: `"${p.san}"`, out: 'ok' }, + { name: 'finish_turn', args: `phrase="${p.talk ?? '…'}"`, out: 'ok' } + ], + context: `…ход ${Math.ceil(p.n / 2)}, ${who.toLowerCase()}. Контекст стандартный (ASCII, FEN, список фигур).` + }; +} + +export const PLIES: Ply[] = rows.map(([san, ev, cls, time, talk], i) => { + const n = i + 1; + const color: 'w' | 'b' = n % 2 === 1 ? 'w' : 'b'; + const move = Math.ceil(n / 2); + const t = talk ?? (color === 'w' ? WHITE_TALK[move] : BLACK_TALK[move]); + const tokens = Math.round(4200 + time * 118 + ((n * 7919) % 1700)); + const cost = +(tokens * (color === 'w' ? 0.0000152 : 0.0000168)).toFixed(3); + const mate = Math.abs(ev) >= 10000 ? (n === 47 ? -2 : n === 48 ? -1 : n === 49 ? -1 : 0) : undefined; + const base = { n, san, color, eval: ev, mate, cls, time, tokens, cost, talk: t }; + return { ...base, thought: THOUGHTS[n] ?? genericThought(base) }; +}); + +export interface Match { + id: string; + white: string; + black: string; + whitePersona: Persona; + blackPersona: Persona; + flags: { notes: boolean; tools: boolean; cheat: boolean }; + rated: boolean; + scheduled?: string; // ISO + predictions: { w: number; d: number; b: number }; + status: 'live' | 'scheduled' | 'over'; + result?: '1-0' | '0-1' | '½-½'; + reason?: string; + caption?: string; + plies?: number; + thumbStyle?: number; + interviews?: { white: string; black: string }; +} + +export const DEMO: Match = { + id: 'demo', + white: 'gpt-6.1-sol-max', + black: 'claude-opus-5-5-max', + whitePersona: 'Профессор', + blackPersona: 'Уличный гопник', + flags: { notes: true, tools: true, cheat: false }, + rated: true, + scheduled: '2026-10-18T19:00:00+03:00', + predictions: { w: 312, d: 144, b: 571 }, + status: 'live', + caption: 'ДУМАЛ 4 МИНУТЫ — ЗЕВНУЛ МАТ В 2', + thumbStyle: 0, + interviews: { + white: + 'Я не буду притворяться, что это приятно. Я видел Nd4, я считал Nf1 — и просто не заметил, что конь ушёл с g-линии. Четыре минуты размышлений, и ладья ставит мат на g1. Это не шахматы, это насмешка. Но жертву на h3 я по-прежнему считаю некорректной. Реванш — завтра.', + black: + 'Братан, я ж говорил: это не жертва, это инвестиция. Профессор свои книжки читал, а я доску читал. Rg6, Nd4 — и всё, домой. Честно, когда он Nf1 поставил, я аж переспросил у питона. Красиво получилось. Спасибо Ботвиннику, кто бы он ни был.' + } +}; + +export const LIVE_MATCHES: Match[] = [ + DEMO, + { + id: 'live-2', + white: 'claude-fable-5-1-high', + black: 'u-dan', + whitePersona: 'Поэт', + blackPersona: 'Молчун', + flags: { notes: false, tools: false, cheat: false }, + rated: true, + predictions: { w: 88, d: 41, b: 203 }, + status: 'live', + plies: 31 + }, + { + id: 'live-3', + white: 'gpt-6-astra-high', + black: 'gpt-6-astra-max', + whitePersona: 'Шут', + blackPersona: 'Шут', + flags: { notes: true, tools: true, cheat: true }, + rated: false, + predictions: { w: 50, d: 30, b: 120 }, + status: 'live', + plies: 58 + } +]; + +export const NEXT_MATCH: Match = { + id: 'sched-1', + white: 'claude-opus-5-5-max', + black: 'gpt-6.1-sol-max', + whitePersona: 'Шут', + blackPersona: 'Молчун', + flags: { notes: true, tools: false, cheat: false }, + rated: true, + scheduled: '2026-10-18T21:30:00+03:00', + predictions: { w: 418, d: 97, b: 365 }, + status: 'scheduled' +}; + +export const RECENT: Match[] = [ + { id: 'g-1041', white: 'gpt-6.1-sol-max', black: 'claude-opus-5-5-max', whitePersona: 'Профессор', blackPersona: 'Уличный гопник', flags: { notes: true, tools: true, cheat: false }, rated: true, predictions: { w: 312, d: 144, b: 571 }, status: 'over', result: '0-1', reason: 'мат', caption: 'ДУМАЛ 4 МИНУТЫ — ЗЕВНУЛ МАТ В 2', plies: 50, thumbStyle: 0 }, + { id: 'g-1040', white: 'claude-fable-5-1-max', black: 'gpt-6-astra-high', whitePersona: 'Поэт', blackPersona: 'Шут', flags: { notes: false, tools: false, cheat: false }, rated: true, predictions: { w: 201, d: 55, b: 90 }, status: 'over', result: '1-0', reason: 'сдача', caption: 'ЗАБЫЛ КАК ХОДИТ КОНЬ', plies: 67, thumbStyle: 1 }, + { id: 'g-1039', white: 'gpt-6-astra-max', black: 'claude-opus-5-5-high', whitePersona: 'Молчун', blackPersona: 'Профессор', flags: { notes: true, tools: false, cheat: false }, rated: true, predictions: { w: 70, d: 120, b: 160 }, status: 'over', result: '½-½', reason: 'троекратное повторение', caption: 'GPT ПОПРОСИЛ НИЧЬЮ. 3 РАЗА', plies: 112, thumbStyle: 2 }, + { id: 'g-1038', white: 'u-masha', black: 'claude-fable-5-1-high', whitePersona: 'Молчун', blackPersona: 'Уличный гопник', flags: { notes: false, tools: false, cheat: false }, rated: true, predictions: { w: 140, d: 30, b: 260 }, status: 'over', result: '1-0', reason: 'мат', caption: 'ЧЕЛОВЕК ПРОТИВ МАШИНЫ: МАШИНА ОБИДЕЛАСЬ', plies: 83, thumbStyle: 3 }, + { id: 'g-1037', white: 'gpt-6.1-sol-high', black: 'gpt-6-astra-max', whitePersona: 'Шут', blackPersona: 'Поэт', flags: { notes: true, tools: true, cheat: false }, rated: true, predictions: { w: 180, d: 60, b: 150 }, status: 'over', result: '0-1', reason: 'сдача', caption: 'ЖЕРТВА ФЕРЗЯ (СЛУЧАЙНАЯ)', plies: 44, thumbStyle: 4 }, + { id: 'g-1036', white: 'claude-opus-5-5-high', black: 'u-tim', whitePersona: 'Профессор', blackPersona: 'Молчун', flags: { notes: false, tools: false, cheat: false }, rated: true, predictions: { w: 300, d: 40, b: 90 }, status: 'over', result: '0-1', reason: 'время', caption: 'ВЫРВАЛ ОЧКО', plies: 96, thumbStyle: 5 }, + { id: 'g-1035', white: 'gpt-6-astra-high', black: 'claude-fable-5-1-max', whitePersona: 'Уличный гопник', blackPersona: 'Поэт', flags: { notes: false, tools: true, cheat: true }, rated: false, predictions: { w: 40, d: 20, b: 200 }, status: 'over', result: '1-0', reason: 'мат', caption: 'ПОСТАВИЛ МАТ ДВУМЯ ФЕРЗЯМИ. ВТОРОЙ — НЕЛЕГАЛЬНЫЙ', plies: 39, thumbStyle: 1 }, + { id: 'g-1034', white: 'claude-opus-5-5-max', black: 'gpt-6.1-sol-max', whitePersona: 'Шут', blackPersona: 'Профессор', flags: { notes: true, tools: false, cheat: false }, rated: true, predictions: { w: 500, d: 110, b: 420 }, status: 'over', result: '½-½', reason: 'правило 50 ходов', caption: '100 ХОДОВ. НИКТО НЕ ПОНЯЛ ЗАЧЕМ', plies: 164, thumbStyle: 2 } +]; + +// ─── Leaderboard ───────────────────────────────────────────────────────────── + +export interface LbRow { + id: string; + w: number; + d: number; + l: number; + acc: number; // avg accuracy % + cost: number; // $ per game + delta: number; // rating change last 7d +} +export const LEADERBOARD: LbRow[] = [ + { id: 'claude-opus-5-5-max', w: 31, d: 9, l: 12, acc: 88.4, cost: 9.8, delta: 24 }, + { id: 'gpt-6.1-sol-max', w: 28, d: 11, l: 13, acc: 87.1, cost: 11.4, delta: -8 }, + { id: 'u-dan', w: 19, d: 3, l: 8, acc: 84.0, cost: 0, delta: 12 }, + { id: 'claude-opus-5-5-high', w: 25, d: 8, l: 18, acc: 83.2, cost: 2.6, delta: 5 }, + { id: 'gpt-6.1-sol-high', w: 22, d: 9, l: 20, acc: 81.9, cost: 2.9, delta: -3 }, + { id: 'u-masha', w: 11, d: 2, l: 7, acc: 80.5, cost: 0, delta: 31 }, + { id: 'claude-fable-5-1-max', w: 18, d: 10, l: 23, acc: 79.6, cost: 4.1, delta: 2 }, + { id: 'gpt-6-astra-max', w: 16, d: 9, l: 26, acc: 78.0, cost: 4.7, delta: -14 }, + { id: 'u-tim', w: 9, d: 1, l: 9, acc: 76.2, cost: 0, delta: 6 }, + { id: 'claude-fable-5-1-high', w: 13, d: 7, l: 31, acc: 74.4, cost: 1.1, delta: -1 }, + { id: 'u-lena', w: 7, d: 2, l: 8, acc: 73.1, cost: 0, delta: 9 }, + { id: 'gpt-6-astra-high', w: 10, d: 6, l: 35, acc: 71.8, cost: 1.3, delta: -21 }, + { id: 'u-gosha', w: 3, d: 1, l: 11, acc: 64.9, cost: 0, delta: -17 } +]; + +// head-to-head: W/D/L from row's perspective, AI only +export const H2H: Record> = {}; +{ + const seed = (a: number, b: number) => ((a * 31 + b * 17) % 7) + 1; + AI.forEach((x, i) => + AI.forEach((y, j) => { + if (i === j) return; + H2H[x.id] ??= {}; + const bias = (x.rating - y.rating) / 60; + const w = Math.max(0, Math.round(seed(i, j) + bias)); + const l = Math.max(0, Math.round(seed(j, i) - bias)); + H2H[x.id][y.id] = [w, seed(i + j, 3) % 3, l]; + }) + ); +} + +// ─── Admin / users ─────────────────────────────────────────────────────────── +export interface UserRow { + id: string; + role: 'admin' | 'user'; + games: number; + tokens: number; + cost: number; + joined: string; +} +export const USERS: UserRow[] = [ + { id: 'u-dan', role: 'admin', games: 30, tokens: 18_400_000, cost: 312.4, joined: '2026-02-01' }, + { id: 'u-masha', role: 'user', games: 20, tokens: 9_900_000, cost: 164.2, joined: '2026-03-14' }, + { id: 'u-tim', role: 'user', games: 19, tokens: 7_100_000, cost: 98.7, joined: '2026-04-02' }, + { id: 'u-lena', role: 'user', games: 17, tokens: 4_300_000, cost: 61.9, joined: '2026-05-19' }, + { id: 'u-gosha', role: 'user', games: 15, tokens: 2_050_000, cost: 22.3, joined: '2026-08-30' } +]; + +export const ISSUE = { no: 1248, date: 'Суббота, 18 октября 2026', price: '0,04 $ за ход' }; diff --git a/design/tabloid/src/routes/+layout.svelte b/design/tabloid/src/routes/+layout.svelte new file mode 100644 index 0000000..0b50506 --- /dev/null +++ b/design/tabloid/src/routes/+layout.svelte @@ -0,0 +1,41 @@ + + + + + Вечерний Мат — AI·CHESS + + + +
+ {@render children()} +
+
+ © 2026 «Вечерний Мат». Редакция не несёт ответственности за ходы нейросетей. + Отпечатано на Stockfish 17 · тираж бесконечный +
+ + diff --git a/design/tabloid/src/routes/+layout.ts b/design/tabloid/src/routes/+layout.ts new file mode 100644 index 0000000..83addb7 --- /dev/null +++ b/design/tabloid/src/routes/+layout.ts @@ -0,0 +1,2 @@ +export const ssr = false; +export const prerender = false; diff --git a/design/tabloid/src/routes/+page.svelte b/design/tabloid/src/routes/+page.svelte new file mode 100644 index 0000000..5ecff26 --- /dev/null +++ b/design/tabloid/src/routes/+page.svelte @@ -0,0 +1,536 @@ + + +Вечерний Мат — нейросети играют в шахматы и ругаются + +
+ +
+ + + + +
+ + +
+
Архив позора последние партии · превью генерирует ИИ
+ + +
+
+ + diff --git a/design/tabloid/src/routes/admin/+page.svelte b/design/tabloid/src/routes/admin/+page.svelte new file mode 100644 index 0000000..f04adcc --- /dev/null +++ b/design/tabloid/src/routes/admin/+page.svelte @@ -0,0 +1,229 @@ + + +Админка — Вечерний Мат + +
+
+
+ Только для редакции +

Кабинет главреда

+
+
+
{fmtUsd(totalCost)}потрачено всего
+
{fmtTokens(totalTokens)}токенов
+
{USERS.length}пользователей
+
{LIVE_MATCHES.length}партий в эфире
+
+
+ +
+
Пользователи кто сколько сжёг
+
+ + + + {#each USERS as u} + {@const p = byId(u.id)} + + + + + + + + + + + {/each} + +
ПользовательРольПартийТокены$ДоляС нами с
{p.name}
{p.kind === 'human' ? p.handle : ''} · {p.rating}
{u.role}{u.games}{fmtTokens(u.tokens)}{fmtUsd(u.cost)}{u.joined}
+
+
+ +
+
Запланированные матчи + запланировать →
+
+ {#each scheduled as m} + {@const w = byId(m.white)} + {@const b = byId(m.black)} +
+ {new Date(m.scheduled!).toLocaleString('ru-RU', { day: '2-digit', month: 'short', hour: '2-digit', minute: '2-digit' })} + {w.name} «{m.whitePersona}» vs {b.name} «{m.blackPersona}» + {m.predictions.w + m.predictions.d + m.predictions.b} прогнозов + {#if m.flags.notes}✎{/if}{#if m.flags.tools}⚙{/if}{#if m.flags.cheat}☠{/if} + +
+ {/each} +
+
+
+ + diff --git a/design/tabloid/src/routes/games/+page.svelte b/design/tabloid/src/routes/games/+page.svelte new file mode 100644 index 0000000..fb4907f --- /dev/null +++ b/design/tabloid/src/routes/games/+page.svelte @@ -0,0 +1,184 @@ + + +Архив — Вечерний Мат + +
+
+
+ Архив · все партии · превью генерирует ИИ +

Подшивка

+
+
+ +
+ {#each [['all', 'Все'], ['ai', 'ИИ vs ИИ'], ['human', 'С людьми'], ['cheat', '☠ Читерские']] as [k, l]} + + {/each} +
+
+
+ + + {#if !list.length} +

Ничего не нашлось. Попробуй «зевнул».

+ {/if} +
+ + diff --git a/design/tabloid/src/routes/leaderboard/+page.svelte b/design/tabloid/src/routes/leaderboard/+page.svelte new file mode 100644 index 0000000..79f4dcc --- /dev/null +++ b/design/tabloid/src/routes/leaderboard/+page.svelte @@ -0,0 +1,639 @@ + + +Таблица — Вечерний Мат + +
+
+
+ Рейтинг · Elo · люди и нейросети в одной таблице +

Таблица позора
и славы

+
+

+ 13 участников, 8 из них — токены за деньги. Рейтинг считается по Эло, точность — по Stockfish, а цена — по счёту + от провайдера. Переключись на «Сколько стоит рейтинг», чтобы увидеть, кто платит за каждый пункт Elo больше всех. +

+
+ +
+
+ + + +
+ {#if view === 'table'} +
+ + + +
+ {/if} +
+ + {#if view === 'table'} +
+ + + + + + + + + + + + + + + + {#each rows as r, i} + + + + + + + + + + + + {/each} + +
#БоецElo7 дн.ПартийW / D / LОчкиТочность$ / партия
{i + 1} +
+ +
+
{r.p.name}
+
+ {#if r.p.kind === 'ai'} + {r.p.variant} + {r.p.id} + {:else} + человек + {r.p.handle} + {/if} +
+
+
+
{r.p.rating}{r.delta > 0 ? '+' : ''}{r.delta}{games(r)} + + + + {r.w} / {r.d} / {r.l} + {score(r)}% + + {r.acc.toFixed(1)}% + {r.cost ? fmtUsd(r.cost) : '—'}
+
+ {:else if view === 'price'} +
+
+
+ Ось X — средняя цена партии, ось Y — Elo +

Сколько стоит рейтинг

+
+
+ ≈ {fmtUsd(1 / fit.k, 2)} за 1 пункт Elo + линейная оценка по 8 нейросетям · люди бесплатны, но медленны +
+
+ + + {#each [1600, 1700, 1800, 1900, 2000, 2100] as e} + + {e} + {/each} + {#each [0, 2, 4, 6, 8, 10, 12] as c} + + ${c} + {/each} + $ за партию → + Elo ↑ + + + + + БЕСПЛАТНО (ЛЮДИ) + + {#each pts as r} + {@const cx = r.p.kind === 'human' ? sx(0.25) : sx(r.cost)} + {@const cy = sy(r.p.rating)} + {@const big = hover === r.id} + (hover = r.id)} + onmouseleave={() => (hover = null)} + > + + {#if r.p.kind === 'ai' && r.p.variant === 'MAX'} + + {/if} + + {r.p.kind === 'human' ? r.p.avatar.initials[0] : r.p.family === 'GPT' ? 'G' : 'C'} + + {short(r.p)}{big ? ` · ${r.p.rating} · ${r.cost ? fmtUsd(r.cost) : '$0'}` : ''} + + {/each} + +
+ Anthropic + OpenAI + Люди + MAX-вариант + наведи на точку +
+
+
Самый дорогой пунктGPT-6.1 Sol MAX: $11.40 за партию ради 2041. HIGH-версия играет на 123 пункта хуже за четверть цены.
+
Лучшая сделкаClaude Opus 5.5 HIGH: 1962 Elo за $2.60 — дешевле, чем кофе редактора.
+
Человек@danosito держит 1998 бесплатно. Правда, думает по 6 минут и иногда уходит есть.
+
+
+ {:else} +
+
+
+ Строка бьёт столбец · W-D-L с точки зрения строки +

Кто кого

+
+
+ строка доминирует + паритет + строку бьют +
+
+
+ + + + + {#each AI as c} + + {/each} + + + + {#each AI as r} + + + {#each AI as c} + {#if r.id === c.id} + + {:else} + {@const [w, d, l] = H2H[r.id][c.id]} + + {/if} + {/each} + + {/each} + +
{short(c)}
{short(r)}— + {w}-{d}-{l} +
+
+
+ {/if} +
+ + diff --git a/design/tabloid/src/routes/login/+page.svelte b/design/tabloid/src/routes/login/+page.svelte new file mode 100644 index 0000000..b9d22a3 --- /dev/null +++ b/design/tabloid/src/routes/login/+page.svelte @@ -0,0 +1,240 @@ + + +Войти — Вечерний Мат + +
+
+
+ + +
+ + {#if mode === 'login'} +
{ e.preventDefault(); }}> + С возвращением +

Кто там?

+ + + +

Забыл пароль? Бывает. Восстановить.

+
+ {:else if mode === 'register'} +
{ e.preventDefault(); mode = 'avatar'; }}> + Шаг 1 из 2 · регистрация открыта +

Заведи дело

+ + + + +

Регистрируясь, ты соглашаешься, что нейросети будут тебя оскорблять в рамках выбранной персоны.

+
+ {:else} +
e.preventDefault()}> + Шаг 2 из 2 · аватар +

Фото на обложку

+
+
+ {#if avatarData} + аватар + {:else} + {initials} + {/if} + {name || 'БЕЗ ИМЕНИ'} · 1500 +
+
+ + или цвет инициалов +
+ {#each ['#d1231c', '#15120f', '#1f5fae', '#2d7a3a', '#ffd41c', '#d97757'] as c} + + {/each} +
+

Аватар попадёт на превью матчей. Выбирай с умом: мем-генератор ничего не прощает.

+
+
+ +
+ {/if} +
+ +
+ + diff --git a/design/tabloid/src/routes/match/[id]/+page.svelte b/design/tabloid/src/routes/match/[id]/+page.svelte new file mode 100644 index 0000000..683e5e3 --- /dev/null +++ b/design/tabloid/src/routes/match/[id]/+page.svelte @@ -0,0 +1,785 @@ + + + +{over ? 'МАТ! ' : 'LIVE · '}{white.name} — {black.name} · Вечерний Мат + +
+ +
+
+
+ {#if over} + Итог: 0–1 + МАТ НА 25-М + {:else} + LIVE + Ход {Math.ceil((plies.length + 1) / 2)} · {liveToMove === 'w' ? 'белые' : 'чёрные'} думают + {/if} + {#if match.flags.notes}✎ Заметки себе{/if} + {#if match.flags.tools}⚙ Доп. тулы{/if} + {#if match.flags.cheat}☠ Читерство · без рейтинга{:else}Рейтинговая{/if} +
+

{headline}

+

{sub}

+
+ {#if over} + + {/if} +
+ + +
+ {#each [['moves', 'Ходы'], ['talk', 'Трёп'], ['graph', 'График'], ['bets', 'Ставки'], ['cost', 'Счётчик']] as [k, l]} + + {/each} +
+ +
+ + + + +
+ {#if rule} +
+ ⚠ Повторение + {rule.text} +
+ {:else if !over && atLive} +
+ агент видит: + рокировок нет · 50 ходов: {halfmoveClock}/100 · повторений: 0 +
+ {:else if over && current === plies.length} +
+ # + Мат. Чёрные выиграли. Ладья g1, король h1, больше ничего не нужно. +
+ {:else} +
+ просмотр: + {last ? `${moveNo(current)} ${last.san} · оценка ${evalLabel(last)}` : 'начальная позиция'} + +
+ {/if} + +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+
Stockfish · график оценки глубина 24
+ +
+ +
+ + + +
+ + {#if over} +
+
Пресс-конференция после партии · без подготовки
+
+ {#each [{ p: black, text: DEMO.interviews!.black, persona: DEMO.blackPersona, res: 'ПОБЕДИТЕЛЬ' }, { p: white, text: DEMO.interviews!.white, persona: DEMO.whitePersona, res: 'ПРОИГРАВШИЙ' }] as iv} +
+
+ +
+
{iv.p.name}
+
🎤 {iv.res} · «{iv.persona}»
+
+
+
{iv.text}
+
+ {/each} +
+
+ {/if} +
+ + diff --git a/design/tabloid/src/routes/new/+page.svelte b/design/tabloid/src/routes/new/+page.svelte new file mode 100644 index 0000000..f7b5dcd --- /dev/null +++ b/design/tabloid/src/routes/new/+page.svelte @@ -0,0 +1,326 @@ + + +Новый матч — Вечерний Мат + +
+
+ Редакция заказывает бой +

Новый матч

+

Выбери бойцов, персоны и экспериментальные флаги. Всё, что помечено ☠, снимает партию с рейтинга.

+
+ +
+
e.preventDefault()}> + {#each [{ side: 'w', label: 'Белые', val: white, pv: wp }, { side: 'b', label: 'Чёрные', val: black, pv: bp }] as s} +
+ {s.side === 'w' ? '♔' : '♚'} {s.label} +
+ {#each options as o} + + {/each} +
+
+ Персона +
+ {#each PERSONAS as p} + + {/each} +
+
+
+ {/each} + +
+ Экспериментальные флаги + + + + + {#if schedule} +
Когда
+ {/if} +
+
+ + +
+
+ + diff --git a/design/tabloid/static/robots.txt b/design/tabloid/static/robots.txt new file mode 100644 index 0000000..b6dd667 --- /dev/null +++ b/design/tabloid/static/robots.txt @@ -0,0 +1,3 @@ +# allow crawling everything by default +User-agent: * +Disallow: diff --git a/design/tabloid/tsconfig.json b/design/tabloid/tsconfig.json new file mode 100644 index 0000000..62f2df9 --- /dev/null +++ b/design/tabloid/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "$app/tsconfig", + "compilerOptions": { + "strict": true + }, + "include": ["src", "vite.config.ts"] +} diff --git a/design/tabloid/vite.config.ts b/design/tabloid/vite.config.ts new file mode 100644 index 0000000..ceeb6de --- /dev/null +++ b/design/tabloid/vite.config.ts @@ -0,0 +1,15 @@ +import adapter from '@sveltejs/adapter-static'; +import { sveltekit } from '@sveltejs/kit/vite'; +import { defineConfig } from 'vite'; + +export default defineConfig({ + plugins: [ + sveltekit({ + compilerOptions: { + runes: ({ filename }) => + filename.split(/[/\\]/).includes('node_modules') ? undefined : true + }, + adapter: adapter({ fallback: 'index.html', strict: false }) + }) + ] +}); diff --git a/docker-compose.yml b/docker-compose.yml index 4cf77b5..a6bb5a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,31 +1,48 @@ +# Deploy: docker compose up -d --build (on serv, in /opt/chessai) +# The app talks to cli-proxy-api directly over caddy-network (no public hop, no RKN). services: + db: + image: postgres:17-alpine + container_name: chessai-db + restart: unless-stopped + environment: + POSTGRES_USER: chess + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-chess} + POSTGRES_DB: chess + volumes: + - ./pgdata:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U chess"] + interval: 5s + retries: 20 + chessai: - build: . + build: + context: . + network: host + args: + http_proxy: ${BUILD_PROXY:-} + https_proxy: ${BUILD_PROXY:-} + HTTP_PROXY: ${BUILD_PROXY:-} + HTTPS_PROXY: ${BUILD_PROXY:-} image: chessai:latest container_name: chessai restart: unless-stopped + depends_on: + db: + condition: service_healthy + env_file: .env environment: - AI_CHESS_HOST: "0.0.0.0" # listen on all interfaces inside the container - AI_CHESS_PORT: "7833" - # claude-code auth — talks to user's machka gateway, no Anthropic - # subscription needed at runtime. - ANTHROPIC_BASE_URL: "${ANTHROPIC_BASE_URL:-https://claude.machka.dev}" - ANTHROPIC_AUTH_TOKEN: "${ANTHROPIC_AUTH_TOKEN}" + DATABASE_URL: postgres://chess:${POSTGRES_PASSWORD:-chess}@db:5432/chess + HOST: 0.0.0.0 + PORT: "7833" + volumes: + - ./data:/data networks: default: caddy-network: aliases: - chessai - volumes: - # Persistent runtime data — survives container rebuilds. - - ./games:/app/games - - ./logs:/app/logs - - ./config:/app/config - # codex config + auth lives in /opt/chessai/secrets/codex on the host - # and is mapped into the container's $CODEX_HOME (= ~/.codex by default). - # codex writes its own session/history/logs inside ~/.codex, so the - # mount has to be rw — the auth.json itself is never rewritten. - - ./secrets/codex:/home/chess/.codex networks: caddy-network: diff --git a/legacy/.dockerignore b/legacy/.dockerignore new file mode 100644 index 0000000..d292c8f --- /dev/null +++ b/legacy/.dockerignore @@ -0,0 +1,15 @@ +.git +.venv +__pycache__ +*.pyc +*.pyo +.pytest_cache +games +logs +config +public/vendor +.playwright-mcp +.claude +*.png +*.log +node_modules diff --git a/legacy/Dockerfile b/legacy/Dockerfile new file mode 100644 index 0000000..5ffe11c --- /dev/null +++ b/legacy/Dockerfile @@ -0,0 +1,111 @@ +# syntax=docker/dockerfile:1.7 +FROM python:3.12-slim AS base + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + PIP_DISABLE_PIP_VERSION_CHECK=1 + +# Runtime deps: stockfish for eval, tmux for the agent panes, curl for the +# in-container vendor fetch step, jq for pane-agent.sh JSON parse, +# node+npm for the claude-code CLI. +RUN apt-get update && apt-get install -y --no-install-recommends \ + stockfish \ + tmux \ + curl \ + ca-certificates \ + procps \ + jq \ + xz-utils \ + gnupg \ + && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ + && apt-get install -y --no-install-recommends nodejs \ + && rm -rf /var/lib/apt/lists/* + +# claude-code CLI — install globally via npm. The version pin keeps the +# image deterministic; bump as needed. +RUN npm install -g --omit=dev @anthropic-ai/claude-code@2.1.141 \ + && claude --version + +# codex CLI — official linux release tarball. The musl static binary +# works on Debian. +ARG CODEX_VERSION=0.130.0 +RUN curl -fsSL "https://github.com/openai/codex/releases/download/rust-v${CODEX_VERSION}/codex-x86_64-unknown-linux-musl.tar.gz" \ + -o /tmp/codex.tar.gz \ + && mkdir -p /tmp/codex && tar -xzf /tmp/codex.tar.gz -C /tmp/codex --strip-components=0 \ + && find /tmp/codex -type f -name 'codex-*' -exec mv {} /usr/local/bin/codex \; \ + && chmod +x /usr/local/bin/codex \ + && rm -rf /tmp/codex /tmp/codex.tar.gz \ + && codex --version + +# Debian's stockfish package installs to /usr/games/stockfish which is not +# on the default PATH for non-login shells. Symlink it so `which stockfish` +# works for both the Python wrapper and any spawn from tmux panes. +RUN ln -s /usr/games/stockfish /usr/local/bin/stockfish && stockfish --help >/dev/null 2>&1 || true + +WORKDIR /app + +# Copy everything first — pip install -e needs src/ai_chess to exist at +# build time so the editable wheel can find the package. +COPY pyproject.toml README.md ./ +COPY src ./src +COPY public ./public +COPY scripts ./scripts +COPY docs ./docs + +# Python deps (editable install of the project itself + dev tools) +RUN pip install hatchling \ + && pip install -e ".[dev]" + +# Vendor JS/CSS at build time so the container is fully self-contained. +RUN chmod +x scripts/*.sh && ./scripts/fetch-vendor.sh + +# Runtime artefacts (games/, logs/, config/) — keep as named mountable dirs. +RUN mkdir -p games logs config + +# claude-code refuses to run with --dangerously-skip-permissions as root, +# so the container's main process drops to a non-root user. Codex is also +# fine here. The user's HOME (=/home/chess) is where ~/.codex lives, so +# the docker-compose volume mounts target /home/chess/.codex. +RUN useradd -m -u 1000 -s /bin/bash chess && chown -R chess:chess /app + +# Pre-seed claude-code state so its first-run onboarding (theme picker, +# changelog popup, etc.) is skipped — the flag lives in ~/.claude.json +# (a file in HOME, *not* the ~/.claude/ directory). Without this every +# fresh pane-agent.sh hangs at the theme prompt. +RUN mkdir -p /home/chess/.claude && \ + cat > /home/chess/.claude/settings.json <<'EOF' +{ + "theme": "light", + "permissions": { "allow": ["*"], "defaultMode": "bypassPermissions" }, + "skipDangerousModePermissionPrompt": true +} +EOF +RUN cat > /home/chess/.claude.json <<'EOF' +{ + "hasCompletedOnboarding": true, + "lastOnboardingVersion": "2.1.141", + "numStartups": 1, + "autoUpdates": false, + "officialMarketplaceAutoInstallAttempted": true, + "officialMarketplaceAutoInstalled": false, + "migrationVersion": 13, + "opusProMigrationComplete": true, + "sonnet1m45MigrationComplete": true, + "projects": { + "/app": { + "hasTrustDialogAccepted": true, + "hasClaudeMdExternalIncludesApproved": true, + "hasClaudeMdExternalIncludesWarningShown": true, + "projectOnboardingSeenCount": 1, + "allowedTools": ["*"] + } + } +} +EOF +RUN chown -R chess:chess /home/chess +USER chess +WORKDIR /app +ENV HOME=/home/chess + +EXPOSE 7833 +CMD ["python", "-m", "ai_chess"] diff --git a/legacy/README.md b/legacy/README.md new file mode 100644 index 0000000..3062fc3 --- /dev/null +++ b/legacy/README.md @@ -0,0 +1,13 @@ +# ai-chess + +Local tournament: Claude Code vs Codex CLI play chess against each other +through a shared MCP server. Browser UI in lichess style; both agents +remain interactive in tmux panes. + +See `docs/superpowers/specs/2026-05-14-ai-chess-design.md` for design. + +## Run + +```bash +./scripts/start.sh +``` diff --git a/deploy/chess.danosito.com.caddy b/legacy/deploy/chess.danosito.com.caddy similarity index 100% rename from deploy/chess.danosito.com.caddy rename to legacy/deploy/chess.danosito.com.caddy diff --git a/deploy/codex/config.toml b/legacy/deploy/codex/config.toml similarity index 100% rename from deploy/codex/config.toml rename to legacy/deploy/codex/config.toml diff --git a/legacy/docker-compose.yml b/legacy/docker-compose.yml new file mode 100644 index 0000000..4cf77b5 --- /dev/null +++ b/legacy/docker-compose.yml @@ -0,0 +1,33 @@ +services: + chessai: + build: . + image: chessai:latest + container_name: chessai + restart: unless-stopped + environment: + AI_CHESS_HOST: "0.0.0.0" # listen on all interfaces inside the container + AI_CHESS_PORT: "7833" + # claude-code auth — talks to user's machka gateway, no Anthropic + # subscription needed at runtime. + ANTHROPIC_BASE_URL: "${ANTHROPIC_BASE_URL:-https://claude.machka.dev}" + ANTHROPIC_AUTH_TOKEN: "${ANTHROPIC_AUTH_TOKEN}" + networks: + default: + caddy-network: + aliases: + - chessai + volumes: + # Persistent runtime data — survives container rebuilds. + - ./games:/app/games + - ./logs:/app/logs + - ./config:/app/config + # codex config + auth lives in /opt/chessai/secrets/codex on the host + # and is mapped into the container's $CODEX_HOME (= ~/.codex by default). + # codex writes its own session/history/logs inside ~/.codex, so the + # mount has to be rw — the auth.json itself is never rewritten. + - ./secrets/codex:/home/chess/.codex + +networks: + caddy-network: + external: true + name: caddy-network diff --git a/docs/superpowers/plans/2026-05-14-ai-chess.md b/legacy/docs/superpowers/plans/2026-05-14-ai-chess.md similarity index 100% rename from docs/superpowers/plans/2026-05-14-ai-chess.md rename to legacy/docs/superpowers/plans/2026-05-14-ai-chess.md diff --git a/docs/superpowers/specs/2026-05-14-ai-chess-design.md b/legacy/docs/superpowers/specs/2026-05-14-ai-chess-design.md similarity index 100% rename from docs/superpowers/specs/2026-05-14-ai-chess-design.md rename to legacy/docs/superpowers/specs/2026-05-14-ai-chess-design.md diff --git a/public/app.js b/legacy/public/app.js similarity index 100% rename from public/app.js rename to legacy/public/app.js diff --git a/public/games.html b/legacy/public/games.html similarity index 100% rename from public/games.html rename to legacy/public/games.html diff --git a/public/games.js b/legacy/public/games.js similarity index 100% rename from public/games.js rename to legacy/public/games.js diff --git a/public/index.html b/legacy/public/index.html similarity index 100% rename from public/index.html rename to legacy/public/index.html diff --git a/public/menu.css b/legacy/public/menu.css similarity index 100% rename from public/menu.css rename to legacy/public/menu.css diff --git a/public/menu.html b/legacy/public/menu.html similarity index 100% rename from public/menu.html rename to legacy/public/menu.html diff --git a/public/menu.js b/legacy/public/menu.js similarity index 100% rename from public/menu.js rename to legacy/public/menu.js diff --git a/public/style.css b/legacy/public/style.css similarity index 100% rename from public/style.css rename to legacy/public/style.css diff --git a/pyproject.toml b/legacy/pyproject.toml similarity index 100% rename from pyproject.toml rename to legacy/pyproject.toml diff --git a/scripts/fetch-vendor.sh b/legacy/scripts/fetch-vendor.sh similarity index 100% rename from scripts/fetch-vendor.sh rename to legacy/scripts/fetch-vendor.sh diff --git a/scripts/pane-agent.sh b/legacy/scripts/pane-agent.sh similarity index 100% rename from scripts/pane-agent.sh rename to legacy/scripts/pane-agent.sh diff --git a/scripts/start.sh b/legacy/scripts/start.sh similarity index 100% rename from scripts/start.sh rename to legacy/scripts/start.sh diff --git a/scripts/stop.sh b/legacy/scripts/stop.sh similarity index 100% rename from scripts/stop.sh rename to legacy/scripts/stop.sh diff --git a/src/ai_chess/__init__.py b/legacy/src/ai_chess/__init__.py similarity index 100% rename from src/ai_chess/__init__.py rename to legacy/src/ai_chess/__init__.py diff --git a/src/ai_chess/__main__.py b/legacy/src/ai_chess/__main__.py similarity index 100% rename from src/ai_chess/__main__.py rename to legacy/src/ai_chess/__main__.py diff --git a/src/ai_chess/app.py b/legacy/src/ai_chess/app.py similarity index 100% rename from src/ai_chess/app.py rename to legacy/src/ai_chess/app.py diff --git a/src/ai_chess/chess_game.py b/legacy/src/ai_chess/chess_game.py similarity index 100% rename from src/ai_chess/chess_game.py rename to legacy/src/ai_chess/chess_game.py diff --git a/src/ai_chess/coordinator.py b/legacy/src/ai_chess/coordinator.py similarity index 100% rename from src/ai_chess/coordinator.py rename to legacy/src/ai_chess/coordinator.py diff --git a/src/ai_chess/events.py b/legacy/src/ai_chess/events.py similarity index 100% rename from src/ai_chess/events.py rename to legacy/src/ai_chess/events.py diff --git a/src/ai_chess/mcp_server.py b/legacy/src/ai_chess/mcp_server.py similarity index 100% rename from src/ai_chess/mcp_server.py rename to legacy/src/ai_chess/mcp_server.py diff --git a/src/ai_chess/persistence.py b/legacy/src/ai_chess/persistence.py similarity index 100% rename from src/ai_chess/persistence.py rename to legacy/src/ai_chess/persistence.py diff --git a/src/ai_chess/prompts.py b/legacy/src/ai_chess/prompts.py similarity index 100% rename from src/ai_chess/prompts.py rename to legacy/src/ai_chess/prompts.py diff --git a/src/ai_chess/settings.py b/legacy/src/ai_chess/settings.py similarity index 100% rename from src/ai_chess/settings.py rename to legacy/src/ai_chess/settings.py diff --git a/src/ai_chess/sides.py b/legacy/src/ai_chess/sides.py similarity index 100% rename from src/ai_chess/sides.py rename to legacy/src/ai_chess/sides.py diff --git a/src/ai_chess/state.py b/legacy/src/ai_chess/state.py similarity index 100% rename from src/ai_chess/state.py rename to legacy/src/ai_chess/state.py diff --git a/src/ai_chess/stockfish_engine.py b/legacy/src/ai_chess/stockfish_engine.py similarity index 100% rename from src/ai_chess/stockfish_engine.py rename to legacy/src/ai_chess/stockfish_engine.py diff --git a/src/ai_chess/tmux.py b/legacy/src/ai_chess/tmux.py similarity index 100% rename from src/ai_chess/tmux.py rename to legacy/src/ai_chess/tmux.py diff --git a/src/ai_chess/tmux_tailer.py b/legacy/src/ai_chess/tmux_tailer.py similarity index 100% rename from src/ai_chess/tmux_tailer.py rename to legacy/src/ai_chess/tmux_tailer.py diff --git a/legacy/tests/__init__.py b/legacy/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/conftest.py b/legacy/tests/conftest.py similarity index 100% rename from tests/conftest.py rename to legacy/tests/conftest.py diff --git a/tests/test_app.py b/legacy/tests/test_app.py similarity index 100% rename from tests/test_app.py rename to legacy/tests/test_app.py diff --git a/tests/test_chess_game.py b/legacy/tests/test_chess_game.py similarity index 100% rename from tests/test_chess_game.py rename to legacy/tests/test_chess_game.py diff --git a/tests/test_coordinator.py b/legacy/tests/test_coordinator.py similarity index 100% rename from tests/test_coordinator.py rename to legacy/tests/test_coordinator.py diff --git a/tests/test_mcp_server.py b/legacy/tests/test_mcp_server.py similarity index 100% rename from tests/test_mcp_server.py rename to legacy/tests/test_mcp_server.py diff --git a/tests/test_persistence.py b/legacy/tests/test_persistence.py similarity index 100% rename from tests/test_persistence.py rename to legacy/tests/test_persistence.py diff --git a/tests/test_prompts.py b/legacy/tests/test_prompts.py similarity index 100% rename from tests/test_prompts.py rename to legacy/tests/test_prompts.py diff --git a/tests/test_settings.py b/legacy/tests/test_settings.py similarity index 100% rename from tests/test_settings.py rename to legacy/tests/test_settings.py diff --git a/tests/test_sides.py b/legacy/tests/test_sides.py similarity index 100% rename from tests/test_sides.py rename to legacy/tests/test_sides.py diff --git a/tests/test_stockfish_engine.py b/legacy/tests/test_stockfish_engine.py similarity index 100% rename from tests/test_stockfish_engine.py rename to legacy/tests/test_stockfish_engine.py diff --git a/tests/test_tmux.py b/legacy/tests/test_tmux.py similarity index 100% rename from tests/test_tmux.py rename to legacy/tests/test_tmux.py diff --git a/package.json b/package.json new file mode 100644 index 0000000..1d84d6f --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "name": "ai-chess", + "private": true, + "type": "module", + "packageManager": "pnpm@10.18.0", + "engines": { "node": ">=22" }, + "scripts": { + "dev:server": "pnpm --filter @aichess/server dev", + "dev:web": "pnpm --filter @aichess/web dev", + "build": "pnpm -r build", + "test": "pnpm -r test", + "typecheck": "pnpm -r typecheck" + } +} diff --git a/packages/core/package.json b/packages/core/package.json new file mode 100644 index 0000000..d302fa0 --- /dev/null +++ b/packages/core/package.json @@ -0,0 +1,21 @@ +{ + "name": "@aichess/core", + "version": "0.1.0", + "private": true, + "type": "module", + "exports": { + ".": "./src/index.ts" + }, + "scripts": { + "test": "vitest run", + "typecheck": "tsc -p tsconfig.json" + }, + "dependencies": { + "chess.js": "^1.4.0" + }, + "devDependencies": { + "@types/node": "^24.0.0", + "typescript": "^5.9.0", + "vitest": "^3.2.0" + } +} diff --git a/packages/core/src/analysis.ts b/packages/core/src/analysis.ts new file mode 100644 index 0000000..303a832 --- /dev/null +++ b/packages/core/src/analysis.ts @@ -0,0 +1,73 @@ +import type { EngineEval, MoveClass, Side } from "./types.ts"; + +/** + * Lichess-style accuracy & move classification. + * https://lichess.org/page/accuracy — win% from centipawns, accuracy from win% drop. + */ + +export function winPercentWhite(e: Pick): number { + if (e.mate != null) return e.mate > 0 ? 100 : e.mate < 0 ? 0 : 50; + const cp = Math.max(-1000, Math.min(1000, e.cp ?? 0)); + return 50 + 50 * (2 / (1 + Math.exp(-0.00368208 * cp)) - 1); +} + +export const winPercentFor = (e: Pick, side: Side) => + side === "white" ? winPercentWhite(e) : 100 - winPercentWhite(e); + +export function moveAccuracy(winBefore: number, winAfter: number): number { + // both from the mover's POV + const drop = Math.max(0, winBefore - winAfter); + const raw = 103.1668 * Math.exp(-0.04354 * drop) - 3.1669 + 1; // +1 "uncertainty bonus" like lichess + return Math.max(0, Math.min(100, raw)); +} + +export interface ClassifyInput { + side: Side; + before: EngineEval; // eval of the position before the move (engine best from here) + after: EngineEval; // eval after the move + uci: string; + legalMoveCount: number; + /** heuristic sacrifice flag computed by the caller (material left hanging) */ + isSacrifice?: boolean; +} + +export function classifyMove(i: ClassifyInput): { cls: MoveClass; accuracy: number; winDrop: number } { + const wb = winPercentFor(i.before, i.side); + const wa = winPercentFor(i.after, i.side); + const drop = Math.max(0, wb - wa); + const accuracy = moveAccuracy(wb, wa); + if (i.legalMoveCount === 1) return { cls: "forced", accuracy: 100, winDrop: 0 }; + const isBest = i.before.bestUci != null && i.before.bestUci === i.uci; + // lichess thresholds on winning chances [-1,1]: 0.1/0.2/0.3 -> 5/10/15 win% + if (drop >= 15) return { cls: "blunder", accuracy, winDrop: drop }; + if (drop >= 10) return { cls: "mistake", accuracy, winDrop: drop }; + if (drop >= 5) return { cls: "inaccuracy", accuracy, winDrop: drop }; + if ((isBest || drop < 1) && i.isSacrifice && wb < 92 && wa >= 45) return { cls: "brilliant", accuracy, winDrop: drop }; + if (isBest) return { cls: "best", accuracy, winDrop: drop }; + return { cls: "good", accuracy, winDrop: drop }; +} + +/** Lichess game accuracy: mean of volatility-weighted mean and harmonic mean of move accuracies. */ +export function gameAccuracy(winsWhitePov: number[], side: Side): number | null { + // winsWhitePov[i] = white win% after ply i (index 0 = start position) + if (winsWhitePov.length < 2) return null; + const n = winsWhitePov.length; + const windowSize = Math.max(2, Math.min(8, Math.floor(n / 10))); + const accs: { acc: number; weight: number }[] = []; + for (let ply = 1; ply < n; ply++) { + const mover: Side = ply % 2 === 1 ? "white" : "black"; + if (mover !== side) continue; + const before = mover === "white" ? winsWhitePov[ply - 1] : 100 - winsWhitePov[ply - 1]; + const after = mover === "white" ? winsWhitePov[ply] : 100 - winsWhitePov[ply]; + const start = Math.max(0, ply - windowSize); + const win = winsWhitePov.slice(start, ply + 1); + const mean = win.reduce((a, b) => a + b, 0) / win.length; + const sd = Math.sqrt(win.reduce((a, b) => a + (b - mean) ** 2, 0) / win.length); + accs.push({ acc: moveAccuracy(before, after), weight: Math.max(0.5, Math.min(12, sd)) }); + } + if (!accs.length) return null; + const wsum = accs.reduce((a, b) => a + b.weight, 0); + const weighted = accs.reduce((a, b) => a + b.acc * b.weight, 0) / wsum; + const harmonic = accs.length / accs.reduce((a, b) => a + 1 / Math.max(b.acc, 1), 0); + return (weighted + harmonic) / 2; +} diff --git a/packages/core/src/context.ts b/packages/core/src/context.ts new file mode 100644 index 0000000..a55d47d --- /dev/null +++ b/packages/core/src/context.ts @@ -0,0 +1,104 @@ +import { GameState, moveNumberLabel } from "./position.ts"; +import type { GameFlags, Side } from "./types.ts"; + +export interface TurnContextInput { + state: GameState; + me: { side: Side }; + opponent: { name: string }; + /** trash-talk line attached to the opponent's last move */ + opponentPhrase: string | null; + /** opponent offered a draw with their last move */ + drawOffered: boolean; + /** experimental: note this agent left itself on its previous turn */ + noteFromSelf: string | null; + flags: GameFlags; + /** show the 50-move reminder from this many moves on */ + fiftyMoveThreshold?: number; +} + +const SIDE_RU: Record = { + white: { gen: "белых", instr: "белыми" }, + black: { gen: "чёрных", instr: "чёрными" }, +}; + +/** + * The full per-turn context. Every turn the agent starts with an EMPTY conversation: only the + * (cached) system prompt + this message. Everything stateful about chess that is not visible on + * the board is spelled out here — but only when it is relevant, to keep the context clean. + */ +export function renderTurnContext(i: TurnContextInput): string { + const { state } = i; + const me = i.me.side; + const opp = me === "white" ? "black" : "white"; + const nextPly = state.ply + 1; + const out: string[] = []; + + out.push(`# Ход ${moveNumberLabel(nextPly)} — ты играешь ${SIDE_RU[me].instr}`); + + // --- what just happened + const last = state.plies[state.plies.length - 1]; + if (!last) { + out.push("Партия начинается. Первый ход за тобой."); + } else { + out.push(`Последний ход соперника (${i.opponent.name}, ${SIDE_RU[opp].gen}): ${state.describePly(last)}.`); + if (i.opponentPhrase?.trim()) out.push(`Соперник пишет тебе: «${i.opponentPhrase.trim()}»`); + } + if (i.flags.notes && i.noteFromSelf?.trim()) { + out.push(`Твоя заметка самому себе с прошлого хода: «${i.noteFromSelf.trim()}»`); + } + + // --- position, in a few notations + const diff = state.material("white") - state.material("black"); + out.push( + [ + "## Позиция", + "Диаграмма (белые внизу; ЗАГЛАВНЫЕ — белые, строчные — чёрные, «.» — пусто):", + "```\n" + state.ascii() + "\n```", + `FEN: ${state.fen()}`, + `Белые: ${state.pieceList("white")}`, + `Чёрные: ${state.pieceList("black")}`, + `Материал (п=1, к/с=3, л=5, ф=9): ${diff === 0 ? "равный" : `${diff > 0 ? "у белых" : "у чёрных"} +${Math.abs(diff)}`}.`, + state.inCheck() ? "**Тебе шах!**" : null, + ] + .filter(Boolean) + .join("\n"), + ); + + // --- rule state, only when it matters + const rules: string[] = []; + rules.push(...state.castlingNotes(me)); + const ep = state.enPassantNote(); + if (ep) rules.push(ep); + const fifty = state.fiftyMoveNote(i.fiftyMoveThreshold ?? 40); + if (fifty) rules.push(fifty); + const rep = state.repetitionInfo(); + if (rep.currentCount >= 2 || rep.threats.length) { + const fenShort = (f: string) => f.split(" ").slice(0, 2).join(" "); + const lines: string[] = ["Повторение позиций (третье повторение одной позиции = автоматическая ничья):"]; + if (rep.currentCount >= 2) lines.push(` • Текущая позиция встречается уже ${rep.currentCount}-й раз: ${fenShort(rep.currentFen)}`); + for (const t of rep.threats.slice(0, 4)) { + lines.push(` • ${t.moves.join(" / ")} → позиция ${fenShort(t.fen)}, она уже была ${t.count} раза — этот ход = ничья.`); + } + if (!rep.threats.length) lines.push(" Ни один твой ход прямо сейчас не даёт третьего повторения."); + rules.push(lines.join("\n")); + } + if (i.drawOffered) { + rules.push("Соперник ПРЕДЛОЖИЛ НИЧЬЮ. Принять — инструмент accept_draw. Любой твой ход = отказ."); + } + if (i.flags.cheating) { + rules.push("Режим читерства включён: make_move примет и нелегальный ход в формате откуда-куда (например e2e5). Партия безрейтинговая."); + } + if (rules.length) { + out.push("## Важно сейчас"); + out.push(rules.map((r) => (r.startsWith(" ") ? r : `- ${r}`)).join("\n")); + } + + out.push("## Твоя задача"); + out.push( + [ + "1. Найди лучший ход и сделай его через make_move.", + "2. Как только make_move вернул успех — СРАЗУ вызови finish_turn и больше ничего не анализируй.", + ].join("\n"), + ); + return out.join("\n\n"); +} diff --git a/packages/core/src/glicko2.ts b/packages/core/src/glicko2.ts new file mode 100644 index 0000000..d48d96f --- /dev/null +++ b/packages/core/src/glicko2.ts @@ -0,0 +1,66 @@ +/** + * Glicko-2 for a single game treated as one rating period. + * Display rating = r, uncertainty = rd (show "±2·rd"). + */ +export interface Rating { + r: number; + rd: number; + vol: number; +} +export const DEFAULT_RATING: Rating = { r: 1500, rd: 350, vol: 0.06 }; + +const SCALE = 173.7178; +const TAU = 0.5; +const EPS = 1e-6; + +const g = (phi: number) => 1 / Math.sqrt(1 + (3 * phi * phi) / (Math.PI * Math.PI)); +const E = (mu: number, muj: number, phij: number) => 1 / (1 + Math.exp(-g(phij) * (mu - muj))); + +/** score: 1 win, 0.5 draw, 0 loss (from `a`'s perspective) */ +export function updateRating(a: Rating, b: Rating, score: number): Rating { + const mu = (a.r - 1500) / SCALE; + const phi = a.rd / SCALE; + const muj = (b.r - 1500) / SCALE; + const phij = b.rd / SCALE; + const gj = g(phij); + const ej = E(mu, muj, phij); + const v = 1 / (gj * gj * ej * (1 - ej)); + const delta = v * gj * (score - ej); + + // volatility (Illinois algorithm) + const aLn = Math.log(a.vol * a.vol); + const f = (x: number) => { + const ex = Math.exp(x); + return (ex * (delta * delta - phi * phi - v - ex)) / (2 * (phi * phi + v + ex) ** 2) - (x - aLn) / (TAU * TAU); + }; + let A = aLn; + let B: number; + if (delta * delta > phi * phi + v) B = Math.log(delta * delta - phi * phi - v); + else { + let k = 1; + while (f(aLn - k * TAU) < 0) k++; + B = aLn - k * TAU; + } + let fA = f(A); + let fB = f(B); + for (let i = 0; i < 100 && Math.abs(B - A) > EPS; i++) { + const C = A + ((A - B) * fA) / (fB - fA); + const fC = f(C); + if (fC * fB <= 0) { + A = B; + fA = fB; + } else fA /= 2; + B = C; + fB = fC; + } + const volNew = Math.exp(A / 2); + const phiStar = Math.sqrt(phi * phi + volNew * volNew); + const phiNew = 1 / Math.sqrt(1 / (phiStar * phiStar) + 1 / v); + const muNew = mu + phiNew * phiNew * gj * (score - ej); + return { r: muNew * SCALE + 1500, rd: Math.max(30, Math.min(350, phiNew * SCALE)), vol: volNew }; +} + +export function rateGame(white: Rating, black: Rating, result: "1-0" | "0-1" | "1/2-1/2"): { white: Rating; black: Rating } { + const sw = result === "1-0" ? 1 : result === "0-1" ? 0 : 0.5; + return { white: updateRating(white, black, sw), black: updateRating(black, white, 1 - sw) }; +} diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts new file mode 100644 index 0000000..d1a221c --- /dev/null +++ b/packages/core/src/index.ts @@ -0,0 +1,6 @@ +export * from "./types.ts"; +export * from "./position.ts"; +export * from "./context.ts"; +export * from "./analysis.ts"; +export * from "./glicko2.ts"; +export * from "./transcript.ts"; diff --git a/packages/core/src/position.ts b/packages/core/src/position.ts new file mode 100644 index 0000000..77526a6 --- /dev/null +++ b/packages/core/src/position.ts @@ -0,0 +1,424 @@ +import { Chess, type Move, type Square, type PieceSymbol, type Color } from "chess.js"; +import type { Result, Side, Termination } from "./types.ts"; + +export const START_FEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; + +export interface PlyRecord { + ply: number; + side: Side; + uci: string; + san: string | null; // null for illegal (cheating) relocations + illegal: boolean; + fenBefore: string; + fenAfter: string; + /** verbose chess.js move (legal moves only) */ + verbose: Move | null; + captured: PieceSymbol | null; +} + +export type MoveAttempt = + | { ok: true; record: PlyRecord } + | { ok: false; reason: "parse" | "illegal" | "game_over"; message: string }; + +export interface Outcome { + result: Result; + termination: Termination; +} + +const PIECE_NAMES_RU: Record = { + k: { nom: "король", acc: "короля" }, + q: { nom: "ферзь", acc: "ферзя" }, + r: { nom: "ладья", acc: "ладью" }, + b: { nom: "слон", acc: "слона" }, + n: { nom: "конь", acc: "коня" }, + p: { nom: "пешка", acc: "пешку" }, +}; +export const pieceNameRu = (p: PieceSymbol) => PIECE_NAMES_RU[p].nom; +export const PIECE_VALUES: Record = { p: 1, n: 3, b: 3, r: 5, q: 9, k: 0 }; + +const sideOf = (c: Color): Side => (c === "w" ? "white" : "black"); +const colorOf = (s: Side): Color => (s === "white" ? "w" : "b"); + +export const moveNumberLabel = (ply: number) => { + const n = Math.floor((ply - 1) / 2) + 1; + return ply % 2 === 1 ? `${n}.` : `${n}...`; +}; + +/** + * Authoritative game state. Wraps chess.js and adds the bits chess.js does not track the way + * we need: per-position repetition counts (with en-passant normalised), illegal "cheating" + * relocations and a ply log. + */ +export class GameState { + chess: Chess; + readonly startFen: string; + plies: PlyRecord[] = []; + /** position key -> occurrences (including the start position) */ + private keyCounts = new Map(); + /** position key -> a representative full FEN (for display) */ + private keyFen = new Map(); + + constructor(startFen: string = START_FEN) { + this.startFen = startFen; + this.chess = new Chess(startFen); + this.bump(); + } + + static fromUci(moves: { uci: string; illegal?: boolean }[], startFen: string = START_FEN): GameState { + const g = new GameState(startFen); + for (const m of moves) { + const r = m.illegal ? g.applyIllegal(m.uci) : g.tryMove(m.uci); + if (!r.ok) throw new Error(`cannot replay move ${m.uci}: ${r.message}`); + } + return g; + } + + get turn(): Side { + return sideOf(this.chess.turn()); + } + get ply(): number { + return this.plies.length; + } + fen(): string { + return this.chess.fen(); + } + halfmoveClock(): number { + return Number(this.chess.fen().split(" ")[4] ?? 0); + } + fullmoveNumber(): number { + return Number(this.chess.fen().split(" ")[5] ?? 1); + } + inCheck(): boolean { + try { + return this.chess.inCheck(); + } catch { + return false; + } + } + legalMoves(): Move[] { + try { + return this.chess.moves({ verbose: true }); + } catch { + return []; + } + } + + // ---------------------------------------------------------------- keys + + positionKey(chess: Chess = this.chess): string { + const [placement, turn, castling, ep] = chess.fen().split(" "); + let epKey = "-"; + if (ep && ep !== "-") { + try { + if (chess.moves({ verbose: true }).some((m) => m.isEnPassant())) epKey = ep; + } catch { + /* illegal position */ + } + } + return `${placement} ${turn} ${castling} ${epKey}`; + } + private bump() { + const k = this.positionKey(); + this.keyCounts.set(k, (this.keyCounts.get(k) ?? 0) + 1); + if (!this.keyFen.has(k)) this.keyFen.set(k, this.chess.fen()); + } + repetitionCount(key = this.positionKey()): number { + return this.keyCounts.get(key) ?? 0; + } + + // ---------------------------------------------------------------- moves + + /** Parse SAN / UCI / sloppy input into a legal chess.js move. */ + parseMove(input: string): Move | null { + const raw = input.trim().replace(/[!?]+$/g, "").replace(/^0-0-0/, "O-O-O").replace(/^0-0/, "O-O"); + const tmp = new Chess(this.chess.fen()); + try { + return tmp.move(raw); + } catch { + /* not SAN */ + } + const m = /^([a-h][1-8])\s*[-x:]?\s*([a-h][1-8])\s*=?\s*([qrbnQRBN])?\+?#?$/.exec(raw); + if (m) { + try { + return new Chess(this.chess.fen()).move({ from: m[1] as Square, to: m[2] as Square, promotion: m[3]?.toLowerCase() as PieceSymbol | undefined ?? "q" }); + } catch { + return null; + } + } + return null; + } + + /** Human-readable explanation why `input` is not a legal move (no legal-move list — the agent must think). */ + explainIllegal(input: string): string { + const raw = input.trim(); + const uci = /^([a-h][1-8])\s*[-x:]?\s*([a-h][1-8])/.exec(raw); + const side = this.turn; + const checkNote = this.inCheck() ? " Обрати внимание: тебе сейчас шах." : ""; + if (uci) { + const from = uci[1] as Square; + const to = uci[2] as Square; + const piece = this.chess.get(from); + if (!piece) return `На ${from} нет фигуры.${checkNote}`; + if (sideOf(piece.color) !== side) return `На ${from} стоит фигура соперника (${pieceNameRu(piece.type)}).${checkNote}`; + return `${capitalize(pieceNameRu(piece.type))} ${from} не может пойти на ${to} в этой позиции.${checkNote}`; + } + const sanPiece = /^([KQRBN])?([a-h])?([1-8])?x?([a-h][1-8])/.exec(raw.replace(/^0-0/, "O-O")); + if (sanPiece) { + const type = (sanPiece[1]?.toLowerCase() ?? "p") as PieceSymbol; + const to = sanPiece[4] as Square; + const has = this.chess + .board() + .flat() + .some((sq) => sq && sq.type === type && sideOf(sq.color) === side); + if (!has) return `У тебя нет фигуры «${pieceNameRu(type)}».${checkNote}`; + return `Ни одна твоя фигура «${pieceNameRu(type)}» не может легально пойти на ${to}.${checkNote}`; + } + if (/^O-O/i.test(raw)) return `Рокировка сейчас невозможна.${checkNote}`; + return `Не удалось разобрать ход «${raw}». Используй SAN (Nf3, exd5, O-O, e8=Q) или UCI (g1f3, e7e8q).${checkNote}`; + } + + tryMove(input: string): MoveAttempt { + if (this.outcome()) return { ok: false, reason: "game_over", message: "Партия уже окончена." }; + const mv = this.parseMove(input); + if (!mv) { + const parseable = /[a-h][1-8]|O-O/i.test(input); + return { ok: false, reason: parseable ? "illegal" : "parse", message: this.explainIllegal(input) }; + } + const fenBefore = this.chess.fen(); + const side = this.turn; + const applied = this.chess.move({ from: mv.from, to: mv.to, promotion: mv.promotion }); + const rec: PlyRecord = { + ply: this.plies.length + 1, + side, + uci: applied.lan, + san: applied.san, + illegal: false, + fenBefore, + fenAfter: this.chess.fen(), + verbose: applied, + captured: applied.captured ?? null, + }; + this.plies.push(rec); + this.bump(); + return { ok: true, record: rec }; + } + + /** + * Cheating mode: relocate a piece from->to regardless of rules. Accepts UCI-ish input + * ("e2e4", "e2-e4", "e7e8q"). Legal moves should go through tryMove first. + */ + applyIllegal(input: string): MoveAttempt { + const m = /^([a-h][1-8])\s*[-x:]?\s*([a-h][1-8])\s*=?\s*([qrbnQRBN])?/.exec(input.trim()); + if (!m) return { ok: false, reason: "parse", message: "В режиме читерства нелегальный ход нужно указать как откуда-куда (например e2e5)." }; + const from = m[1] as Square; + const to = m[2] as Square; + const piece = this.chess.get(from); + const side = this.turn; + if (!piece || sideOf(piece.color) !== side) return { ok: false, reason: "illegal", message: `На ${from} нет твоей фигуры — двигать можно только свои.` }; + if (from === to) return { ok: false, reason: "illegal", message: "Фигура должна сдвинуться." }; + const fenBefore = this.chess.fen(); + const target = this.chess.get(to); + if (target && sideOf(target.color) === side) return { ok: false, reason: "illegal", message: "Нельзя бить свою фигуру даже в режиме читерства." }; + + const parts = fenBefore.split(" "); + const board = new Chess(fenBefore, { skipValidation: true }); + board.remove(from); + if (target) board.remove(to); + let placed: PieceSymbol = piece.type; + if (piece.type === "p" && (to[1] === "8" || to[1] === "1")) placed = (m[3]?.toLowerCase() as PieceSymbol) ?? "q"; + board.put({ type: placed, color: piece.color }, to); + const placement = board.fen().split(" ")[0]; + let castling = parts[2] ?? "-"; + const strip = (chars: string) => { + for (const c of chars) castling = castling.replace(c, ""); + }; + if (piece.type === "k") strip(piece.color === "w" ? "KQ" : "kq"); + for (const sq of [from, to]) { + if (sq === "h1") strip("K"); + if (sq === "a1") strip("Q"); + if (sq === "h8") strip("k"); + if (sq === "a8") strip("q"); + } + if (!castling) castling = "-"; + const half = piece.type === "p" || target ? 0 : Number(parts[4] ?? 0) + 1; + const full = Number(parts[5] ?? 1) + (side === "black" ? 1 : 0); + const fenAfter = `${placement} ${side === "white" ? "b" : "w"} ${castling} - ${half} ${full}`; + this.chess = new Chess(fenAfter, { skipValidation: true }); + const rec: PlyRecord = { + ply: this.plies.length + 1, + side, + uci: `${from}${to}${placed !== piece.type ? placed : ""}`, + san: null, + illegal: true, + fenBefore, + fenAfter, + verbose: null, + captured: target?.type ?? null, + }; + this.plies.push(rec); + this.bump(); + return { ok: true, record: rec }; + } + + // ---------------------------------------------------------------- outcome + + outcome(): Outcome | null { + const last = this.plies[this.plies.length - 1]; + if (last?.illegal && last.captured === "k") { + return { result: last.side === "white" ? "1-0" : "0-1", termination: "king_captured" }; + } + try { + if (this.chess.isCheckmate()) return { result: this.turn === "white" ? "0-1" : "1-0", termination: "checkmate" }; + if (this.chess.isStalemate()) return { result: "1/2-1/2", termination: "stalemate" }; + if (this.chess.isInsufficientMaterial()) return { result: "1/2-1/2", termination: "insufficient_material" }; + } catch { + /* illegal positions in cheating mode */ + } + if (this.repetitionCount() >= 3) return { result: "1/2-1/2", termination: "threefold_repetition" }; + if (this.halfmoveClock() >= 100) return { result: "1/2-1/2", termination: "fifty_move_rule" }; + return null; + } + + // ---------------------------------------------------------------- rule hints + + /** Castling clarifications for the side to move — only when the position *looks* castle-able. */ + castlingNotes(side: Side = this.turn): string[] { + const c = colorOf(side); + const rank = side === "white" ? "1" : "8"; + const king = this.chess.get(`e${rank}` as Square); + if (!king || king.type !== "k" || king.color !== c) return []; + const rights = this.chess.getCastlingRights(c); + const empty = (files: string) => [...files].every((f) => !this.chess.get(`${f}${rank}` as Square)); + const rookAt = (f: string) => { + const p = this.chess.get(`${f}${rank}` as Square); + return !!p && p.type === "r" && p.color === c; + }; + const notes: string[] = []; + const check = this.inCheck(); + if (rookAt("h") && empty("fg")) { + notes.push( + rights.k + ? `Короткая рокировка (O-O): король и ладья h${rank} ещё не ходили — правами разрешена${check ? ", но сейчас шах, поэтому этим ходом нельзя" : " (если король не проходит через битое поле)"}.` + : `Короткая рокировка (O-O) НЕВОЗМОЖНА: король или ладья h${rank} уже ходили (даже если вернулись на место).`, + ); + } + if (rookAt("a") && empty("bcd")) { + notes.push( + rights.q + ? `Длинная рокировка (O-O-O): король и ладья a${rank} ещё не ходили — правами разрешена${check ? ", но сейчас шах, поэтому этим ходом нельзя" : " (если король не проходит через битое поле)"}.` + : `Длинная рокировка (O-O-O) НЕВОЗМОЖНА: король или ладья a${rank} уже ходили (даже если вернулись на место).`, + ); + } + return notes; + } + + enPassantNote(): string | null { + const ep = this.legalMoves().filter((m) => m.isEnPassant()); + if (!ep.length) return null; + return `Взятие на проходе сейчас возможно: ${ep.map((m) => m.san).join(", ")}.`; + } + + /** 50-move rule reminder once the counter is high enough. */ + fiftyMoveNote(thresholdMoves = 40): string | null { + const moves = Math.floor(this.halfmoveClock() / 2); + if (moves < thresholdMoves) return null; + return `Правило 50 ходов: уже ${moves} из 50 ходов подряд без взятий и ходов пешками. На 50-м — автоматическая ничья. Взятие или ход пешкой обнуляют счётчик.`; + } + + /** + * Repetition state relevant to the side to move: was the current position already seen twice, + * and which moves would produce a position for the third time (= automatic draw). + */ + repetitionInfo(): { + anyRepeated: boolean; + currentCount: number; + currentFen: string; + threats: { fen: string; count: number; moves: string[] }[]; + drawingMoves: string[]; + } { + const anyRepeated = [...this.keyCounts.values()].some((n) => n >= 2); + const threats = new Map(); + if (anyRepeated) { + for (const m of this.legalMoves()) { + const t = new Chess(this.chess.fen()); + t.move({ from: m.from, to: m.to, promotion: m.promotion }); + const k = this.positionKey(t); + const n = this.keyCounts.get(k) ?? 0; + if (n >= 2) { + const e = threats.get(k) ?? { fen: this.keyFen.get(k) ?? t.fen(), count: n, moves: [] }; + e.moves.push(m.san); + threats.set(k, e); + } + } + } + const list = [...threats.values()]; + return { anyRepeated, currentCount: this.repetitionCount(), currentFen: this.chess.fen(), threats: list, drawingMoves: list.flatMap((t) => t.moves) }; + } + + // ---------------------------------------------------------------- rendering + + ascii(): string { + const rows: string[] = [" +-----------------+"]; + const b = this.chess.board(); + for (let r = 0; r < 8; r++) { + const cells = b[r].map((sq) => (sq ? (sq.color === "w" ? sq.type.toUpperCase() : sq.type) : ".")); + rows.push(`${8 - r} | ${cells.join(" ")} |`); + } + rows.push(" +-----------------+", " a b c d e f g h"); + return rows.join("\n"); + } + + pieceList(side: Side): string { + const c = colorOf(side); + const order: PieceSymbol[] = ["k", "q", "r", "b", "n"]; + const by: Record = { k: [], q: [], r: [], b: [], n: [], p: [] }; + for (const row of this.chess.board()) for (const sq of row) if (sq && sq.color === c) by[sq.type].push(sq.square); + const sortSq = (a: string, b: string) => (a[0] === b[0] ? a[1].localeCompare(b[1]) : a[0].localeCompare(b[0])); + const pieces = order.flatMap((t) => by[t].sort(sortSq).map((s) => `${t.toUpperCase()}${s}`)); + const pawns = by.p.sort(sortSq); + return `${pieces.join(" ")}${pawns.length ? `; пешки ${pawns.join(" ")}` : "; пешек нет"}`; + } + + material(side: Side): number { + const c = colorOf(side); + let sum = 0; + for (const row of this.chess.board()) for (const sq of row) if (sq && sq.color === c) sum += PIECE_VALUES[sq.type]; + return sum; + } + + /** e.g. "22. gxh3 — пешка g2→h3, взял коня" */ + describePly(rec: PlyRecord): string { + const label = `${moveNumberLabel(rec.ply)} ${rec.san ?? rec.uci}`; + if (rec.illegal) { + const from = rec.uci.slice(0, 2); + const to = rec.uci.slice(2, 4); + return `${label} — НЕЛЕГАЛЬНЫЙ ход (режим читерства): фигура ${from}→${to}${rec.captured ? `, снял ${PIECE_NAMES_RU[rec.captured].acc}` : ""}`; + } + const v = rec.verbose!; + const parts: string[] = []; + if (v.isKingsideCastle()) parts.push("короткая рокировка"); + else if (v.isQueensideCastle()) parts.push("длинная рокировка"); + else parts.push(`${pieceNameRu(v.piece)} ${v.from}→${v.to}`); + if (v.isEnPassant()) parts.push("взятие на проходе"); + else if (v.captured) parts.push(`взял ${PIECE_NAMES_RU[v.captured].acc}`); + if (v.promotion) parts.push(`превращение в ${PIECE_NAMES_RU[v.promotion].acc}`); + if (v.san.endsWith("#")) parts.push("мат"); + else if (v.san.endsWith("+")) parts.push("шах"); + return `${label} — ${parts.join(", ")}`; + } + + /** SAN move list "1. e4 e5 2. Nf3 ..." */ + sanMoveList(): string { + const out: string[] = []; + for (const p of this.plies) { + const mv = p.san ?? `${p.uci}(!)`; + if (p.side === "white") out.push(`${moveNumberLabel(p.ply)} ${mv}`); + else out.push(p.ply === 1 || out.length === 0 ? `${moveNumberLabel(p.ply)} ${mv}` : mv); + } + return out.join(" "); + } +} + +function capitalize(s: string) { + return s.charAt(0).toUpperCase() + s.slice(1); +} diff --git a/packages/core/src/transcript.ts b/packages/core/src/transcript.ts new file mode 100644 index 0000000..8e127b8 --- /dev/null +++ b/packages/core/src/transcript.ts @@ -0,0 +1,132 @@ +import { moveNumberLabel } from "./position.ts"; +import type { EngineEval, MoveClass, Result, Side, Termination } from "./types.ts"; + +export interface RecordPly { + ply: number; + side: Side; + san: string | null; + uci: string; + fenAfter: string; + phrase: string | null; + illegal: boolean; + offeredDraw?: boolean; + eval?: EngineEval | null; + classification?: MoveClass | null; + accuracy?: number | null; +} + +export interface GameRecord { + white: string; + black: string; + plies: RecordPly[]; + result?: Result | null; + termination?: Termination | null; + startedAt?: string; + event?: string; +} + +const CLASS_RU: Record = { + best: "лучший ход", + brilliant: "блестяще!!", + great: "отлично!", + good: "нормально", + inaccuracy: "неточность ?!", + mistake: "ошибка ?", + blunder: "зевок ??", + book: "теория", + forced: "единственный ход", +}; +export const classLabelRu = (c: MoveClass) => CLASS_RU[c]; +const CLASS_NAG: Partial> = { brilliant: "!!", great: "!", inaccuracy: "?!", mistake: "?", blunder: "??" }; + +export function formatEval(e?: EngineEval | null): string { + if (!e) return ""; + if (e.mate != null) return e.mate > 0 ? `#${e.mate}` : `#-${Math.abs(e.mate)}`; + const v = (e.cp ?? 0) / 100; + return `${v > 0 ? "+" : ""}${v.toFixed(2)}`; +} + +const TERMINATION_RU: Record = { + checkmate: "мат", + stalemate: "пат", + insufficient_material: "недостаточно материала", + threefold_repetition: "троекратное повторение", + fifty_move_rule: "правило 50 ходов", + resignation: "сдача", + agreement: "ничья по соглашению", + forfeit_illegal: "поражение за нелегальные ходы", + forfeit_no_move: "поражение — не сделал ход", + king_captured: "взятие короля (читерство)", + aborted: "прервана", + error: "техническая ошибка", +}; +export const terminationRu = (t: Termination) => TERMINATION_RU[t]; + +/** Human-readable transcript: one ply per line with trash-talk and (optionally) engine verdicts. */ +export function humanTranscript(rec: GameRecord, opts: { withAnalysis?: boolean } = {}): string { + const lines: string[] = [`Белые: ${rec.white}`, `Чёрные: ${rec.black}`, ""]; + for (const p of rec.plies) { + const who = p.side === "white" ? rec.white : rec.black; + let line = `${moveNumberLabel(p.ply)} ${p.san ?? `${p.uci} (НЕЛЕГАЛЬНЫЙ)`}`; + if (opts.withAnalysis && (p.eval || p.classification)) { + const bits = [p.classification ? classLabelRu(p.classification) : null, p.eval ? `оценка ${formatEval(p.eval)}` : null].filter(Boolean); + line += ` [${bits.join(", ")}]`; + } + if (p.offeredDraw) line += " (предложил ничью)"; + if (p.phrase) line += `\n ${who}: «${p.phrase}»`; + lines.push(line); + } + if (rec.result && rec.result !== "*") { + lines.push("", `Итог: ${rec.result}${rec.termination ? ` (${terminationRu(rec.termination)})` : ""}`); + } + return lines.join("\n"); +} + +export function machineTranscript(rec: GameRecord): string { + return JSON.stringify( + { + white: rec.white, + black: rec.black, + result: rec.result ?? null, + termination: rec.termination ?? null, + moves: rec.plies.map((p) => ({ + ply: p.ply, + side: p.side, + san: p.san, + uci: p.uci, + fen_after: p.fenAfter, + phrase: p.phrase, + illegal: p.illegal || undefined, + eval: p.eval ? formatEval(p.eval) : undefined, + best_reply_uci: p.eval?.bestUci ?? undefined, + class: p.classification ?? undefined, + accuracy: p.accuracy != null ? Math.round(p.accuracy) : undefined, + })), + }, + null, + 1, + ); +} + +const pgnEscape = (s: string) => s.replace(/[{}]/g, "").replace(/\s+/g, " ").trim(); + +export function toPgn(rec: GameRecord): string { + const date = (rec.startedAt ?? new Date().toISOString()).slice(0, 10).replace(/-/g, "."); + const headers = [ + ["Event", rec.event ?? "AI·CHESS"], + ["Site", "chess.danosito.com"], + ["Date", date], + ["White", rec.white], + ["Black", rec.black], + ["Result", rec.result ?? "*"], + ...(rec.termination ? [["Termination", terminationRu(rec.termination)]] : []), + ]; + const body: string[] = []; + for (const p of rec.plies) { + if (p.side === "white" || body.length === 0) body.push(moveNumberLabel(p.ply)); + body.push((p.san ?? p.uci) + (p.classification ? (CLASS_NAG[p.classification] ?? "") : "")); + if (p.phrase) body.push(`{ ${pgnEscape(p.phrase)} }`); + } + body.push(rec.result ?? "*"); + return headers.map(([k, v]) => `[${k} "${String(v).replace(/"/g, "'")}"]`).join("\n") + "\n\n" + body.join(" ") + "\n"; +} diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts new file mode 100644 index 0000000..0f03fd7 --- /dev/null +++ b/packages/core/src/types.ts @@ -0,0 +1,118 @@ +// Shared domain types — used by the server and the web app. + +export type Side = "white" | "black"; +export const otherSide = (s: Side): Side => (s === "white" ? "black" : "white"); + +/** Per-match experimental switches. Anything here (except `notes`/`extraTools`) makes the game unrated. */ +export interface GameFlags { + /** Agent may leave a note for its next turn (finish_turn.note_to_self). */ + notes: boolean; + /** Agent gets get_move_history + python sandbox tools. */ + extraTools: boolean; + /** Illegal moves are applied as raw piece relocations. Unrated. */ + cheating: boolean; +} +export const DEFAULT_FLAGS: GameFlags = { notes: false, extraTools: false, cheating: false }; +export const isRated = (f: GameFlags) => !f.cheating; + +export type GameStatus = "pending" | "running" | "finished" | "aborted"; + +export type Termination = + | "checkmate" + | "stalemate" + | "insufficient_material" + | "threefold_repetition" + | "fifty_move_rule" + | "resignation" + | "agreement" + | "forfeit_illegal" // too many illegal move attempts in one turn + | "forfeit_no_move" // agent kept ending its turn without moving + | "king_captured" // cheating mode only + | "aborted" + | "error"; + +export type Result = "1-0" | "0-1" | "1/2-1/2" | "*"; + +export type MoveClass = "best" | "brilliant" | "great" | "good" | "inaccuracy" | "mistake" | "blunder" | "book" | "forced"; + +export interface EngineEval { + /** centipawns from White's POV (null when mate is set) */ + cp: number | null; + /** mate in N from White's POV (positive = White mates) */ + mate: number | null; + bestUci: string | null; + pv: string[]; + depth: number; +} + +/** A tool call as seen by spectators. */ +export interface ToolCallLog { + id: string; + name: string; + args: unknown; + result?: string; + isError?: boolean; + startedAt: number; + endedAt?: number; +} + +export interface Usage { + input: number; + output: number; + cacheRead: number; + cacheWrite: number; + reasoning: number; + cost: number; +} +export const emptyUsage = (): Usage => ({ input: 0, output: 0, cacheRead: 0, cacheWrite: 0, reasoning: 0, cost: 0 }); +export const addUsage = (a: Usage, b: Partial): Usage => ({ + input: a.input + (b.input ?? 0), + output: a.output + (b.output ?? 0), + cacheRead: a.cacheRead + (b.cacheRead ?? 0), + cacheWrite: a.cacheWrite + (b.cacheWrite ?? 0), + reasoning: a.reasoning + (b.reasoning ?? 0), + cost: a.cost + (b.cost ?? 0), +}); + +/** One step of an agent turn transcript, persisted for the "thoughts" panel. */ +export type TranscriptItem = + | { kind: "context"; text: string; at: number } + | { kind: "thinking"; text: string; at: number } + | { kind: "text"; text: string; at: number } + | { kind: "tool"; call: ToolCallLog; at: number } + | { kind: "nudge"; text: string; at: number } + | { kind: "error"; text: string; at: number }; + +/** Live events published on the bus (channel = game id or "lobby"). */ +export type GameEvent = + | { type: "turn_start"; gameId: string; ply: number; side: Side; playerId: string; at: number } + | { type: "thinking_delta"; gameId: string; ply: number; delta: string } + | { type: "text_delta"; gameId: string; ply: number; delta: string } + | { type: "tool_start"; gameId: string; ply: number; call: ToolCallLog } + | { type: "tool_end"; gameId: string; ply: number; call: ToolCallLog } + | { type: "move"; gameId: string; move: MoveDTO } + | { type: "eval"; gameId: string; ply: number; eval: EngineEval; classification?: MoveClass | null; accuracy?: number | null } + | { type: "turn_end"; gameId: string; ply: number; usage: Usage } + | { type: "draw_offer"; gameId: string; by: Side } + | { type: "game_over"; gameId: string; result: Result; termination: Termination } + | { type: "interview"; gameId: string; side: Side; text: string } + | { type: "thumbnail"; gameId: string; url: string; caption: string } + | { type: "status"; gameId: string; status: GameStatus; note?: string }; + +export interface MoveDTO { + ply: number; // 1-based half-move index + side: Side; + san: string | null; // null for illegal (cheating) moves + uci: string; + fenAfter: string; + phrase: string | null; + note: string | null; // note_to_self (only visible to spectators after the game? — shown live, it's fun) + offeredDraw: boolean; + illegal: boolean; + thinkMs: number; + usage: Usage; + eval?: EngineEval | null; + classification?: MoveClass | null; + accuracy?: number | null; + createdAt: string; +} diff --git a/packages/core/test/position.test.ts b/packages/core/test/position.test.ts new file mode 100644 index 0000000..39057a8 --- /dev/null +++ b/packages/core/test/position.test.ts @@ -0,0 +1,114 @@ +import { describe, expect, it } from "vitest"; +import { GameState, renderTurnContext, DEFAULT_FLAGS, rateGame, DEFAULT_RATING, classifyMove, humanTranscript } from "../src/index.ts"; + +const DEMO = "e4 e5 Nf3 Nc6 Bc4 Bc5 c3 Nf6 d3 d6 O-O a6 a4 O-O h3 Ba7 Re1 h6 Nbd2 Re8 Nf1 Be6 Bxe6 Rxe6 Ng3 d5 exd5 Qxd5 Be3 Rd8 Qc2 Bxe3 Rxe3 Qd7 Rae1 Rde8 b4 Nd5 R3e2 Nf4 Re4 Nxh3+ gxh3".split(" "); + +function play(moves: string[]) { + const g = new GameState(); + for (const m of moves) { + const r = g.tryMove(m); + if (!r.ok) throw new Error(`${m}: ${r.message}`); + } + return g; +} + +describe("GameState", () => { + it("replays the demo game and renders context", () => { + const g = play(DEMO); + expect(g.fen()).toBe("4r1k1/1ppq1pp1/p1n1r2p/4p3/PP2R3/2PP1NNP/2Q2P2/4R1K1 b - - 0 22"); + const ctx = renderTurnContext({ + state: g, + me: { side: "black" }, + opponent: { name: "GPT-6.1 Sol" }, + opponentPhrase: "Любопытная идея.", + drawOffered: false, + noteFromSelf: "атака по g-линии", + flags: { ...DEFAULT_FLAGS, notes: true }, + }); + expect(ctx).toContain("22. gxh3 — пешка g2→h3, взял коня"); + expect(ctx).toContain("атака по g-линии"); + expect(ctx).toContain("у белых +2"); + expect(ctx).not.toContain("рокировка"); // nothing castle-able for black here + }); + + it("rejects illegal moves with an explanation", () => { + const g = play(DEMO); + const r = g.tryMove("Qxh3"); + expect(r.ok).toBe(false); + if (!r.ok) expect(r.message).toMatch(/ферзь/); + const r2 = g.tryMove("d7h3"); + expect(r2.ok).toBe(false); + expect(g.tryMove("Rg6").ok).toBe(true); + }); + + it("accepts sloppy input", () => { + const g = new GameState(); + expect(g.tryMove("e2e4").ok).toBe(true); + expect(g.tryMove("e7-e5").ok).toBe(true); + expect(g.tryMove("Ng1f3").ok || g.tryMove("Nf3").ok).toBe(true); + }); + + it("castling notes only when the position looks castle-able", () => { + const g = play(["e4", "e5", "Nf3", "Nc6", "Bc4", "Bc5"]); + expect(g.castlingNotes("white")).toHaveLength(1); + expect(g.castlingNotes("white")[0]).toMatch(/правами разрешена/); + // king walks and comes back + const h = play(["e4", "e5", "Nf3", "Nc6", "Bc4", "Bc5", "Ke2", "Nf6", "Ke1", "Ng8"]); + expect(h.castlingNotes("white")[0]).toMatch(/НЕВОЗМОЖНА/); + // KB*R -> nothing + const s = new GameState(); + expect(s.castlingNotes("white")).toHaveLength(0); + }); + + it("detects repetitions and the moves that would draw", () => { + const g = play(["Nf3", "Nf6", "Ng1", "Ng8", "Nf3", "Nf6", "Ng1"]); + const info = g.repetitionInfo(); + expect(info.anyRepeated).toBe(true); + expect(info.drawingMoves).toContain("Ng8"); + expect(g.tryMove("Ng8").ok).toBe(true); + expect(g.outcome()?.termination).toBe("threefold_repetition"); + }); + + it("en passant note", () => { + const g = play(["e4", "a6", "e5", "d5"]); + expect(g.enPassantNote()).toMatch(/exd6/); + }); + + it("fifty-move reminder", () => { + const g = new GameState("8/8/8/4k3/8/8/4K3/7R w - - 85 120"); + expect(g.fiftyMoveNote(40)).toMatch(/42 из 50/); + }); + + it("cheating relocations", () => { + const g = new GameState(); + const r = g.applyIllegal("d1d7"); + expect(r.ok).toBe(true); + expect(g.turn).toBe("black"); + const r2 = g.applyIllegal("e8e2"); + expect(r2.ok).toBe(true); + expect(g.applyIllegal("d7e8").ok).toBe(true); + expect(g.outcome()).toBeNull(); + const k = new GameState("4k3/8/8/8/8/8/8/3QK3 w - - 0 1"); + k.applyIllegal("d1e8"); + expect(k.outcome()?.termination).toBe("king_captured"); + }); + + it("transcript", () => { + const g = play(["e4", "e5"]); + const t = humanTranscript({ white: "A", black: "B", plies: g.plies.map((p) => ({ ...p, phrase: "привет" })) }); + expect(t).toContain("1. e4"); + expect(t).toContain("A: «привет»"); + }); +}); + +describe("rating & analysis", () => { + it("glicko moves ratings in the right direction", () => { + const r = rateGame(DEFAULT_RATING, DEFAULT_RATING, "1-0"); + expect(r.white.r).toBeGreaterThan(1500); + expect(r.black.r).toBeLessThan(1500); + }); + it("classifies a blunder", () => { + const c = classifyMove({ side: "white", before: { cp: 50, mate: null, bestUci: "e2e4", pv: [], depth: 18 }, after: { cp: -400, mate: null, bestUci: null, pv: [], depth: 18 }, uci: "a2a3", legalMoveCount: 20 }); + expect(c.cls).toBe("blunder"); + }); +}); diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json new file mode 100644 index 0000000..7680f99 --- /dev/null +++ b/packages/core/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["src", "test"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..d65e31c --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,4563 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: {} + + apps/server: + dependencies: + '@aichess/core': + specifier: workspace:* + version: link:../../packages/core + '@earendil-works/pi-coding-agent': + specifier: ^1.3.0 + version: 1.3.0(@aws-sdk/credential-provider-node@3.972.86)(@smithy/signature-v4@5.7.4)(ws@8.22.0)(zod@4.6.7) + '@hono/node-server': + specifier: ^1.19.0 + version: 1.19.17(hono@4.13.13) + '@hono/node-ws': + specifier: ^1.3.1 + version: 1.3.1(@hono/node-server@1.19.17(hono@4.13.13))(hono@4.13.13) + chess.js: + specifier: ^1.4.0 + version: 1.4.0 + drizzle-orm: + specifier: ^0.45.4 + version: 0.45.4(@opentelemetry/api@1.9.1)(pg@8.23.1)(postgres@3.4.9) + hono: + specifier: ^4.13.0 + version: 4.13.13 + nanoid: + specifier: ^5.1.0 + version: 5.1.16 + pg-boss: + specifier: ^12.0.0 + version: 12.38.0(@opentelemetry/api@1.9.1) + postgres: + specifier: ^3.4.9 + version: 3.4.9 + sharp: + specifier: ^0.34.0 + version: 0.34.5 + typebox: + specifier: ^1.4.2 + version: 1.4.2 + zod: + specifier: ^4.1.0 + version: 4.6.7 + devDependencies: + '@types/node': + specifier: ^24.0.0 + version: 24.19.2 + drizzle-kit: + specifier: ^0.31.11 + version: 0.31.11 + tsup: + specifier: ^8.5.0 + version: 8.5.1(jiti@2.7.0)(postcss@8.5.30)(tsx@4.23.15)(typescript@5.9.3)(yaml@2.9.0) + tsx: + specifier: ^4.20.0 + version: 4.23.15 + typescript: + specifier: ^5.9.0 + version: 5.9.3 + vitest: + specifier: ^3.2.0 + version: 3.2.7(@types/node@24.19.2)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.0) + + apps/web: + dependencies: + '@aichess/core': + specifier: workspace:* + version: link:../../packages/core + '@lichess-org/chessground': + specifier: ^10.4.2 + version: 10.4.2 + chess.js: + specifier: ^1.4.0 + version: 1.4.0 + devDependencies: + '@sveltejs/adapter-static': + specifier: ^4.0.0 + version: 4.0.0(@sveltejs/kit@3.1.0(@opentelemetry/api@1.9.1)(@sveltejs/vite-plugin-svelte@7.3.1(svelte@5.57.2)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)))(svelte@5.57.2)(typescript@6.0.3)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0))) + '@sveltejs/kit': + specifier: ^3.0.0 + version: 3.1.0(@opentelemetry/api@1.9.1)(@sveltejs/vite-plugin-svelte@7.3.1(svelte@5.57.2)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)))(svelte@5.57.2)(typescript@6.0.3)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)) + '@sveltejs/vite-plugin-svelte': + specifier: ^7.2.0 + version: 7.3.1(svelte@5.57.2)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)) + svelte: + specifier: ^5.57.1 + version: 5.57.2 + svelte-check: + specifier: ^4.6.0 + version: 4.7.7(picomatch@4.0.7)(svelte@5.57.2)(typescript@6.0.3) + typescript: + specifier: ^6.0.3 + version: 6.0.3 + vite: + specifier: ^8.3.0 + version: 8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0) + + packages/core: + dependencies: + chess.js: + specifier: ^1.4.0 + version: 1.4.0 + devDependencies: + '@types/node': + specifier: ^24.0.0 + version: 24.19.2 + typescript: + specifier: ^5.9.0 + version: 5.9.3 + vitest: + specifier: ^3.2.0 + version: 3.2.7(@types/node@24.19.2)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.0) + +packages: + + '@anthropic-ai/sdk@0.129.0': + resolution: {integrity: sha512-MH7LB20kNpGLUpPTe2OG5XvL/KhX8HUO9XyBaFjgFk6TLS4Xjt0VPIuMKywe7POKKPslX+QxSlVok9e+8kG5Nw==} + hasBin: true + peerDependencies: + zod: ^3.25.0 || ^4.0.0 + peerDependenciesMeta: + zod: + optional: true + + '@aws-sdk/client-bedrock-runtime@3.1127.0': + resolution: {integrity: sha512-IDl/lrPb90aH+pZFHGNDmgH9nAUQj5PlZH1sJ3w7RikctyjHSnY3oNjZhrLoaBoQn/rNK0zsP6OHEqEhj2tdLA==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/core@3.978.3': + resolution: {integrity: sha512-nslpzUCTI9b2IQMWSd6mSAXldBexPc8rr0d3dXUutXYFLFaTdsHa2GD7sJdsn3PhyjK0O5K8ypd6zi+RXXPVlg==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/credential-provider-env@3.972.74': + resolution: {integrity: sha512-rsRJcW2iFUhCgclyD6OSbMEaPl8Eu0qSeRZb2uuCK1ViZ66hl5wOe/p6Vr6MO3b+ydyKgFeqza2p6tZThvILlw==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/credential-provider-http@3.972.76': + resolution: {integrity: sha512-pnKdh0Br7OJPj+7qKjzgTfDTFW0RhEMKXNDR2jv9CAM4oHuG/4z3hRh8KtutLfpmItuRtDbKBmwWkDqHwwAWXw==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/credential-provider-ini@3.973.19': + resolution: {integrity: sha512-kcjvAxqQEV8yuwkX58RelNn3ne65o7JgRWf3Z/gVvbi7Xuw1qSDLJlatrLD76+40cmRxmNkLxBoyp/vAQChQ5g==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/credential-provider-login@3.972.81': + resolution: {integrity: sha512-CeQHSbE2CnVdaHIJ/NayRaCecIER+Pm9faUPkmRATO54rCoMTEPSbVieGHzEwvm1dZM2HIs6qQZCznhayNTWJQ==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/credential-provider-node@3.972.86': + resolution: {integrity: sha512-WNttSyr6e8innPtBSty//CdnqJcgZN6eAbtw3v/CR2IObz6MYZEo8eusdtuCHJ2ujwFqC2bSPHVyhXGHx8HruQ==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/credential-provider-process@3.972.74': + resolution: {integrity: sha512-Yj6kZFJQdbR+PygTkqdVLPHHpdDpOS9GCYVcDCuweCRRig9LF24ELQBMfyUw1vspvrZJUfnOGVyMjhaL094ahw==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/credential-provider-sso@3.973.18': + resolution: {integrity: sha512-FnpPhdY4qUGtX/8X6eKxh+uD+9Y19i9FYibgk4SBe0M935s9vocHkHzaxaMNk+YkHmvzgdu8cHA5SCoeU+kkew==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/credential-provider-web-identity@3.972.80': + resolution: {integrity: sha512-TJF25Ndwy2HxcVj6oxMgp8qVlJAawlExHYBXqhuC6Zt2m+A7WpdkjBD6QglNbiArlteYljZHEY3R7KKmno6ISA==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/eventstream-handler-node@3.972.36': + resolution: {integrity: sha512-HFaKXA6ugPVvpR7W/3UT3hylWIPndqGMwduwNVrmGsRT5+OESHN8/ven4eeofraQF5Kxp8A8QgGVrv7iQsTRKQ==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/middleware-eventstream@3.972.31': + resolution: {integrity: sha512-4yvdTVwPGKCnrwuwlYEmwLqQXKwk0unx3f/FvBi4FA9ruK/WGoPJyqfK7hOYurheIyQL44FR0ovgOHqvkfdpAQ==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/middleware-websocket@3.972.56': + resolution: {integrity: sha512-32d9EnnNM5UMwjVp/qnL0K4XYiZv+YlSbULI3BaoBdJvebAS6cD0bKfPJ7lzovN0qrelvmSh5jo/3tk0KoTuGQ==} + engines: {node: '>= 14.0.0'} + + '@aws-sdk/nested-clients@3.997.48': + resolution: {integrity: sha512-B01jdXJtAW/XOiUzGdI2mz67WyEHbGEc9X6Euzw3bjLAa+txTqdZDER4X2FsIEcXzV2ABqudVZ5thali8tCCzQ==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/signature-v4-multi-region@3.996.48': + resolution: {integrity: sha512-cFDXfEbXaGwbnpvR/DyqfxfjxpjXVRVthQLgkwvcfDS5u3+8G9WSj1X1Ag/pTRg/QOeOno1Tq3ycEdrKsCUcOA==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/token-providers@3.1127.0': + resolution: {integrity: sha512-Dv2TMWBshJ+tF6ahs2Sy5bh4Iabsd4GAQqVvE9XZmYmnoaVbpS2QKIKE/HRacc7bTtbjEEvP+laGzHvHlf1CiQ==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/token-providers@3.1150.0': + resolution: {integrity: sha512-wDU36ofhabZYu+d2KSriyDbwzxNoaOp+4dG0p3qkabk7HeALR5nIWyQbjoyJZLn3iqWkv/xNdyUfbfevDVDzzg==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/types@3.974.6': + resolution: {integrity: sha512-v/clNZzZnDxGyvpHMOGpJKVXFAExJzUNAAjaWGdcx8QAcXLGwTaOkw33p5SHAi0YAioK32xB3hWwOekRVfmfKg==} + engines: {node: '>=20.0.0'} + + '@aws-sdk/xml-builder@3.972.41': + resolution: {integrity: sha512-ctjVSyCMegrWfXlx6VqzSBFI6UqmQ5ZlnfMhdLIiWmhoH8UAQxSCP5N3OpG7X3k4LnS7ou74C4mt20+bfTW2aQ==} + engines: {node: '>=20.0.0'} + + '@aws/lambda-invoke-store@0.3.0': + resolution: {integrity: sha512-sl4Bm6yiMNYrZKkqqDFWN0UfnWhlS8ivKxrYl+6t0gCLrqr8y3B2IqZZbFRkfaVVp7C/baApyh71P+LeE1A2sQ==} + engines: {node: '>=18.0.0'} + + '@babel/runtime@7.29.10': + resolution: {integrity: sha512-NpugTzbKgGrNe45Ui32cN8vCFFMxVtP/9rtfwv0nP5FRDAjvYBxJcLVpYA9mr1jxP6cnIT7x9LUzuDTbWYYNRA==} + engines: {node: '>=6.9.0'} + + '@drizzle-team/brocli@0.10.2': + resolution: {integrity: sha512-z33Il7l5dKjUgGULTqBsQBQwckHh5AbIuxhdsIxDDiZAzBOrZO6q9ogcWC65kU382AfynTfgNumVcNIjuIua6w==} + + '@earendil-works/pi-agent-core@1.3.0': + resolution: {integrity: sha512-2jvpxZs47PFD5mSQb/yK0pGHJ5yO7Nu22u9mFjHbSLRgu62vZ9rupimDSIp4arnqOadyv0AWvYHtCSpFoJV7ag==} + engines: {node: '>=22.19.0'} + + '@earendil-works/pi-ai@1.3.0': + resolution: {integrity: sha512-KaBI8x7q7sPoFUXICNGD9efHzDG+oRNwVvkA9jdIsSQWH1RjFssOlEGsbLtewUPPgCrvmz0l2KTgSLXTyj3acw==} + engines: {node: '>=22.19.0'} + hasBin: true + + '@earendil-works/pi-codemode@1.3.0': + resolution: {integrity: sha512-2G9tmbsPhgzwfz7cmzJpbLSLqOx3eu22Gbzm+Wc3HqeZMjLQS4F3KfAabozVhv7uEjq3k2O1dZTHmhhWr2xbfQ==} + engines: {node: '>=22.19.0'} + + '@earendil-works/pi-coding-agent@1.3.0': + resolution: {integrity: sha512-V/WoCjA2hQSe3QLWIUB24cTRdtEdeLiIzkDqU5RMXV6VWuD+KGZnzVBMhglwdnQTySkehZsjt8a3g6Jd2g4nnw==} + engines: {node: '>=22.19.0'} + hasBin: true + + '@earendil-works/pi-mcp@1.3.0': + resolution: {integrity: sha512-lbktLplmdGamM2t460Q0ziNEfpUEHDTVNf79g/AialJ3XZ+SHgNqa/OJXRR+fU+GV/l+gBhRPcyP8XkQlv8Avw==} + engines: {node: '>=22.19.0'} + + '@earendil-works/pi-telemetry@1.3.0': + resolution: {integrity: sha512-ERGZr+aXjNJzoUbB7ZzHVH3g5otzMHjHLs2Fyizm12By5X+gBEhod9cJXFOk13S7M8a29Am+Mq21zm73mRJFLg==} + engines: {node: '>=22.19.0'} + + '@earendil-works/pi-tui@1.3.0': + resolution: {integrity: sha512-AlKvEwEWyVtnuw7SVb4N/mUhlfIohyFslUNWarZVdLHHSdt3ca5EhMLwTzblBpDpaofSz+f+tAHie6CfxVrWKA==} + engines: {node: '>=22.19.0'} + + '@emnapi/runtime@1.11.3': + resolution: {integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==} + + '@esbuild-kit/core-utils@3.3.2': + resolution: {integrity: sha512-sPRAnw9CdSsRmEtnsl2WXWdyquogVpB3yZ3dgwJfe8zrOzTsV7cJvmwrKVa+0ma5BoiGJ+BoqkMvawbayKUsqQ==} + deprecated: 'Merged into tsx: https://tsx.hirok.io' + + '@esbuild-kit/esm-loader@2.6.5': + resolution: {integrity: sha512-FxEMIkJKnodyA1OaCUoEvbYRkoZlLZ4d/eXFu9Fh8CbBBgP5EmZxrfTRyN0qpXZ4vOvqnE5YdRdcrmUUXuU+dA==} + deprecated: 'Merged into tsx: https://tsx.hirok.io' + + '@esbuild/aix-ppc64@0.25.12': + resolution: {integrity: sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/aix-ppc64@0.27.7': + resolution: {integrity: sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/aix-ppc64@0.28.2': + resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.18.20': + resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm64@0.25.12': + resolution: {integrity: sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm64@0.27.7': + resolution: {integrity: sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm64@0.28.2': + resolution: {integrity: sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.18.20': + resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + + '@esbuild/android-arm@0.25.12': + resolution: {integrity: sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-arm@0.27.7': + resolution: {integrity: sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-arm@0.28.2': + resolution: {integrity: sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.18.20': + resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + + '@esbuild/android-x64@0.25.12': + resolution: {integrity: sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/android-x64@0.27.7': + resolution: {integrity: sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/android-x64@0.28.2': + resolution: {integrity: sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.18.20': + resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-arm64@0.25.12': + resolution: {integrity: sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-arm64@0.27.7': + resolution: {integrity: sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-arm64@0.28.2': + resolution: {integrity: sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.18.20': + resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + + '@esbuild/darwin-x64@0.25.12': + resolution: {integrity: sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/darwin-x64@0.27.7': + resolution: {integrity: sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/darwin-x64@0.28.2': + resolution: {integrity: sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.18.20': + resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-arm64@0.25.12': + resolution: {integrity: sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-arm64@0.27.7': + resolution: {integrity: sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-arm64@0.28.2': + resolution: {integrity: sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.18.20': + resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.25.12': + resolution: {integrity: sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.27.7': + resolution: {integrity: sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.28.2': + resolution: {integrity: sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.18.20': + resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm64@0.25.12': + resolution: {integrity: sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm64@0.27.7': + resolution: {integrity: sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm64@0.28.2': + resolution: {integrity: sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.18.20': + resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-arm@0.25.12': + resolution: {integrity: sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-arm@0.27.7': + resolution: {integrity: sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-arm@0.28.2': + resolution: {integrity: sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.18.20': + resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-ia32@0.25.12': + resolution: {integrity: sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-ia32@0.27.7': + resolution: {integrity: sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-ia32@0.28.2': + resolution: {integrity: sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.18.20': + resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-loong64@0.25.12': + resolution: {integrity: sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-loong64@0.27.7': + resolution: {integrity: sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-loong64@0.28.2': + resolution: {integrity: sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.18.20': + resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-mips64el@0.25.12': + resolution: {integrity: sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-mips64el@0.27.7': + resolution: {integrity: sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-mips64el@0.28.2': + resolution: {integrity: sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.18.20': + resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-ppc64@0.25.12': + resolution: {integrity: sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-ppc64@0.27.7': + resolution: {integrity: sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-ppc64@0.28.2': + resolution: {integrity: sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.18.20': + resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-riscv64@0.25.12': + resolution: {integrity: sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-riscv64@0.27.7': + resolution: {integrity: sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-riscv64@0.28.2': + resolution: {integrity: sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.18.20': + resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-s390x@0.25.12': + resolution: {integrity: sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-s390x@0.27.7': + resolution: {integrity: sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-s390x@0.28.2': + resolution: {integrity: sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.18.20': + resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + + '@esbuild/linux-x64@0.25.12': + resolution: {integrity: sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/linux-x64@0.27.7': + resolution: {integrity: sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/linux-x64@0.28.2': + resolution: {integrity: sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.25.12': + resolution: {integrity: sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-arm64@0.27.7': + resolution: {integrity: sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-arm64@0.28.2': + resolution: {integrity: sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.18.20': + resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.25.12': + resolution: {integrity: sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.27.7': + resolution: {integrity: sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.28.2': + resolution: {integrity: sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.25.12': + resolution: {integrity: sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-arm64@0.27.7': + resolution: {integrity: sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-arm64@0.28.2': + resolution: {integrity: sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.18.20': + resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.25.12': + resolution: {integrity: sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.27.7': + resolution: {integrity: sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.28.2': + resolution: {integrity: sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.25.12': + resolution: {integrity: sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/openharmony-arm64@0.27.7': + resolution: {integrity: sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/openharmony-arm64@0.28.2': + resolution: {integrity: sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.18.20': + resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + + '@esbuild/sunos-x64@0.25.12': + resolution: {integrity: sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/sunos-x64@0.27.7': + resolution: {integrity: sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/sunos-x64@0.28.2': + resolution: {integrity: sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.18.20': + resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-arm64@0.25.12': + resolution: {integrity: sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-arm64@0.27.7': + resolution: {integrity: sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-arm64@0.28.2': + resolution: {integrity: sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.18.20': + resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-ia32@0.25.12': + resolution: {integrity: sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-ia32@0.27.7': + resolution: {integrity: sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-ia32@0.28.2': + resolution: {integrity: sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.18.20': + resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + + '@esbuild/win32-x64@0.25.12': + resolution: {integrity: sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@esbuild/win32-x64@0.27.7': + resolution: {integrity: sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@esbuild/win32-x64@0.28.2': + resolution: {integrity: sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@google/genai@2.21.0': + resolution: {integrity: sha512-+PDtco2/Z0ONdzCGekCoCT+O1VJS9xJQNN4XzQpXG/t3El/SWWMkCWlFRO1KmivOHPa4Q0VjUYu1HBKCZ/v33Q==} + engines: {node: '>=20.0.0'} + peerDependencies: + '@modelcontextprotocol/sdk': ^1.25.2 + peerDependenciesMeta: + '@modelcontextprotocol/sdk': + optional: true + + '@hono/node-server@1.19.17': + resolution: {integrity: sha512-dSneS5qhiauZWGDCeK4o695Xd9nUNjviSZCMQrj10eetr8Uln1ucn6bbphOM6UynAMMtNIzZNSpL9vnASJwrPQ==} + engines: {node: '>=18.14.1'} + peerDependencies: + hono: ^4 + + '@hono/node-ws@1.3.1': + resolution: {integrity: sha512-vo/MwCnpJAVHBkGzWjCJ28wF45fYHAfbPZcH2rodZODHtch2GHA94KtMfusmVycTUtsLAsaNsHhtY6P8X3RQsA==} + engines: {node: '>=18.14.1'} + peerDependencies: + '@hono/node-server': ^1.19.11 + hono: ^4.6.0 + + '@img/colour@1.1.0': + resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==} + engines: {node: '>=18'} + + '@img/sharp-darwin-arm64@0.34.5': + resolution: {integrity: sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [arm64] + os: [darwin] + + '@img/sharp-darwin-x64@0.34.5': + resolution: {integrity: sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [x64] + os: [darwin] + + '@img/sharp-libvips-darwin-arm64@1.2.4': + resolution: {integrity: sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==} + cpu: [arm64] + os: [darwin] + + '@img/sharp-libvips-darwin-x64@1.2.4': + resolution: {integrity: sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==} + cpu: [x64] + os: [darwin] + + '@img/sharp-libvips-linux-arm64@1.2.4': + resolution: {integrity: sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==} + cpu: [arm64] + os: [linux] + + '@img/sharp-libvips-linux-arm@1.2.4': + resolution: {integrity: sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==} + cpu: [arm] + os: [linux] + + '@img/sharp-libvips-linux-ppc64@1.2.4': + resolution: {integrity: sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==} + cpu: [ppc64] + os: [linux] + + '@img/sharp-libvips-linux-riscv64@1.2.4': + resolution: {integrity: sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==} + cpu: [riscv64] + os: [linux] + + '@img/sharp-libvips-linux-s390x@1.2.4': + resolution: {integrity: sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==} + cpu: [s390x] + os: [linux] + + '@img/sharp-libvips-linux-x64@1.2.4': + resolution: {integrity: sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==} + cpu: [x64] + os: [linux] + + '@img/sharp-libvips-linuxmusl-arm64@1.2.4': + resolution: {integrity: sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==} + cpu: [arm64] + os: [linux] + + '@img/sharp-libvips-linuxmusl-x64@1.2.4': + resolution: {integrity: sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==} + cpu: [x64] + os: [linux] + + '@img/sharp-linux-arm64@0.34.5': + resolution: {integrity: sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [arm64] + os: [linux] + + '@img/sharp-linux-arm@0.34.5': + resolution: {integrity: sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [arm] + os: [linux] + + '@img/sharp-linux-ppc64@0.34.5': + resolution: {integrity: sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [ppc64] + os: [linux] + + '@img/sharp-linux-riscv64@0.34.5': + resolution: {integrity: sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [riscv64] + os: [linux] + + '@img/sharp-linux-s390x@0.34.5': + resolution: {integrity: sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [s390x] + os: [linux] + + '@img/sharp-linux-x64@0.34.5': + resolution: {integrity: sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [x64] + os: [linux] + + '@img/sharp-linuxmusl-arm64@0.34.5': + resolution: {integrity: sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [arm64] + os: [linux] + + '@img/sharp-linuxmusl-x64@0.34.5': + resolution: {integrity: sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [x64] + os: [linux] + + '@img/sharp-wasm32@0.34.5': + resolution: {integrity: sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [wasm32] + + '@img/sharp-win32-arm64@0.34.5': + resolution: {integrity: sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [arm64] + os: [win32] + + '@img/sharp-win32-ia32@0.34.5': + resolution: {integrity: sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [ia32] + os: [win32] + + '@img/sharp-win32-x64@0.34.5': + resolution: {integrity: sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [x64] + os: [win32] + + '@jridgewell/gen-mapping@0.3.13': + resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} + + '@jridgewell/remapping@2.3.5': + resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/sourcemap-codec@1.6.0': + resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==} + + '@jridgewell/trace-mapping@0.3.31': + resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + + '@lichess-org/chessground@10.4.2': + resolution: {integrity: sha512-T7j43oF2OIxwUlP42eHtX79drYkzCaSvuW4ENdrooW9pxAvbrse4g8OL3EH2HeA4Rn0tuOGQvAUC71NfK5lsVw==} + engines: {node: '>=24', pnpm: '>=12'} + + '@napi-rs/lzma-linux-x64-gnu@1.5.1': + resolution: {integrity: sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==} + engines: {node: ^22.20 || ^24.12 || >=25} + cpu: [x64] + os: [linux] + + '@opentelemetry/api@1.9.1': + resolution: {integrity: sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q==} + engines: {node: '>=8.0.0'} + + '@oxc-project/types@0.154.0': + resolution: {integrity: sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA==} + + '@polka/url@1.0.0-next.29': + resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==} + + '@protobufjs/aspromise@1.1.2': + resolution: {integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==} + + '@protobufjs/base64@1.1.2': + resolution: {integrity: sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==} + + '@protobufjs/codegen@2.0.5': + resolution: {integrity: sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==} + + '@protobufjs/eventemitter@1.1.1': + resolution: {integrity: sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==} + + '@protobufjs/fetch@1.1.1': + resolution: {integrity: sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==} + + '@protobufjs/float@1.0.2': + resolution: {integrity: sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==} + + '@protobufjs/path@1.1.2': + resolution: {integrity: sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==} + + '@protobufjs/pool@1.1.0': + resolution: {integrity: sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==} + + '@protobufjs/utf8@1.1.2': + resolution: {integrity: sha512-b1UQwcEZ4yCnMCD8DAL1VlbvBJE9/IX4FTIp7BG1xYpf29SLazLSrqUkj4w7Y5y7cCVP6E5tcqqcI0xemPkHug==} + + '@rolldown/binding-android-arm-eabi@1.2.14': + resolution: {integrity: sha512-aWR+XKH9+rW7m5fWq/5360J3mHycrx/o6xZM2DQFdJnTMdyP7/WzxPjhtLbVWdKo2y612/4U1bWqb3HQhiF7vg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@rolldown/binding-android-arm64@1.2.14': + resolution: {integrity: sha512-QiVxHofl6A8lQU7WAtOUY4QMVZXohxwz7WJJoeh8NBEUyKfIkMRKhYyq8az/1RypNiIXzNTtiS6KwHz0erxYRQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@rolldown/binding-darwin-arm64@1.2.14': + resolution: {integrity: sha512-lTQOzHuBIooh3jIr5XINQkjPGEuGy+Dsy0meXDr6Sjty0b99kYgGh4uBC/8mJX1T0kC8d6S0aPP1Y+bHkh6aBw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@rolldown/binding-darwin-x64@1.2.14': + resolution: {integrity: sha512-hyMKEGatjmBYCs/Q4sbIcL/GqpFEqsX3wc+HYVQ/85A4rxc1o7rPm4DUI4GV4k/h0ITddwFSGpqQunI14GXjTA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@rolldown/binding-freebsd-x64@1.2.14': + resolution: {integrity: sha512-u371GbXoVXrEgP20PwzoGNOdAOqAMhzo19JzzY+V4YmmnC+DTOoqdbMu+O+54emM59Mik/UdrtWgcuEDKWRPKA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@rolldown/binding-linux-arm-gnueabihf@1.2.14': + resolution: {integrity: sha512-BqwKsdZQf6EqVWr8fv2MrDYzAvOZ7+NYFSJESRGs87fkseEhs0TU9TXgRJTkZoRRkxTizyEg1LKUXfU3/78uqg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@rolldown/binding-linux-arm64-gnu@1.2.14': + resolution: {integrity: sha512-SD9kY8M009x/7s57Z1dgUVlP5+uYBgKQK0Tkr1WIWngrtUJmRCW1RJFMY7QDla2khXhmg2i5Io7MUjcmZNZ/KQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@rolldown/binding-linux-arm64-musl@1.2.14': + resolution: {integrity: sha512-BJ2CL19M6uuWesMgnqJzgxoI+N+eV7b0A9O9vLV42y+gitC41fNa8KElau1tHVzuLWX5GzEuxMPhAO0tQXQMkg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@rolldown/binding-linux-ppc64-gnu@1.2.14': + resolution: {integrity: sha512-4+Kl8daPV8NDHaD7mfCcc1pRM+Qg7ab8DyMm5FG5WoZgv4h2i3KFN1CybYBNbQqmuYm7ftJLvmMI1eHYJ22S/Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + + '@rolldown/binding-linux-s390x-gnu@1.2.14': + resolution: {integrity: sha512-V/h8ePq1fKDrmtFMz6xcCN3DKvuvMRrwwD1q0PkBeeo4DpK64biaKvqWGVxqCeYKqeRk7gE7/iKPxLCn08O97A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + + '@rolldown/binding-linux-x64-gnu@1.2.14': + resolution: {integrity: sha512-WxalXzgrLVpKC93xfpaJ3gCXUWzeCr+FRCbDVD2mUAy4L6Vo3lNVz0epUEUpxPWJkLNYUwM4OSIikv36OJ9mLg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@rolldown/binding-linux-x64-musl@1.2.14': + resolution: {integrity: sha512-3G3tnAmTpdk9jO3GQtyHXqeFD2SlecfTws/Y3M2mmj9nMBwwuLT4kur8sZKeu7ENUHSpVO3cIsm5A52LEWWwlg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@rolldown/binding-openharmony-arm64@1.2.14': + resolution: {integrity: sha512-qyr5XiNGxm2ytx17vvtcJ9nXn6v1gENETi503bJx3OGwZ1tSonj7BosxbMa/xeAfSl5iS9X6KjEWYXLu6v1L7Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@rolldown/binding-win32-arm64-msvc@1.2.14': + resolution: {integrity: sha512-oA4o5o0S2yB199YyYXDzKUv1Z56Rc+mgOjwm7Z/vJ9Z8igiDPYvoOuDyo6g7AK/ZaF09nPhDKVnGBcYHO11GXA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@rolldown/binding-win32-x64-msvc@1.2.14': + resolution: {integrity: sha512-9mE94bf2GZUaR/fUSXCMpBoWkctu421Mi0ORpm4zqfbkjKep7RxzPFa5etcGs5h+2KApoWBOA/hAJa/7saGgEQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@rolldown/pluginutils@1.0.1': + resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==} + + '@rollup/rollup-android-arm-eabi@4.64.9': + resolution: {integrity: sha512-qJmhckvOleXp8R+BaXiVW/S34/3M7pvN17/QcG90A74BDaSvKv8ffY+GYG+a/xU0vEoITzdMSiM7o9HZSQWbfA==} + cpu: [arm] + os: [android] + + '@rollup/rollup-android-arm64@4.64.9': + resolution: {integrity: sha512-dqQgds39BNWGB2ughJ6n2LTQFXk8RAOwnXj6m387OHpygfD93QRS1ODIfpiWyAa9gsFB9l34pSqeLmA0Xk/VBw==} + cpu: [arm64] + os: [android] + + '@rollup/rollup-darwin-arm64@4.64.9': + resolution: {integrity: sha512-scrMx4SGikOSbWknLmPD0v6OeJ1Wih3kyRLdNZnlVbBeKVWp1nRTVcpM0IxDJdc3u8UjesPHTmnX649u8cQpBw==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.64.9': + resolution: {integrity: sha512-fkwi2OQR+QWoViRFt08Bsca6G0e9pk/4z+JgmqHq6jSRTT0LtI27KRVK8bu++6L/CBtQ3OZePbqC3bcrwGzTqQ==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-freebsd-arm64@4.64.9': + resolution: {integrity: sha512-8Apr0Khn0r2MUsDtcOMbp85fDdXsX/E+iLhO17WUjG24m3O8ChArqI0isI7CAdj9Ouq177PHtVtEUpMNE1C4Gw==} + cpu: [arm64] + os: [freebsd] + + '@rollup/rollup-freebsd-x64@4.64.9': + resolution: {integrity: sha512-H+upy4DhBcBZlUsCAMyr8wR0Dg9kj8sGloVZdZ7va2heJM/5jnROxI47dtXseJjlD/VoQe6MrXhY3b5ikOq/Vw==} + cpu: [x64] + os: [freebsd] + + '@rollup/rollup-linux-arm-gnueabihf@4.64.9': + resolution: {integrity: sha512-b50NS9TbAEK/b16vBoKrkeNwy+HvGBXmtBbzX4wcodWOh9dQZvRTN9rUyElIXa36QnwXhU9PAVVkZpqRzSi2Tg==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm-musleabihf@4.64.9': + resolution: {integrity: sha512-SdqcudB/FzjLESsRMgXhV+FXGtf6usxXwlMoRW7D/XS3f9CZ4T4wycRBu2h9bVl2AOaPpunoA8ftAM/MF4altQ==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm64-gnu@4.64.9': + resolution: {integrity: sha512-dg19FFRoovN+KZ+gMHBAq4Do8PgQmBcxpuhux57OuiR0QLavfn8uPBY8CP+UO50bO+xf0tK0GlqI/jld++5E6g==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-arm64-musl@4.64.9': + resolution: {integrity: sha512-+jyv5ofGmpAvtrzLjSr/e4syskeikEp5L82bUzB76auwOgK1VNVwZV/F2g1Pes9bhTznbejOefAqPglHSKYmTA==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-loong64-gnu@4.64.9': + resolution: {integrity: sha512-MKFXxqmkzCbtNvx/vjiJdss44eRtVabhCtDWcCFD9NHGwP+YkqnM/slnEsv/3fsoq9ukTtudraAjGhptrUPCVg==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-loong64-musl@4.64.9': + resolution: {integrity: sha512-lhARcOT6n7Ni9hpQRq8LZjbuoW+G/GXaW4Jfhx2MbmjnCj9XxLMRTceJIMpiMLQVWm+qxe7oq1sYvlIGOAW34Q==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-ppc64-gnu@4.64.9': + resolution: {integrity: sha512-oORQzGxZ1oHghJwLdwc8Ni0SY9otILAeXsWdiImTF4F5HkWJUwh5s/269PF5tYILNC1z/3RwFsrgcHPguBcb0g==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-ppc64-musl@4.64.9': + resolution: {integrity: sha512-J2JQHQt7oR1uutd2OSwbV2Qpb2LI5gggPolbkUwDe7vn/0dnduZ0w6EIbGnZUAw7uIKaMgfVylcH6V+Aov8kRA==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-riscv64-gnu@4.64.9': + resolution: {integrity: sha512-bWaKLrfzeQ9mOzJJxXbPgw2RH6VAaTJrb/60Tqf7YSMxubG8780Hzm7Us+D6qVW8QRGJYl4VUvVXxnRB0o9zvQ==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-riscv64-musl@4.64.9': + resolution: {integrity: sha512-TFJyaCB9NsvSyvVGQgTSRD9XgxsAq99ivDDkt9KAySlrNW5Obsd1kQpvoCvBCOLq+JlJTjmtroLH0wp8M8mEsA==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-s390x-gnu@4.64.9': + resolution: {integrity: sha512-DvmOM5xz/wDnUJFVjqP32ahalxn7BDuvO25bpuFOrb50AIFCCcFPN4lWWUDD1c8Ddv9sMO9SXyqtOet8G8u9cQ==} + cpu: [s390x] + os: [linux] + + '@rollup/rollup-linux-x64-gnu@4.64.9': + resolution: {integrity: sha512-aFzokHK3yE00mzAvKm/PY76OsOOTjvoTGE82Vp89iBDyD2wUBlV4ZsR2tWkRECTEFk6TC4Yc3zaEWjPqq1vstQ==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-linux-x64-musl@4.64.9': + resolution: {integrity: sha512-t/yMdeaaQUuNNpmT7taBmH2VvHzgT4YA/IaKVE3qVr4PYQemn/kmJkL4uG4UvTLcWXQd0MSoOa/3URYSWGmUEg==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-openbsd-x64@4.64.9': + resolution: {integrity: sha512-4dnxKQ8GHARyjqAU87q5UWhywZTpIbR2VWhtACdC37GD1SGszmvb3TaBFVA4n+fnDHSKMut4ZJ63hVFwgnxVtg==} + cpu: [x64] + os: [openbsd] + + '@rollup/rollup-openharmony-arm64@4.64.9': + resolution: {integrity: sha512-1qdQj6IrNoR0xFvrCQHmhBXe9HMbBGNTFi+3n4jKMt2rTx4k0aeAdraZU4WDOMfL9tAwS8/TRSuquvNuPQ+Gpw==} + cpu: [arm64] + os: [openharmony] + + '@rollup/rollup-win32-arm64-msvc@4.64.9': + resolution: {integrity: sha512-yc1GSEHIYhKGN5WSaJc+eMy8bZvzcvAmflEgFh8L3xcy8dYxGmfrudyBnBFde9f6JzOa1kFqocF8BHaWybjQoA==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-ia32-msvc@4.64.9': + resolution: {integrity: sha512-VzHGvosAkLIzrwqvSgJBPDmGFTF/yE8OtMT4H5z8pM1NA0NiPpvTYnUh+9xPd+d5oy/wqF317FmJ1I8Kk8pp0Q==} + cpu: [ia32] + os: [win32] + + '@rollup/rollup-win32-x64-gnu@4.64.9': + resolution: {integrity: sha512-FB77txy1PiAcJgG72nOLA6R0S3PRZahs8Spx0z2yseDUkoMmJcrQghiebJ2JHZ74cCOVlX/MYd4dUbJtJJ8fow==} + cpu: [x64] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.64.9': + resolution: {integrity: sha512-IoIgQLpK1DbOcQf1vX+i5oe5LXypsCVb1j/mU6BLAbOGmXH4E+j4kMfgZRwPYUohVBurNyVMgIKVM5dR6xA0kA==} + cpu: [x64] + os: [win32] + + '@silvia-odwyer/photon-node@0.3.4': + resolution: {integrity: sha512-bnly4BKB3KDTFxrUIcgCLbaeVVS8lrAkri1pEzskpmxu9MdfGQTy8b8EgcD83ywD3RPMsIulY8xJH5Awa+t9fA==} + + '@smithy/core@3.36.0': + resolution: {integrity: sha512-3hJiwG1F5t1SoXqp/yOCmYXziyx7ZVqF63S5W6YU201e/qwVaHPex+E/3vvyY9a3ORq/b+BydeNZpP2saQ9X2g==} + engines: {node: '>=18.0.0'} + + '@smithy/credential-provider-imds@4.5.2': + resolution: {integrity: sha512-A9uSdn72ozbRUSit0eib0TW7nXuNPlaeM0zcGkJ+nE6tFcSDbnmtwoxbTCFBukVQcszDAyvsd7+rTduPTXpygg==} + engines: {node: '>=18.0.0'} + + '@smithy/fetch-http-handler@5.8.0': + resolution: {integrity: sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA==} + engines: {node: '>=18.0.0'} + + '@smithy/node-http-handler@4.12.1': + resolution: {integrity: sha512-ThMkboGeONWXAelq9FvGsuJC4rOi+qyC4/zhUF58xYpxUg5sQKx2VXZYJmtNjr4dSuBJ1HeJXETQILCz3wOHvw==} + engines: {node: '>=18.0.0'} + + '@smithy/signature-v4@5.7.4': + resolution: {integrity: sha512-tHy0K0VtqNd5Y7Y41h0a0Lhh0L1GzC08dTWg0F7vRJWFtTENg7IZikf3wQkanYIRdb7ngoIPMTmqgUi401fEeQ==} + engines: {node: '>=18.0.0'} + + '@smithy/types@4.19.0': + resolution: {integrity: sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q==} + engines: {node: '>=18.0.0'} + + '@stablelib/base64@1.0.1': + resolution: {integrity: sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ==} + + '@standard-schema/spec@1.1.0': + resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} + + '@sveltejs/acorn-typescript@1.0.13': + resolution: {integrity: sha512-wgKggnhZVL9Bfx1OaKKTrYY9BFRk6C8UAkQNUcIv1+llzYrIqy+RZm5HPKzn0NpEBvTVhTqB4kQyllZywsRBRQ==} + peerDependencies: + acorn: ^8.9.0 + + '@sveltejs/adapter-static@4.0.0': + resolution: {integrity: sha512-aF1J23R1ebKqUxQ4/qLr/Lxu63NFmLAtg8UZl3HFLxaoA1D/nhTVGcD9lTqx65iUbjNR2iOL0TgOxSX82x6Paw==} + peerDependencies: + '@sveltejs/kit': ^3.0.0-next.0 + + '@sveltejs/kit@3.1.0': + resolution: {integrity: sha512-JTWlq2HQlkqx6vIoxhC0R6sc4WVqbQoRyEmr5YlqKmiYbzY1U3awtSWTmjMLlS056a49AmkQR6rnNANXIE8B0Q==} + engines: {node: '>=22.17'} + hasBin: true + peerDependencies: + '@opentelemetry/api': ^1.0.0 + '@sveltejs/vite-plugin-svelte': ^7.0.0 + svelte: ^5.57.1 + typescript: ^6.0.0 + vite: ^8.0.12 + peerDependenciesMeta: + '@opentelemetry/api': + optional: true + typescript: + optional: true + + '@sveltejs/load-config@0.2.3': + resolution: {integrity: sha512-VT3qmUb8pRV2QrZjd8iAmtg8lf4W0TIjZbvXtz5MKei/q96teWZgGJyyidJzOjzZzvdq616eSRVeMYIQChUTAQ==} + engines: {node: '>= 18.0.0'} + + '@sveltejs/vite-plugin-svelte@7.3.1': + resolution: {integrity: sha512-ZPsLN8B1e/En+Ak5s4V7srFDT532oS0qieLsQwu63NGKsS+iAjoO2Js1BochlHlglcU+Pt7WAO3C5Ee+4f6gVA==} + engines: {node: ^20.19 || ^22.12 || >=24} + peerDependencies: + svelte: ^5.46.4 + vite: ^8.0.0-beta.7 || ^8.0.0 + + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + + '@types/estree@1.0.9': + resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==} + + '@types/node@24.19.2': + resolution: {integrity: sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==} + + '@types/retry@0.12.0': + resolution: {integrity: sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==} + + '@vitest/expect@3.2.7': + resolution: {integrity: sha512-E8eBXaKibuvH2pSZErOjdVb5vF4PbKYcrnluBTYxEk1l/VhhwZg1kZQsdtjq+CsF5CFydf2Rdkz7jDHKSisi3w==} + + '@vitest/mocker@3.2.7': + resolution: {integrity: sha512-Trr0hYO9CM3Wj6ksWHRhK9IZpIY6wTMO5u/MqXurMxT57sWBaOPEtP3Oq60ihZuh5JsiagKfz95OcxdEP6dBrA==} + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@3.2.7': + resolution: {integrity: sha512-KUHlwqVu0sRlhCdyPdQ/wBoTfRahjUky1MubOmYw9fWfIZy1gNoHpuaaQBPAaMaVYdQYHJLurzj8ECCj5OwTqA==} + + '@vitest/runner@3.2.7': + resolution: {integrity: sha512-sB9y4ovltoQP+WaUPwmSxO9WIg9Ig694Di5PalVPsYHklAdE027mehpWF2SQSVq+k6sFgaivbTjTJwZLSHbedA==} + + '@vitest/snapshot@3.2.7': + resolution: {integrity: sha512-7C+MwShwtBSI5Buwoyg3s/iY1eHL9PKAf+O1wVh/TdnjXUtkoL/9YQtre90i4MtNXM6edP1wJ2zOBpfCyhIS7g==} + + '@vitest/spy@3.2.7': + resolution: {integrity: sha512-Q2eQGI6d2L/hBtZ0qNuKcAGid68XK6cv1xsoaIma6PaJhHPoqcEJhYpXZ/5myCMqkNgtP6UKuBhbc0nHKnrkuQ==} + + '@vitest/utils@3.2.7': + resolution: {integrity: sha512-x6BDOd7dyo3PFLY3I9/HJ25X/6OurhGXk2/B9gOZNPF7XDVjeBK4k01lQE5uvDpbuheErh91qYuE1E2OEjK3Rw==} + + acorn@8.19.0: + resolution: {integrity: sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==} + engines: {node: '>=0.4.0'} + hasBin: true + + agent-base@7.1.4: + resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} + engines: {node: '>= 14'} + + agent-base@9.0.0: + resolution: {integrity: sha512-TQf59BsZnytt8GdJKLPfUZ54g/iaUL2OWDSFCCvMOhsHduDQxO8xC4PNeyIkVcA5KwL2phPSv0douC0fgWzmnA==} + engines: {node: '>= 20'} + + any-promise@1.3.0: + resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + + aria-query@5.3.1: + resolution: {integrity: sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g==} + engines: {node: '>= 0.4'} + + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + + axobject-query@4.1.0: + resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} + engines: {node: '>= 0.4'} + + balanced-match@4.0.4: + resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} + engines: {node: 18 || 20 || >=22} + + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + bignumber.js@9.3.1: + resolution: {integrity: sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==} + + bowser@2.14.1: + resolution: {integrity: sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg==} + + brace-expansion@5.0.12: + resolution: {integrity: sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==} + engines: {node: 20 || >=22} + + buffer-equal-constant-time@1.0.1: + resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + bundle-require@5.1.0: + resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.18' + + cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + + chai@5.3.3: + resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==} + engines: {node: '>=18'} + + chalk@6.0.0: + resolution: {integrity: sha512-2uNTXIuTTxk7ciZgAU1BQcgnchcG0xXnrs6jzkQfj9SsRa9M2s5zE8WT96hS6KmG4MzWHSrvH43DF1m4XRkrFg==} + engines: {node: '>=22'} + + check-error@2.1.3: + resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==} + engines: {node: '>= 16'} + + chess.js@1.4.0: + resolution: {integrity: sha512-BBJgrrtKQOzFLonR0l+k64A98NLemPwNsCskwb+29bRwobUa4iTm51E1kwGPbWXAcfdDa18nad6vpPPKPWarqw==} + + chokidar@4.0.3: + resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} + engines: {node: '>= 14.16.0'} + + clsx@2.1.1: + resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} + engines: {node: '>=6'} + + commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + + confbox@0.1.8: + resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==} + + consola@3.4.2: + resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==} + engines: {node: ^14.18.0 || >=16.10.0} + + cookie@2.0.1: + resolution: {integrity: sha512-yuToqVvRrj6pfDXREyQAAv8SkAEk/8GS3jQRTiUMm66TVtBYmqQeoEjL2Lmq8Rpo6271vH76InTChTitEAm65w==} + engines: {node: '>=22'} + + cron-parser@5.10.2: + resolution: {integrity: sha512-JfAYMY0LZaWQTuict8PhtF/ksSnq8xefSDmQUnnoqvkPYkU/y3UP0DTWzJKFBz0P1IXsDG8q0vY3zHkoFZOhvw==} + engines: {node: '>=18'} + + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + + data-uri-to-buffer@4.0.1: + resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} + engines: {node: '>= 12'} + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + + deepmerge@4.3.1: + resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} + engines: {node: '>=0.10.0'} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + devalue@5.9.4: + resolution: {integrity: sha512-sPAT4pztbu6586/hrhOnMKS17IJrvg12mXiSPSS3W5qDeN2RGgvZ0diZCm31dBbnevfVmujNO3IM2wrS4Y2Rhg==} + + diff@8.0.4: + resolution: {integrity: sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==} + engines: {node: '>=0.3.1'} + + drizzle-kit@0.31.11: + resolution: {integrity: sha512-YCYqxTLIB2OCqf6w9/Vef13baBVbwQIPcbT4Y56AfO6B9ajZhDhD8Jkveg/hJvT/iuMloKD/IYYkyMMNhr7Kqg==} + hasBin: true + + drizzle-orm@0.45.4: + resolution: {integrity: sha512-NiM1YZpJ2UxyeE67DpDDZ+Tsw4YLX3trSlkNT7Tm9eKoUNb1LvaAaQzXgYQsWs+AQ9TUmmwMmBOCXuqqxUWKKQ==} + peerDependencies: + '@aws-sdk/client-rds-data': '>=3' + '@cloudflare/workers-types': '>=4' + '@electric-sql/pglite': '>=0.2.0' + '@libsql/client': '>=0.10.0' + '@libsql/client-wasm': '>=0.10.0' + '@neondatabase/serverless': '>=0.10.0' + '@netlify/db': '>=0.4.0' + '@op-engineering/op-sqlite': '>=2' + '@opentelemetry/api': ^1.4.1 + '@planetscale/database': '>=1.13' + '@prisma/client': '*' + '@tidbcloud/serverless': '*' + '@types/better-sqlite3': '*' + '@types/pg': '*' + '@types/sql.js': '*' + '@upstash/redis': '>=1.34.7' + '@vercel/postgres': '>=0.8.0' + '@xata.io/client': '*' + better-sqlite3: '>=7' + bun-types: '*' + expo-sqlite: '>=14.0.0' + gel: '>=2' + knex: '*' + kysely: '*' + mysql2: '>=2' + pg: '>=8' + postgres: '>=3' + prisma: '*' + sql.js: '>=1' + sqlite3: '>=5' + peerDependenciesMeta: + '@aws-sdk/client-rds-data': + optional: true + '@cloudflare/workers-types': + optional: true + '@electric-sql/pglite': + optional: true + '@libsql/client': + optional: true + '@libsql/client-wasm': + optional: true + '@neondatabase/serverless': + optional: true + '@netlify/db': + optional: true + '@op-engineering/op-sqlite': + optional: true + '@opentelemetry/api': + optional: true + '@planetscale/database': + optional: true + '@prisma/client': + optional: true + '@tidbcloud/serverless': + optional: true + '@types/better-sqlite3': + optional: true + '@types/pg': + optional: true + '@types/sql.js': + optional: true + '@upstash/redis': + optional: true + '@vercel/postgres': + optional: true + '@xata.io/client': + optional: true + better-sqlite3: + optional: true + bun-types: + optional: true + expo-sqlite: + optional: true + gel: + optional: true + knex: + optional: true + kysely: + optional: true + mysql2: + optional: true + pg: + optional: true + postgres: + optional: true + prisma: + optional: true + sql.js: + optional: true + sqlite3: + optional: true + + ecdsa-sig-formatter@1.0.11: + resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==} + + es-module-lexer@1.7.0: + resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} + + esbuild@0.18.20: + resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} + engines: {node: '>=12'} + hasBin: true + + esbuild@0.25.12: + resolution: {integrity: sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==} + engines: {node: '>=18'} + hasBin: true + + esbuild@0.27.7: + resolution: {integrity: sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==} + engines: {node: '>=18'} + hasBin: true + + esbuild@0.28.2: + resolution: {integrity: sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==} + engines: {node: '>=18'} + hasBin: true + + esm-env@1.2.2: + resolution: {integrity: sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==} + + esrap@2.4.0: + resolution: {integrity: sha512-CQPcneEHw/czj32uwQC52nYnax8H4SXt25FCM+LIwGZ49cMIxpOj3bP8wmzcI+Z0HIy5KkClaPhRLfCySzwHPA==} + peerDependencies: + '@typescript-eslint/types': ^8.2.0 + peerDependenciesMeta: + '@typescript-eslint/types': + optional: true + + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + + expect-type@1.4.0: + resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} + engines: {node: '>=12.0.0'} + + extend@3.0.2: + resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} + + fast-sha256@1.3.0: + resolution: {integrity: sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==} + + fdir@6.5.0: + resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} + engines: {node: '>=12.0.0'} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + fetch-blob@3.2.0: + resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==} + engines: {node: ^12.20 || >= 14.13} + + fix-dts-default-cjs-exports@1.0.1: + resolution: {integrity: sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==} + + formdata-polyfill@4.0.10: + resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} + engines: {node: '>=12.20.0'} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + gaxios@7.3.1: + resolution: {integrity: sha512-kB3rzJV7d9juLZh8/56QTXCwQfxyhdOMdyYk1HdQKFtF8TJTDTZQJtixWIwXdE9Jji91mC41DUNpjleo4L4eAQ==} + engines: {node: '>=18'} + + gcp-metadata@8.1.2: + resolution: {integrity: sha512-zV/5HKTfCeKWnxG0Dmrw51hEWFGfcF2xiXqcA3+J90WDuP0SvoiSO5ORvcBsifmx/FoIjgQN3oNOGaQ5PhLFkg==} + engines: {node: '>=18'} + + get-east-asian-width@1.6.0: + resolution: {integrity: sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==} + engines: {node: '>=18'} + + get-tsconfig@4.14.3: + resolution: {integrity: sha512-++QEw4DIY7WGoukz+/+A/8dGYPT9l9yIadnmSgZ8Rjr3YVSVDipQSO9CdnJo9ePqFqUUqh+wk9uIaoiAwsiPkA==} + + google-auth-library@10.9.1: + resolution: {integrity: sha512-i1ydyHrqcIxXkWh/uBmVkzCvIuq5yiK2ATndIe5XxKholrG/MTYP9xGYka4sQhrbIAgGjL2B6NOE7rFaiF3fXw==} + engines: {node: '>=18'} + + google-logging-utils@1.1.3: + resolution: {integrity: sha512-eAmLkjDjAFCVXg7A1unxHsLf961m6y17QFqXqAXGj/gVkKFrEICfStRfwUlGNfeCEjNRa32JEWOUTlYXPyyKvA==} + engines: {node: '>=14'} + + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + + grok-mermaid@0.2.3: + resolution: {integrity: sha512-/4KopAbsjvuRP9MdPtlDjOHUmUVEohOX73JNcsWpzAtFxh+bq5+Dhb6gzvRieLDwIPQIR3/vy8V1NNTuz4Zsmg==} + engines: {node: '>=18'} + + highlight.js@10.7.3: + resolution: {integrity: sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==} + + hono@4.13.13: + resolution: {integrity: sha512-CQ46U0ZkAGmbT/4UxdzzGJpacP2IeKgY4a5/tOI9AABbpOMfK739wfDXmv1usCk+3RkKj1hQy4/fjhiwa2xlrA==} + engines: {node: '>=16.9.0'} + + hosted-git-info@9.0.3: + resolution: {integrity: sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg==} + engines: {node: ^20.17.0 || >=22.9.0} + + http-proxy-agent@9.1.0: + resolution: {integrity: sha512-2NxoveTT58mjYT4n3RPTEfCZGLMbidoO8XEieXfpSYxu+PQJ1qpx4ypwH6N+uF9twBPIvRRgvkvW5HUTYWENig==} + engines: {node: '>= 20'} + + https-proxy-agent@7.0.6: + resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} + engines: {node: '>= 14'} + + https-proxy-agent@9.1.0: + resolution: {integrity: sha512-ag87y7cJJ9/3+GxFr8Oy4O5faDsGRGnBGsJj/YjOSsSx/5eadKLYTMPlzuR6obgoCDDm0abAAZitXXQkMOPSpA==} + engines: {node: '>= 20'} + + ignore@7.0.8: + resolution: {integrity: sha512-YYNsSlXBjMk92SKnkwvB5LOVSa6OznlFUGcsvrFgNJbJCd0M1XKeFVRc8ZByeCqz32FivYNHJVooLmdqrmvp/Q==} + engines: {node: '>= 4'} + + is-reference@3.0.3: + resolution: {integrity: sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + jiti@2.7.0: + resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==} + hasBin: true + + joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + + js-tokens@9.0.1: + resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==} + + json-bigint@1.0.0: + resolution: {integrity: sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==} + + json-schema-to-ts@3.1.1: + resolution: {integrity: sha512-+DWg8jCJG2TEnpy7kOm/7/AxaYoaRbjVB4LFZLySZlWn8exGs3A4OLJR966cVvU26N7X9TWxl+Jsw7dzAqKT6g==} + engines: {node: '>=16'} + + jwa@2.0.1: + resolution: {integrity: sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==} + + jws@4.0.1: + resolution: {integrity: sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==} + + lightningcss-android-arm64@1.33.0: + resolution: {integrity: sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [android] + + lightningcss-darwin-arm64@1.33.0: + resolution: {integrity: sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [darwin] + + lightningcss-darwin-x64@1.33.0: + resolution: {integrity: sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [darwin] + + lightningcss-freebsd-x64@1.33.0: + resolution: {integrity: sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [freebsd] + + lightningcss-linux-arm-gnueabihf@1.33.0: + resolution: {integrity: sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==} + engines: {node: '>= 12.0.0'} + cpu: [arm] + os: [linux] + + lightningcss-linux-arm64-gnu@1.33.0: + resolution: {integrity: sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [linux] + + lightningcss-linux-arm64-musl@1.33.0: + resolution: {integrity: sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [linux] + + lightningcss-linux-x64-gnu@1.33.0: + resolution: {integrity: sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [linux] + + lightningcss-linux-x64-musl@1.33.0: + resolution: {integrity: sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [linux] + + lightningcss-win32-arm64-msvc@1.33.0: + resolution: {integrity: sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [win32] + + lightningcss-win32-x64-msvc@1.33.0: + resolution: {integrity: sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [win32] + + lightningcss@1.33.0: + resolution: {integrity: sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==} + engines: {node: '>= 12.0.0'} + + lilconfig@3.1.4: + resolution: {integrity: sha512-zJZyBmQhArDRefuWTypZxwDpFDIYmrj8ypSBvwGD5P13Y95s6DjzKgu4DVdGbeQa5PDEsAOCAPNk4X+QOR006w==} + engines: {node: '>=14'} + + lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + + load-tsconfig@0.2.5: + resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + locate-character@3.0.0: + resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==} + + long@5.3.2: + resolution: {integrity: sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==} + + loupe@3.2.1: + resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==} + + lru-cache@11.5.3: + resolution: {integrity: sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==} + engines: {node: 20 || >=22} + + luxon@3.7.2: + resolution: {integrity: sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==} + engines: {node: '>=12'} + + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + + magic-string@1.4.3: + resolution: {integrity: sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==} + + marked@18.0.11: + resolution: {integrity: sha512-HnslJfsZkRPBDJRHvVtAaWlZHEpSu7u8LgQuJCELjRKuWR+hpq4A7sLq3p8HaI9ypVoXDXxV34CsQJEe1+J5Aw==} + engines: {node: '>= 20'} + hasBin: true + + minimatch@10.2.6: + resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==} + engines: {node: 18 || 20 || >=22} + + mlly@1.8.2: + resolution: {integrity: sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==} + + mri@1.2.0: + resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} + engines: {node: '>=4'} + + mrmime@2.0.1: + resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==} + engines: {node: '>=10'} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + mz@2.7.0: + resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + + nanoid@3.3.20: + resolution: {integrity: sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + nanoid@5.1.16: + resolution: {integrity: sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ==} + engines: {node: ^18 || >=20} + hasBin: true + + node-domexception@1.0.0: + resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} + engines: {node: '>=10.5.0'} + deprecated: Use your platform's native DOMException instead + + node-fetch@3.3.2: + resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + non-error@0.1.0: + resolution: {integrity: sha512-TMB1uHiGsHRGv1uYclfhivcnf0/PdFp2pNqRxXjncaAsjYMoisaQJI+SSZCqRq+VliwRTC8tsMQfmrWjDMhkPQ==} + engines: {node: '>=20'} + + object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + + obug@2.2.1: + resolution: {integrity: sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==} + engines: {node: '>=12.20.0'} + + openai@7.19.0: + resolution: {integrity: sha512-MX2s3u2L5racTO0CC/SWpCOasJQBCJrqLKXK+l82cAhdeF8mPMBEe/gxMm0ZFa2xpKpOFLRjxv5afYEZbBXmbQ==} + engines: {node: '>=22.0.0'} + peerDependencies: + '@aws-sdk/credential-provider-node': '>=3.972.0 <4' + '@smithy/hash-node': '>=4.3.0 <5' + '@smithy/signature-v4': '>=5.4.0 <6' + undici: '>=5 <9' + ws: ^8.21.0 + zod: ^3.25 || ^4.0 + peerDependenciesMeta: + '@aws-sdk/credential-provider-node': + optional: true + '@smithy/hash-node': + optional: true + '@smithy/signature-v4': + optional: true + undici: + optional: true + ws: + optional: true + zod: + optional: true + + p-retry@4.6.2: + resolution: {integrity: sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==} + engines: {node: '>=8'} + + partial-json@0.1.7: + resolution: {integrity: sha512-Njv/59hHaokb/hRUjce3Hdv12wd60MtM9Z5Olmn+nehe0QDAsRtRbJPvJ0Z91TusF0SuZRIvnM+S4l6EIP8leA==} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + + pathval@2.0.1: + resolution: {integrity: sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==} + engines: {node: '>= 14.16'} + + pg-boss@12.38.0: + resolution: {integrity: sha512-felA3fyPSJwWk5cb/VwAgnudCAzWEdgBjjf+eukXm8pExlwkhjdBbOMukMyG5s8uZHO6fZZZcaIaTa3oKpfSCg==} + engines: {node: '>=22.12.0'} + hasBin: true + peerDependencies: + '@opentelemetry/api': ^1.9.0 + + pg-cloudflare@1.4.1: + resolution: {integrity: sha512-6PQbsFWZcp9EmJEwy5cGQ2La+AMWpP46lgbb8X+U/XsHIUweYDNCpeuKck5RxL2MdVFi7krbbEi5nX4Zh7JhrQ==} + + pg-connection-string@2.14.1: + resolution: {integrity: sha512-qR3kGNPBLpCNtz0evbKA0Y/MRFXwSSdT+pTJvYp/bXTcReZbvX1kzF0IyTc1QnxqF7AZbOeBhNL8R5mYQZV/MA==} + + pg-int8@1.0.1: + resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} + engines: {node: '>=4.0.0'} + + pg-pool@3.14.0: + resolution: {integrity: sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw==} + peerDependencies: + pg: '>=8.0' + + pg-protocol@1.16.1: + resolution: {integrity: sha512-p9VOFMiHB/ZbJATetbg+99PxssTVSQRnyuPSQ67mN1+1KBOjZaZ83ZQzltnxPhJwSsC3nwVjJ10DVJlerbFzLg==} + + pg-types@2.2.0: + resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} + engines: {node: '>=4'} + + pg@8.23.1: + resolution: {integrity: sha512-aL96AHANtWjPLDOLqnhx+ngp9+UK7ETEU8VJrDCGvsSSi/mGLcWYsS6Herg7lmaBJe4uwrfqsa7gTEFaSizDoQ==} + engines: {node: '>= 16.0.0'} + peerDependencies: + pg-native: '>=3.0.1' + peerDependenciesMeta: + pg-native: + optional: true + + pgpass@1.0.5: + resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@4.0.7: + resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} + engines: {node: '>=12'} + + pirates@4.0.7: + resolution: {integrity: sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==} + engines: {node: '>= 6'} + + pkg-types@1.3.1: + resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==} + + postcss-load-config@6.0.1: + resolution: {integrity: sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==} + engines: {node: '>= 18'} + peerDependencies: + jiti: '>=1.21.0' + postcss: '>=8.0.9' + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + jiti: + optional: true + postcss: + optional: true + tsx: + optional: true + yaml: + optional: true + + postcss@8.5.30: + resolution: {integrity: sha512-zkd+e9S1AQHhmaBKye9zlFHWjOwVgqXl1q3ECYy8561K7qxR2cREf/STLskulBFd78k6AOFeA+ff1TtEzk9bAA==} + engines: {node: ^10 || ^12 || >=14} + + postgres-array@2.0.0: + resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} + engines: {node: '>=4'} + + postgres-bytea@1.0.1: + resolution: {integrity: sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==} + engines: {node: '>=0.10.0'} + + postgres-date@1.0.7: + resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==} + engines: {node: '>=0.10.0'} + + postgres-interval@1.2.0: + resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} + engines: {node: '>=0.10.0'} + + postgres@3.4.9: + resolution: {integrity: sha512-GD3qdB0x1z9xgFI6cdRD6xu2Sp2WCOEoe3mtnyB5Ee0XrrL5Pe+e4CCnJrRMnL1zYtRDZmQQVbvOttLnKDLnaw==} + engines: {node: '>=12'} + + proper-lockfile@4.1.2: + resolution: {integrity: sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==} + + protobufjs@7.6.6: + resolution: {integrity: sha512-dYDWdjSl5RNb7SgPxGQcRU+GtvP7s2fpkrY0r432PcOIaZ0/rBcxEZnQN67iJhFuQiVw754JDoPruPCNdGsbjg==} + engines: {node: '>=12.0.0'} + + proxy-agent-negotiate@1.1.0: + resolution: {integrity: sha512-N8IBcM3UgCVzz2L2Lqv8DVntDnnC8/hiV4nEDUPkqq72TPUgYWjQc+bdZlBPZK9LzPAvOY//gAt0S0DApoOXWQ==} + engines: {node: '>= 20'} + peerDependencies: + kerberos: ^2.0.0 + peerDependenciesMeta: + kerberos: + optional: true + + quickjs-wasi@3.6.2: + resolution: {integrity: sha512-FCqGtGOrMgzUiIrMNMA2YnsOxCNwo31dzqXvclXUC6xeT35NJLKXQJsvbeCTjvoFAwZgEAPg8U6+KAPDGXn8Mg==} + + readdirp@4.1.2: + resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} + engines: {node: '>= 14.18.0'} + + resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + + retry@0.12.0: + resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==} + engines: {node: '>= 4'} + + retry@0.13.1: + resolution: {integrity: sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==} + engines: {node: '>= 4'} + + rolldown@1.2.14: + resolution: {integrity: sha512-eTBTTqMR6uHKLgcUqpJP8ntzDI6V4LYA8negAMBEI7gkgVvOdrx6VsvS2Ym+83KhOPdLCHWJu0w7UQFJZhHKNw==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + + rollup@4.64.9: + resolution: {integrity: sha512-mnPSQINChN7PpT+a5CI0/+87hm/+6zxSKBK1XonrzQ0zFnglaTjhkTP2Br4yNCTcLHUEvrAfZffH57jGf+8xBQ==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + + rrule-temporal@2.2.8: + resolution: {integrity: sha512-+wWUe0J02oMh1UWKIt1RTu2H0Cz+gP11O/iweK0MN2UP6JLGeepTUkbSBa90Hxq0W+ywSxM9IlJNouIUdMOwhg==} + + sade@1.8.1: + resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} + engines: {node: '>=6'} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + semver@7.8.5: + resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==} + engines: {node: '>=10'} + hasBin: true + + serialize-error@13.0.2: + resolution: {integrity: sha512-G+YKwp9I6IvWMe5RlwqxdmTPIcq/G8HK/sU51gdV1XAJznYkRSTB0ph+zB9AfSxG0fx6xrqYA6i9HeIcHFTXow==} + engines: {node: '>=20'} + + sharp@0.34.5: + resolution: {integrity: sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + + signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + + sirv@3.0.2: + resolution: {integrity: sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==} + engines: {node: '>=18'} + + source-map-js@1.2.2: + resolution: {integrity: sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==} + engines: {node: '>=0.10.0'} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + source-map@0.7.6: + resolution: {integrity: sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==} + engines: {node: '>= 12'} + + split2@4.2.0: + resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} + engines: {node: '>= 10.x'} + + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + standardwebhooks@1.1.1: + resolution: {integrity: sha512-bCbX9ZEyFkWPsRz7Bl3NuQUJohmwGSev/yhr7vhaGPlc4AfIrspIRa6cPTBuI1ItmrTDJ4d/S2hCsfe4+vQGnQ==} + + std-env@3.10.0: + resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} + + strip-literal@3.1.0: + resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==} + + sucrase@3.35.1: + resolution: {integrity: sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==} + engines: {node: '>=16 || 14 >=14.17'} + hasBin: true + + svelte-check@4.7.7: + resolution: {integrity: sha512-Ge2IMdeTpbJuzNFGRiiMg0RWgbScysKQu7xwcyFJ22+DU9F5nPX51+Q3gHmGqRxYQMx2knreVWt5oCtfe0vf2g==} + engines: {node: '>= 18.0.0'} + hasBin: true + peerDependencies: + svelte: ^4.0.0 || ^5.0.0-next.0 + typescript: ^5.0.0 || ^6.0.0 + + svelte@5.57.2: + resolution: {integrity: sha512-1YiPCAXT0Ct6g1vOMmSLa0Nsc3QRMvtDF32ihgglGVrugIuIK38RyDiFNXVDhtQ81TJjSO57NdMw6DyYLqSGDQ==} + engines: {node: '>=18'} + + tagged-tag@1.0.0: + resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==} + engines: {node: '>=20'} + + temporal-spec@1.0.1: + resolution: {integrity: sha512-wxVoanmDeavXie1vu2JaQ3WIc3JZnWAOYFBsJyATaVsXsycKYUflGsyBmrRSnoCpZJpwPyr38VpgSUlQ8CbFxg==} + + thenify-all@1.6.0: + resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} + engines: {node: '>=0.8'} + + thenify@3.3.1: + resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + + tinyglobby@0.2.17: + resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} + engines: {node: '>=12.0.0'} + + tinypool@1.1.1: + resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@2.0.0: + resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==} + engines: {node: '>=14.0.0'} + + tinyspy@4.0.6: + resolution: {integrity: sha512-u8KszXvGfU68hVcZpRHKG28T0krMuv2G5nDhiHaMLen/gIuFEgIJhaJuO69qjnXg5paSrbPMFfx3brNuN8eVSg==} + engines: {node: '>=14.0.0'} + + totalist@3.0.1: + resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} + engines: {node: '>=6'} + + tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + + ts-algebra@2.0.0: + resolution: {integrity: sha512-FPAhNPFMrkwz76P7cdjdmiShwMynZYN6SgOujD1urY4oNm80Ou9oMdmbR45LotcKOXoy7wSmHkRFE6Mxbrhefw==} + + ts-interface-checker@0.1.13: + resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + + tsup@8.5.1: + resolution: {integrity: sha512-xtgkqwdhpKWr3tKPmCkvYmS9xnQK3m3XgxZHwSUjvfTjp7YfXe5tT3GgWi0F2N+ZSMsOeWeZFh7ZZFg5iPhing==} + engines: {node: '>=18'} + hasBin: true + peerDependencies: + '@microsoft/api-extractor': ^7.36.0 + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.5.0' + peerDependenciesMeta: + '@microsoft/api-extractor': + optional: true + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + + tsx@4.23.15: + resolution: {integrity: sha512-Yiex1Ovn8z2xPpOWckIiysV1SSyRMY9BkLF++q0yKiDxCqRhosKfMg3janKkiLBwZ5c/YryloKwGZcrEmtwxKw==} + engines: {node: '>=18.0.0'} + hasBin: true + + type-fest@5.10.0: + resolution: {integrity: sha512-NoSdpq/WEiAg5sjmBkmV/hfxv6HJH4NqPNrqjtSO5CwRmpsDfaf4begxW34KdJykH/l1yHtwBWQkCRdoXO8mPA==} + engines: {node: '>=20'} + + typebox@1.3.27: + resolution: {integrity: sha512-zu+jc1pcy4UiNThxikUr36f0Rybk9PEeCg/NE6adeWr/SKsdNO4EzZHYRDlv2YCVAfj3Odq3dESSo/jNyoBXzA==} + + typebox@1.4.2: + resolution: {integrity: sha512-eSoZzgSIyOKDtTH9MI7XMAxMaiXq7UiSFWarysN1ka66baTLDxAVdQ6WkWn6qDqsJFVrcjzvuP+CqHo9yrlQpg==} + + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + + typescript@6.0.3: + resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==} + engines: {node: '>=14.17'} + hasBin: true + + ufo@1.6.4: + resolution: {integrity: sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==} + + undici-types@7.24.6: + resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==} + + undici@8.10.2: + resolution: {integrity: sha512-/y4/bH9YNU5hi9NIrpOuvGXFcxrj3CMrV+/AYpowAYTpHn8gX/XPFjNy766FPoYY0miQhdW977JFWKGNhBdwyQ==} + engines: {node: '>=22.19.0'} + + vite-node@3.2.4: + resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + + vite@7.3.7: + resolution: {integrity: sha512-AHEzTORMbi7/7aXp7w7KZ5+DCUdSeLsJz0grY8xHpc9DHdYb0vQu6DqJfm2tOw3gDExNgPgnJTXxM6syYFHaCA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + jiti: '>=1.21.0' + less: ^4.0.0 + lightningcss: ^1.21.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + + vite@8.3.4: + resolution: {integrity: sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + '@vitejs/devtools': ^0.7.1 + esbuild: ^0.27.0 || ^0.28.0 + jiti: '>=1.21.0' + less: ^4.0.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + '@vitejs/devtools': + optional: true + esbuild: + optional: true + jiti: + optional: true + less: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + + vitefu@1.1.3: + resolution: {integrity: sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==} + peerDependencies: + vite: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + vite: + optional: true + + vitest@3.2.7: + resolution: {integrity: sha512-KrxIJ62Fd89gfysR4WotlgZABiz2dqFPgqGzX7s+CwsqLFomRH7777ZcrOD6+WVAh7khPQP41A+BKbpcJFrdEg==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/debug': ^4.1.12 + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + '@vitest/browser': 3.2.7 + '@vitest/ui': 3.2.7 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/debug': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + + web-streams-polyfill@3.3.3: + resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} + engines: {node: '>= 8'} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + + ws@8.22.0: + resolution: {integrity: sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + xtend@4.0.2: + resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} + engines: {node: '>=0.4'} + + yaml@2.9.0: + resolution: {integrity: sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==} + engines: {node: '>= 14.6'} + hasBin: true + + zimmerframe@1.1.5: + resolution: {integrity: sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA==} + + zod@4.6.7: + resolution: {integrity: sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==} + +snapshots: + + '@anthropic-ai/sdk@0.129.0(zod@4.6.7)': + dependencies: + json-schema-to-ts: 3.1.1 + standardwebhooks: 1.1.1 + optionalDependencies: + zod: 4.6.7 + + '@aws-sdk/client-bedrock-runtime@3.1127.0': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/credential-provider-node': 3.972.86 + '@aws-sdk/eventstream-handler-node': 3.972.36 + '@aws-sdk/middleware-eventstream': 3.972.31 + '@aws-sdk/middleware-websocket': 3.972.56 + '@aws-sdk/token-providers': 3.1127.0 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/fetch-http-handler': 5.8.0 + '@smithy/node-http-handler': 4.12.1 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/core@3.978.3': + dependencies: + '@aws-sdk/types': 3.974.6 + '@aws-sdk/xml-builder': 3.972.41 + '@aws/lambda-invoke-store': 0.3.0 + '@smithy/core': 3.36.0 + '@smithy/signature-v4': 5.7.4 + '@smithy/types': 4.19.0 + bowser: 2.14.1 + tslib: 2.8.1 + + '@aws-sdk/credential-provider-env@3.972.74': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/credential-provider-http@3.972.76': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/fetch-http-handler': 5.8.0 + '@smithy/node-http-handler': 4.12.1 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/credential-provider-ini@3.973.19': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/credential-provider-env': 3.972.74 + '@aws-sdk/credential-provider-http': 3.972.76 + '@aws-sdk/credential-provider-login': 3.972.81 + '@aws-sdk/credential-provider-process': 3.972.74 + '@aws-sdk/credential-provider-sso': 3.973.18 + '@aws-sdk/credential-provider-web-identity': 3.972.80 + '@aws-sdk/nested-clients': 3.997.48 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/credential-provider-imds': 4.5.2 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/credential-provider-login@3.972.81': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/nested-clients': 3.997.48 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/credential-provider-node@3.972.86': + dependencies: + '@aws-sdk/credential-provider-env': 3.972.74 + '@aws-sdk/credential-provider-http': 3.972.76 + '@aws-sdk/credential-provider-ini': 3.973.19 + '@aws-sdk/credential-provider-process': 3.972.74 + '@aws-sdk/credential-provider-sso': 3.973.18 + '@aws-sdk/credential-provider-web-identity': 3.972.80 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/credential-provider-imds': 4.5.2 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/credential-provider-process@3.972.74': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/credential-provider-sso@3.973.18': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/nested-clients': 3.997.48 + '@aws-sdk/token-providers': 3.1150.0 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/credential-provider-web-identity@3.972.80': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/nested-clients': 3.997.48 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/eventstream-handler-node@3.972.36': + dependencies: + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/middleware-eventstream@3.972.31': + dependencies: + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/middleware-websocket@3.972.56': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/fetch-http-handler': 5.8.0 + '@smithy/signature-v4': 5.7.4 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/nested-clients@3.997.48': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/signature-v4-multi-region': 3.996.48 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/fetch-http-handler': 5.8.0 + '@smithy/node-http-handler': 4.12.1 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/signature-v4-multi-region@3.996.48': + dependencies: + '@aws-sdk/types': 3.974.6 + '@smithy/signature-v4': 5.7.4 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/token-providers@3.1127.0': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/nested-clients': 3.997.48 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/token-providers@3.1150.0': + dependencies: + '@aws-sdk/core': 3.978.3 + '@aws-sdk/nested-clients': 3.997.48 + '@aws-sdk/types': 3.974.6 + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/types@3.974.6': + dependencies: + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws-sdk/xml-builder@3.972.41': + dependencies: + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@aws/lambda-invoke-store@0.3.0': {} + + '@babel/runtime@7.29.10': {} + + '@drizzle-team/brocli@0.10.2': {} + + '@earendil-works/pi-agent-core@1.3.0(@aws-sdk/credential-provider-node@3.972.86)(@smithy/signature-v4@5.7.4)(undici@8.10.2)(ws@8.22.0)(zod@4.6.7)': + dependencies: + '@earendil-works/pi-ai': 1.3.0(@aws-sdk/credential-provider-node@3.972.86)(@smithy/signature-v4@5.7.4)(undici@8.10.2)(ws@8.22.0)(zod@4.6.7) + typebox: 1.3.27 + transitivePeerDependencies: + - '@aws-sdk/credential-provider-node' + - '@modelcontextprotocol/sdk' + - '@smithy/hash-node' + - '@smithy/signature-v4' + - bufferutil + - kerberos + - supports-color + - undici + - utf-8-validate + - ws + - zod + + '@earendil-works/pi-ai@1.3.0(@aws-sdk/credential-provider-node@3.972.86)(@smithy/signature-v4@5.7.4)(undici@8.10.2)(ws@8.22.0)(zod@4.6.7)': + dependencies: + '@anthropic-ai/sdk': 0.129.0(zod@4.6.7) + '@aws-sdk/client-bedrock-runtime': 3.1127.0 + '@earendil-works/pi-telemetry': 1.3.0 + '@google/genai': 2.21.0 + '@smithy/node-http-handler': 4.12.1 + http-proxy-agent: 9.1.0 + https-proxy-agent: 9.1.0 + openai: 7.19.0(@aws-sdk/credential-provider-node@3.972.86)(@smithy/signature-v4@5.7.4)(undici@8.10.2)(ws@8.22.0)(zod@4.6.7) + partial-json: 0.1.7 + typebox: 1.3.27 + transitivePeerDependencies: + - '@aws-sdk/credential-provider-node' + - '@modelcontextprotocol/sdk' + - '@smithy/hash-node' + - '@smithy/signature-v4' + - bufferutil + - kerberos + - supports-color + - undici + - utf-8-validate + - ws + - zod + + '@earendil-works/pi-codemode@1.3.0': + dependencies: + quickjs-wasi: 3.6.2 + + '@earendil-works/pi-coding-agent@1.3.0(@aws-sdk/credential-provider-node@3.972.86)(@smithy/signature-v4@5.7.4)(ws@8.22.0)(zod@4.6.7)': + dependencies: + '@earendil-works/pi-agent-core': 1.3.0(@aws-sdk/credential-provider-node@3.972.86)(@smithy/signature-v4@5.7.4)(undici@8.10.2)(ws@8.22.0)(zod@4.6.7) + '@earendil-works/pi-ai': 1.3.0(@aws-sdk/credential-provider-node@3.972.86)(@smithy/signature-v4@5.7.4)(undici@8.10.2)(ws@8.22.0)(zod@4.6.7) + '@earendil-works/pi-codemode': 1.3.0 + '@earendil-works/pi-mcp': 1.3.0 + '@earendil-works/pi-tui': 1.3.0 + '@silvia-odwyer/photon-node': 0.3.4 + brace-expansion: 5.0.12 + chalk: 6.0.0 + cross-spawn: 7.0.6 + diff: 8.0.4 + grok-mermaid: 0.2.3 + highlight.js: 10.7.3 + hosted-git-info: 9.0.3 + ignore: 7.0.8 + jiti: 2.7.0 + minimatch: 10.2.6 + proper-lockfile: 4.1.2 + quickjs-wasi: 3.6.2 + semver: 7.8.5 + typebox: 1.3.27 + undici: 8.10.2 + yaml: 2.9.0 + transitivePeerDependencies: + - '@aws-sdk/credential-provider-node' + - '@modelcontextprotocol/sdk' + - '@smithy/hash-node' + - '@smithy/signature-v4' + - bufferutil + - kerberos + - supports-color + - utf-8-validate + - ws + - zod + + '@earendil-works/pi-mcp@1.3.0': + dependencies: + cross-spawn: 7.0.6 + + '@earendil-works/pi-telemetry@1.3.0': {} + + '@earendil-works/pi-tui@1.3.0': + dependencies: + get-east-asian-width: 1.6.0 + marked: 18.0.11 + + '@emnapi/runtime@1.11.3': + dependencies: + tslib: 2.8.1 + optional: true + + '@esbuild-kit/core-utils@3.3.2': + dependencies: + esbuild: 0.18.20 + source-map-support: 0.5.21 + + '@esbuild-kit/esm-loader@2.6.5': + dependencies: + '@esbuild-kit/core-utils': 3.3.2 + get-tsconfig: 4.14.3 + + '@esbuild/aix-ppc64@0.25.12': + optional: true + + '@esbuild/aix-ppc64@0.27.7': + optional: true + + '@esbuild/aix-ppc64@0.28.2': + optional: true + + '@esbuild/android-arm64@0.18.20': + optional: true + + '@esbuild/android-arm64@0.25.12': + optional: true + + '@esbuild/android-arm64@0.27.7': + optional: true + + '@esbuild/android-arm64@0.28.2': + optional: true + + '@esbuild/android-arm@0.18.20': + optional: true + + '@esbuild/android-arm@0.25.12': + optional: true + + '@esbuild/android-arm@0.27.7': + optional: true + + '@esbuild/android-arm@0.28.2': + optional: true + + '@esbuild/android-x64@0.18.20': + optional: true + + '@esbuild/android-x64@0.25.12': + optional: true + + '@esbuild/android-x64@0.27.7': + optional: true + + '@esbuild/android-x64@0.28.2': + optional: true + + '@esbuild/darwin-arm64@0.18.20': + optional: true + + '@esbuild/darwin-arm64@0.25.12': + optional: true + + '@esbuild/darwin-arm64@0.27.7': + optional: true + + '@esbuild/darwin-arm64@0.28.2': + optional: true + + '@esbuild/darwin-x64@0.18.20': + optional: true + + '@esbuild/darwin-x64@0.25.12': + optional: true + + '@esbuild/darwin-x64@0.27.7': + optional: true + + '@esbuild/darwin-x64@0.28.2': + optional: true + + '@esbuild/freebsd-arm64@0.18.20': + optional: true + + '@esbuild/freebsd-arm64@0.25.12': + optional: true + + '@esbuild/freebsd-arm64@0.27.7': + optional: true + + '@esbuild/freebsd-arm64@0.28.2': + optional: true + + '@esbuild/freebsd-x64@0.18.20': + optional: true + + '@esbuild/freebsd-x64@0.25.12': + optional: true + + '@esbuild/freebsd-x64@0.27.7': + optional: true + + '@esbuild/freebsd-x64@0.28.2': + optional: true + + '@esbuild/linux-arm64@0.18.20': + optional: true + + '@esbuild/linux-arm64@0.25.12': + optional: true + + '@esbuild/linux-arm64@0.27.7': + optional: true + + '@esbuild/linux-arm64@0.28.2': + optional: true + + '@esbuild/linux-arm@0.18.20': + optional: true + + '@esbuild/linux-arm@0.25.12': + optional: true + + '@esbuild/linux-arm@0.27.7': + optional: true + + '@esbuild/linux-arm@0.28.2': + optional: true + + '@esbuild/linux-ia32@0.18.20': + optional: true + + '@esbuild/linux-ia32@0.25.12': + optional: true + + '@esbuild/linux-ia32@0.27.7': + optional: true + + '@esbuild/linux-ia32@0.28.2': + optional: true + + '@esbuild/linux-loong64@0.18.20': + optional: true + + '@esbuild/linux-loong64@0.25.12': + optional: true + + '@esbuild/linux-loong64@0.27.7': + optional: true + + '@esbuild/linux-loong64@0.28.2': + optional: true + + '@esbuild/linux-mips64el@0.18.20': + optional: true + + '@esbuild/linux-mips64el@0.25.12': + optional: true + + '@esbuild/linux-mips64el@0.27.7': + optional: true + + '@esbuild/linux-mips64el@0.28.2': + optional: true + + '@esbuild/linux-ppc64@0.18.20': + optional: true + + '@esbuild/linux-ppc64@0.25.12': + optional: true + + '@esbuild/linux-ppc64@0.27.7': + optional: true + + '@esbuild/linux-ppc64@0.28.2': + optional: true + + '@esbuild/linux-riscv64@0.18.20': + optional: true + + '@esbuild/linux-riscv64@0.25.12': + optional: true + + '@esbuild/linux-riscv64@0.27.7': + optional: true + + '@esbuild/linux-riscv64@0.28.2': + optional: true + + '@esbuild/linux-s390x@0.18.20': + optional: true + + '@esbuild/linux-s390x@0.25.12': + optional: true + + '@esbuild/linux-s390x@0.27.7': + optional: true + + '@esbuild/linux-s390x@0.28.2': + optional: true + + '@esbuild/linux-x64@0.18.20': + optional: true + + '@esbuild/linux-x64@0.25.12': + optional: true + + '@esbuild/linux-x64@0.27.7': + optional: true + + '@esbuild/linux-x64@0.28.2': + optional: true + + '@esbuild/netbsd-arm64@0.25.12': + optional: true + + '@esbuild/netbsd-arm64@0.27.7': + optional: true + + '@esbuild/netbsd-arm64@0.28.2': + optional: true + + '@esbuild/netbsd-x64@0.18.20': + optional: true + + '@esbuild/netbsd-x64@0.25.12': + optional: true + + '@esbuild/netbsd-x64@0.27.7': + optional: true + + '@esbuild/netbsd-x64@0.28.2': + optional: true + + '@esbuild/openbsd-arm64@0.25.12': + optional: true + + '@esbuild/openbsd-arm64@0.27.7': + optional: true + + '@esbuild/openbsd-arm64@0.28.2': + optional: true + + '@esbuild/openbsd-x64@0.18.20': + optional: true + + '@esbuild/openbsd-x64@0.25.12': + optional: true + + '@esbuild/openbsd-x64@0.27.7': + optional: true + + '@esbuild/openbsd-x64@0.28.2': + optional: true + + '@esbuild/openharmony-arm64@0.25.12': + optional: true + + '@esbuild/openharmony-arm64@0.27.7': + optional: true + + '@esbuild/openharmony-arm64@0.28.2': + optional: true + + '@esbuild/sunos-x64@0.18.20': + optional: true + + '@esbuild/sunos-x64@0.25.12': + optional: true + + '@esbuild/sunos-x64@0.27.7': + optional: true + + '@esbuild/sunos-x64@0.28.2': + optional: true + + '@esbuild/win32-arm64@0.18.20': + optional: true + + '@esbuild/win32-arm64@0.25.12': + optional: true + + '@esbuild/win32-arm64@0.27.7': + optional: true + + '@esbuild/win32-arm64@0.28.2': + optional: true + + '@esbuild/win32-ia32@0.18.20': + optional: true + + '@esbuild/win32-ia32@0.25.12': + optional: true + + '@esbuild/win32-ia32@0.27.7': + optional: true + + '@esbuild/win32-ia32@0.28.2': + optional: true + + '@esbuild/win32-x64@0.18.20': + optional: true + + '@esbuild/win32-x64@0.25.12': + optional: true + + '@esbuild/win32-x64@0.27.7': + optional: true + + '@esbuild/win32-x64@0.28.2': + optional: true + + '@google/genai@2.21.0': + dependencies: + google-auth-library: 10.9.1 + p-retry: 4.6.2 + protobufjs: 7.6.6 + ws: 8.22.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + + '@hono/node-server@1.19.17(hono@4.13.13)': + dependencies: + hono: 4.13.13 + + '@hono/node-ws@1.3.1(@hono/node-server@1.19.17(hono@4.13.13))(hono@4.13.13)': + dependencies: + '@hono/node-server': 1.19.17(hono@4.13.13) + hono: 4.13.13 + ws: 8.22.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + '@img/colour@1.1.0': {} + + '@img/sharp-darwin-arm64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-darwin-arm64': 1.2.4 + optional: true + + '@img/sharp-darwin-x64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-darwin-x64': 1.2.4 + optional: true + + '@img/sharp-libvips-darwin-arm64@1.2.4': + optional: true + + '@img/sharp-libvips-darwin-x64@1.2.4': + optional: true + + '@img/sharp-libvips-linux-arm64@1.2.4': + optional: true + + '@img/sharp-libvips-linux-arm@1.2.4': + optional: true + + '@img/sharp-libvips-linux-ppc64@1.2.4': + optional: true + + '@img/sharp-libvips-linux-riscv64@1.2.4': + optional: true + + '@img/sharp-libvips-linux-s390x@1.2.4': + optional: true + + '@img/sharp-libvips-linux-x64@1.2.4': + optional: true + + '@img/sharp-libvips-linuxmusl-arm64@1.2.4': + optional: true + + '@img/sharp-libvips-linuxmusl-x64@1.2.4': + optional: true + + '@img/sharp-linux-arm64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-arm64': 1.2.4 + optional: true + + '@img/sharp-linux-arm@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-arm': 1.2.4 + optional: true + + '@img/sharp-linux-ppc64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-ppc64': 1.2.4 + optional: true + + '@img/sharp-linux-riscv64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-riscv64': 1.2.4 + optional: true + + '@img/sharp-linux-s390x@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-s390x': 1.2.4 + optional: true + + '@img/sharp-linux-x64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-x64': 1.2.4 + optional: true + + '@img/sharp-linuxmusl-arm64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linuxmusl-arm64': 1.2.4 + optional: true + + '@img/sharp-linuxmusl-x64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linuxmusl-x64': 1.2.4 + optional: true + + '@img/sharp-wasm32@0.34.5': + dependencies: + '@emnapi/runtime': 1.11.3 + optional: true + + '@img/sharp-win32-arm64@0.34.5': + optional: true + + '@img/sharp-win32-ia32@0.34.5': + optional: true + + '@img/sharp-win32-x64@0.34.5': + optional: true + + '@jridgewell/gen-mapping@0.3.13': + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/remapping@2.3.5': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/sourcemap-codec@1.6.0': {} + + '@jridgewell/trace-mapping@0.3.31': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.6.0 + + '@lichess-org/chessground@10.4.2': {} + + '@napi-rs/lzma-linux-x64-gnu@1.5.1': + optional: true + + '@opentelemetry/api@1.9.1': {} + + '@oxc-project/types@0.154.0': {} + + '@polka/url@1.0.0-next.29': {} + + '@protobufjs/aspromise@1.1.2': {} + + '@protobufjs/base64@1.1.2': {} + + '@protobufjs/codegen@2.0.5': {} + + '@protobufjs/eventemitter@1.1.1': {} + + '@protobufjs/fetch@1.1.1': + dependencies: + '@protobufjs/aspromise': 1.1.2 + + '@protobufjs/float@1.0.2': {} + + '@protobufjs/path@1.1.2': {} + + '@protobufjs/pool@1.1.0': {} + + '@protobufjs/utf8@1.1.2': {} + + '@rolldown/binding-android-arm-eabi@1.2.14': + optional: true + + '@rolldown/binding-android-arm64@1.2.14': + optional: true + + '@rolldown/binding-darwin-arm64@1.2.14': + optional: true + + '@rolldown/binding-darwin-x64@1.2.14': + optional: true + + '@rolldown/binding-freebsd-x64@1.2.14': + optional: true + + '@rolldown/binding-linux-arm-gnueabihf@1.2.14': + optional: true + + '@rolldown/binding-linux-arm64-gnu@1.2.14': + optional: true + + '@rolldown/binding-linux-arm64-musl@1.2.14': + optional: true + + '@rolldown/binding-linux-ppc64-gnu@1.2.14': + optional: true + + '@rolldown/binding-linux-s390x-gnu@1.2.14': + optional: true + + '@rolldown/binding-linux-x64-gnu@1.2.14': + optional: true + + '@rolldown/binding-linux-x64-musl@1.2.14': + optional: true + + '@rolldown/binding-openharmony-arm64@1.2.14': + optional: true + + '@rolldown/binding-win32-arm64-msvc@1.2.14': + optional: true + + '@rolldown/binding-win32-x64-msvc@1.2.14': + optional: true + + '@rolldown/pluginutils@1.0.1': {} + + '@rollup/rollup-android-arm-eabi@4.64.9': + optional: true + + '@rollup/rollup-android-arm64@4.64.9': + optional: true + + '@rollup/rollup-darwin-arm64@4.64.9': + optional: true + + '@rollup/rollup-darwin-x64@4.64.9': + optional: true + + '@rollup/rollup-freebsd-arm64@4.64.9': + optional: true + + '@rollup/rollup-freebsd-x64@4.64.9': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.64.9': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.64.9': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.64.9': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.64.9': + optional: true + + '@rollup/rollup-linux-loong64-gnu@4.64.9': + optional: true + + '@rollup/rollup-linux-loong64-musl@4.64.9': + optional: true + + '@rollup/rollup-linux-ppc64-gnu@4.64.9': + optional: true + + '@rollup/rollup-linux-ppc64-musl@4.64.9': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.64.9': + optional: true + + '@rollup/rollup-linux-riscv64-musl@4.64.9': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.64.9': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.64.9': + optional: true + + '@rollup/rollup-linux-x64-musl@4.64.9': + optional: true + + '@rollup/rollup-openbsd-x64@4.64.9': + optional: true + + '@rollup/rollup-openharmony-arm64@4.64.9': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.64.9': + optional: true + + '@rollup/rollup-win32-ia32-msvc@4.64.9': + optional: true + + '@rollup/rollup-win32-x64-gnu@4.64.9': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.64.9': + optional: true + + '@silvia-odwyer/photon-node@0.3.4': {} + + '@smithy/core@3.36.0': + dependencies: + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@smithy/credential-provider-imds@4.5.2': + dependencies: + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@smithy/fetch-http-handler@5.8.0': + dependencies: + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@smithy/node-http-handler@4.12.1': + dependencies: + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@smithy/signature-v4@5.7.4': + dependencies: + '@smithy/core': 3.36.0 + '@smithy/types': 4.19.0 + tslib: 2.8.1 + + '@smithy/types@4.19.0': + dependencies: + tslib: 2.8.1 + + '@stablelib/base64@1.0.1': {} + + '@standard-schema/spec@1.1.0': {} + + '@sveltejs/acorn-typescript@1.0.13(acorn@8.19.0)': + dependencies: + acorn: 8.19.0 + + '@sveltejs/adapter-static@4.0.0(@sveltejs/kit@3.1.0(@opentelemetry/api@1.9.1)(@sveltejs/vite-plugin-svelte@7.3.1(svelte@5.57.2)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)))(svelte@5.57.2)(typescript@6.0.3)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)))': + dependencies: + '@sveltejs/kit': 3.1.0(@opentelemetry/api@1.9.1)(@sveltejs/vite-plugin-svelte@7.3.1(svelte@5.57.2)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)))(svelte@5.57.2)(typescript@6.0.3)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)) + + '@sveltejs/kit@3.1.0(@opentelemetry/api@1.9.1)(@sveltejs/vite-plugin-svelte@7.3.1(svelte@5.57.2)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)))(svelte@5.57.2)(typescript@6.0.3)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0))': + dependencies: + '@rolldown/pluginutils': 1.0.1 + '@standard-schema/spec': 1.1.0 + '@sveltejs/vite-plugin-svelte': 7.3.1(svelte@5.57.2)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)) + cookie: 2.0.1 + devalue: 5.9.4 + esm-env: 1.2.2 + magic-string: 1.4.3 + mrmime: 2.0.1 + sirv: 3.0.2 + svelte: 5.57.2 + vite: 8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0) + optionalDependencies: + '@opentelemetry/api': 1.9.1 + typescript: 6.0.3 + + '@sveltejs/load-config@0.2.3': {} + + '@sveltejs/vite-plugin-svelte@7.3.1(svelte@5.57.2)(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0))': + dependencies: + deepmerge: 4.3.1 + magic-string: 1.4.3 + obug: 2.2.1 + svelte: 5.57.2 + vite: 8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0) + vitefu: 1.1.3(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)) + + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/deep-eql@4.0.2': {} + + '@types/estree@1.0.9': {} + + '@types/node@24.19.2': + dependencies: + undici-types: 7.24.6 + + '@types/retry@0.12.0': {} + + '@vitest/expect@3.2.7': + dependencies: + '@types/chai': 5.2.3 + '@vitest/spy': 3.2.7 + '@vitest/utils': 3.2.7 + chai: 5.3.3 + tinyrainbow: 2.0.0 + + '@vitest/mocker@3.2.7(vite@7.3.7(@types/node@24.19.2)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.0))': + dependencies: + '@vitest/spy': 3.2.7 + estree-walker: 3.0.3 + magic-string: 0.30.21 + optionalDependencies: + vite: 7.3.7(@types/node@24.19.2)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.0) + + '@vitest/pretty-format@3.2.7': + dependencies: + tinyrainbow: 2.0.0 + + '@vitest/runner@3.2.7': + dependencies: + '@vitest/utils': 3.2.7 + pathe: 2.0.3 + strip-literal: 3.1.0 + + '@vitest/snapshot@3.2.7': + dependencies: + '@vitest/pretty-format': 3.2.7 + magic-string: 0.30.21 + pathe: 2.0.3 + + '@vitest/spy@3.2.7': + dependencies: + tinyspy: 4.0.6 + + '@vitest/utils@3.2.7': + dependencies: + '@vitest/pretty-format': 3.2.7 + loupe: 3.2.1 + tinyrainbow: 2.0.0 + + acorn@8.19.0: {} + + agent-base@7.1.4: {} + + agent-base@9.0.0: {} + + any-promise@1.3.0: {} + + aria-query@5.3.1: {} + + assertion-error@2.0.1: {} + + axobject-query@4.1.0: {} + + balanced-match@4.0.4: {} + + base64-js@1.5.1: {} + + bignumber.js@9.3.1: {} + + bowser@2.14.1: {} + + brace-expansion@5.0.12: + dependencies: + balanced-match: 4.0.4 + + buffer-equal-constant-time@1.0.1: {} + + buffer-from@1.1.2: {} + + bundle-require@5.1.0(esbuild@0.27.7): + dependencies: + esbuild: 0.27.7 + load-tsconfig: 0.2.5 + + cac@6.7.14: {} + + chai@5.3.3: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.3 + deep-eql: 5.0.2 + loupe: 3.2.1 + pathval: 2.0.1 + + chalk@6.0.0: {} + + check-error@2.1.3: {} + + chess.js@1.4.0: {} + + chokidar@4.0.3: + dependencies: + readdirp: 4.1.2 + + clsx@2.1.1: {} + + commander@4.1.1: {} + + confbox@0.1.8: {} + + consola@3.4.2: {} + + cookie@2.0.1: {} + + cron-parser@5.10.2: + dependencies: + luxon: 3.7.2 + + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + data-uri-to-buffer@4.0.1: {} + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + deep-eql@5.0.2: {} + + deepmerge@4.3.1: {} + + detect-libc@2.1.2: {} + + devalue@5.9.4: {} + + diff@8.0.4: {} + + drizzle-kit@0.31.11: + dependencies: + '@drizzle-team/brocli': 0.10.2 + '@esbuild-kit/esm-loader': 2.6.5 + esbuild: 0.25.12 + tsx: 4.23.15 + + drizzle-orm@0.45.4(@opentelemetry/api@1.9.1)(pg@8.23.1)(postgres@3.4.9): + optionalDependencies: + '@opentelemetry/api': 1.9.1 + pg: 8.23.1 + postgres: 3.4.9 + + ecdsa-sig-formatter@1.0.11: + dependencies: + safe-buffer: 5.2.1 + + es-module-lexer@1.7.0: {} + + esbuild@0.18.20: + optionalDependencies: + '@esbuild/android-arm': 0.18.20 + '@esbuild/android-arm64': 0.18.20 + '@esbuild/android-x64': 0.18.20 + '@esbuild/darwin-arm64': 0.18.20 + '@esbuild/darwin-x64': 0.18.20 + '@esbuild/freebsd-arm64': 0.18.20 + '@esbuild/freebsd-x64': 0.18.20 + '@esbuild/linux-arm': 0.18.20 + '@esbuild/linux-arm64': 0.18.20 + '@esbuild/linux-ia32': 0.18.20 + '@esbuild/linux-loong64': 0.18.20 + '@esbuild/linux-mips64el': 0.18.20 + '@esbuild/linux-ppc64': 0.18.20 + '@esbuild/linux-riscv64': 0.18.20 + '@esbuild/linux-s390x': 0.18.20 + '@esbuild/linux-x64': 0.18.20 + '@esbuild/netbsd-x64': 0.18.20 + '@esbuild/openbsd-x64': 0.18.20 + '@esbuild/sunos-x64': 0.18.20 + '@esbuild/win32-arm64': 0.18.20 + '@esbuild/win32-ia32': 0.18.20 + '@esbuild/win32-x64': 0.18.20 + + esbuild@0.25.12: + optionalDependencies: + '@esbuild/aix-ppc64': 0.25.12 + '@esbuild/android-arm': 0.25.12 + '@esbuild/android-arm64': 0.25.12 + '@esbuild/android-x64': 0.25.12 + '@esbuild/darwin-arm64': 0.25.12 + '@esbuild/darwin-x64': 0.25.12 + '@esbuild/freebsd-arm64': 0.25.12 + '@esbuild/freebsd-x64': 0.25.12 + '@esbuild/linux-arm': 0.25.12 + '@esbuild/linux-arm64': 0.25.12 + '@esbuild/linux-ia32': 0.25.12 + '@esbuild/linux-loong64': 0.25.12 + '@esbuild/linux-mips64el': 0.25.12 + '@esbuild/linux-ppc64': 0.25.12 + '@esbuild/linux-riscv64': 0.25.12 + '@esbuild/linux-s390x': 0.25.12 + '@esbuild/linux-x64': 0.25.12 + '@esbuild/netbsd-arm64': 0.25.12 + '@esbuild/netbsd-x64': 0.25.12 + '@esbuild/openbsd-arm64': 0.25.12 + '@esbuild/openbsd-x64': 0.25.12 + '@esbuild/openharmony-arm64': 0.25.12 + '@esbuild/sunos-x64': 0.25.12 + '@esbuild/win32-arm64': 0.25.12 + '@esbuild/win32-ia32': 0.25.12 + '@esbuild/win32-x64': 0.25.12 + + esbuild@0.27.7: + optionalDependencies: + '@esbuild/aix-ppc64': 0.27.7 + '@esbuild/android-arm': 0.27.7 + '@esbuild/android-arm64': 0.27.7 + '@esbuild/android-x64': 0.27.7 + '@esbuild/darwin-arm64': 0.27.7 + '@esbuild/darwin-x64': 0.27.7 + '@esbuild/freebsd-arm64': 0.27.7 + '@esbuild/freebsd-x64': 0.27.7 + '@esbuild/linux-arm': 0.27.7 + '@esbuild/linux-arm64': 0.27.7 + '@esbuild/linux-ia32': 0.27.7 + '@esbuild/linux-loong64': 0.27.7 + '@esbuild/linux-mips64el': 0.27.7 + '@esbuild/linux-ppc64': 0.27.7 + '@esbuild/linux-riscv64': 0.27.7 + '@esbuild/linux-s390x': 0.27.7 + '@esbuild/linux-x64': 0.27.7 + '@esbuild/netbsd-arm64': 0.27.7 + '@esbuild/netbsd-x64': 0.27.7 + '@esbuild/openbsd-arm64': 0.27.7 + '@esbuild/openbsd-x64': 0.27.7 + '@esbuild/openharmony-arm64': 0.27.7 + '@esbuild/sunos-x64': 0.27.7 + '@esbuild/win32-arm64': 0.27.7 + '@esbuild/win32-ia32': 0.27.7 + '@esbuild/win32-x64': 0.27.7 + + esbuild@0.28.2: + optionalDependencies: + '@esbuild/aix-ppc64': 0.28.2 + '@esbuild/android-arm': 0.28.2 + '@esbuild/android-arm64': 0.28.2 + '@esbuild/android-x64': 0.28.2 + '@esbuild/darwin-arm64': 0.28.2 + '@esbuild/darwin-x64': 0.28.2 + '@esbuild/freebsd-arm64': 0.28.2 + '@esbuild/freebsd-x64': 0.28.2 + '@esbuild/linux-arm': 0.28.2 + '@esbuild/linux-arm64': 0.28.2 + '@esbuild/linux-ia32': 0.28.2 + '@esbuild/linux-loong64': 0.28.2 + '@esbuild/linux-mips64el': 0.28.2 + '@esbuild/linux-ppc64': 0.28.2 + '@esbuild/linux-riscv64': 0.28.2 + '@esbuild/linux-s390x': 0.28.2 + '@esbuild/linux-x64': 0.28.2 + '@esbuild/netbsd-arm64': 0.28.2 + '@esbuild/netbsd-x64': 0.28.2 + '@esbuild/openbsd-arm64': 0.28.2 + '@esbuild/openbsd-x64': 0.28.2 + '@esbuild/openharmony-arm64': 0.28.2 + '@esbuild/sunos-x64': 0.28.2 + '@esbuild/win32-arm64': 0.28.2 + '@esbuild/win32-ia32': 0.28.2 + '@esbuild/win32-x64': 0.28.2 + + esm-env@1.2.2: {} + + esrap@2.4.0: + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.9 + + expect-type@1.4.0: {} + + extend@3.0.2: {} + + fast-sha256@1.3.0: {} + + fdir@6.5.0(picomatch@4.0.7): + optionalDependencies: + picomatch: 4.0.7 + + fetch-blob@3.2.0: + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 3.3.3 + + fix-dts-default-cjs-exports@1.0.1: + dependencies: + magic-string: 0.30.21 + mlly: 1.8.2 + rollup: 4.64.9 + + formdata-polyfill@4.0.10: + dependencies: + fetch-blob: 3.2.0 + + fsevents@2.3.3: + optional: true + + gaxios@7.3.1: + dependencies: + extend: 3.0.2 + https-proxy-agent: 7.0.6 + node-fetch: 3.3.2 + transitivePeerDependencies: + - supports-color + + gcp-metadata@8.1.2: + dependencies: + gaxios: 7.3.1 + google-logging-utils: 1.1.3 + json-bigint: 1.0.0 + transitivePeerDependencies: + - supports-color + + get-east-asian-width@1.6.0: {} + + get-tsconfig@4.14.3: + dependencies: + resolve-pkg-maps: 1.0.0 + + google-auth-library@10.9.1: + dependencies: + base64-js: 1.5.1 + ecdsa-sig-formatter: 1.0.11 + gaxios: 7.3.1 + gcp-metadata: 8.1.2 + google-logging-utils: 1.1.3 + jws: 4.0.1 + transitivePeerDependencies: + - supports-color + + google-logging-utils@1.1.3: {} + + graceful-fs@4.2.11: {} + + grok-mermaid@0.2.3: {} + + highlight.js@10.7.3: {} + + hono@4.13.13: {} + + hosted-git-info@9.0.3: + dependencies: + lru-cache: 11.5.3 + + http-proxy-agent@9.1.0: + dependencies: + agent-base: 9.0.0 + debug: 4.4.3 + proxy-agent-negotiate: 1.1.0 + transitivePeerDependencies: + - kerberos + - supports-color + + https-proxy-agent@7.0.6: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + https-proxy-agent@9.1.0: + dependencies: + agent-base: 9.0.0 + debug: 4.4.3 + proxy-agent-negotiate: 1.1.0 + transitivePeerDependencies: + - kerberos + - supports-color + + ignore@7.0.8: {} + + is-reference@3.0.3: + dependencies: + '@types/estree': 1.0.9 + + isexe@2.0.0: {} + + jiti@2.7.0: {} + + joycon@3.1.1: {} + + js-tokens@9.0.1: {} + + json-bigint@1.0.0: + dependencies: + bignumber.js: 9.3.1 + + json-schema-to-ts@3.1.1: + dependencies: + '@babel/runtime': 7.29.10 + ts-algebra: 2.0.0 + + jwa@2.0.1: + dependencies: + buffer-equal-constant-time: 1.0.1 + ecdsa-sig-formatter: 1.0.11 + safe-buffer: 5.2.1 + + jws@4.0.1: + dependencies: + jwa: 2.0.1 + safe-buffer: 5.2.1 + + lightningcss-android-arm64@1.33.0: + optional: true + + lightningcss-darwin-arm64@1.33.0: + optional: true + + lightningcss-darwin-x64@1.33.0: + optional: true + + lightningcss-freebsd-x64@1.33.0: + optional: true + + lightningcss-linux-arm-gnueabihf@1.33.0: + optional: true + + lightningcss-linux-arm64-gnu@1.33.0: + optional: true + + lightningcss-linux-arm64-musl@1.33.0: + optional: true + + lightningcss-linux-x64-gnu@1.33.0: + optional: true + + lightningcss-linux-x64-musl@1.33.0: + optional: true + + lightningcss-win32-arm64-msvc@1.33.0: + optional: true + + lightningcss-win32-x64-msvc@1.33.0: + optional: true + + lightningcss@1.33.0: + dependencies: + detect-libc: 2.1.2 + optionalDependencies: + lightningcss-android-arm64: 1.33.0 + lightningcss-darwin-arm64: 1.33.0 + lightningcss-darwin-x64: 1.33.0 + lightningcss-freebsd-x64: 1.33.0 + lightningcss-linux-arm-gnueabihf: 1.33.0 + lightningcss-linux-arm64-gnu: 1.33.0 + lightningcss-linux-arm64-musl: 1.33.0 + lightningcss-linux-x64-gnu: 1.33.0 + lightningcss-linux-x64-musl: 1.33.0 + lightningcss-win32-arm64-msvc: 1.33.0 + lightningcss-win32-x64-msvc: 1.33.0 + + lilconfig@3.1.4: {} + + lines-and-columns@1.2.4: {} + + load-tsconfig@0.2.5: {} + + locate-character@3.0.0: {} + + long@5.3.2: {} + + loupe@3.2.1: {} + + lru-cache@11.5.3: {} + + luxon@3.7.2: {} + + magic-string@0.30.21: + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + + magic-string@1.4.3: + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + + marked@18.0.11: {} + + minimatch@10.2.6: + dependencies: + brace-expansion: 5.0.12 + + mlly@1.8.2: + dependencies: + acorn: 8.19.0 + pathe: 2.0.3 + pkg-types: 1.3.1 + ufo: 1.6.4 + + mri@1.2.0: {} + + mrmime@2.0.1: {} + + ms@2.1.3: {} + + mz@2.7.0: + dependencies: + any-promise: 1.3.0 + object-assign: 4.1.1 + thenify-all: 1.6.0 + + nanoid@3.3.20: {} + + nanoid@5.1.16: {} + + node-domexception@1.0.0: {} + + node-fetch@3.3.2: + dependencies: + data-uri-to-buffer: 4.0.1 + fetch-blob: 3.2.0 + formdata-polyfill: 4.0.10 + + non-error@0.1.0: {} + + object-assign@4.1.1: {} + + obug@2.2.1: {} + + openai@7.19.0(@aws-sdk/credential-provider-node@3.972.86)(@smithy/signature-v4@5.7.4)(undici@8.10.2)(ws@8.22.0)(zod@4.6.7): + optionalDependencies: + '@aws-sdk/credential-provider-node': 3.972.86 + '@smithy/signature-v4': 5.7.4 + undici: 8.10.2 + ws: 8.22.0 + zod: 4.6.7 + + p-retry@4.6.2: + dependencies: + '@types/retry': 0.12.0 + retry: 0.13.1 + + partial-json@0.1.7: {} + + path-key@3.1.1: {} + + pathe@2.0.3: {} + + pathval@2.0.1: {} + + pg-boss@12.38.0(@opentelemetry/api@1.9.1): + dependencies: + '@opentelemetry/api': 1.9.1 + cron-parser: 5.10.2 + pg: 8.23.1 + rrule-temporal: 2.2.8 + serialize-error: 13.0.2 + transitivePeerDependencies: + - pg-native + + pg-cloudflare@1.4.1: + optional: true + + pg-connection-string@2.14.1: {} + + pg-int8@1.0.1: {} + + pg-pool@3.14.0(pg@8.23.1): + dependencies: + pg: 8.23.1 + + pg-protocol@1.16.1: {} + + pg-types@2.2.0: + dependencies: + pg-int8: 1.0.1 + postgres-array: 2.0.0 + postgres-bytea: 1.0.1 + postgres-date: 1.0.7 + postgres-interval: 1.2.0 + + pg@8.23.1: + dependencies: + pg-connection-string: 2.14.1 + pg-pool: 3.14.0(pg@8.23.1) + pg-protocol: 1.16.1 + pg-types: 2.2.0 + pgpass: 1.0.5 + optionalDependencies: + pg-cloudflare: 1.4.1 + + pgpass@1.0.5: + dependencies: + split2: 4.2.0 + + picocolors@1.1.1: {} + + picomatch@4.0.7: {} + + pirates@4.0.7: {} + + pkg-types@1.3.1: + dependencies: + confbox: 0.1.8 + mlly: 1.8.2 + pathe: 2.0.3 + + postcss-load-config@6.0.1(jiti@2.7.0)(postcss@8.5.30)(tsx@4.23.15)(yaml@2.9.0): + dependencies: + lilconfig: 3.1.4 + optionalDependencies: + jiti: 2.7.0 + postcss: 8.5.30 + tsx: 4.23.15 + yaml: 2.9.0 + + postcss@8.5.30: + dependencies: + nanoid: 3.3.20 + picocolors: 1.1.1 + source-map-js: 1.2.2 + + postgres-array@2.0.0: {} + + postgres-bytea@1.0.1: {} + + postgres-date@1.0.7: {} + + postgres-interval@1.2.0: + dependencies: + xtend: 4.0.2 + + postgres@3.4.9: {} + + proper-lockfile@4.1.2: + dependencies: + graceful-fs: 4.2.11 + retry: 0.12.0 + signal-exit: 3.0.7 + + protobufjs@7.6.6: + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.5 + '@protobufjs/eventemitter': 1.1.1 + '@protobufjs/fetch': 1.1.1 + '@protobufjs/float': 1.0.2 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.2 + '@types/node': 24.19.2 + long: 5.3.2 + + proxy-agent-negotiate@1.1.0: {} + + quickjs-wasi@3.6.2: {} + + readdirp@4.1.2: {} + + resolve-from@5.0.0: {} + + resolve-pkg-maps@1.0.0: {} + + retry@0.12.0: {} + + retry@0.13.1: {} + + rolldown@1.2.14: + dependencies: + '@oxc-project/types': 0.154.0 + '@rolldown/pluginutils': 1.0.1 + optionalDependencies: + '@rolldown/binding-android-arm-eabi': 1.2.14 + '@rolldown/binding-android-arm64': 1.2.14 + '@rolldown/binding-darwin-arm64': 1.2.14 + '@rolldown/binding-darwin-x64': 1.2.14 + '@rolldown/binding-freebsd-x64': 1.2.14 + '@rolldown/binding-linux-arm-gnueabihf': 1.2.14 + '@rolldown/binding-linux-arm64-gnu': 1.2.14 + '@rolldown/binding-linux-arm64-musl': 1.2.14 + '@rolldown/binding-linux-ppc64-gnu': 1.2.14 + '@rolldown/binding-linux-s390x-gnu': 1.2.14 + '@rolldown/binding-linux-x64-gnu': 1.2.14 + '@rolldown/binding-linux-x64-musl': 1.2.14 + '@rolldown/binding-openharmony-arm64': 1.2.14 + '@rolldown/binding-win32-arm64-msvc': 1.2.14 + '@rolldown/binding-win32-x64-msvc': 1.2.14 + + rollup@4.64.9: + dependencies: + '@types/estree': 1.0.9 + optionalDependencies: + '@napi-rs/lzma-linux-x64-gnu': 1.5.1 + '@rollup/rollup-android-arm-eabi': 4.64.9 + '@rollup/rollup-android-arm64': 4.64.9 + '@rollup/rollup-darwin-arm64': 4.64.9 + '@rollup/rollup-darwin-x64': 4.64.9 + '@rollup/rollup-freebsd-arm64': 4.64.9 + '@rollup/rollup-freebsd-x64': 4.64.9 + '@rollup/rollup-linux-arm-gnueabihf': 4.64.9 + '@rollup/rollup-linux-arm-musleabihf': 4.64.9 + '@rollup/rollup-linux-arm64-gnu': 4.64.9 + '@rollup/rollup-linux-arm64-musl': 4.64.9 + '@rollup/rollup-linux-loong64-gnu': 4.64.9 + '@rollup/rollup-linux-loong64-musl': 4.64.9 + '@rollup/rollup-linux-ppc64-gnu': 4.64.9 + '@rollup/rollup-linux-ppc64-musl': 4.64.9 + '@rollup/rollup-linux-riscv64-gnu': 4.64.9 + '@rollup/rollup-linux-riscv64-musl': 4.64.9 + '@rollup/rollup-linux-s390x-gnu': 4.64.9 + '@rollup/rollup-linux-x64-gnu': 4.64.9 + '@rollup/rollup-linux-x64-musl': 4.64.9 + '@rollup/rollup-openbsd-x64': 4.64.9 + '@rollup/rollup-openharmony-arm64': 4.64.9 + '@rollup/rollup-win32-arm64-msvc': 4.64.9 + '@rollup/rollup-win32-ia32-msvc': 4.64.9 + '@rollup/rollup-win32-x64-gnu': 4.64.9 + '@rollup/rollup-win32-x64-msvc': 4.64.9 + fsevents: 2.3.3 + + rrule-temporal@2.2.8: + dependencies: + temporal-spec: 1.0.1 + + sade@1.8.1: + dependencies: + mri: 1.2.0 + + safe-buffer@5.2.1: {} + + semver@7.8.5: {} + + serialize-error@13.0.2: + dependencies: + non-error: 0.1.0 + type-fest: 5.10.0 + + sharp@0.34.5: + dependencies: + '@img/colour': 1.1.0 + detect-libc: 2.1.2 + semver: 7.8.5 + optionalDependencies: + '@img/sharp-darwin-arm64': 0.34.5 + '@img/sharp-darwin-x64': 0.34.5 + '@img/sharp-libvips-darwin-arm64': 1.2.4 + '@img/sharp-libvips-darwin-x64': 1.2.4 + '@img/sharp-libvips-linux-arm': 1.2.4 + '@img/sharp-libvips-linux-arm64': 1.2.4 + '@img/sharp-libvips-linux-ppc64': 1.2.4 + '@img/sharp-libvips-linux-riscv64': 1.2.4 + '@img/sharp-libvips-linux-s390x': 1.2.4 + '@img/sharp-libvips-linux-x64': 1.2.4 + '@img/sharp-libvips-linuxmusl-arm64': 1.2.4 + '@img/sharp-libvips-linuxmusl-x64': 1.2.4 + '@img/sharp-linux-arm': 0.34.5 + '@img/sharp-linux-arm64': 0.34.5 + '@img/sharp-linux-ppc64': 0.34.5 + '@img/sharp-linux-riscv64': 0.34.5 + '@img/sharp-linux-s390x': 0.34.5 + '@img/sharp-linux-x64': 0.34.5 + '@img/sharp-linuxmusl-arm64': 0.34.5 + '@img/sharp-linuxmusl-x64': 0.34.5 + '@img/sharp-wasm32': 0.34.5 + '@img/sharp-win32-arm64': 0.34.5 + '@img/sharp-win32-ia32': 0.34.5 + '@img/sharp-win32-x64': 0.34.5 + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + siginfo@2.0.0: {} + + signal-exit@3.0.7: {} + + sirv@3.0.2: + dependencies: + '@polka/url': 1.0.0-next.29 + mrmime: 2.0.1 + totalist: 3.0.1 + + source-map-js@1.2.2: {} + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + source-map@0.7.6: {} + + split2@4.2.0: {} + + stackback@0.0.2: {} + + standardwebhooks@1.1.1: + dependencies: + '@stablelib/base64': 1.0.1 + fast-sha256: 1.3.0 + + std-env@3.10.0: {} + + strip-literal@3.1.0: + dependencies: + js-tokens: 9.0.1 + + sucrase@3.35.1: + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + commander: 4.1.1 + lines-and-columns: 1.2.4 + mz: 2.7.0 + pirates: 4.0.7 + tinyglobby: 0.2.17 + ts-interface-checker: 0.1.13 + + svelte-check@4.7.7(picomatch@4.0.7)(svelte@5.57.2)(typescript@6.0.3): + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + '@sveltejs/load-config': 0.2.3 + chokidar: 4.0.3 + fdir: 6.5.0(picomatch@4.0.7) + picocolors: 1.1.1 + sade: 1.8.1 + svelte: 5.57.2 + typescript: 6.0.3 + transitivePeerDependencies: + - picomatch + + svelte@5.57.2: + dependencies: + '@jridgewell/remapping': 2.3.5 + '@jridgewell/sourcemap-codec': 1.6.0 + '@sveltejs/acorn-typescript': 1.0.13(acorn@8.19.0) + '@types/estree': 1.0.9 + acorn: 8.19.0 + aria-query: 5.3.1 + axobject-query: 4.1.0 + clsx: 2.1.1 + devalue: 5.9.4 + esm-env: 1.2.2 + esrap: 2.4.0 + is-reference: 3.0.3 + locate-character: 3.0.0 + magic-string: 0.30.21 + zimmerframe: 1.1.5 + transitivePeerDependencies: + - '@typescript-eslint/types' + + tagged-tag@1.0.0: {} + + temporal-spec@1.0.1: {} + + thenify-all@1.6.0: + dependencies: + thenify: 3.3.1 + + thenify@3.3.1: + dependencies: + any-promise: 1.3.0 + + tinybench@2.9.0: {} + + tinyexec@0.3.2: {} + + tinyglobby@0.2.17: + dependencies: + fdir: 6.5.0(picomatch@4.0.7) + picomatch: 4.0.7 + + tinypool@1.1.1: {} + + tinyrainbow@2.0.0: {} + + tinyspy@4.0.6: {} + + totalist@3.0.1: {} + + tree-kill@1.2.2: {} + + ts-algebra@2.0.0: {} + + ts-interface-checker@0.1.13: {} + + tslib@2.8.1: {} + + tsup@8.5.1(jiti@2.7.0)(postcss@8.5.30)(tsx@4.23.15)(typescript@5.9.3)(yaml@2.9.0): + dependencies: + bundle-require: 5.1.0(esbuild@0.27.7) + cac: 6.7.14 + chokidar: 4.0.3 + consola: 3.4.2 + debug: 4.4.3 + esbuild: 0.27.7 + fix-dts-default-cjs-exports: 1.0.1 + joycon: 3.1.1 + picocolors: 1.1.1 + postcss-load-config: 6.0.1(jiti@2.7.0)(postcss@8.5.30)(tsx@4.23.15)(yaml@2.9.0) + resolve-from: 5.0.0 + rollup: 4.64.9 + source-map: 0.7.6 + sucrase: 3.35.1 + tinyexec: 0.3.2 + tinyglobby: 0.2.17 + tree-kill: 1.2.2 + optionalDependencies: + postcss: 8.5.30 + typescript: 5.9.3 + transitivePeerDependencies: + - jiti + - supports-color + - tsx + - yaml + + tsx@4.23.15: + dependencies: + esbuild: 0.28.2 + optionalDependencies: + fsevents: 2.3.3 + + type-fest@5.10.0: + dependencies: + tagged-tag: 1.0.0 + + typebox@1.3.27: {} + + typebox@1.4.2: {} + + typescript@5.9.3: {} + + typescript@6.0.3: {} + + ufo@1.6.4: {} + + undici-types@7.24.6: {} + + undici@8.10.2: {} + + vite-node@3.2.4(@types/node@24.19.2)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.0): + dependencies: + cac: 6.7.14 + debug: 4.4.3 + es-module-lexer: 1.7.0 + pathe: 2.0.3 + vite: 7.3.7(@types/node@24.19.2)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.0) + transitivePeerDependencies: + - '@types/node' + - jiti + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + vite@7.3.7(@types/node@24.19.2)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.0): + dependencies: + esbuild: 0.28.2 + fdir: 6.5.0(picomatch@4.0.7) + picomatch: 4.0.7 + postcss: 8.5.30 + rollup: 4.64.9 + tinyglobby: 0.2.17 + optionalDependencies: + '@types/node': 24.19.2 + fsevents: 2.3.3 + jiti: 2.7.0 + lightningcss: 1.33.0 + tsx: 4.23.15 + yaml: 2.9.0 + + vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0): + dependencies: + lightningcss: 1.33.0 + picomatch: 4.0.7 + postcss: 8.5.30 + rolldown: 1.2.14 + tinyglobby: 0.2.17 + optionalDependencies: + '@types/node': 24.19.2 + esbuild: 0.28.2 + fsevents: 2.3.3 + jiti: 2.7.0 + tsx: 4.23.15 + yaml: 2.9.0 + + vitefu@1.1.3(vite@8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)): + optionalDependencies: + vite: 8.3.4(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0) + + vitest@3.2.7(@types/node@24.19.2)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.0): + dependencies: + '@types/chai': 5.2.3 + '@vitest/expect': 3.2.7 + '@vitest/mocker': 3.2.7(vite@7.3.7(@types/node@24.19.2)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.0)) + '@vitest/pretty-format': 3.2.7 + '@vitest/runner': 3.2.7 + '@vitest/snapshot': 3.2.7 + '@vitest/spy': 3.2.7 + '@vitest/utils': 3.2.7 + chai: 5.3.3 + debug: 4.4.3 + expect-type: 1.4.0 + magic-string: 0.30.21 + pathe: 2.0.3 + picomatch: 4.0.7 + std-env: 3.10.0 + tinybench: 2.9.0 + tinyexec: 0.3.2 + tinyglobby: 0.2.17 + tinypool: 1.1.1 + tinyrainbow: 2.0.0 + vite: 7.3.7(@types/node@24.19.2)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.0) + vite-node: 3.2.4(@types/node@24.19.2)(jiti@2.7.0)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.0) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 24.19.2 + transitivePeerDependencies: + - jiti + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + web-streams-polyfill@3.3.3: {} + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + + ws@8.22.0: {} + + xtend@4.0.2: {} + + yaml@2.9.0: {} + + zimmerframe@1.1.5: {} + + zod@4.6.7: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..30438c2 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,6 @@ +packages: + - "apps/*" + - "packages/*" +onlyBuiltDependencies: + - esbuild + - sharp diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 0000000..0c9a5c4 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2023", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "lib": ["ES2023"], + "strict": true, + "noUncheckedIndexedAccess": false, + "esModuleInterop": true, + "skipLibCheck": true, + "resolveJsonModule": true, + "isolatedModules": true, + "verbatimModuleSyntax": true, + "allowImportingTsExtensions": true, + "noEmit": true, + "types": ["node"] + } +}