diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 21ea8d8..a33bc04 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,6 +12,9 @@ api/ backend — server.js (Node, no framework), one dependency (@simplewe web/ multi-stage Dockerfile (builds frontend → nginx) + nginx.conf (serves app, proxies /api). media/ exercise img/gif (gitignored, fetched at runtime). docs/ self-hosting guide. +mcp/ optional Model Context Protocol server — read-only stdio bridge for LLM apps + (Claude Desktop, Cursor, …) to query a user's workouts/1RM/muscle balance. Not in + the Docker build; only runs when an LLM client spawns it. See mcp/README.md. ``` ## Running for development diff --git a/README.md b/README.md index 3471e8d..c8d8893 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,10 @@ lives in pure functions under `frontend/src/lib/` with tests next to them: `npm `frontend/`. Vitest is a dev dependency; the app itself ships no runtime dependencies beyond React, the router and Zustand. +The same pure helpers power an optional MCP server (`mcp/`) that lets an LLM client like +Claude Desktop read your data over stdio — see [mcp/README.md](mcp/README.md). Opt-in, not +in the Docker build. + ## Community - **[Q&A](https://github.com/DuarteSantos8/openGym/discussions/categories/q-a)** — self-hosting diff --git a/frontend/src/lib/exercises.js b/frontend/src/lib/exercises.js index c26e1f7..0bd6552 100644 --- a/frontend/src/lib/exercises.js +++ b/frontend/src/lib/exercises.js @@ -1,5 +1,5 @@ import { EXDB } from './exercises-data.js' -import { t } from './i18n.js' +import { t } from './i18n-core.js' export { EXDB } export const EXIDX = {} @@ -28,9 +28,11 @@ export const allExercises = st => [...(st.customEx || []), ...EXDB] // Media normally sits next to the app (img/ and gif/, mounted into the web container). // A build can point them somewhere else — the demo build pulls them off a CDN instead of -// shipping ~140 MB of images into the deployment. -const IMG_BASE = import.meta.env.VITE_IMG_BASE || 'img/' -const GIF_BASE = import.meta.env.VITE_GIF_BASE || 'gif/' +// shipping ~140 MB of images into the deployment. `import.meta.env` is undefined in plain +// Node; the guard keeps this module loadable without Vite. +const ENV = import.meta.env || {} +const IMG_BASE = ENV.VITE_IMG_BASE || 'img/' +const GIF_BASE = ENV.VITE_GIF_BASE || 'gif/' export const imgSrc = ex => IMG_BASE + ex.img export const gifSrc = ex => GIF_BASE + ex.gif diff --git a/frontend/src/lib/format.js b/frontend/src/lib/format.js index de25f40..e8eadeb 100644 --- a/frontend/src/lib/format.js +++ b/frontend/src/lib/format.js @@ -1,5 +1,5 @@ // Formatting + date helpers (ported from the vanilla app, unit taken from the store where needed). -import { dateLocale, t } from './i18n.js' +import { dateLocale, t } from './i18n-core.js' export const todayISO = () => { const d = new Date() return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0') diff --git a/frontend/src/lib/i18n-core.js b/frontend/src/lib/i18n-core.js new file mode 100644 index 0000000..cfa4924 --- /dev/null +++ b/frontend/src/lib/i18n-core.js @@ -0,0 +1,44 @@ +// Runtime-agnostic core of the i18n module: state, constants and readers (t, dateLocale, +// instrFor, getLang). Plain Node-loadable — the browser-only pieces (import.meta.glob lazy +// loads, the React subscription hook) live in i18n.js and re-export from here. + +export const LANGS = { + en: 'English', de: 'Deutsch', es: 'Español', fr: 'Français', it: 'Italiano', + pt: 'Português', pl: 'Polski', tr: 'Türkçe', ru: 'Русский', zh: '中文', + ko: '한국어', hi: 'हिन्दी' +} +export const INSTR_LANGS = ['en', 'es', 'fr', 'it', 'tr', 'ru', 'zh', 'hi', 'pl', 'ko'] +export const DATE_LOCALES = { + en: 'en-GB', de: 'de-DE', es: 'es-ES', fr: 'fr-FR', it: 'it-IT', pt: 'pt-PT', + pl: 'pl-PL', tr: 'tr-TR', ru: 'ru-RU', zh: 'zh-CN', ko: 'ko-KR', hi: 'hi-IN' +} + +let lang = 'en' // set only by _setLangState, called from i18n.js setLang +let dict = {} // current locale pack (empty = English fallback) +let instr = null // { exId: [steps] } for the current language, null = English +let version = 0 // bumped on every setLang; drives the React subscription selector + +export const getLang = () => lang +export const dateLocale = () => DATE_LOCALES[lang] || 'en-GB' +export const getVersion = () => version + +// Translate a source string; {0},{1}… are replaced with args (also on the English fallback). +export function t(s, ...args) { + let v = dict[s] || s + for (let i = 0; i < args.length; i++) v = v.replaceAll('{' + i + '}', args[i]) + return v +} + +// Instructions for an exercise in the current language (English steps as fallback). +export const instrFor = ex => (instr && instr[ex.id]) || ex.st || [] + +// Called by i18n.js's setLang once the locale pack has been loaded — kept here rather than +// exported as setLang because loading packs requires import.meta.glob, which is Vite-only. +// Both `dict` and `instr` may be null to reset to English. +export function _setLangState(newLang, newDict, newInstr) { + lang = LANGS[newLang] ? newLang : 'en' + dict = lang === 'en' ? {} : (newDict || {}) + instr = lang === 'en' || !INSTR_LANGS.includes(lang) ? null : (newInstr || null) + version++ + return version +} diff --git a/frontend/src/lib/i18n.js b/frontend/src/lib/i18n.js index ebade43..12ead1f 100644 --- a/frontend/src/lib/i18n.js +++ b/frontend/src/lib/i18n.js @@ -1,56 +1,38 @@ -// Tiny dependency-free i18n. English source strings are the keys; locale files in -// src/locales/ map them to translations and are lazy-loaded (Vite code-splits each -// import.meta.glob entry), so the initial bundle stays English-only. -// Exercise instructions come from separately generated packs in src/instr/ (one per -// language, from the upstream dataset) — also lazy-loaded on language switch. +// Browser-only shell of the i18n module. The runtime-agnostic state and readers live +// in i18n-core.js (plain Node-loadable); this file adds the two pieces that genuinely need +// the browser: `setLang` (which lazy-loads locale packs via import.meta.glob) and the React +// subscription hook `useLang`. + import { useSyncExternalStore } from 'react' +import { + LANGS, INSTR_LANGS, DATE_LOCALES, + getLang, dateLocale, t, instrFor, getVersion, _setLangState +} from './i18n-core.js' -// UI languages. de/pt have no instruction pack upstream — instructions fall back to English. -export const LANGS = { - en: 'English', de: 'Deutsch', es: 'Español', fr: 'Français', it: 'Italiano', - pt: 'Português', pl: 'Polski', tr: 'Türkçe', ru: 'Русский', zh: '中文', - ko: '한국어', hi: 'हिन्दी' -} -export const INSTR_LANGS = ['en', 'es', 'fr', 'it', 'tr', 'ru', 'zh', 'hi', 'pl', 'ko'] -const DATE_LOCALES = { - en: 'en-GB', de: 'de-DE', es: 'es-ES', fr: 'fr-FR', it: 'it-IT', pt: 'pt-PT', - pl: 'pl-PL', tr: 'tr-TR', ru: 'ru-RU', zh: 'zh-CN', ko: 'ko-KR', hi: 'hi-IN' -} +export { LANGS, INSTR_LANGS, DATE_LOCALES, getLang, dateLocale, t, instrFor } +// Vite code-splits each locale pack into its own chunk via import.meta.glob; instructions use +// the same mechanism in src/instr/. Both are lazy, so the production bundle ships English only. const localePacks = import.meta.glob('../locales/*.js') const instrPacks = import.meta.glob('../instr/*.js') -let lang = 'en' -let dict = {} -let instr = null // { exId: [steps] } for the current language, null = English -let version = 0 +// React subscription bookkeeping — kept here, not in core, so core has zero React coupling. const subs = new Set() -const notify = () => { version++; subs.forEach(f => f()) } - -export const getLang = () => lang -export const dateLocale = () => DATE_LOCALES[lang] || 'en-GB' - -// Translate a source string; {0},{1}… are replaced with args (also on the English fallback). -export function t(s, ...args) { - let v = dict[s] || s - for (let i = 0; i < args.length; i++) v = v.replaceAll('{' + i + '}', args[i]) - return v -} -// Instructions for an exercise in the current language (English steps as fallback). -export const instrFor = ex => (instr && instr[ex.id]) || ex.st || [] +const notify = () => { subs.forEach(f => f()) } export async function setLang(l) { if (!LANGS[l]) l = 'en' - if (l === lang && version > 0) return - lang = l + if (l === getLang() && getVersion() > 0) return + let dict = {}, instr = null try { dict = l === 'en' ? {} : (await localePacks['../locales/' + l + '.js']()).default instr = l === 'en' || !INSTR_LANGS.includes(l) ? null : (await instrPacks['../instr/' + l + '.js']()).default } catch (e) { dict = {}; instr = null } + _setLangState(l, dict, instr) notify() } // Re-renders the subscribing component (and its children) whenever the language changes. export function useLang() { - return useSyncExternalStore(fn => { subs.add(fn); return () => subs.delete(fn) }, () => version) + return useSyncExternalStore(fn => { subs.add(fn); return () => subs.delete(fn) }, getVersion) } diff --git a/mcp/README.md b/mcp/README.md new file mode 100644 index 0000000..77b2641 --- /dev/null +++ b/mcp/README.md @@ -0,0 +1,136 @@ +# openGym MCP server + +A [Model Context Protocol](https://modelcontextprotocol.io) bridge that lets an external LLM +application (Claude Desktop, Cursor, Cline, Continue, etc.) read your openGym profile — +routines, workouts, body-weight log, estimated 1RMs, and muscle balance — directly from your +self-hosted `./data` directory. + +It is read-only, runs locally as a stdio process spawned by the LLM client, adds no new +container, and requires no extra authentication. The LLM never sees passkeys, VAPID keys, or +session secrets — it can only read the same `state-.json` files the openGym api already +writes. + +The numbers it answers with are computed by the **same pure functions the React UI uses** +(`frontend/src/lib/*.js`) — `estimate1RM`, `loadOfWorkouts`, `effectiveRoutine`, etc. — so a +"what's my bench 1RM?" answer matches the Stats screen exactly. + +> Phase 1 of a multi-phase plan. Read-only today; long-lived token auth + write tools are +> planned but not shipped yet. See **Roadmap** below. + +## Quick start + +### 1. Install + +```bash +cd mcp +npm install +``` + +### 2. Point it at your data + +The MCP server reads the same `./data` directory `docker compose up` creates. Pick the profile +to answer for — its user id is in `./data/db.json` under `users[].id`: + +```bash +# single-user instance (the common self-hosted case) — auto-detected: +node src/index.js + +# multi-user instance, or just to be explicit: +OPENGYM_UID= OPENGYM_DATA=/path/to/openGym/data node src/index.js +``` + +### 3. Register with your LLM client + +Add the server to your LLM client's MCP config. For Claude Desktop, edit +`claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`): + +```jsonc +{ + "mcpServers": { + "opengym": { + "command": "node", + "args": ["/absolute/path/to/openGym/mcp/src/index.js"], + "env": { + "OPENGYM_DATA": "/absolute/path/to/openGym/data", + "OPENGYM_UID": "" // optional — auto-detected if you have one profile + } + } + } +} +``` + +For Cursor and other MCP-compatible clients, see the client's MCP docs — the same `command` + +`args` + `env` shape is what every stdio MCP server expects. + +Restart the client; you should see the openGym tools appear with "serving profile \" on +the server's stderr. + +## Tools + +Eight read-only tools in v1: + +| Tool | What it answers | +|---|---| +| `list_routines` | What routines are saved in my profile? (names + exercise counts) | +| `get_routine` | What does the Push Day routine prescribe? (sets/reps/weight per exercise) | +| `get_week_plan` | What's on my plan this week, including today with any date-specific override? | +| `list_workouts` | Recent sessions — newest first, with dates, sets done/planned, volume, duration, PRs. | +| `get_workout` | Full set-by-set breakdown of one date's session. | +| `get_bodyweight` | Weigh-ins with the latest weight, the goal line, and deltas vs goal. | +| `estimate_1rm` | All-time best 1RM for an exercise + the trend, or a PR table across all exercises. | +| `muscle_balance` | Which muscles I've trained this week/month/all-time, ranked + which I've neglected. | + +Each tool returns JSON the LLM can format as it likes; structured fields (sets, dates, levels) +are pre-formatted into human-readable labels in `src/labels.js` so the LLM doesn't need to +re-interpret them. + +## How it reuses the training logic + +The MCP server imports the training helpers under `frontend/src/lib/` directly as Node ESM +and calls the same functions the React UI does (`history.js`, `onerm.js`, `muscles.js`, +`exercises.js`). The numbers it returns match what the Stats screen shows, because they are +the same code. + +The one lib file that wasn't Node-safe was `i18n.js` (Vite's `import.meta.glob` at module +top level) — split into `i18n-core.js` (pure, Node-safe) + `i18n.js` (Vite/React bits, +re-exports from core). `exercises.js` got a one-line `import.meta.env || {}` guard. No new +dependencies landed in `frontend/`, no public exports changed. + +## Design constraints honoured + +- **One runtime dependency beyond the MCP SDK:** none. No database driver, no HTTP framework. +- **No new container.** stdio transport is spawned by the LLM client; nothing to add to + `docker-compose.yml`. +- **No new auth.** The filesystem is the boundary — same as `docker compose` running on the + user's box. No passkey material, VAPID keys, or session secrets ever cross it. +- **No telemetry, no network.** Reads `./data/*.json` and exits when the LLM client + disconnects. + +## Tests + +```bash +cd mcp && npm test +``` + +32 cases seeding state from `frontend/src/lib/demoSeed.js` (the same deterministic fixture +the public demo runs on). Pins JSON shape and the user-facing edge cases: rest-day override, +missing routine, zero-workout history, no synced state, superset links, three 1RM formulas. +"Today" is pinned via `vi.useFakeTimers({ now: ..., toFake: ['Date'] })` so date-dependent +tools see consistent values regardless of when the suite runs. The pure lib functions have +their own 92 tests in `frontend/src/lib/*.test.js`. + +## Roadmap + +- **Done (Phase 1):** read-only stdio, 8 tools, direct `./data` access. +- **Phase 1.5:** a `progression_next` tool (what does the policy prescribe next?). No new + deps; small surface area. +- **Phase 2:** read+write over stdio. Requires a long-lived token auth path minted from the + admin dashboard (new `./data/tokens.json`) and a write-lock against the web UI's read-modify- + write of `state-.json`. Tools: `log_workout`, `add_bodyweight`, `edit_routine`, + `assign_weekday`, `override_day`. +- **Phase 3:** Streamable HTTP transport, opt-in 4th container in `docker-compose.yml`. Same + tool implementations, second transport — the MCP SDK supports both behind one tool registration. + +## License + +AGPL-3.0-or-later, same as openGym. diff --git a/mcp/package-lock.json b/mcp/package-lock.json new file mode 100644 index 0000000..f29cb60 --- /dev/null +++ b/mcp/package-lock.json @@ -0,0 +1,2465 @@ +{ + "name": "opengym-mcp", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "opengym-mcp", + "version": "0.1.0", + "license": "AGPL-3.0-or-later", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.0.4", + "zod": "^3.23.8" + }, + "bin": { + "opengym-mcp": "src/index.js" + }, + "devDependencies": { + "vitest": "^4.1.10" + } + }, + "node_modules/@emnapi/core": { + "version": "2.0.0-alpha.3", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-alpha.3.tgz", + "integrity": "sha512-AZypUeJ/yByuxyS7BlSNRDOMLMlROYtjYdIAuBmJssVz1UJDSeYxLrdizhXCFYhedC5bqd/ASy8EuNXbVVXp9g==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "2.0.1", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "2.0.0-alpha.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-alpha.3.tgz", + "integrity": "sha512-hFPAhMUjJD9BSyCANEISPOogeXC9Zo9ZQl7L6vKnaVsMkCtzznaW/naYypeyl0Gv5rYfWYsZbpixTMpjDJzQeA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.0.1.tgz", + "integrity": "sha512-9DsSk+o5NBX0CCJT8s0EROGSGxjR/tKu6aBTaVyq+SjAEQH4XcdcRxPBRzsBLizTTJ49MJjF+jgu3qnO9GLQcQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@hono/node-server": { + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.0.12.tgz", + "integrity": "sha512-eWpQYr67tqJLeaSUl0Q+TquuYfUdTibpOJlUMV2FfUP7+KqCC5TufnwnlXL6mobZBJbGAYRd7ZvEBDCbLInjhg==", + "license": "MIT", + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "hono": "^4" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.30.0.tgz", + "integrity": "sha512-xKd8OIzlqNzcqcNumGAa6g+PW2kjD5vrpcKOnfldAUPP3j7lnqMPwlTXQm8gF+UwH72z0lqaRbjr9hqGz0eITA==", + "license": "MIT", + "dependencies": { + "@hono/node-server": "^1.19.9 || ^2.0.5", + "ajv": "^8.17.1", + "ajv-formats": "^3.0.1", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.2.1", + "express-rate-limit": "^8.2.1", + "hono": "^4.11.4", + "jose": "^6.1.3", + "json-schema-typed": "^8.0.2", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.25 || ^4.0", + "zod-to-json-schema": "^3.25.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@cfworker/json-schema": "^4.1.1", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "@cfworker/json-schema": { + "optional": true + }, + "zod": { + "optional": false + } + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.2.tgz", + "integrity": "sha512-JfB4kuJQjaoHuCTseIINHtHWeJnvgEcxjwA5t/Y00ZgaOO1Crz3fjT/p8kT28zA/Caz7oiUMn3d6H2yOVCVwuw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.3", + "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.3" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.142.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.142.0.tgz", + "integrity": "sha512-7W+2q5AKQVU36fkaryontrHn3YDt1RyUYXatw9i5H8ocYe2sPKSFB6eS8WNPeRKiN1qAWWZUPm7gwFzJGrccqQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/Boshen" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.1.tgz", + "integrity": "sha512-02hOeOSryYxVrOIphmLAsqnCJWxwlzFk+pEt/N/i6OgT3lShHO7xGCU5cpgchRDHboAEbSjzgGh+O/u1GswQmA==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.1.tgz", + "integrity": "sha512-fMsTOnN0OjFm3CyppWPitKnc8UlliVARUULW6cfU6AIqjdtgmSFWSk9vecHzZduv/yMWIHDlRhM1e8Iff9uAfA==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.1.tgz", + "integrity": "sha512-1wjKdz/XLGKHaTNHjQveQ/B23TKx4ItAqm1JbyVuvNPc4Ze0Fb48s49TAd/2zcplPl8okE/UbTgmlVfwT7eFeQ==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.1.tgz", + "integrity": "sha512-Fa0jHR07E7YBN4vOEsbVf2briYNsuOowfLJaXULZM0ldMlaCaj2LJgLMbMe4iacRyZmvR8efFhgR9wKuGclQUg==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.1.tgz", + "integrity": "sha512-pzkgu1SSHGgRRyRZ4fbmSgmajbVt+epaLP99NDjFft69v/ypfTi6swBMiVdh2EkQ0OSnHE1lZDM7DRGkyAzUpA==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.1.tgz", + "integrity": "sha512-QI5SEDY8cbiYWHx0VO4vIc3UlS6a32vXHjU8Qy/17adEmZIPuByJg13UEvo9c/UCiUkdcVWY83C+b+JrwnNyUg==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.1.tgz", + "integrity": "sha512-Sm41FyCeXqmYcERoYOCbGIL5hNfd8w9LQ7Y61Bev48HkcjaJqV/iiVOaiDxjVTRMS+QKrZmD8cfPt4uMVnvM+A==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.1.tgz", + "integrity": "sha512-2x+WhXTGl9yJYPbltW/BSEPTVz9OIWQyER4N+gJEDWkkn904eRcBzELqh/Hf7K0w/ubGbKNMv0ZC+94QK/IFEg==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.1.tgz", + "integrity": "sha512-eEjmQpuRQayHPWWnywaWHkFT3ToPbP3RYy42VVd/B9aBGDA+Ol25EIWHxKQST3IiWJjikCWUF7KtbfqwZrzVwQ==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.1.tgz", + "integrity": "sha512-/Orga1fZYkLc/56jBICcHrKchl8Z2UKdDSr3LG9ToWO1lQ6a4Livk9Xz+9WN91zsz5QR3XQz2NNoSDEvP6qadw==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.1.tgz", + "integrity": "sha512-xxBJRL+0q0Kce7orznGWLuylHDY65vuARXZRpX+hPdv+DqK2c3NlCsVA98tlWzWNEE7yPqA/1NQ5nnCrj49Y5A==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.1.tgz", + "integrity": "sha512-M6AdXIXw3s+/8XpKMzdGDEXGS1S7kwUsy+rcTIUIOx5Ge4nXKCtAFHFV9YKkXvGcC5WMoTjAteLzlsQROVI0Yw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.2.1.tgz", + "integrity": "sha512-/TX0SoRGojHzSAHpfVBbavRVSazg5U3h3Y3VXfcc0cdugq6kxdqw8LPGFiPr+/7gE/60zRcsOY2Vi9b9eT0jww==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "2.0.0-alpha.3", + "@emnapi/runtime": "2.0.0-alpha.3", + "@napi-rs/wasm-runtime": "^1.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.1.tgz", + "integrity": "sha512-EvRrivJieyHG+AO9lleZWgq+g0+S7oV2C51yuqlcyU/R9net+sI4Pj0F+lUoP2bEr6TWX3SqFaaS0SzfLxSzkw==", + "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.1", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.1.tgz", + "integrity": "sha512-Z4eCmn5QJ/5+azF9knpLWKfVd9aidn0mAe9TpJgvBLId9Ax3t0+JVxBmT25Bv7NBbVW1TZyKjQjQReouMeH5UQ==", + "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/@tybys/wasm-util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz", + "integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "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/@vitest/expect": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.10.tgz", + "integrity": "sha512-YsCn+qAk1GWjQOWFEsEcL2gNQ0zmVmQu3T03qP6UyjhtmdtwtbuI+DASn/7iQB3HGTXkdBwGddzxPlmiql5vlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.1.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.1.10", + "@vitest/utils": "4.1.10", + "chai": "^6.2.2", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.10.tgz", + "integrity": "sha512-v0xaezt+DKEmKfaxg133ldzADrwLGd7Ze1MfQQTYfvs8OqZIwbxyxaYURivwV7sWy5fqn3rH5uOrSp07bp44Ow==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "4.1.10", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.10.tgz", + "integrity": "sha512-W1HsjSH4MXQ9YfmmhLAoIYf1HRfekQCGngeIgcei6MP5QQGWUe0gkopdZQaVCFO+JDJMrAJGwa5pRpNpvy4P8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.10.tgz", + "integrity": "sha512-IKI6kpIH+LmpROplyLwBBaCfMgOZOMsygVa6BARD6ahA04VRuJSa6OaVG7kRvSEMD870Vd91rSSw0eegtWyLGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "4.1.10", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.10.tgz", + "integrity": "sha512-xRkfOT1qpTAi/Ti4Y1LtfRc3kEuqxGw59eN2jN9pRWMtS/XDevekhcFSqvQqjUNGksfjMJu3Y+oJ+4Ypn2OaJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.10", + "@vitest/utils": "4.1.10", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.10.tgz", + "integrity": "sha512-PLf/Ugvoq5wO/b4rwYCR1h2PSIdXz7wnkQFMiUpLdtM7l6pqVFcQIBEHyT1+l+cj7mNwAfZHzqXqDyjvOuwbDw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.10.tgz", + "integrity": "sha512-fy9am/HWxbaGt/Sawrp90vt6Y6jQwf1RX77cz3uwoJwJVMli/e1IEwRPnMNJ7vKfPTwo0diXifkpPvwH9v7nGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.10", + "convert-source-map": "^2.0.0", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ajv": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/body-parser": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.3.0.tgz", + "integrity": "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^2.0.0", + "debug": "^4.4.3", + "http-errors": "^2.0.1", + "iconv-lite": "^0.7.2", + "on-finished": "^2.4.1", + "qs": "^6.15.2", + "raw-body": "^3.0.2", + "type-is": "^2.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/body-parser/node_modules/content-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz", + "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chai": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/content-disposition": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz", + "integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "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/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-module-lexer": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.1.tgz", + "integrity": "sha512-shc1dbU90Yl/xq1QrC7QRtfcwURZuVRfPhZbDoldJ1cn1gzDvBaBWlv0eFolj5+0znnPJz5TXLxsN77X/12KTA==", + "dev": true, + "license": "MIT" + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventsource": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", + "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.1.0.tgz", + "integrity": "sha512-kJezFj9YFAMLeORyi7aCLxLbD5/qWMQnoMVlVPyHIll7lgRJCc3JVln9Vgl9nwQi0YkMnhdGTMNn7CkRRAptMg==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "8.6.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.6.1.tgz", + "integrity": "sha512-0D493aP61w0TJ2A0wy27riRsO7FMQ7FK+KUHOKCSfPvYo0R55aiC6emCVgFUeShH0fq0ICPVzNcgoS+BsbXQCA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "ip-address": "^10.2.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz", + "integrity": "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "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/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "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/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hono": { + "version": "4.12.33", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.33.tgz", + "integrity": "sha512-+SwvkaiJtxsiPjhy9LivY/1m7UsNqCJetM1BrZl9A5DkQhlbHQDU730mMiDPWjnoCYOM8Chf3WrCJw27kNTPFQ==", + "license": "MIT", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz", + "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ip-address": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.4.0.tgz", + "integrity": "sha512-oSK96Grm3aP6OrS263xVxbNDGVL7rzBtYdpGqlDG8iQdoenDoTs/nkki+DflYbAEE8Xl6o5YxhxlrKvI3nqKXQ==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/jose": { + "version": "6.2.7", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.7.tgz", + "integrity": "sha512-hq1OB1bALKfydZNoViyg6hPVGV4i93ny9Op+n4zP5RSf7SCZEXa/TsG2O3IEr7+WlHRTPnpqDmHfMH6qXAD60w==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/json-schema-typed": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz", + "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==", + "license": "BSD-2-Clause" + }, + "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/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/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.1.tgz", + "integrity": "sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.16", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz", + "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==", + "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/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/obug": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.4.tgz", + "integrity": "sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz", + "integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "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.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkce-challenge": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", + "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/postcss": { + "version": "8.5.25", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.25.tgz", + "integrity": "sha512-DTPx3RWSSnWyzLxQnlH0rJP+EW5ekl16ZU4/psbIhA0e53kJfdgaN5vKM+xP7yJtXVu+nfdVFmlgFDEKAe4Pyw==", + "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.16", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.15.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz", + "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==", + "license": "BSD-3-Clause", + "dependencies": { + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz", + "integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rolldown": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.1.tgz", + "integrity": "sha512-4FKJhg8d3OiyQOA6Q1Q0hoFFpW9/OoX+VsHzpECsdsIZoOArrAK90gl59YK/Z+gnDel45bgJZK03ozH/9bCqEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.142.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm64": "1.2.1", + "@rolldown/binding-darwin-arm64": "1.2.1", + "@rolldown/binding-darwin-x64": "1.2.1", + "@rolldown/binding-freebsd-x64": "1.2.1", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.1", + "@rolldown/binding-linux-arm64-gnu": "1.2.1", + "@rolldown/binding-linux-arm64-musl": "1.2.1", + "@rolldown/binding-linux-ppc64-gnu": "1.2.1", + "@rolldown/binding-linux-s390x-gnu": "1.2.1", + "@rolldown/binding-linux-x64-gnu": "1.2.1", + "@rolldown/binding-linux-x64-musl": "1.2.1", + "@rolldown/binding-openharmony-arm64": "1.2.1", + "@rolldown/binding-wasm32-wasi": "1.2.1", + "@rolldown/binding-win32-arm64-msvc": "1.2.1", + "@rolldown/binding-win32-x64-msvc": "1.2.1" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/std-env": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz", + "integrity": "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.0.tgz", + "integrity": "sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "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/tinyrainbow": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.1.tgz", + "integrity": "sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD", + "optional": true + }, + "node_modules/type-is": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz", + "integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==", + "license": "MIT", + "dependencies": { + "content-type": "^2.0.0", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/type-is/node_modules/content-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz", + "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vite": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.2.0.tgz", + "integrity": "sha512-pn+CFpM0lwDeKwmOq1ZaBK/9sjorZcgqxki6MbY/jPEVd9vichIlmlD4HmQ5wdP5EgqQCFRaACBxMC7uEGc6lQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.5", + "postcss": "^8.5.23", + "rolldown": "~1.2.0", + "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.4.0", + "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/vitest": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.10.tgz", + "integrity": "sha512-R9jUTe5S4Qb0HCd4TNqpC7oGcrMssMRGXLW80ubjWsW9VH5GF8y1Y0SFLY9AbqSk6nt0PnOx4H4WNJYZ13GUPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "4.1.10", + "@vitest/mocker": "4.1.10", + "@vitest/pretty-format": "4.1.10", + "@vitest/runner": "4.1.10", + "@vitest/snapshot": "4.1.10", + "@vitest/spy": "4.1.10", + "@vitest/utils": "4.1.10", + "es-module-lexer": "^2.0.0", + "expect-type": "^1.3.0", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^4.0.0-rc.1", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.1.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.1.10", + "@vitest/browser-preview": "4.1.10", + "@vitest/browser-webdriverio": "4.1.10", + "@vitest/coverage-istanbul": "4.1.10", + "@vitest/coverage-v8": "4.1.10", + "@vitest/ui": "4.1.10", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/zod": { + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.25.2", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.2.tgz", + "integrity": "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.25.28 || ^4" + } + } + } +} diff --git a/mcp/package.json b/mcp/package.json new file mode 100644 index 0000000..62afb79 --- /dev/null +++ b/mcp/package.json @@ -0,0 +1,23 @@ +{ + "name": "opengym-mcp", + "version": "0.1.0", + "private": true, + "type": "module", + "description": "MCP (Model Context Protocol) bridge for openGym — lets an external LLM read your routines, workouts, body-weight log, estimated 1RMs and muscle balance from your self-hosted data. Read-only, stdio transport; no extra container.", + "license": "AGPL-3.0-or-later", + "main": "src/index.js", + "bin": { + "opengym-mcp": "src/index.js" + }, + "scripts": { + "start": "node src/index.js", + "test": "vitest run" + }, + "dependencies": { + "@modelcontextprotocol/sdk": "^1.0.4", + "zod": "^3.23.8" + }, + "devDependencies": { + "vitest": "^4.1.10" + } +} diff --git a/mcp/src/index.js b/mcp/src/index.js new file mode 100644 index 0000000..6c1ff35 --- /dev/null +++ b/mcp/src/index.js @@ -0,0 +1,50 @@ +#!/usr/bin/env node +/* openGym MCP server — stdio transport. The LLM client (Claude Desktop, Cursor, …) spawns + this process locally, talks JSON-RPC over stdin/stdout, tears it down when the session ends. + No extra container, no new outbound network — your data stays in a folder you control. */ +import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' +import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js' +import { TOOLS } from './tools.js' +import { init, getUser } from './state.js' + +const server = new McpServer({ + name: 'opengym', + version: '0.1.0' +}) + +// Fail fast on bad config so a misnamed OPENGYM_DATA doesn't silently answer every call with +// the no-state sentinel. Always register every tool so the LLM sees the full list at +// handshake, even when state didn't resolve. +try { + init() + const u = getUser() + console.error(`[opengym-mcp] serving profile ${u.name} (${u.id})`) +} catch (e) { + console.error(`[opengym-mcp] ${e.message}`) + // Don't exit — keep the tool listings up so the user sees a useful error after fixing their + // env and restarting. +} + +for (const t of TOOLS) { + server.tool( + t.name, + t.description, + t.schema, + async (params) => { + try { + const result = t.handler(params || {}) + return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] } + } catch (err) { + const code = err.code || 'ERROR' + return { + isError: true, + content: [{ type: 'text', text: `${code}: ${err.message}` }] + } + } + } + ) +} + +const transport = new StdioServerTransport() +await server.connect(transport) +// Process stays alive serving JSON-RPC over stdio until the LLM client disconnects. diff --git a/mcp/src/labels.js b/mcp/src/labels.js new file mode 100644 index 0000000..f65e162 --- /dev/null +++ b/mcp/src/labels.js @@ -0,0 +1,47 @@ +// Formatting glue between lib helpers (which speak {0}/{1} templates) and the JSON returned +// to the LLM. +import { MUSCLE_NAME, MUSCLES } from '../../frontend/src/lib/muscles.js' +import { modeOf, fmtSec, setLabel } from '../../frontend/src/lib/history.js' +import { POLICY_NAME } from '../../frontend/src/lib/progression.js' +import { fmtDate, fmtNum, fmtDur } from '../../frontend/src/lib/format.js' + +// Apply {0},{1},… substitutions to the template strings the lib returns. +export function fmt(template, args) { + let v = template + for (let i = 0; i < (args || []).length; i++) v = v.replaceAll('{' + i + '}', String(args[i])) + return v +} + +export { setLabel } + +export function exLine(cfg, unit) { + const mode = modeOf(cfg) + const n = cfg.sets || 1 + const load = cfg.weight ? ' · ' + fmtNum(cfg.weight) + ' ' + unit : '' + if (mode === 'cardio') return `${n} × ${cfg.min || 20} min @ ${fmtNum(cfg.speed || 8)} km/h` + if (mode === 'time') return `${n} × ${fmtSec(cfg.sec || 45)}${load}` + return `${n} × ${cfg.reps}${load}` +} + +export function muscleName(slug) { + return MUSCLE_NAME[slug] || slug +} + +export function policyName(policy) { + return POLICY_NAME[policy] || policy +} + +export function friendlyDate(iso) { + if (!iso) return null + return fmtDate(iso) +} + +export function friendlyDuration(ms) { + return ms ? fmtDur(ms) : null +} + +export function ratio(done, total) { + return `${done}/${total}` +} + +export function muscleOrder() { return MUSCLES.slice() } diff --git a/mcp/src/state.js b/mcp/src/state.js new file mode 100644 index 0000000..5f67c47 --- /dev/null +++ b/mcp/src/state.js @@ -0,0 +1,131 @@ +/* opengym-mcp state — reads ./data/state-.json + db.json (read-only). Cached with an + fs.watch + mtime fallback so a session the api server just wrote is visible on the next + tool call without a restart. */ +import fs from 'node:fs' +import path from 'node:path' + +const DATA_DIR = process.env.OPENGYM_DATA || path.join(process.cwd(), 'data') + +// null = no state file (brand-new account); undefined = not yet loaded. +let _state = undefined +let _db = undefined +let _uid = null +let _watcher = null +let _loadedMtime = 0 // mtimeMs we last read at — used to catch watcher omissions + +function readJsonOrNull(file) { + try { return JSON.parse(fs.readFileSync(file, 'utf8')) } catch { return null } +} + +function reloadDb() { _db = readJsonOrNull(path.join(DATA_DIR, 'db.json')) || { users: [], creds: [], subs: [], invites: [] } } + +function stateFile(uid) { + return path.join(DATA_DIR, 'state-' + uid.replace(/[^a-zA-Z0-9_-]/g, '') + '.json') +} + +// Pick the uid: OPENGYM_UID env, else the only state-* file, else the only user in db.json. +// Throws listing the options if ambiguous. The sanitiser on stateFile() keeps a sneaky +// '..' in OPENGYM_UID harmless. +function resolveUid() { + const envUid = (process.env.OPENGYM_UID || '').trim() + if (envUid) { + if (!/^[a-zA-Z0-9_-]+$/.test(envUid)) throw new Error(`OPENGYM_UID contains characters that aren't safe in a filename: ${JSON.stringify(envUid)}`) + return envUid + } + const files = fs.readdirSync(DATA_DIR) + .filter(f => /^state-[a-zA-Z0-9_-]+\.json$/.test(f)) + .map(f => f.replace(/^state-/, '').replace(/\.json$/, '')) + if (files.length === 1) return files[0] + if (files.length === 0) { + reloadDb() + if (_db.users.length === 1) return _db.users[0].id + if (_db.users.length === 0) throw new Error(`no openGym users found in ${path.join(DATA_DIR, 'db.json')} — sign in at least once on a device`) + // Multiple users in db.json but no state files yet — list their ids, not the (empty) + // files list. Hit when accounts exist but none has signed in on a device. + throw new Error( + `multiple openGym users found — set OPENGYM_UID to one of: ${_db.users.map(u => u.id).join(', ')}\n` + + ` (look them up in ${path.join(DATA_DIR, 'db.json')} under "users"[].id)` + ) + } + throw new Error( + `multiple openGym users found — set OPENGYM_UID to one of: ${files.join(', ')}\n` + + ` (look them up in ${path.join(DATA_DIR, 'db.json')} under "users"[].id)` + ) +} + +// Idempotent. Picks the uid, loads db.json, attaches the watcher, primes state. +export function init() { + if (_uid !== null) return + if (!fs.existsSync(DATA_DIR)) throw new Error(`OPENGYM_DATA dir does not exist: ${DATA_DIR}`) + _uid = resolveUid() + reloadDb() + const file = stateFile(_uid) + if (fs.existsSync(file)) { + _state = readJsonOrNull(file) + if (_state) _state = Object.assign({}, defaultsShape(), _state) + try { _loadedMtime = fs.statSync(file).mtimeMs } catch {} + } + if (_watcher) _watcher.close() + // fs.watch is best-effort: the api server's atomic write at PUT /api/data is the source of + // truth, and a stale read just gets corrected on the next change or the next tool call. + try { + _watcher = fs.watch(file, () => { + // On change, simply clear the cache — the next getState() will re-read. Avoids reading + // twice if the watcher fires multiple events for one atomic-write (rename + create). + _state = undefined + _loadedMtime = 0 + }) + } catch { /* fs.watch unsupported on this platform; tools will re-read on mtime change */ } +} + +// Returns the state object, or null for a fresh account that never signed in on a device. +export function getState() { + init() + const file = stateFile(_uid) + // Re-read if the file's mtime changed since our last load — covers watcher omissions and + // platforms with no fs.watch. + let mtime + try { mtime = fs.statSync(file).mtimeMs } catch { + return _state === undefined ? null : _state + } + if (_state === undefined || mtime !== _loadedMtime) { + const fresh = readJsonOrNull(file) + if (fresh) { + // Same shape the frontend builds on pullState — defaults merged with stored state so any + // field the app added since the snapshot was last saved shows up undefined-safe. + _state = Object.assign({}, defaultsShape(), fresh) + _loadedMtime = mtime + } else if (_state === undefined) { + _state = null // no state file at all — never signed in on a device + } + } + return _state +} + +// Returns the user record (id + name). No passkey material, no VAPID keys, no push subs. +export function getUser() { + init() + const u = _db.users.find(x => x.id === _uid) || { id: _uid, name: 'Profile', created: null } + return { id: u.id, name: u.name, created: u.created || null } +} + +export const dataDir = () => DATA_DIR + +// Test-only: work against a passed-in state, not the disk. +export function _seedStateForTests(state) { + _uid = 'test-uid' + _db = { users: [{ id: _uid, name: 'Test', created: '2026-07-26T00:00:00.000Z' }], creds: [], subs: [], invites: [] } + _state = state + _loadedMtime = Number.MAX_SAFE_INTEGER // never re-read from disk in a test + if (_watcher) { _watcher.close(); _watcher = null } +} + +function defaultsShape() { + return { + unit: 'kg', restSec: 90, sound: true, lang: 'en', + theme: 'dark', accent: 'lime', body: 'male', targetW: null, + bodyweight: [], routines: [], week: {}, dayPlan: {}, + exWeights: {}, workouts: [], customEx: [], gifSize: 'full', + reminder: { on: false, time: '08:00', tz: null } + } +} diff --git a/mcp/src/tools.js b/mcp/src/tools.js new file mode 100644 index 0000000..552bf79 --- /dev/null +++ b/mcp/src/tools.js @@ -0,0 +1,345 @@ +/* The eight read-only tools. Each handler returns JSON; labels.js pre-substitutes any + {0}/{1} template the lib returns so the LLM gets final text, not template strings. + ISO dates are validated on the way in; the handlers never see 'yesterday'. */ +import { z } from 'zod' +import { getState, getUser } from './state.js' +import { + setLabel, exLine, muscleName, policyName, friendlyDuration, ratio, muscleOrder +} from './labels.js' +import { + modeOf, workoutVolume, setsDone, effectiveRoutine, effectiveRoutineId +} from '../../frontend/src/lib/history.js' +import { EXIDX, exOr } from '../../frontend/src/lib/exercises.js' +import { + estimate1RM, best1RM, e1rmSeries, FORMULAS, DEFAULT_FORMULA, REP_CAP +} from '../../frontend/src/lib/onerm.js' +import { loadOfWorkouts, rankOf, levelsOf } from '../../frontend/src/lib/muscles.js' + +/* ---------- helpers ---------- */ + +function entryView(e, S) { + const ex = exOr(e.id) + // Spread id into the cfg the way every call site in the app does (Workout.jsx, Stats.jsx, + // progression.js) — the sheet saves a cardio target as {sets, min, speed} with no id and no + // mode, so modeOf needs the id to fall through to isCardio(id). + const cfg = { ...(e.target || {}), id: e.id } + const mode = modeOf(cfg) + return { + id: e.id, + name: ex.n, + body_part: ex.bp || null, + mode, + target: e.target || null, + sets: (e.sets || []).map(s => ({ + done: !!s.done, + label: setLabel(e.id, { ...s, done: undefined }, cfg), + w: Number(s.w) || 0, + r: Number(s.r) || 0, + sec: Number(s.sec) || 0, + min: Number(s.min) || 0, + speed: Number(s.speed) || 0 + })) + } +} + +// Best estimate per exercise, mirroring the UI's PR table: every eligible set across history, biggest wins. +function prTable(S, formula) { + const byId = new Map() + for (const w of (S.workouts || [])) { + for (const e of (w.entries || [])) { + for (const s of (e.sets || [])) { + if (!s.done) continue + const est = estimate1RM(s.w, s.r, formula) + if (est == null) continue + const ex = exOr(e.id) + const prev = byId.get(e.id) + if (!prev || est > prev.est) { + // exId as well as exName: the consumer needs an id, not a name — exOr() treats any + // string as both, so passing exName where exId belongs would silently "work" wrong. + byId.set(e.id, { exId: e.id, exName: ex.n, bp: ex.bp || null, est, w: Number(s.w), r: Math.round(Number(s.r)), date: w.d }) + } + } + } + } + return [...byId.values()].sort((a, b) => b.est - a.est) +} + +/* ---------- the 8 tools ---------- */ + +/** list_routines — names + counts of each routine in the user's plan. */ +export const listRoutines = { + name: 'list_routines', + description: 'List the workout routines saved in the user\'s openGym profile (the same list the Plan screen shows). Each routine is a named set of exercises with set/rep targets. Use this to discover the plan structure before diving into a specific routine or today\'s workout.', + schema: {}, + handler: () => { + const S = getState() + if (!S) return noState() + return { + unit: S.unit || 'kg', + routines: (S.routines || []).map(r => ({ + id: r.id, + name: r.name, + emoji: r.emoji || null, + exercise_count: (r.ex || []).length, + superset_groups: [...new Set((r.ex || []).map(e => e.sg).filter(Boolean))].length || 0, + policy: r.policy || 'off' + })) + } + } +} + +/** get_routine — the full exercise list for one routine, including set/rep targets. */ +export const getRoutine = { + name: 'get_routine', + description: 'Get the full exercise list for a single routine (the same view the routine editor shows). Returns mode (reps/time/cardio), set/rep/weight targets, superset links, and any per-exercise custom increment you can override. Use routine_id from list_routines.', + schema: { routine_id: z.string().min(1) }, + handler: ({ routine_id }) => { + const S = getState() + if (!S) return noState() + const r = (S.routines || []).find(x => x.id === routine_id) + if (!r) { const e = new Error(`no routine with id ${JSON.stringify(routine_id)}`); e.code = 'ENOENT'; throw e } + return { + id: r.id, + name: r.name, + emoji: r.emoji || null, + policy: r.policy || 'off', + policy_name: policyName(r.policy || 'off'), + unit: S.unit || 'kg', + exercises: (r.ex || []).map((cfg, i) => { + const ex = exOr(cfg.id) + const mode = modeOf(cfg) + return { + position: i + 1, + id: cfg.id, + name: ex.n, + body_part: ex.bp || null, + mode, + sets: cfg.sets || 1, + reps: mode === 'reps' ? (cfg.reps || 0) : undefined, + reps_min: mode === 'reps' && cfg.repsMin != null ? cfg.repsMin : undefined, + sec: mode === 'time' ? (cfg.sec || 0) : undefined, + min: mode === 'cardio' ? (cfg.min || 0) : undefined, + speed: mode === 'cardio' ? (cfg.speed || 0) : undefined, + weight: cfg.weight != null ? cfg.weight : undefined, + increment: cfg.inc != null ? cfg.inc : undefined, + policy_override: cfg.policy || null, + superset_group: cfg.sg || null, + summary: exLine(cfg, S.unit || 'kg') + } + }) + } + } +} + +/** get_week_plan — what's scheduled each weekday + today. */ +export const getWeekPlan = { + name: 'get_week_plan', + description: 'Show the user\'s weekly plan: which routine (if any) is assigned to each weekday, keyed by JS getDay() (Sunday=0, Monday=1, … Saturday=6 — the same convention the openGym state file uses). Also reports today\'s date and what routine applies today, accounting for one-off overrides the user may have set for a specific date (a "rest" override cancels the day).', + schema: {}, + handler: () => { + const S = getState() + if (!S) return noState() + const today = new Date() + const isoToday = today.getFullYear() + '-' + String(today.getMonth() + 1).padStart(2, '0') + '-' + String(today.getDate()).padStart(2, '0') + const todayWd = today.getDay() + return { + today: isoToday, + weekdays: [0, 1, 2, 3, 4, 5, 6].map(d => { + const rid = S.week?.[d] || null + const r = rid ? (S.routines || []).find(x => x.id === rid) : null + // Surface today's override only (not the whole dayPlan dict — usually empty, but might + // have grown from repeated "move this day" actions). + const overrideForToday = d === todayWd ? (S.dayPlan?.[isoToday] ?? null) : null + return { + weekday: d, + weekday_name: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][d], + routine_id: rid, + routine_name: r?.name || null, + routine_emoji: r?.emoji || null, + override_for_today_or_null: overrideForToday + } + }), + today_routine_id: effectiveRoutineId(S, isoToday), + today_routine_name: effectiveRoutine(S, isoToday)?.name || null + } + } +} + +/** list_workouts — newest-first summary of recent sessions. */ +export const listWorkouts = { + name: 'list_workouts', + description: 'List recent finished workouts, newest first. Each item summarises the date, exercise count, sets done / planned, total volume (in the user\'s unit), duration and whether PRs were set. Use this before drilling into a specific date with get_workout.', + schema: { + from: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe('Inclusive start date YYYY-MM-DD. Defaults to no lower bound (list most recent).'), + to: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe('Inclusive end date YYYY-MM-DD. Defaults to today.'), + limit: z.number().int().min(1).max(200).optional().describe('Max items to return. Defaults to 25.') + }, + handler: ({ from, to, limit }) => { + const S = getState() + if (!S) return noState() + const lim = Math.min(Math.max(limit || 25, 1), 200) + const all = (S.workouts || []).slice().sort((a, b) => (b.d || '').localeCompare(a.d || '')) + const filtered = all.filter(w => { + if (from && w.d < from) return false + if (to && w.d > to) return false + return true + }).slice(0, lim) + return { + unit: S.unit || 'kg', + total_count: all.length, + returned_count: filtered.length, + workouts: filtered.map(w => ({ + date: w.d, + routine_id: w.routineId || null, + routine_name: w.name || null, + exercise_count: (w.entries || []).length, + sets_done: setsDone(w), + sets_planned: plannedSets(w), + sets_ratio: ratio(setsDone(w), plannedSets(w)), + volume: workoutVolume(w), + duration_ms: w.end && w.start ? (w.end - w.start) : null, + duration: w.end && w.start ? friendlyDuration(w.end - w.start) : null, + prs: (w.prs || []).length, + bodyweight_at_workout: w.bw || null + })) + } + } +} + +function plannedSets(w) { + let n = 0 + ;(w.entries || []).forEach(e => { n += (e.sets || []).length }) + return n +} + +/** get_workout — full entry/set breakdown for one date. */ +export const getWorkout = { + name: 'get_workout', + description: 'Get the full breakdown of one workout: every exercise, its mode (reps/time/cardio), the target, and per-set labels (e.g. "5 @ 60 kg", "1:30 · 20 kg"). Use list_workouts first if you don\'t know the exact date.', + schema: { date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe('The workout date as YYYY-MM-DD') }, + handler: ({ date }) => { + const S = getState() + if (!S) return noState() + const w = (S.workouts || []).find(x => x.d === date) + if (!w) { const e = new Error(`no workout on ${date}`); e.code = 'ENOENT'; throw e } + return { + date: w.d, + routine_id: w.routineId || null, + routine_name: w.name || null, + unit: S.unit || 'kg', + bodyweight_at_workout: w.bw || null, + volume: workoutVolume(w), + sets_done: setsDone(w), + sets_planned: plannedSets(w), + duration: w.end && w.start ? friendlyDuration(w.end - w.start) : null, + prs: (w.prs || []).map(id => EXIDX[id]?.n || id), + entries: (w.entries || []).map(e => entryView(e, S)) + } + } +} + +/** get_bodyweight — recent weigh-ins with the goal line. */ +export const getBodyweight = { + name: 'get_bodyweight', + description: 'Get the body-weight log: chronological weigh-ins with weights, current goal, deltas vs goal (signed positive = above goal), and a latest summary. Useful for "am I trending toward my weight goal?" questions.', + schema: { + from: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe('Inclusive start date YYYY-MM-DD.'), + to: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe('Inclusive end date YYYY-MM-DD. Defaults to today.') + }, + handler: ({ from, to }) => { + const S = getState() + if (!S) return noState() + const goal = S.targetW || null + const bw = (S.bodyweight || []).filter(b => { + if (from && b.d < from) return false + if (to && b.d > to) return false + return true + }).sort((a, b) => (a.d || '').localeCompare(b.d || '')) + const latest = bw.length ? bw[bw.length - 1] : null + return { + unit: S.unit || 'kg', + goal, + count: bw.length, + latest: latest ? { date: latest.d, weight: latest.w, delta_vs_goal: goal != null ? Math.round((latest.w - goal) * 10) / 10 : null } : null, + entries: bw.map(b => ({ + date: b.d, + weight: b.w, + delta_vs_goal: goal != null ? Math.round((b.w - goal) * 10) / 10 : null + })) + } + } +} + +/** estimate_1rm — best-ever 1RM for one exercise or a PR table across all reps-mode exercises. */ +export const estimate1rm = { + name: 'estimate_1rm', + description: `Estimate one-rep max using Epley, Brzycki or Lombardi formulas. If an exercise_id is given, returns the all-time best estimate for that exercise with the source set (weight × reps + date) and the trend across history. If no exercise_id is given, returns a PR table across all reps-mode exercises (sorted highest first). Refuses to guess above ${REP_CAP} reps — above that, formulas diverge past 10% and "work capacity" is read instead of "maximal strength".`, + schema: { + exercise_id: z.string().optional().describe('An exercise id from list_routines or get_workout entries. If omitted, returns a full PR table.'), + formula: z.enum(['epley', 'brzycki', 'lombardi']).optional().describe(`Formula to use. Defaults to ${DEFAULT_FORMULA}.`) + }, + handler: ({ exercise_id, formula }) => { + const S = getState() + if (!S) return noState() + const f = formula || DEFAULT_FORMULA + if (exercise_id) { + const ex = exOr(exercise_id) + const best = best1RM(S, exercise_id, f) + const series = e1rmSeries(S, exercise_id, f) + // w/r (not weight/reps) matches pr_table and entry-view — every set in the API surface uses the same couple. + return { + exercise: { id: exercise_id, name: ex.n, body_part: ex.bp || null }, + formula: f, + best: best ? { est: best.est, w: best.w, r: best.r, date: best.d } : null, + trend: series.map(p => ({ date: p.d, est: p.y, w: p.w, r: p.r })) + } + } + return { + formula: f, + formula_note: `Estimates use the ${f} formula. Cap at ${REP_CAP} reps applies; r=1 is treated as the measurement, not an estimate.`, + pr_table: prTable(S, f) + } + } +} + +/** muscle_balance — training distribution per muscle over a period (week/month/all). */ +export const muscleBalance = { + name: 'muscle_balance', + description: 'Show which muscles the user has trained in a period, ranked by "effective sets" (volume in kg is intentionally not used — 100 kg leg press vs 12 kg lateral raise say nothing about which muscle worked harder). Reports worked muscles with a 0-4 relative level (1 = some work, 4 = most worked) and the muscles trained zero times in that period — useful for "what am I neglecting?" questions.', + schema: { + period: z.enum(['week', 'month', 'all']).describe('window: last 7 days, last 30 days, or all-time') + }, + handler: ({ period }) => { + const S = getState() + if (!S) return noState() + const now = Date.now() + const cutoff = period === 'week' ? now - 7 * 86400000 + : period === 'month' ? now - 30 * 86400000 + : Number.NEGATIVE_INFINITY + const workouts = (S.workouts || []).filter(w => (w.start || new Date(w.d + 'T12:00:00').getTime()) >= cutoff) + const load = loadOfWorkouts(workouts) + const { worked, missed } = rankOf(load) + const levels = levelsOf(load) + return { + period, + cutoff_iso: period === 'all' ? null : new Date(cutoff).toISOString().slice(0, 10), + workouts_in_period: workouts.length, + worked: worked.map(slug => ({ slug, name: muscleName(slug), level: levels[slug], effective_sets: Math.round((load[slug] || 0) * 10) / 10 })), + neglected: missed.map(slug => ({ slug, name: muscleName(slug) })), + muscle_order_head_to_toe: muscleOrder() + } + } +} + +/* ---------- registration list ---------- */ + +export const TOOLS = [ + listRoutines, getRoutine, getWeekPlan, listWorkouts, getWorkout, getBodyweight, estimate1rm, muscleBalance +] + +function noState() { + return { + error: 'no synced state yet — sign in at least once from a device so the openGym api can save a state file for this profile', + unit: 'kg' + } +} diff --git a/mcp/test/tools.test.js b/mcp/test/tools.test.js new file mode 100644 index 0000000..3002bc8 --- /dev/null +++ b/mcp/test/tools.test.js @@ -0,0 +1,476 @@ +// Tool-layer tests for mcp/src/tools.js, seeded from frontend/src/lib/demoSeed.js — the same +// deterministic fixture the public demo runs on. The pure lib functions have their own 92 +// tests in frontend/src/lib/*.test.js; here we pin JSON shape + the user-facing edge cases +// (rest-day override, missing routine, zero-workout history, no synced state, superset links). +import { describe, beforeAll, afterAll, beforeEach, test, expect, vi } from 'vitest' +import { buildDemoState } from '../../frontend/src/lib/demoSeed.js' +import { EXDB } from '../../frontend/src/lib/exercises.js' +import { _seedStateForTests } from '../src/state.js' +import { TOOLS } from '../src/tools.js' + +// Re-stated here so the assertions stand alone without reaching into lib internals to learn +// the demo state's exact values. +const FAKE_TODAY_ISO = '2026-07-27' // Monday — Push Day is scheduled +const GOAL_WEIGHT = 77 +const NEWEST_WORKOUT = { date: '2026-07-24', name: 'Leg Day', volume: 18500, bw: 78.6, sets_done: 20, sets_total: 20, duration_min: 51 } +const LATEST_BW = { date: '2026-07-27', weight: 78.5, delta: 1.5 } +const LEG_PRESS_ID = '0739' // sled 45° leg press in the demo data +const LEG_PRESS_BEST = { w: 152.5, r: 12, epley: 213.5, brzycki: 219.6 } + +const byName = Object.fromEntries(TOOLS.map(t => [t.name, t.handler])) + +let S = null + +function call(name, params = {}) { + const h = byName[name] + if (!h) throw new Error(`unknown tool ${name}`) + return h(params) +} + +function freshState() { + const s = buildDemoState() + s.unit = 'kg' + return s +} + +// Pin "today" before building state so dayPlan/week alignment matches the assertions below. +// `toFake: ['Date']` only — keeps fs.watch and the rest of the event loop real. +beforeAll(() => { + vi.useFakeTimers({ now: new Date(FAKE_TODAY_ISO + 'T12:00:00Z'), toFake: ['Date'] }) + S = freshState() + _seedStateForTests(S) +}) + +afterAll(() => { + vi.useRealTimers() +}) + +// Fresh state per test — tests that mutate dayPlan can't leak into siblings. +beforeEach(() => { + S = freshState() + _seedStateForTests(S) +}) + +/* ---------- list_routines ---------- */ + +describe('list_routines', () => { + test('returns the three starter routines with names + counts', () => { + const r = call('list_routines') + expect(r.unit).toBe('kg') + expect(r.routines.length).toBe(3) + expect(r.routines.map(x => x.name).sort()).toEqual(['Leg Day', 'Pull Day', 'Push Day']) + r.routines.forEach(rn => { + expect(typeof rn.id).toBe('string') + expect(rn.exercise_count).toBeGreaterThan(0) + expect(typeof rn.superset_groups).toBe('number') + expect(['off', 'linear', 'greyskull', 'double', 'time']).toContain(rn.policy) + }) + }) + + test('list_routines entries line up with get_routine (no id drift)', () => { + const list = call('list_routines').routines + list.forEach(summary => { + const detail = call('get_routine', { routine_id: summary.id }) + expect(detail.id).toBe(summary.id) + expect(detail.name).toBe(summary.name) + expect(detail.exercises.length).toBe(summary.exercise_count) + }) + }) +}) + +/* ---------- get_routine ---------- */ + +describe('get_routine', () => { + test('returns the full exercise list for Push Day with per-exercise summaries', () => { + const push = call('list_routines').routines.find(x => x.name === 'Push Day') + const r = call('get_routine', { routine_id: push.id }) + expect(r.name).toBe('Push Day') + expect(r.exercises.length).toBe(push.exercise_count) + expect(r.policy_name).toBeTruthy() + r.exercises.forEach(e => { + expect(['reps', 'time', 'cardio']).toContain(e.mode) + // Every summary has "N × M" with a non-ASCII × (the lib uses U+00D7, not ASCII 'x') + expect(e.summary).toMatch(/\d+\s*×\s*\d+/) + expect(e.superset_group === null || typeof e.superset_group === 'string').toBe(true) + }) + }) + + test('throws ENOENT on a bogus routine id', () => { + expect(() => call('get_routine', { routine_id: 'bogus' })).toThrow() + }) + + test('reports superset links when an adjacent pair shares an sg id', () => { + // Inject a superset pair into a clone, since the starter plan has none. + S.routines[0].ex[0].sg = 'A' + S.routines[0].ex[1].sg = 'A' + const r = call('get_routine', { routine_id: S.routines[0].id }) + expect(r.exercises[0].superset_group).toBe('A') + expect(r.exercises[1].superset_group).toBe('A') + expect(r.exercises[2].superset_group).toBeNull() + }) + + test('preserves mode + per-mode fields for a timed entry and a cardio entry', () => { + // Append synthetic entries the starter plan doesn't ship: a timed plank (sec, no w) and a + // cardio treadmill block (min + speed). These exercise ids don't exist in EXDB, so exOr + // returns a placeholder named "Unknown exercise" — that's fine, we test the cfg fields. + const push = S.routines.find(r => r.name === 'Push Day') + push.ex.push({ id: 'synth-plank', sets: 3, sec: 60, weight: 0, mode: 'time' }) + push.ex.push({ id: 'synth-treadmill', sets: 1, min: 20, speed: 8, mode: 'cardio' }) + const r = call('get_routine', { routine_id: push.id }) + const t = r.exercises[r.exercises.length - 2] + const c = r.exercises[r.exercises.length - 1] + expect(t.mode).toBe('time') + expect(t.sec).toBe(60) + expect(t.reps).toBeUndefined() + expect(c.mode).toBe('cardio') + expect(c.min).toBe(20) + expect(c.speed).toBe(8) + }) +}) + +/* ---------- get_week_plan ---------- */ + +describe('get_week_plan', () => { + test('reports each weekday in getDay() order (Sunday=0 … Saturday=6) with names', () => { + const r = call('get_week_plan') + expect(r.weekdays.length).toBe(7) + expect(r.weekdays.map(d => d.weekday)).toEqual([0, 1, 2, 3, 4, 5, 6]) + expect(r.weekdays.map(d => d.weekday_name)) + .toEqual(['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']) + }) + + test('today is the pinned Monday, and Push Day is scheduled', () => { + const r = call('get_week_plan') + expect(r.today).toBe(FAKE_TODAY_ISO) + const push = S.routines.find(x => x.name === 'Push Day') + expect(r.today_routine_id).toBe(push.id) + expect(r.today_routine_name).toBe('Push Day') + }) + + test('week[1]/[3]/[5] map to Push/Pull/Leg, other weekdays are rest', () => { + const r = call('get_week_plan') + const byWd = Object.fromEntries(r.weekdays.map(d => [d.weekday, d])) + expect(byWd[1].routine_name).toBe('Push Day') + expect(byWd[3].routine_name).toBe('Pull Day') + expect(byWd[5].routine_name).toBe('Leg Day') + ;[0, 2, 4, 6].forEach(wd => { + expect(byWd[wd].routine_id).toBeNull() + expect(byWd[wd].routine_name).toBeNull() + }) + }) + + test('a "rest" override on today cancels the scheduled routine', () => { + // Sanity check first — without the override, today has a routine. + const before = call('get_week_plan') + expect(before.today_routine_id).not.toBeNull() + S.dayPlan[FAKE_TODAY_ISO] = 'rest' + const after = call('get_week_plan') + expect(after.today_routine_id).toBeNull() + expect(after.today_routine_name).toBeNull() + // The override is surfaced on the matching weekday entry. + const todayWd = new Date(FAKE_TODAY_ISO + 'T12:00:00Z').getDay() + expect(after.weekdays.find(d => d.weekday === todayWd).override_for_today_or_null).toBe('rest') + }) + + test('a routine-id override on today replaces the weekday default', () => { + const legs = S.routines.find(r => r.name === 'Leg Day') + S.dayPlan[FAKE_TODAY_ISO] = legs.id + const r = call('get_week_plan') + expect(r.today_routine_id).toBe(legs.id) + expect(r.today_routine_name).toBe('Leg Day') + }) + + test('empty week + no override → today has no routine (a quiet Sunday)', () => { + S.week = {} + S.dayPlan = {} + const r = call('get_week_plan') + expect(r.today_routine_id).toBeNull() + expect(r.today_routine_name).toBeNull() + r.weekdays.forEach(d => expect(d.routine_id).toBeNull()) + }) +}) + +/* ---------- list_workouts ---------- */ + +describe('list_workouts', () => { + test('newest first, with computed volume/duration matching hand-calculated values', () => { + const r = call('list_workouts', {}) + expect(r.returned_count).toBeGreaterThan(0) + expect(r.total_count).toBeGreaterThanOrEqual(r.returned_count) + // newest-first check + const dates = r.workouts.map(w => w.date) + expect([...dates].sort().reverse()).toEqual(dates) + // The newest workout is the Friday before the pinned Monday today. + expect(r.workouts[0].date).toBe(NEWEST_WORKOUT.date) + expect(r.workouts[0].routine_name).toBe(NEWEST_WORKOUT.name) + expect(r.workouts[0].volume).toBe(NEWEST_WORKOUT.volume) + expect(r.workouts[0].sets_done).toBe(NEWEST_WORKOUT.sets_done) + expect(r.workouts[0].sets_planned).toBe(NEWEST_WORKOUT.sets_total) + expect(r.workouts[0].sets_ratio).toBe(`${NEWEST_WORKOUT.sets_done}/${NEWEST_WORKOUT.sets_total}`) + expect(r.workouts[0].duration).toBe(`${NEWEST_WORKOUT.duration_min} min`) + expect(r.workouts[0].bodyweight_at_workout).toBe(NEWEST_WORKOUT.bw) + r.workouts.forEach(w => { + expect(w.sets_done).toBeLessThanOrEqual(w.sets_planned) + expect(typeof w.volume).toBe('number') + expect(w.sets_ratio).toMatch(/^\d+\/\d+$/) + }) + }) + + test('date range filter narrows results (closed interval, both endpoints inclusive)', () => { + const all = call('list_workouts') + expect(all.workouts.length).toBeGreaterThan(2) + const earliest = all.workouts[all.workouts.length - 1].date + // closed on both ends — earliest's own date should still appear + const restricted = call('list_workouts', { from: earliest, to: earliest }) + expect(restricted.returned_count).toBe(1) + expect(restricted.workouts[0].date).toBe(earliest) + }) + + test('a from > to range yields zero workouts (not an error, not silently everything)', () => { + const r = call('list_workouts', { from: '2026-07-27', to: '2026-01-01' }) + expect(r.returned_count).toBe(0) + expect(r.workouts).toEqual([]) + expect(r.total_count).toBeGreaterThan(0) // total still reflects the real history + }) + + test('respects limit (caps returned_count, never total_count)', () => { + const r = call('list_workouts', { limit: 3 }) + expect(r.returned_count).toBeLessThanOrEqual(3) + expect(r.total_count).toBeGreaterThanOrEqual(r.returned_count) + }) +}) + +/* ---------- get_workout ---------- */ + +describe('get_workout', () => { + test('matches the newest workout from list_workouts, every set has a readable label', () => { + const list = call('list_workouts', {}).workouts + const w = call('get_workout', { date: list[0].date }) + expect(w.date).toBe(list[0].date) + expect(w.entries.length).toBe(list[0].exercise_count) + expect(w.volume).toBe(list[0].volume) + w.entries.forEach(e => { + expect(['reps', 'time', 'cardio']).toContain(e.mode) + e.sets.forEach(s => { + expect(typeof s.label).toBe('string') + expect(s.label.length).toBeGreaterThan(0) + }) + }) + }) + + test('throws ENOENT on a date with no workout', () => { + expect(() => call('get_workout', { date: '1900-01-01' })).toThrow() + }) + + test('renders reps/time/cardio set labels in the lib format on a synthetic workout', () => { + // The starter routine has only reps-mode exercises — synthesise a workout that includes a + // timed plank and a cardio row so the label rendering is actually exercised. + S.workouts = [{ + id: 'synth-1', d: '2026-07-25', start: 0, end: 1800000, routineId: 'x', name: 'Synth', + bw: 78, vol: 0, prs: [], + entries: [ + { id: 'squat', target: { mode: 'reps' }, sets: [{ w: 60, r: 5, done: true }] }, + { id: 'plank', target: { mode: 'time' }, sets: [{ sec: 90, w: 0, done: true }] }, + { id: 'plank-w', target: { mode: 'time' }, sets: [{ sec: 90, w: 20, done: true }] }, + { id: 'row', target: { mode: 'cardio' }, sets: [{ min: 20, speed: 8, done: true }] } + ] + }] + const w = call('get_workout', { date: '2026-07-25' }) + expect(w.entries[0].sets[0].label).toBe('60×5') // reps + // 90 sec → 1 min 30 sec → mm:ss label is "1:30" (fmtSec in history.js) + expect(w.entries[1].sets[0].label).toBe('1:30') // 90 s in mm:ss, no weight + expect(w.entries[2].sets[0].label).toBe('1:30 · 20') // weighted plank + expect(w.entries[3].sets[0].label).toBe('20 min @ 8 km/h') // cardio + }) + + test('infers cardio mode from the exercise id when the target has no mode key', () => { + // Reproduces the review bug: the sheet saves a cardio target as {sets, min, speed} with + // no mode and no id. modeOf must fall through to isCardio(id), which needs the id on the + // cfg — entryView has to spread id into the cfg the way every app call site does. + const CARDIO_ID = EXDB.find(e => e.bp === 'cardio').id + S.workouts = [{ + id: 'synth-cardio', d: '2026-07-25', start: 0, end: 1800000, routineId: 'x', name: 'Synth', + bw: 78, vol: 0, prs: [], + entries: [ + { id: CARDIO_ID, target: { sets: 1, min: 20, speed: 8 }, sets: [{ min: 20, speed: 8, done: true }] } + ] + }] + const w = call('get_workout', { date: '2026-07-25' }) + expect(w.entries[0].mode).toBe('cardio') + expect(w.entries[0].sets[0].label).toBe('20 min @ 8 km/h') + }) +}) + +/* ---------- get_bodyweight ---------- */ + +describe('get_bodyweight', () => { + test('returns weigh-ins with the goal, the latest entry, and exact delta vs goal', () => { + const r = call('get_bodyweight') + expect(r.goal).toBe(GOAL_WEIGHT) + expect(r.entries.length).toBeGreaterThan(0) + // Newest is the LATEST_BW entry (deterministic from the demo seed at the pinned time). + expect(r.latest).toBeTruthy() + expect(r.latest.date).toBe(LATEST_BW.date) + expect(r.latest.weight).toBe(LATEST_BW.weight) + expect(r.latest.delta_vs_goal).toBe(LATEST_BW.delta) + // entries are chronological + const dates = r.entries.map(e => e.date) + expect([...dates].sort()).toEqual(dates) + }) + + test('closed date range returns a single matching entry on the boundary', () => { + const all = call('get_bodyweight') + expect(all.entries.length).toBeGreaterThan(1) + const earliest = all.entries[0].date + const restricted = call('get_bodyweight', { from: earliest, to: earliest }) + expect(restricted.entries.length).toBe(1) + expect(restricted.entries[0].date).toBe(earliest) + }) + + test('no goal set → delta_vs_goal is null, not NaN, not zero', () => { + S.targetW = null + const r = call('get_bodyweight') + expect(r.goal).toBeNull() + r.entries.forEach(e => expect(e.delta_vs_goal).toBeNull()) + expect(r.latest.delta_vs_goal).toBeNull() + }) +}) + +/* ---------- estimate_1rm ---------- */ + +describe('estimate_1rm', () => { + test('PR table across all reps-mode exercises; epley formula is the default', () => { + const r = call('estimate_1rm', {}) + expect(r.formula).toBe('epley') + expect(Array.isArray(r.pr_table)).toBe(true) + expect(r.pr_table.length).toBeGreaterThan(0) + r.pr_table.forEach(p => { + expect(typeof p.est).toBe('number') + expect(p.est).toBeGreaterThan(0) + expect(typeof p.exName).toBe('string') + expect(typeof p.exId).toBe('string') // exId surfaced (regression test for the bug where callers passed exName as id) + }) + // sort order: descending by est + for (let i = 1; i < r.pr_table.length; i++) { + expect(r.pr_table[i].est).toBeLessThanOrEqual(r.pr_table[i - 1].est) + } + }) + + test('top-of-table values exactly match the hand-computed Epley for the demo seed', () => { + const r = call('estimate_1rm', {}) + const top = r.pr_table[0] + // Demo seed's hardest set: sled 45° leg press at 152.5×12 (r=12 hits estimate1RM's REP_CAP). + expect(top.exId).toBe(LEG_PRESS_ID) + expect(top.w).toBe(LEG_PRESS_BEST.w) + expect(top.r).toBe(LEG_PRESS_BEST.r) + expect(top.est).toBeCloseTo(LEG_PRESS_BEST.epley, 1) + }) + + test('per-exercise trend + best, with formula honours (Epley vs Brzycki numbers diverge)', () => { + const epley = call('estimate_1rm', { exercise_id: LEG_PRESS_ID, formula: 'epley' }) + expect(epley.exercise.id).toBe(LEG_PRESS_ID) + expect(epley.formula).toBe('epley') + expect(Array.isArray(epley.trend)).toBe(true) + expect(epley.best).toBeTruthy() + expect(epley.best.w).toBe(LEG_PRESS_BEST.w) + expect(epley.best.r).toBe(LEG_PRESS_BEST.r) + expect(epley.best.est).toBeCloseTo(LEG_PRESS_BEST.epley, 1) + const brz = call('estimate_1rm', { exercise_id: LEG_PRESS_ID, formula: 'brzycki' }) + expect(brz.formula).toBe('brzycki') + expect(brz.best.est).toBeCloseTo(LEG_PRESS_BEST.brzycki, 1) + // Distinct formulas must produce distinct estimates for this set. + expect(epley.best.est).not.toBeCloseTo(brz.best.est, 1) + }) + + test('exercises with no reps-mode history get null best + empty trend (not a 0 estimate)', () => { + S.workouts = [] + const r = call('estimate_1rm', { exercise_id: LEG_PRESS_ID }) + expect(r.best).toBeNull() + expect(r.trend).toEqual([]) + const table = call('estimate_1rm', {}).pr_table + expect(table).toEqual([]) + }) + + test('all three formulas are accepted', () => { + ['epley', 'brzycki', 'lombardi'].forEach(f => { + const r = call('estimate_1rm', { exercise_id: LEG_PRESS_ID, formula: f }) + expect(r.formula).toBe(f) + expect(r.best).not.toBeNull() + }) + }) +}) + +/* ---------- muscle_balance ---------- */ + +describe('muscle_balance', () => { + test('reports worked + neglected muscles in head-to-toe order over all time', () => { + const r = call('muscle_balance', { period: 'all' }) + expect(r.period).toBe('all') + expect(r.workouts_in_period).toBeGreaterThan(0) + expect(Array.isArray(r.worked)).toBe(true) + expect(Array.isArray(r.neglected)).toBe(true) + expect(r.muscle_order_head_to_toe[0]).toBe('trapezius') + expect(r.muscle_order_head_to_toe.at(-1)).toBe('tibialis') + r.worked.forEach(w => { + expect(w.level).toBeGreaterThanOrEqual(1) + expect(w.level).toBeLessThanOrEqual(4) + expect(typeof w.name).toBe('string') + expect(typeof w.effective_sets).toBe('number') + }) + }) + + test('worked + neglected partition every muscle exactly once', () => { + const r = call('muscle_balance', { period: 'all' }) + const all = new Set(r.muscle_order_head_to_toe) + const worked = new Set(r.worked.map(w => w.slug)) + const neg = new Set(r.neglected.map(n => n.slug)) + expect(worked.size + neg.size).toBe(all.size) + expect([...worked].every(s => all.has(s))).toBe(true) + expect([...neg].every(s => all.has(s))).toBe(true) + }) + + test('period windows are inclusive: week ≤ month ≤ all', () => { + const all = call('muscle_balance', { period: 'all' }).workouts_in_period + const month = call('muscle_balance', { period: 'month' }).workouts_in_period + const week = call('muscle_balance', { period: 'week' }).workouts_in_period + expect(week).toBeLessThanOrEqual(month) + expect(month).toBeLessThanOrEqual(all) + }) + + test('zero-workout state still returns all 18 muscles as neglected (not empty)', () => { + S.workouts = [] + const r = call('muscle_balance', { period: 'all' }) + expect(r.workouts_in_period).toBe(0) + expect(r.worked).toEqual([]) + expect(r.neglected.length).toBe(r.muscle_order_head_to_toe.length) + expect(r.neglected.length).toBe(18) + }) +}) + +/* ---------- shared: no-state fallback ---------- */ + +describe('shared: no-state fallback', () => { + test('every tool answers gracefully when state is null (fresh account, never signed in)', () => { + _seedStateForTests(null) + // Each tool gets the minimum args its zod schema mandates; under real LLM-client use the + // SDK rejects missing ones before the handler runs, so we only test the post-validation path. + const calls = { + list_routines: {}, + get_routine: { routine_id: '0031' }, + get_week_plan: {}, + list_workouts: {}, + get_workout: { date: '2026-07-26' }, + get_bodyweight: {}, + estimate_1rm: {}, + muscle_balance: { period: 'all' } + } + for (const t of TOOLS) { + const r = t.handler(calls[t.name] || {}) + expect(r).toHaveProperty('error') + } + }) + + // Restore state after the no-state detour so a future test that forgets to seed sees the + // failure rather than inherits null silently. + afterAll(() => { _seedStateForTests(S = freshState()) }) +}) diff --git a/mcp/vitest.config.js b/mcp/vitest.config.js new file mode 100644 index 0000000..f37fd1e --- /dev/null +++ b/mcp/vitest.config.js @@ -0,0 +1,12 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + include: ['test/**/*.test.js'], + globals: false, + environment: 'node', + pool: 'forks', + isolate: true, + reporters: ['default'] + } +})