diff --git a/.gitignore b/.gitignore index b317b22f..70db2795 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,12 @@ src-tauri/gen # tsc -b 的增量缓存 *.tsbuildinfo + +# 装进来的 agent skill 正文。 +# +# **只留 skills-lock.json,不留内容。**那是 328K 第三方文本、没带 +# LICENSE,而这是个 MIT 的公开仓库。锁文件里有来源和哈希,谁都能用 +# `pnpm dlx skills add shadcn/ui` 取回一模一样的一份 —— 和 +# node_modules 与 pnpm-lock.yaml 是同一个分工。 +.agents/ +.claude/ diff --git a/components.json b/components.json new file mode 100644 index 00000000..80d40ade --- /dev/null +++ b/components.json @@ -0,0 +1,25 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "radix-nova", + "rsc": false, + "tsx": true, + "tailwind": { + "config": "", + "css": "src/index.css", + "baseColor": "neutral", + "cssVariables": true, + "prefix": "" + }, + "iconLibrary": "lucide", + "rtl": false, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/ui", + "lib": "@/lib", + "hooks": "@/hooks" + }, + "menuColor": "default", + "menuAccent": "subtle", + "registries": {} +} diff --git a/package.json b/package.json index e8edd895..894df0d4 100644 --- a/package.json +++ b/package.json @@ -12,15 +12,27 @@ "test": "vitest run" }, "dependencies": { + "@base-ui/react": "^1.8.0", "@codemirror/commands": "^6.11.0", "@codemirror/lang-yaml": "^6.1.3", "@codemirror/language": "^6.12.4", "@codemirror/state": "^6.7.4", "@codemirror/view": "^6.43.11", "@tauri-apps/api": "^2.9.0", + "class-variance-authority": "^0.7.1", + "clsx": "^2.1.1", + "date-fns": "^4.4.0", + "lucide-react": "^1.45.0", "radix-ui": "^1.6.7", "react": "^19.2.0", - "react-dom": "^19.2.0" + "react-day-picker": "^10.0.1", + "react-dom": "^19.2.0", + "react-resizable-panels": "^4.12.4", + "recharts": "3.8.0", + "shadcn": "^4.21.0", + "sonner": "^2.0.8", + "tailwind-merge": "^3.7.0", + "tw-animate-css": "^1.4.0" }, "devDependencies": { "@tailwindcss/vite": "^4.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9da944d5..65ee5908 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@base-ui/react': + specifier: ^1.8.0 + version: 1.8.0(@date-fns/tz@1.5.0)(@types/react@19.2.18)(date-fns@4.4.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@codemirror/commands': specifier: ^6.11.0 version: 6.11.0 @@ -26,15 +29,48 @@ importers: '@tauri-apps/api': specifier: ^2.9.0 version: 2.11.1 + class-variance-authority: + specifier: ^0.7.1 + version: 0.7.1 + clsx: + specifier: ^2.1.1 + version: 2.1.1 + date-fns: + specifier: ^4.4.0 + version: 4.4.0 + lucide-react: + specifier: ^1.45.0 + version: 1.45.0(react@19.2.8) radix-ui: specifier: ^1.6.7 version: 1.6.7(@types/react-dom@19.2.7(@types/react@19.2.18))(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) react: specifier: ^19.2.0 version: 19.2.8 + react-day-picker: + specifier: ^10.0.1 + version: 10.0.1(@types/react@19.2.18)(react@19.2.8) react-dom: specifier: ^19.2.0 version: 19.2.8(react@19.2.8) + react-resizable-panels: + specifier: ^4.12.4 + version: 4.12.4(react-dom@19.2.8(react@19.2.8))(react@19.2.8) + recharts: + specifier: 3.8.0 + version: 3.8.0(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react-is@19.3.0)(react@19.2.8)(redux@5.0.1) + shadcn: + specifier: ^4.21.0 + version: 4.21.0(typescript@5.9.3) + sonner: + specifier: ^2.0.8 + version: 2.0.8(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) + tailwind-merge: + specifier: ^3.7.0 + version: 3.7.0 + tw-animate-css: + specifier: ^1.4.0 + version: 1.4.0 devDependencies: '@tailwindcss/vite': specifier: ^4.1.0 @@ -85,14 +121,28 @@ packages: resolution: {integrity: sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==} engines: {node: '>=6.9.0'} + '@babel/helper-annotate-as-pure@7.29.7': + resolution: {integrity: sha512-OoK6239jHPuSQOoS0kfTVKn0b/rVTk0seKq4Gd2UMLtmOVLjDC0ki3e+c90Trqv2gMfvJFqkiljrr568+qddiw==} + engines: {node: '>=6.9.0'} + '@babel/helper-compilation-targets@7.29.7': resolution: {integrity: sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==} engines: {node: '>=6.9.0'} + '@babel/helper-create-class-features-plugin@7.29.7': + resolution: {integrity: sha512-IY3ZD9Tmooqr3TUhc3DUWxiuo8xx1DWLhd5M7hQ+ZWJamqM2BbalrBJb2MisSLoYorOj75U03qULCxQTY9r3hg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + '@babel/helper-globals@7.29.7': resolution: {integrity: sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==} engines: {node: '>=6.9.0'} + '@babel/helper-member-expression-to-functions@7.29.7': + resolution: {integrity: sha512-j+7JYmk1JYDtACIGj0QJqqWZjoUpMoEikQGADMaHgCMCSDqd2+P32rfcibUNrGOMWrlzK1WJBdxrB3JJQZwWtg==} + engines: {node: '>=6.9.0'} + '@babel/helper-module-imports@7.29.7': resolution: {integrity: sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==} engines: {node: '>=6.9.0'} @@ -103,10 +153,24 @@ packages: peerDependencies: '@babel/core': ^7.0.0 + '@babel/helper-optimise-call-expression@7.29.7': + resolution: {integrity: sha512-+kmGVjcT9RGYzoDwdwEqEvGgKe3BYq+O1iGzjFubaNgZHwYHP6lsF2Yghf4kEuv9BV7tYDZ913aBW9am6YKong==} + engines: {node: '>=6.9.0'} + '@babel/helper-plugin-utils@7.29.7': resolution: {integrity: sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==} engines: {node: '>=6.9.0'} + '@babel/helper-replace-supers@7.29.7': + resolution: {integrity: sha512-atfGXWSeCiF4DnKZIfmJfQRkSw9b9gNNXR1kqKjbhG4pGYCOnkp8OcTB8E3NXjBu8NpheSnOeNKz8KT7UNFTmQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-skip-transparent-expression-wrappers@7.29.7': + resolution: {integrity: sha512-brcMGQaVzIeUb+6/bs1Av0f8YuNNjKY2JyvfRCsFuFsdKccEQ5Ges2y74D74NZ1Rz8lKJ9ksJkfqwQFJ/iNEyQ==} + engines: {node: '>=6.9.0'} + '@babel/helper-string-parser@7.29.7': resolution: {integrity: sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==} engines: {node: '>=6.9.0'} @@ -128,6 +192,24 @@ packages: engines: {node: '>=6.0.0'} hasBin: true + '@babel/plugin-syntax-jsx@7.29.7': + resolution: {integrity: sha512-TSu8+mHCoEaaCDEZ0I3+6mvTBYR4PCxQwf2z9/r5Tbztv6NaLR3B9thGTTxX2WGuGHJqRiAbKPeGTJ5XWXVg6A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-typescript@7.29.7': + resolution: {integrity: sha512-ngr+82Sh0xMz25TPCZi+nC2iTzjfCdWS2ONXTp/PtSCHCgaCNBpdMqgvJ2ccdLlClVZ7sisIgB914j/JFe+RZA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-modules-commonjs@7.29.7': + resolution: {integrity: sha512-j0vCldybPC5b5dwCQOJ21uKtHzt7hxLygJTg9eF1ScfaikEDNfzn94XoW5Fi+seBR0nCyL23xaBFFkq7dTM8XQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + '@babel/plugin-transform-react-jsx-self@7.29.7': resolution: {integrity: sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==} engines: {node: '>=6.9.0'} @@ -140,6 +222,22 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 + '@babel/plugin-transform-typescript@7.29.7': + resolution: {integrity: sha512-jK52h8LaLc7JarhQV2ofeFMts4H7vnOXnqZNA6fYglBTZewRBE51KWt3BUltW1P+KoPsYkHoJeXePuz4zo2LMw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/preset-typescript@7.29.7': + resolution: {integrity: sha512-/Foi8vKY2EVbed/1eZx0gJEEwHAIxogrySI7rULcRIvhZzbvoE/b5qG5Ghc0WKAFKOHA9SD1x7RsFlOYdutIiQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/runtime@7.29.7': + resolution: {integrity: sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==} + engines: {node: '>=6.9.0'} + '@babel/template@7.29.7': resolution: {integrity: sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==} engines: {node: '>=6.9.0'} @@ -152,6 +250,33 @@ packages: resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==} engines: {node: '>=6.9.0'} + '@base-ui/react@1.8.0': + resolution: {integrity: sha512-P0/1sxo6SBVZOklKMIedvTWqw2s2IQzi9x5bIVsXu980cuSOD4NeuRSs+/L7LZQfDkZP/uRZyGPyfFl/B1oH+Q==} + engines: {node: '>=14.0.0'} + peerDependencies: + '@date-fns/tz': ^1.2.0 + '@types/react': ^17 || ^18 || ^19 + date-fns: ^4.0.0 + react: ^17 || ^18 || ^19 + react-dom: ^17 || ^18 || ^19 + peerDependenciesMeta: + '@date-fns/tz': + optional: true + '@types/react': + optional: true + date-fns: + optional: true + + '@base-ui/utils@0.4.0': + resolution: {integrity: sha512-bO9fz25kKtPf+aZVyfQrC0PDmJdmVni31W2hCS5/Owb+inwdIL3XU26pCPRPlt4LSxZrBgLwubXQXQlKaFEZzw==} + peerDependencies: + '@types/react': ^17 || ^18 || ^19 + react: ^17 || ^18 || ^19 + react-dom: ^17 || ^18 || ^19 + peerDependenciesMeta: + '@types/react': + optional: true + '@codemirror/autocomplete@6.20.3': resolution: {integrity: sha512-tlosUqb+3BbxCxZdu4tKeRghPFC+QM7q4X5YhKV2eCmPG+1r2F3f4AaSz5sCrFqUtX4Jh20VFTKecl16MgiV9g==} @@ -170,6 +295,16 @@ packages: '@codemirror/view@6.43.11': resolution: {integrity: sha512-2+esucbQX6wB2JYi1eDvdCPFTA31BN8oSy6xCmk3G6CloV11yOvEjYk+gH7kLrP0MuHG94E8WDhjs5oMiu3+Wg==} + '@date-fns/tz@1.5.0': + resolution: {integrity: sha512-lwYN/vDPeNRULcepoE/LO2Pgx+7/RV+S9ARfbc9lr2DtGkOD7pAiruHvbR1RX3Qyf6ja47EWJDMsNK5vK08DJg==} + + '@dotenvx/dotenvx@1.75.1': + resolution: {integrity: sha512-/BITOC9dmS/edY2zQwZNicQ059O6RKabtQfyEafV0nGtfYRNHYy1DIPiYVcov40+tob9hfmBnbR963dS+EQ1DQ==} + hasBin: true + + '@dotenvx/primitives@0.8.0': + resolution: {integrity: sha512-VYJy0uhFm9zTJ1TxBaW/pA8bjbOM/OttaNMwZ1RHG4JKyRG7DhSdiqD1ipQoAyoD22olUtxbP78W9xY3Wd11bg==} + '@esbuild/aix-ppc64@0.28.2': resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==} engines: {node: '>=18'} @@ -341,6 +476,12 @@ packages: '@floating-ui/utils@0.2.12': resolution: {integrity: sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==} + '@hono/node-server@2.1.1': + resolution: {integrity: sha512-ELuehkj5VCBdgEw9zs+ivkKwyzzUCSQuE96YmiPvn1ECBoZCczbFXJLeEGMTYjphP6gydh4pHMqEYPVMYUVgQg==} + engines: {node: '>=20'} + peerDependencies: + hono: ^4 + '@jridgewell/gen-mapping@0.3.13': resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} @@ -372,6 +513,16 @@ packages: '@marijn/find-cluster-break@1.0.4': resolution: {integrity: sha512-Wy0V7+SGUjnF9/TkiM1hKVDPj7jKXduPNboMVtHTA8dySMURWqfg/JZ9E2Sq8JgSJmkl7k7Qe9FLeMSrSraWmQ==} + '@modelcontextprotocol/sdk@1.30.0': + resolution: {integrity: sha512-xKd8OIzlqNzcqcNumGAa6g+PW2kjD5vrpcKOnfldAUPP3j7lnqMPwlTXQm8gF+UwH72z0lqaRbjr9hqGz0eITA==} + engines: {node: '>=18'} + peerDependencies: + '@cfworker/json-schema': ^4.1.1 + zod: ^3.25 || ^4.0 + peerDependenciesMeta: + '@cfworker/json-schema': + optional: true + '@napi-rs/lzma-linux-x64-gnu@1.5.1': resolution: {integrity: sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==} engines: {node: ^22.20 || ^24.12 || >=25} @@ -379,6 +530,18 @@ packages: os: [linux] libc: [glibc] + '@nodelib/fs.scandir@2.1.5': + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + + '@nodelib/fs.stat@2.0.5': + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + + '@nodelib/fs.walk@1.2.8': + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + '@radix-ui/number@1.1.3': resolution: {integrity: sha512-Road2bidD0uu/1BGDOWNdPI06g0lIRy6IF9GZcIrDK2KGItfor8IQwQa+yM2ERgHM1MmHxaxpTzk0/Jp42lNfA==} @@ -1069,6 +1232,17 @@ packages: '@radix-ui/rect@1.1.3': resolution: {integrity: sha512-JtyZR+mqgBibTo8xea3B6ZRmzZiM/YeVBtUkas6zMuXjAlfIFIW2FgqeM9eLyvEaYX66vr6DJMK+4U6LV0KhNw==} + '@reduxjs/toolkit@2.12.0': + resolution: {integrity: sha512-KiT+RzZbp6mQET+Mg+h2c97+9j1sNflUxQkIHI7Yuzf6Peu+OYpmkn6nbHWmLLWj+1ZODUJFwGZ7gx3L9R9EOw==} + peerDependencies: + react: ^16.9.0 || ^17.0.0 || ^18 || ^19 + react-redux: ^7.2.1 || ^8.1.3 || ^9.0.0 + peerDependenciesMeta: + react: + optional: true + react-redux: + optional: true + '@rolldown/pluginutils@1.0.0-rc.3': resolution: {integrity: sha512-eybk3TjzzzV97Dlj5c+XrBFW57eTNhzod66y9HrBlzJ6NsCrWCp/2kaPS3K9wJmurBC0Tdw4yPjXKZqlznim3Q==} @@ -1210,6 +1384,19 @@ packages: cpu: [x64] os: [win32] + '@sec-ant/readable-stream@0.4.1': + resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} + + '@sindresorhus/merge-streams@4.0.0': + resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==} + engines: {node: '>=18'} + + '@standard-schema/spec@1.1.0': + resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} + + '@standard-schema/utils@0.3.0': + resolution: {integrity: sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==} + '@tailwindcss/node@4.3.3': resolution: {integrity: sha512-/T8IKEsf9VTU6tLjgC7+sv2mOPtQxzE2jMw7u4Tt40Tx+QSZxpzh95/H6cMKoja9XuW7iMdLJYBB0o9G1CaAgg==} @@ -1383,6 +1570,9 @@ packages: engines: {node: '>= 10'} hasBin: true + '@ts-morph/common@0.27.0': + resolution: {integrity: sha512-Wf29UqxWDpc+i61k3oIOzcUfQt79PIT9y/MWfAGlrkjg6lBC1hwDECLXPVJAhWjiGbfBCxZd65F/LIZF3+jeJQ==} + '@types/babel__core@7.20.5': resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} @@ -1398,6 +1588,33 @@ packages: '@types/chai@5.2.3': resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + '@types/d3-array@3.2.2': + resolution: {integrity: sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==} + + '@types/d3-color@3.1.3': + resolution: {integrity: sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==} + + '@types/d3-ease@3.0.2': + resolution: {integrity: sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==} + + '@types/d3-interpolate@3.0.4': + resolution: {integrity: sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==} + + '@types/d3-path@3.1.1': + resolution: {integrity: sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==} + + '@types/d3-scale@4.0.9': + resolution: {integrity: sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==} + + '@types/d3-shape@3.2.0': + resolution: {integrity: sha512-kVd74ta9eof3eJOvbNd1vGKS/XERRyQbT26Og63hIsvDO84cjD5gEOhsXf26w3FSoNlPVz84DOFcKv/oou+fMw==} + + '@types/d3-time@3.0.4': + resolution: {integrity: sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==} + + '@types/d3-timer@3.0.2': + resolution: {integrity: sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==} + '@types/deep-eql@4.0.2': resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} @@ -1415,6 +1632,12 @@ packages: '@types/react@19.2.18': resolution: {integrity: sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==} + '@types/use-sync-external-store@0.0.6': + resolution: {integrity: sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==} + + '@types/validate-npm-package-name@4.0.2': + resolution: {integrity: sha512-lrpDziQipxCEeK5kWxvljWYhUvOiB2A9izZd9B2AFarYAkqZshb4lPbRs7zKEic6eGtH8V/2qJW+dPp9OtF6bw==} + '@vitejs/plugin-react@5.2.0': resolution: {integrity: sha512-YmKkfhOAi3wsB1PhJq5Scj3GXMn3WvtQ/JC0xoopuHoXSdmtdStOpFrYaT1kie2YgFBcIe64ROzMYRjCrYOdYw==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1435,6 +1658,44 @@ packages: '@vitest/spy@5.0.0': resolution: {integrity: sha512-uy+luWBAPw9XfthoHi5AkfHUnuPYEESjl0p/r+meoBnU8bxg5GDQ3Ey8MjcJ6sqahkL4PFyrvfMJJBw7LbU06g==} + accepts@2.0.0: + resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==} + engines: {node: '>= 0.6'} + + ajv-formats@2.1.1: + resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + + ajv-formats@3.0.1: + resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + + ajv@8.20.0: + resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==} + + ansi-colors@4.1.3: + resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} + engines: {node: '>=6'} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-regex@6.3.0: + resolution: {integrity: sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==} + engines: {node: '>=12'} + + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + aria-hidden@1.2.6: resolution: {integrity: sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA==} engines: {node: '>=10'} @@ -1443,16 +1704,60 @@ packages: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} + ast-types@0.16.3: + resolution: {integrity: sha512-FvWoWYfSCM6kRxCSH+MGLHIKKGRL6A6AW7Zek2O32REPQRdg131428uRTKMBYAeRd3XXAaHDS60Wpri7CdKDrA==} + engines: {node: '>=4'} + + atomically@1.7.0: + resolution: {integrity: sha512-Xcz9l0z7y9yQ9rdDaxlmaI4uJHf/T8g9hOEzJcsEqX2SjCj4J20uK7+ldkDHMbpJDK76wF7xEIgxc/vSlsfw5w==} + engines: {node: '>=10.12.0'} + + balanced-match@4.0.4: + resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} + engines: {node: 18 || 20 || >=22} + baseline-browser-mapping@2.11.21: resolution: {integrity: sha512-uh8vpY/1/YyFkunIDFH/12p7/7VdPKA1hejMVEbdkEaWnUz0Hesvx5EbiU6XxjyHZIOju+ZMbQJkRh+es3/spQ==} engines: {node: '>=6.0.0'} hasBin: true + body-parser@2.3.0: + resolution: {integrity: sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==} + engines: {node: '>=18'} + + brace-expansion@5.0.9: + resolution: {integrity: sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==} + engines: {node: 20 || >=22} + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + browserslist@4.28.9: resolution: {integrity: sha512-EWazOblFYUvlGZcfGhPUPmYh3nikUxBVb+y9MJun5f3hBi812X+8MSQTujLBtgK3cf51fJWbWfOjyeO954d+Eg==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true + bundle-name@4.1.0: + resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==} + engines: {node: '>=18'} + + bytes@3.1.2: + resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} + engines: {node: '>= 0.8'} + + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + + call-bound@1.0.4: + resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==} + engines: {node: '>= 0.4'} + + callsites@3.1.0: + resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} + engines: {node: '>=6'} + caniuse-lite@1.0.30001810: resolution: {integrity: sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==} @@ -1460,15 +1765,147 @@ packages: resolution: {integrity: sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==} engines: {node: '>=18'} + chalk@5.6.2: + resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + + class-variance-authority@0.7.1: + resolution: {integrity: sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==} + + cli-cursor@5.0.0: + resolution: {integrity: sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==} + engines: {node: '>=18'} + + cli-spinners@2.9.2: + resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==} + engines: {node: '>=6'} + + clsx@2.1.1: + resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} + engines: {node: '>=6'} + + cn@0.2.6: + resolution: {integrity: sha512-+i4L0zUGgRcEnhsxueVrP7iBGxBx5iD0WOTYg1MwFEu2ZyCmH5Ov2V1cul2Ht5UchRQQgftCf4be/RxspuW6QQ==} + engines: {node: '>=20'} + hasBin: true + + code-block-writer@13.0.3: + resolution: {integrity: sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg==} + + commander@11.1.0: + resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==} + engines: {node: '>=16'} + + commander@14.0.3: + resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==} + engines: {node: '>=20'} + + conf@10.2.0: + resolution: {integrity: sha512-8fLl9F04EJqjSqH+QjITQfJF8BrOVaYr1jewVgSRAEWePfxT0sku4w2hrGQ60BC/TNLGQ2pgxNlTbWQmMPFvXg==} + engines: {node: '>=12'} + + content-disposition@1.1.0: + resolution: {integrity: sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==} + engines: {node: '>=18'} + + content-type@1.0.5: + resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} + engines: {node: '>= 0.6'} + + content-type@2.1.0: + resolution: {integrity: sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==} + engines: {node: '>=18'} + convert-source-map@2.0.0: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + cookie-signature@1.2.2: + resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==} + engines: {node: '>=6.6.0'} + + cookie@0.7.2: + resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} + engines: {node: '>= 0.6'} + + cors@2.8.6: + resolution: {integrity: sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==} + engines: {node: '>= 0.10'} + + cosmiconfig@9.0.2: + resolution: {integrity: sha512-gtTZxTDau1wL7Y7zifc2dd8jHSK/k6BTx/2Xp/BpdlAdnlYWFVt7qhJqgwi7637yRwRQ3qL4ZidbB4I8tA5VOg==} + engines: {node: '>=14'} + peerDependencies: + typescript: '>=4.9.5' + peerDependenciesMeta: + typescript: + optional: true + crelt@1.0.7: resolution: {integrity: sha512-aK6BbWfhf4U/wCcLHKPJl/xa6VkVstRaPywWtMKGwuOLc/wZTyQYuoxgvZnNsBvv7Kg3YTBQYYBCggcviQczuA==} + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + + cssesc@3.0.0: + resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} + engines: {node: '>=4'} + hasBin: true + csstype@3.2.3: resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==} + d3-array@3.2.4: + resolution: {integrity: sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==} + engines: {node: '>=12'} + + d3-color@3.1.0: + resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==} + engines: {node: '>=12'} + + d3-ease@3.0.1: + resolution: {integrity: sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==} + engines: {node: '>=12'} + + d3-format@3.1.2: + resolution: {integrity: sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==} + engines: {node: '>=12'} + + d3-interpolate@3.0.1: + resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==} + engines: {node: '>=12'} + + d3-path@3.1.0: + resolution: {integrity: sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==} + engines: {node: '>=12'} + + d3-scale@4.0.2: + resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==} + engines: {node: '>=12'} + + d3-shape@3.2.0: + resolution: {integrity: sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==} + engines: {node: '>=12'} + + d3-time-format@4.1.0: + resolution: {integrity: sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==} + engines: {node: '>=12'} + + d3-time@3.1.0: + resolution: {integrity: sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==} + engines: {node: '>=12'} + + d3-timer@3.0.1: + resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==} + engines: {node: '>=12'} + + date-fns@4.4.0: + resolution: {integrity: sha512-+1UMbeh68lH1SegH83CGWwpb6OHHbpSgr3+s5Eww5M4CAgswBpoWS0AjTOfEJ33HiYKz1hdj/KTFprzXHmq/6w==} + + debounce-fn@4.0.0: + resolution: {integrity: sha512-8pYCQiL9Xdcg0UPSD3d+0KMlOjp+KGU5EPwYddgzQ7DATsg4fuUDjQtsYLmWjnk2obnNHgV3vE2Y4jejSOJVBQ==} + engines: {node: '>=10'} + debug@4.4.3: resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} engines: {node: '>=6.0'} @@ -1478,6 +1915,41 @@ packages: supports-color: optional: true + decimal.js-light@2.5.1: + resolution: {integrity: sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==} + + dedent@1.7.2: + resolution: {integrity: sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA==} + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true + + deepmerge@4.3.1: + resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} + engines: {node: '>=0.10.0'} + + default-browser-id@5.0.1: + resolution: {integrity: sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==} + engines: {node: '>=18'} + + default-browser@5.5.1: + resolution: {integrity: sha512-m1pAzaJgZ/gssEqlOhJkPJp8Xly7QyW6xcrkUa2KKcDeDSEMP7X8xipU3snUcfisTQx0w1AGae+9UtJSfVnXGw==} + engines: {node: '>=18'} + + define-lazy-prop@2.0.0: + resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==} + engines: {node: '>=8'} + + define-lazy-prop@3.0.0: + resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==} + engines: {node: '>=12'} + + depd@2.0.0: + resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} + engines: {node: '>= 0.8'} + detect-libc@2.1.2: resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} engines: {node: '>=8'} @@ -1485,16 +1957,68 @@ packages: detect-node-es@1.1.0: resolution: {integrity: sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==} + diff@8.0.4: + resolution: {integrity: sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==} + engines: {node: '>=0.3.1'} + + dot-prop@6.0.1: + resolution: {integrity: sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==} + engines: {node: '>=10'} + + dotenv@17.4.2: + resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==} + engines: {node: '>=12'} + + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + + ee-first@1.1.1: + resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + electron-to-chromium@1.5.422: resolution: {integrity: sha512-UvA/32XqrLDdZSn7Jllo1AYNcWji/G0d5M0GTViE7KoGBiMunw3a34Sb2KO4ZZyrSEhqsxFoVhWWJshdyfKqJA==} + emoji-regex@10.6.0: + resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==} + + encodeurl@2.0.0: + resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==} + engines: {node: '>= 0.8'} + enhanced-resolve@5.24.5: resolution: {integrity: sha512-L1l8TNvomm6UVW5B253AGxQagSQr+vGwhMlrrfRS2qmhx46AMpMVJKQYLvWYbysTMY8VoicOvzHzoHMbyzB+4A==} engines: {node: '>=10.13.0'} + enquirer@2.4.1: + resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==} + engines: {node: '>=8.6'} + + env-paths@2.2.1: + resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} + engines: {node: '>=6'} + + error-ex@1.3.4: + resolution: {integrity: sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==} + + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + + es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + es-module-lexer@2.3.2: resolution: {integrity: sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==} + es-object-atoms@1.1.2: + resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==} + engines: {node: '>= 0.4'} + + es-toolkit@1.52.0: + resolution: {integrity: sha512-XTNEJQh1tY1ZJVcf6ayP/2n4ZPyaHlW2FWs7xvw5ddPuhUVjLD3olQVQS7kf58JbAB48iL0uL/jerTrjtV3lDA==} + esbuild@0.28.2: resolution: {integrity: sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==} engines: {node: '>=18'} @@ -1504,13 +2028,67 @@ packages: resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} engines: {node: '>=6'} + escape-html@1.0.3: + resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} + + esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + etag@1.8.1: + resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} + engines: {node: '>= 0.6'} + + eventemitter3@5.0.4: + resolution: {integrity: sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==} + + eventsource-parser@3.1.1: + resolution: {integrity: sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==} + engines: {node: '>=18.0.0'} + + eventsource@3.0.7: + resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==} + engines: {node: '>=18.0.0'} + + execa@5.1.1: + resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} + engines: {node: '>=10'} + + execa@9.6.1: + resolution: {integrity: sha512-9Be3ZoN4LmYR90tUoVu2te2BsbzHfhJyfEiAVfz7N5/zv+jduIfLrV2xdQXOHbaD6KgpGdO9PRPM1Y4Q9QkPkA==} + engines: {node: ^18.19.0 || >=20.5.0} + expect-type@1.4.0: resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} engines: {node: '>=12.0.0'} + express-rate-limit@8.7.0: + resolution: {integrity: sha512-hOwV7WOxXfjRpAM1DSJWZDXx3GhplwD8IfwuwvogD8i1Qnkgosw/H45s4ZnFAUHDAhPjlY9hLBvJhKmGMyY26g==} + engines: {node: '>= 16'} + peerDependencies: + express: '>= 4.11' + + express@5.2.1: + resolution: {integrity: sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==} + engines: {node: '>= 18'} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-glob@3.3.3: + resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} + engines: {node: '>=8.6.0'} + + fast-uri@3.1.7: + resolution: {integrity: sha512-dOvZVzjdZdz7phd9v6jCbwxrBW3fK6n8Rc0CtdmM4bumzMnxywBYhuph6J819RRw/ku+rLbelwfMunktuzVVHg==} + + fastq@1.20.3: + resolution: {integrity: sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==} + fdir@6.5.0: resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} engines: {node: '>=12.0.0'} @@ -1520,39 +2098,280 @@ packages: picomatch: optional: true + figures@6.1.0: + resolution: {integrity: sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==} + engines: {node: '>=18'} + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + finalhandler@2.1.1: + resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==} + engines: {node: '>= 18.0.0'} + + find-up@3.0.0: + resolution: {integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==} + engines: {node: '>=6'} + + forwarded@0.2.0: + resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} + engines: {node: '>= 0.6'} + + fresh@2.0.0: + resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} + engines: {node: '>= 0.8'} + + fs-extra@11.4.0: + resolution: {integrity: sha512-EQsFzMUJkCKGr1ePqlYADkIUmHW1s3ZXr5Yqy6wbGrfUCphpl2maM/kyOIRA2HpP3AaFQTZXD4ldjek+nccddA==} + engines: {node: '>=14.14'} + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + fuzzysort@3.1.0: + resolution: {integrity: sha512-sR9BNCjBg6LNgwvxlBd0sBABvQitkLzoVY9MYYROQVX/FvfJ4Mai9LsGhDgd8qYdds0bY77VzYd5iuB+v5rwQQ==} + gensync@1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} + get-east-asian-width@1.6.0: + resolution: {integrity: sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==} + engines: {node: '>=18'} + + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + get-nonce@1.0.1: resolution: {integrity: sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==} engines: {node: '>=6'} + get-own-enumerable-keys@1.0.0: + resolution: {integrity: sha512-PKsK2FSrQCyxcGHsGrLDcK0lx+0Ke+6e8KFFozA9/fIQLhQzPaRvJFdcz7+Axg3jUH/Mq+NI4xa5u/UT2tQskA==} + engines: {node: '>=14.16'} + + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + + get-stream@6.0.1: + resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} + engines: {node: '>=10'} + + get-stream@9.0.1: + resolution: {integrity: sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==} + engines: {node: '>=18'} + + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - jiti@2.7.0: - resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==} - hasBin: true + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} - js-tokens@4.0.0: - resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + hasown@2.0.4: + resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==} + engines: {node: '>= 0.4'} - jsesc@3.1.0: - resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==} + hono@4.13.7: + resolution: {integrity: sha512-c8/gF9ac8Y78/agExVocyLevgR+JlpNB444Py0FSX8pJoPdYUfUzRcXtYEYGwt6l19qIlVZPN5Mfsw9jFShmQQ==} + engines: {node: '>=16.9.0'} + + http-errors@2.0.1: + resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==} + engines: {node: '>= 0.8'} + + human-signals@2.1.0: + resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} + engines: {node: '>=10.17.0'} + + human-signals@8.0.1: + resolution: {integrity: sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ==} + engines: {node: '>=18.18.0'} + + iconv-lite@0.7.3: + resolution: {integrity: sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==} + engines: {node: '>=0.10.0'} + + ignore@5.3.2: + resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} + engines: {node: '>= 4'} + + immer@10.2.0: + resolution: {integrity: sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw==} + + immer@11.1.18: + resolution: {integrity: sha512-EQyQtLiYW029lyoczMl/Hh4Xu7cDecSc58JRYpHyL4tIAu3eqd1yJzQX04d2BZHDkzFFvm6qJEJWOtfDSWAXbQ==} + + import-fresh@3.3.1: + resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==} + engines: {node: '>=6'} + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + internmap@2.0.3: + resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==} + engines: {node: '>=12'} + + ip-address@10.7.0: + resolution: {integrity: sha512-BGFsyJd5mpXp3rK6jIdADLNgpJUK1jnjzvYF8lK+VyDab9JAmqN0YOKDdP17HlgKb2+ehPgDc8EtnRLbGCAMhA==} + engines: {node: '>= 12'} + + ipaddr.js@1.9.1: + resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} + engines: {node: '>= 0.10'} + + is-arrayish@0.2.1: + resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} + + is-docker@2.2.1: + resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} + engines: {node: '>=8'} + hasBin: true + + is-docker@3.0.0: + resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + hasBin: true + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-in-ssh@1.0.0: + resolution: {integrity: sha512-jYa6Q9rH90kR1vKB6NM7qqd1mge3Fx4Dhw5TVlK1MUBqhEOuCagrEHMevNuCcbECmXZ0ThXkRm+Ymr51HwEPAw==} + engines: {node: '>=20'} + + is-inside-container@1.0.0: + resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==} + engines: {node: '>=14.16'} + hasBin: true + + is-interactive@2.0.0: + resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} + engines: {node: '>=12'} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + is-obj@2.0.0: + resolution: {integrity: sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==} + engines: {node: '>=8'} + + is-obj@3.0.0: + resolution: {integrity: sha512-IlsXEHOjtKhpN8r/tRFj2nDyTmHvcfNeu/nrRIcXE17ROeatXchkojffa1SpdqW4cr/Fj6QkEf/Gn4zf6KKvEQ==} + engines: {node: '>=12'} + + is-plain-obj@4.1.0: + resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} + engines: {node: '>=12'} + + is-promise@4.0.0: + resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} + + is-regexp@3.1.0: + resolution: {integrity: sha512-rbku49cWloU5bSMI+zaRaXdQHXnthP6DZ/vLnfdSKyL4zUzuWnomtOEiZZOd+ioQ+avFo/qau3KPTc7Fjy1uPA==} + engines: {node: '>=12'} + + is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + + is-stream@4.0.1: + resolution: {integrity: sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==} + engines: {node: '>=18'} + + is-unicode-supported@1.3.0: + resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} + engines: {node: '>=12'} + + is-unicode-supported@2.1.0: + resolution: {integrity: sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==} + engines: {node: '>=18'} + + is-wsl@2.2.0: + resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} + engines: {node: '>=8'} + + is-wsl@3.1.1: + resolution: {integrity: sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==} + engines: {node: '>=16'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + isexe@3.1.5: + resolution: {integrity: sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w==} + engines: {node: '>=18'} + + jiti@2.7.0: + resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==} + hasBin: true + + jose@6.2.12: + resolution: {integrity: sha512-9NiFmJEex0sy2Dk58j2UGBSHgUs2ypF9eZSu4L6vjOX3Dp96Sw1F3uL+H+D1sx02jZZdzUT0HgvCy59CuvXcWw==} + + js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + + js-yaml@4.3.2: + resolution: {integrity: sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==} + hasBin: true + + jsesc@3.1.0: + resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==} engines: {node: '>=6'} hasBin: true + json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + + json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + + json-schema-typed@7.0.3: + resolution: {integrity: sha512-7DE8mpG+/fVw+dTpjbxnx47TaMnDfOI1jwft9g1VybltZCduyRQPJPvc+zzKY9WPHxhPWczyFuYa6I8Mw4iU5A==} + + json-schema-typed@8.0.2: + resolution: {integrity: sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==} + json5@2.2.3: resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} engines: {node: '>=6'} hasBin: true + jsonfile@6.2.1: + resolution: {integrity: sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==} + + kleur@3.0.3: + resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} + engines: {node: '>=6'} + + kleur@4.1.5: + resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} + engines: {node: '>=6'} + lightningcss-android-arm64@1.32.0: resolution: {integrity: sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==} engines: {node: '>= 12.0.0'} @@ -1627,15 +2446,81 @@ packages: resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==} engines: {node: '>= 12.0.0'} + lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + + locate-path@3.0.0: + resolution: {integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==} + engines: {node: '>=6'} + + log-symbols@6.0.0: + resolution: {integrity: sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==} + engines: {node: '>=18'} + lru-cache@5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + lucide-react@1.45.0: + resolution: {integrity: sha512-yH1ubCAduho9UR7oJhRXIQXogksRILBiTuZC4/bQIGeB9JOkxMlSuEHyyZpo1Z3S0yWJO2KTSUZbjiNvVxeOUw==} + peerDependencies: + react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0 + magic-string@0.30.21: resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} magic-string@1.3.1: resolution: {integrity: sha512-rm91zr2Ou+XueDTohjQQjdQEcYM6zVi8KVUCG8Ec3vHwUEKrhSdCNyfuIywkA6hcCAteIn0ZOtAHA6eGpiX+Pg==} + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + + media-typer@1.1.1: + resolution: {integrity: sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==} + engines: {node: '>= 0.8'} + + merge-descriptors@2.0.0: + resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==} + engines: {node: '>=18'} + + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + + mime-db@1.54.0: + resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} + engines: {node: '>= 0.6'} + + mime-types@3.0.2: + resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==} + engines: {node: '>=18'} + + mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + + mimic-fn@3.1.0: + resolution: {integrity: sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==} + engines: {node: '>=8'} + + mimic-function@5.0.1: + resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==} + engines: {node: '>=18'} + + minimatch@10.2.6: + resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==} + engines: {node: 18 || 20 || >=22} + + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -1644,25 +2529,165 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + negotiator@1.1.0: + resolution: {integrity: sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==} + engines: {node: '>=18'} + node-releases@2.0.54: resolution: {integrity: sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==} engines: {node: '>=18'} + npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} + + npm-run-path@6.0.0: + resolution: {integrity: sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA==} + engines: {node: '>=18'} + + object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + + object-inspect@1.13.4: + resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} + engines: {node: '>= 0.4'} + + object-treeify@1.1.33: + resolution: {integrity: sha512-EFVjAYfzWqWsBMRHPMAXLCDIJnpMhdWAqR7xG6M6a2cs6PMFpl/+Z20w9zDW4vkxOFfddegBKq9Rehd0bxWE7A==} + engines: {node: '>= 10'} + obug@2.2.1: resolution: {integrity: sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==} engines: {node: '>=12.20.0'} + on-finished@2.4.1: + resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} + engines: {node: '>= 0.8'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + + onetime@7.0.0: + resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==} + engines: {node: '>=18'} + + open@11.0.3: + resolution: {integrity: sha512-b3souUgU0VaAvMmzA4+9cRgrOgMdE0vc9H9VhQ0FYnjjcyZ8R/f9DiwMU9V8rl+vjf05On9UJhbgb06fsTs87Q==} + engines: {node: '>=20'} + + open@8.4.2: + resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==} + engines: {node: '>=12'} + + ora@8.2.0: + resolution: {integrity: sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==} + engines: {node: '>=18'} + + p-limit@2.3.0: + resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} + engines: {node: '>=6'} + + p-locate@3.0.0: + resolution: {integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==} + engines: {node: '>=6'} + + p-try@2.2.0: + resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} + engines: {node: '>=6'} + + parent-module@1.0.1: + resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} + engines: {node: '>=6'} + + parse-json@5.2.0: + resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} + engines: {node: '>=8'} + + parse-ms@4.0.0: + resolution: {integrity: sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==} + engines: {node: '>=18'} + + parseurl@1.3.3: + resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} + engines: {node: '>= 0.8'} + + path-browserify@1.0.1: + resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} + + path-exists@3.0.0: + resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} + engines: {node: '>=4'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-key@4.0.0: + resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} + engines: {node: '>=12'} + + path-to-regexp@8.4.2: + resolution: {integrity: sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==} + picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + picomatch@2.3.2: + resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} + engines: {node: '>=8.6'} + picomatch@4.0.7: resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} engines: {node: '>=12'} + pkce-challenge@5.0.1: + resolution: {integrity: sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==} + engines: {node: '>=16.20.0'} + + pkg-up@3.1.0: + resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==} + engines: {node: '>=8'} + + postcss-selector-parser@7.1.6: + resolution: {integrity: sha512-7qASPzhKF2l2KLboRZux8CCTRMdGiV08vWmyKzPz22qZ7ZjQBOeY7rNzNoCLSUiftJ7HUq0GERHmxw/t0dCdMw==} + engines: {node: '>=4'} + postcss@8.5.28: resolution: {integrity: sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==} engines: {node: ^10 || ^12 || >=14} + powershell-utils@0.1.0: + resolution: {integrity: sha512-dM0jVuXJPsDN6DvRpea484tCUaMiXWjuCn++HGTqUWzGDjv5tZkEZldAJ/UMlqRYGFrD/etByo4/xOuC/snX2A==} + engines: {node: '>=20'} + + powershell-utils@0.2.1: + resolution: {integrity: sha512-C+y9x90UElAddDZmV4qOx9W53B61PO7cIqWz2dQsWlwswuq4mr8NEwytdGKboYbQlGZ3awrkTeNvcZiZNHnQ8A==} + engines: {node: '>=20'} + + pretty-ms@9.3.1: + resolution: {integrity: sha512-HzMy3Geq23nVALD/M2LliU+F+M+gVNsvkQWWqeBZ8HDiCgzo6YPJ/Omrmtq24EFrIsk0a3EkQGEd7bDOo+IhGA==} + engines: {node: '>=18'} + + prompts@2.4.2: + resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} + engines: {node: '>= 6'} + + proxy-addr@2.0.7: + resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} + engines: {node: '>= 0.10'} + + qs@6.16.0: + resolution: {integrity: sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==} + engines: {node: '>=0.6'} + + queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + radix-ui@1.6.7: resolution: {integrity: sha512-QBdhh1arIEUvPC0dQ5+nwWAxt7+N+oP/9jPwjJkGFoSk/sqxg32gJtSXGtFh8frAIcS6oC9cx2Q+7KYCQLOAeA==} peerDependencies: @@ -1676,11 +2701,44 @@ packages: '@types/react-dom': optional: true + range-parser@1.3.0: + resolution: {integrity: sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==} + engines: {node: '>= 0.6'} + + raw-body@3.0.2: + resolution: {integrity: sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==} + engines: {node: '>= 0.10'} + + react-day-picker@10.0.1: + resolution: {integrity: sha512-eNh6BlwcYInWaJtRv18mXQ06Ys/H6rdTZAnTaSdOYJuTpwP1JMCHNd1FDRadA+gbeinq+psdULN5Xnowy9mV8w==} + engines: {node: '>=18'} + peerDependencies: + '@types/react': '>=16.8.0' + react: '>=16.8.0' + peerDependenciesMeta: + '@types/react': + optional: true + react-dom@19.2.8: resolution: {integrity: sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==} peerDependencies: react: ^19.2.8 + react-is@19.3.0: + resolution: {integrity: sha512-UpMYezM4v5/18F28aC66AEsjXIgE02kyEMH6yLdgLXu/UTfa1Ntwck/nNLrbqJsEXW7gPb0coNO9FQse9WTovA==} + + react-redux@9.3.0: + resolution: {integrity: sha512-KQopgqFo/p/fgmAs5qz6p5RWaNAzq40WAu7fJIXnQpYxFPbJYtsJPWvGeF2rOBaY/kEuV77AVsX8TsQzKm+A/g==} + peerDependencies: + '@types/react': ^18.2.25 || ^19 + react: ^18.0 || ^19 + redux: ^5.0.0 + peerDependenciesMeta: + '@types/react': + optional: true + redux: + optional: true + react-refresh@0.18.0: resolution: {integrity: sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==} engines: {node: '>=0.10.0'} @@ -1705,6 +2763,12 @@ packages: '@types/react': optional: true + react-resizable-panels@4.12.4: + resolution: {integrity: sha512-SOsSj4e9U7vxL15MbgTfl35IO4vxSW4Xb0b1gtJVbRPWv7FOezcgOA00Mi0jP8XqC3y7jOQxpsGs/9zLKHPitA==} + peerDependencies: + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + react-style-singleton@2.2.3: resolution: {integrity: sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ==} engines: {node: '>=10'} @@ -1719,11 +2783,67 @@ packages: resolution: {integrity: sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==} engines: {node: '>=0.10.0'} + recast@0.23.21: + resolution: {integrity: sha512-mFAyJq9vUbSTARLZUvAEf1z3YxlvAwswbmxMx2mPA/MSm4KmpwvwvhsH/NIrZhyOuwD60Lzyw2qh83uCbgTPYw==} + engines: {node: '>= 4'} + + recharts@3.8.0: + resolution: {integrity: sha512-Z/m38DX3L73ExO4Tpc9/iZWHmHnlzWG4njQbxsF5aSjwqmHNDDIm0rdEBArkwsBvR8U6EirlEHiQNYWCVh9sGQ==} + engines: {node: '>=18'} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + react-is: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + + redux-thunk@3.1.0: + resolution: {integrity: sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==} + peerDependencies: + redux: ^5.0.0 + + redux@5.0.1: + resolution: {integrity: sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==} + + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + + reselect@5.1.1: + resolution: {integrity: sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==} + + reselect@5.3.0: + resolution: {integrity: sha512-XGoLeRAVzUTcJ1qkxPQhDJyIZ5d6zzZD9nT7AEZOaaU9UbWclhycElmhO+VD5bFeLuzhPBaOV2oXC8uG35ZSpg==} + + resolve-from@4.0.0: + resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} + engines: {node: '>=4'} + + restore-cursor@5.1.0: + resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==} + engines: {node: '>=18'} + + reusify@1.1.0: + resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + rollup@4.63.1: resolution: {integrity: sha512-3Df9jsstwhccuEfmAMi9l8XUh/GOkVObmFTU7CCVBysEbcOZLl84jCtaAZMcPiMz2EGKsATzQcU+Xr3n/wU6cg==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + router@2.2.0: + resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==} + engines: {node: '>= 18'} + + run-applescript@7.1.0: + resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==} + engines: {node: '>=18'} + + run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + + safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + scheduler@0.27.0: resolution: {integrity: sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==} @@ -1731,22 +2851,144 @@ packages: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true + semver@7.8.5: + resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==} + engines: {node: '>=10'} + hasBin: true + + send@1.2.1: + resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==} + engines: {node: '>= 18'} + + serve-static@2.2.1: + resolution: {integrity: sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==} + engines: {node: '>= 18'} + + setprototypeof@1.2.0: + resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + + shadcn@4.21.0: + resolution: {integrity: sha512-UU2mFNusW8C5rvadKdH69vERYZqUlOOlXBcf0MYhYLdTGP6DPti7X4qovCu+RTfCqsAgq/T+YfE0Vnttxh9aiw==} + engines: {node: '>=20.18.1'} + hasBin: true + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + side-channel-list@1.0.1: + resolution: {integrity: sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==} + engines: {node: '>= 0.4'} + + side-channel-map@1.0.1: + resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==} + engines: {node: '>= 0.4'} + + side-channel-weakmap@1.0.2: + resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==} + engines: {node: '>= 0.4'} + + side-channel@1.1.1: + resolution: {integrity: sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==} + engines: {node: '>= 0.4'} + siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + + sisteransi@1.0.5: + resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + + smart-buffer@4.2.0: + resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} + engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} + + socks@2.8.10: + resolution: {integrity: sha512-e0VyvkVTwVYViNovRkZ9aodhxVlyoMn7eJhVUPxZ+eK9P/7CBkxvvsBOHqFPEH416726W8tLXXXjKwqgTErrCQ==} + engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} + + sonner@2.0.8: + resolution: {integrity: sha512-UM/ByIoFra8yzV75n1o0Puu0bw5U/9UNnDacrJNspekBewIfsQ3D6ez1nvlWpt7aTsO6rujQtifBpycwIivqlg==} + peerDependencies: + '@types/react': ^18.0.0 || ^19.0.0 + react: ^18.0.0 || ^19.0.0 || ^19.0.0-rc + react-dom: ^18.0.0 || ^19.0.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + source-map-js@1.2.1: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + statuses@2.0.2: + resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} + engines: {node: '>= 0.8'} + std-env@4.2.0: resolution: {integrity: sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==} + stdin-discarder@0.2.2: + resolution: {integrity: sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==} + engines: {node: '>=18'} + + string-width@7.2.0: + resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==} + engines: {node: '>=18'} + + stringify-object@5.0.0: + resolution: {integrity: sha512-zaJYxz2FtcMb4f+g60KsRNFOpVMUyuJgA51Zi5Z1DOTC3S59+OQiVOzE9GZt0x72uBGWKsQIuBKeF9iusmKFsg==} + engines: {node: '>=14.16'} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-ansi@7.2.0: + resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==} + engines: {node: '>=12'} + + strip-bom@3.0.0: + resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} + engines: {node: '>=4'} + + strip-final-newline@2.0.0: + resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} + engines: {node: '>=6'} + + strip-final-newline@4.0.0: + resolution: {integrity: sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==} + engines: {node: '>=18'} + style-mod@4.1.3: resolution: {integrity: sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==} + systeminformation@5.33.10: + resolution: {integrity: sha512-/NXbMVASt2UbSVgmWto4aBTIAeuYY7zOELpZybmNxqpsrbo5uYHpuEPf5nkyrPng0uG5YOb+Yv6s0FyKY4mDQg==} + engines: {node: '>=10.0.0'} + os: [darwin, linux, win32, freebsd, openbsd, netbsd, sunos, android] + hasBin: true + + tailwind-merge@3.7.0: + resolution: {integrity: sha512-XPPUyAc+cvspz3lHTcR/QgPfW2A0lv/xQNIjX3HGhLR+Nq2lHaLq5MtTesHn8GUr3W3DguT2KT5x3NVgRtYwmA==} + tailwindcss@4.3.3: resolution: {integrity: sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ==} @@ -1754,6 +2996,9 @@ packages: resolution: {integrity: sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==} engines: {node: '>=6'} + tiny-invariant@1.3.3: + resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==} + tinybench@6.1.4: resolution: {integrity: sha512-9APumHG7r4yOk4X4WlkmE71aZcv1gvin1czO3OQ1U9iJcFA5Ja/ygyb0vPOVHTthFozUYs8CLoLUlM8grb2lTQ==} engines: {node: '>=20.0.0'} @@ -1766,9 +3011,31 @@ packages: resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} engines: {node: '>=12.0.0'} + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + toidentifier@1.0.1: + resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} + engines: {node: '>=0.6'} + + ts-morph@26.0.0: + resolution: {integrity: sha512-ztMO++owQnz8c/gIENcM9XfCEzgoGphTv+nKpYNM1bgsdOVC/jRZuEBf6N+mLLDNg68Kl+GgUZfOySaRiG1/Ug==} + + tsconfig-paths@4.2.0: + resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==} + engines: {node: '>=6'} + tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + tw-animate-css@1.4.0: + resolution: {integrity: sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ==} + + type-is@2.1.0: + resolution: {integrity: sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==} + engines: {node: '>= 18'} + typescript@5.9.3: resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} engines: {node: '>=14.17'} @@ -1777,6 +3044,22 @@ packages: undici-types@8.9.0: resolution: {integrity: sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==} + undici@7.29.1: + resolution: {integrity: sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q==} + engines: {node: '>=20.18.1'} + + unicorn-magic@0.3.0: + resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} + engines: {node: '>=18'} + + universalify@2.0.1: + resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} + engines: {node: '>= 10.0.0'} + + unpipe@1.0.0: + resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} + engines: {node: '>= 0.8'} + update-browserslist-db@1.3.2: resolution: {integrity: sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw==} hasBin: true @@ -1803,6 +3086,25 @@ packages: '@types/react': optional: true + use-sync-external-store@1.7.0: + resolution: {integrity: sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + + util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + + validate-npm-package-name@7.0.2: + resolution: {integrity: sha512-hVDIBwsRruT73PbK7uP5ebUt+ezEtCmzZz3F59BSr2F6OVFnJ/6h8liuvdLrQ88Xmnk6/+xGGuq+pG9WwTuy3A==} + engines: {node: ^20.17.0 || >=22.9.0} + + vary@1.1.2: + resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} + engines: {node: '>= 0.8'} + + victory-vendor@37.3.6: + resolution: {integrity: sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==} + vite@7.3.6: resolution: {integrity: sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1887,14 +3189,47 @@ packages: w3c-keyname@2.2.8: resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==} + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + which@4.0.0: + resolution: {integrity: sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==} + engines: {node: ^16.13.0 || >=18.0.0} + hasBin: true + why-is-node-running@2.3.0: resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} engines: {node: '>=8'} hasBin: true + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + wsl-utils@1.0.0: + resolution: {integrity: sha512-Hl0ZOAs672vg+06kfujwRhoS6/jehvULrlFkuF2dRu6pHgA8U06h3xqNIqNNU1LTXPcedxByAR4GS6pwQK0mgA==} + engines: {node: '>=20'} + yallist@3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + yocto-spinner@1.2.2: + resolution: {integrity: sha512-DODGl1wJjA/s5pnJFKau9lIYHT81lnhob1i3e1TjxZRxEhWRKl74nTbWE6H5KlkViQQTo/Z29YFdxzTZAMY3ng==} + engines: {node: '>=18.19'} + + yoctocolors@2.2.0: + resolution: {integrity: sha512-xYqdZFUK/VYazNl/oCDYN+3WloWQwMfZxBoiNt6qNyk+xfOdi598muWE42rNZFp1kNOiqW936q5RhUdnpqElSg==} + engines: {node: '>=18'} + + zod-to-json-schema@3.25.2: + resolution: {integrity: sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==} + peerDependencies: + zod: ^3.25.28 || ^4 + + zod@3.25.76: + resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==} + snapshots: '@babel/code-frame@7.29.7': @@ -1933,6 +3268,10 @@ snapshots: '@jridgewell/trace-mapping': 0.3.31 jsesc: 3.1.0 + '@babel/helper-annotate-as-pure@7.29.7': + dependencies: + '@babel/types': 7.29.8 + '@babel/helper-compilation-targets@7.29.7': dependencies: '@babel/compat-data': 7.29.7 @@ -1941,8 +3280,28 @@ snapshots: lru-cache: 5.1.1 semver: 6.3.1 + '@babel/helper-create-class-features-plugin@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-annotate-as-pure': 7.29.7 + '@babel/helper-member-expression-to-functions': 7.29.7 + '@babel/helper-optimise-call-expression': 7.29.7 + '@babel/helper-replace-supers': 7.29.7(@babel/core@7.29.7) + '@babel/helper-skip-transparent-expression-wrappers': 7.29.7 + '@babel/traverse': 7.29.8 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + '@babel/helper-globals@7.29.7': {} + '@babel/helper-member-expression-to-functions@7.29.7': + dependencies: + '@babel/traverse': 7.29.8 + '@babel/types': 7.29.8 + transitivePeerDependencies: + - supports-color + '@babel/helper-module-imports@7.29.7': dependencies: '@babel/traverse': 7.29.8 @@ -1959,8 +3318,28 @@ snapshots: transitivePeerDependencies: - supports-color + '@babel/helper-optimise-call-expression@7.29.7': + dependencies: + '@babel/types': 7.29.8 + '@babel/helper-plugin-utils@7.29.7': {} + '@babel/helper-replace-supers@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-member-expression-to-functions': 7.29.7 + '@babel/helper-optimise-call-expression': 7.29.7 + '@babel/traverse': 7.29.8 + transitivePeerDependencies: + - supports-color + + '@babel/helper-skip-transparent-expression-wrappers@7.29.7': + dependencies: + '@babel/traverse': 7.29.8 + '@babel/types': 7.29.8 + transitivePeerDependencies: + - supports-color + '@babel/helper-string-parser@7.29.7': {} '@babel/helper-validator-identifier@7.29.7': {} @@ -1976,6 +3355,24 @@ snapshots: dependencies: '@babel/types': 7.29.8 + '@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-modules-commonjs@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7) + '@babel/helper-plugin-utils': 7.29.7 + transitivePeerDependencies: + - supports-color + '@babel/plugin-transform-react-jsx-self@7.29.7(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 @@ -1986,6 +3383,30 @@ snapshots: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + '@babel/plugin-transform-typescript@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-annotate-as-pure': 7.29.7 + '@babel/helper-create-class-features-plugin': 7.29.7(@babel/core@7.29.7) + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-skip-transparent-expression-wrappers': 7.29.7 + '@babel/plugin-syntax-typescript': 7.29.7(@babel/core@7.29.7) + transitivePeerDependencies: + - supports-color + + '@babel/preset-typescript@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-validator-option': 7.29.7 + '@babel/plugin-syntax-jsx': 7.29.7(@babel/core@7.29.7) + '@babel/plugin-transform-modules-commonjs': 7.29.7(@babel/core@7.29.7) + '@babel/plugin-transform-typescript': 7.29.7(@babel/core@7.29.7) + transitivePeerDependencies: + - supports-color + + '@babel/runtime@7.29.7': {} + '@babel/template@7.29.7': dependencies: '@babel/code-frame': 7.29.7 @@ -2009,6 +3430,31 @@ snapshots: '@babel/helper-string-parser': 7.29.7 '@babel/helper-validator-identifier': 7.29.7 + '@base-ui/react@1.8.0(@date-fns/tz@1.5.0)(@types/react@19.2.18)(date-fns@4.4.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)': + dependencies: + '@babel/runtime': 7.29.7 + '@base-ui/utils': 0.4.0(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) + '@floating-ui/react-dom': 2.1.9(react-dom@19.2.8(react@19.2.8))(react@19.2.8) + '@floating-ui/utils': 0.2.12 + react: 19.2.8 + react-dom: 19.2.8(react@19.2.8) + use-sync-external-store: 1.7.0(react@19.2.8) + optionalDependencies: + '@date-fns/tz': 1.5.0 + '@types/react': 19.2.18 + date-fns: 4.4.0 + + '@base-ui/utils@0.4.0(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)': + dependencies: + '@babel/runtime': 7.29.7 + '@floating-ui/utils': 0.2.12 + react: 19.2.8 + react-dom: 19.2.8(react@19.2.8) + reselect: 5.3.0 + use-sync-external-store: 1.7.0(react@19.2.8) + optionalDependencies: + '@types/react': 19.2.18 + '@codemirror/autocomplete@6.20.3': dependencies: '@codemirror/language': 6.12.4 @@ -2053,6 +3499,29 @@ snapshots: style-mod: 4.1.3 w3c-keyname: 2.2.8 + '@date-fns/tz@1.5.0': {} + + '@dotenvx/dotenvx@1.75.1': + dependencies: + '@dotenvx/primitives': 0.8.0 + commander: 11.1.0 + conf: 10.2.0 + dotenv: 17.4.2 + enquirer: 2.4.1 + env-paths: 2.2.1 + execa: 5.1.1 + fdir: 6.5.0(picomatch@4.0.7) + ignore: 5.3.2 + object-treeify: 1.1.33 + open: 8.4.2 + picomatch: 4.0.7 + systeminformation: 5.33.10 + undici: 7.29.1 + which: 4.0.0 + yocto-spinner: 1.2.2 + + '@dotenvx/primitives@0.8.0': {} + '@esbuild/aix-ppc64@0.28.2': optional: true @@ -2148,6 +3617,10 @@ snapshots: '@floating-ui/utils@0.2.12': {} + '@hono/node-server@2.1.1(hono@4.13.7)': + dependencies: + hono: 4.13.7 + '@jridgewell/gen-mapping@0.3.13': dependencies: '@jridgewell/sourcemap-codec': 1.6.0 @@ -2185,9 +3658,43 @@ snapshots: '@marijn/find-cluster-break@1.0.4': {} + '@modelcontextprotocol/sdk@1.30.0(zod@3.25.76)': + dependencies: + '@hono/node-server': 2.1.1(hono@4.13.7) + ajv: 8.20.0 + ajv-formats: 3.0.1(ajv@8.20.0) + content-type: 1.0.5 + cors: 2.8.6 + cross-spawn: 7.0.6 + eventsource: 3.0.7 + eventsource-parser: 3.1.1 + express: 5.2.1 + express-rate-limit: 8.7.0(express@5.2.1) + hono: 4.13.7 + jose: 6.2.12 + json-schema-typed: 8.0.2 + pkce-challenge: 5.0.1 + raw-body: 3.0.2 + zod: 3.25.76 + zod-to-json-schema: 3.25.2(zod@3.25.76) + transitivePeerDependencies: + - supports-color + '@napi-rs/lzma-linux-x64-gnu@1.5.1': optional: true + '@nodelib/fs.scandir@2.1.5': + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + + '@nodelib/fs.stat@2.0.5': {} + + '@nodelib/fs.walk@1.2.8': + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.20.3 + '@radix-ui/number@1.1.3': {} '@radix-ui/primitive@1.1.7': {} @@ -2935,6 +4442,18 @@ snapshots: '@radix-ui/rect@1.1.3': {} + '@reduxjs/toolkit@2.12.0(react-redux@9.3.0(@types/react@19.2.18)(react@19.2.8)(redux@5.0.1))(react@19.2.8)': + dependencies: + '@standard-schema/spec': 1.1.0 + '@standard-schema/utils': 0.3.0 + immer: 11.1.18 + redux: 5.0.1 + redux-thunk: 3.1.0(redux@5.0.1) + reselect: 5.1.1 + optionalDependencies: + react: 19.2.8 + react-redux: 9.3.0(@types/react@19.2.18)(react@19.2.8)(redux@5.0.1) + '@rolldown/pluginutils@1.0.0-rc.3': {} '@rollup/rollup-android-arm-eabi@4.63.1': @@ -3012,6 +4531,14 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.63.1': optional: true + '@sec-ant/readable-stream@0.4.1': {} + + '@sindresorhus/merge-streams@4.0.0': {} + + '@standard-schema/spec@1.1.0': {} + + '@standard-schema/utils@0.3.0': {} + '@tailwindcss/node@4.3.3': dependencies: '@jridgewell/remapping': 2.3.5 @@ -3129,6 +4656,12 @@ snapshots: '@tauri-apps/cli-win32-ia32-msvc': 2.11.4 '@tauri-apps/cli-win32-x64-msvc': 2.11.4 + '@ts-morph/common@0.27.0': + dependencies: + fast-glob: 3.3.3 + minimatch: 10.2.6 + path-browserify: 1.0.1 + '@types/babel__core@7.20.5': dependencies: '@babel/parser': 7.29.8 @@ -3155,6 +4688,30 @@ snapshots: '@types/deep-eql': 4.0.2 assertion-error: 2.0.1 + '@types/d3-array@3.2.2': {} + + '@types/d3-color@3.1.3': {} + + '@types/d3-ease@3.0.2': {} + + '@types/d3-interpolate@3.0.4': + dependencies: + '@types/d3-color': 3.1.3 + + '@types/d3-path@3.1.1': {} + + '@types/d3-scale@4.0.9': + dependencies: + '@types/d3-time': 3.0.4 + + '@types/d3-shape@3.2.0': + dependencies: + '@types/d3-path': 3.1.1 + + '@types/d3-time@3.0.4': {} + + '@types/d3-timer@3.0.2': {} + '@types/deep-eql@4.0.2': {} '@types/estree@1.0.9': {} @@ -3171,6 +4728,10 @@ snapshots: dependencies: csstype: 3.2.3 + '@types/use-sync-external-store@0.0.6': {} + + '@types/validate-npm-package-name@4.0.2': {} + '@vitejs/plugin-react@5.2.0(vite@7.3.6(@types/node@26.5.1)(jiti@2.7.0)(lightningcss@1.32.0))': dependencies: '@babel/core': 7.29.7 @@ -3194,14 +4755,72 @@ snapshots: '@vitest/spy@5.0.0': {} + accepts@2.0.0: + dependencies: + mime-types: 3.0.2 + negotiator: 1.1.0 + + ajv-formats@2.1.1(ajv@8.20.0): + optionalDependencies: + ajv: 8.20.0 + + ajv-formats@3.0.1(ajv@8.20.0): + optionalDependencies: + ajv: 8.20.0 + + ajv@8.20.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-uri: 3.1.7 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + + ansi-colors@4.1.3: {} + + ansi-regex@5.0.1: {} + + ansi-regex@6.3.0: {} + + argparse@2.0.1: {} + aria-hidden@1.2.6: dependencies: tslib: 2.8.1 assertion-error@2.0.1: {} + ast-types@0.16.3: + dependencies: + tslib: 2.8.1 + + atomically@1.7.0: {} + + balanced-match@4.0.4: {} + baseline-browser-mapping@2.11.21: {} + body-parser@2.3.0: + dependencies: + bytes: 3.1.2 + content-type: 2.1.0 + debug: 4.4.3 + http-errors: 2.0.1 + iconv-lite: 0.7.3 + on-finished: 2.4.1 + qs: 6.16.0 + raw-body: 3.0.2 + type-is: 2.1.0 + transitivePeerDependencies: + - supports-color + + brace-expansion@5.0.9: + dependencies: + balanced-match: 4.0.4 + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + browserslist@4.28.9: dependencies: baseline-browser-mapping: 2.11.21 @@ -3210,33 +4829,222 @@ snapshots: node-releases: 2.0.54 update-browserslist-db: 1.3.2(browserslist@4.28.9) + bundle-name@4.1.0: + dependencies: + run-applescript: 7.1.0 + + bytes@3.1.2: {} + + call-bind-apply-helpers@1.0.2: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + + call-bound@1.0.4: + dependencies: + call-bind-apply-helpers: 1.0.2 + get-intrinsic: 1.3.0 + + callsites@3.1.0: {} + caniuse-lite@1.0.30001810: {} chai@6.2.2: {} + chalk@5.6.2: {} + + class-variance-authority@0.7.1: + dependencies: + clsx: 2.1.1 + + cli-cursor@5.0.0: + dependencies: + restore-cursor: 5.1.0 + + cli-spinners@2.9.2: {} + + clsx@2.1.1: {} + + cn@0.2.6: {} + + code-block-writer@13.0.3: {} + + commander@11.1.0: {} + + commander@14.0.3: {} + + conf@10.2.0: + dependencies: + ajv: 8.20.0 + ajv-formats: 2.1.1(ajv@8.20.0) + atomically: 1.7.0 + debounce-fn: 4.0.0 + dot-prop: 6.0.1 + env-paths: 2.2.1 + json-schema-typed: 7.0.3 + onetime: 5.1.2 + pkg-up: 3.1.0 + semver: 7.8.5 + + content-disposition@1.1.0: {} + + content-type@1.0.5: {} + + content-type@2.1.0: {} + convert-source-map@2.0.0: {} + cookie-signature@1.2.2: {} + + cookie@0.7.2: {} + + cors@2.8.6: + dependencies: + object-assign: 4.1.1 + vary: 1.1.2 + + cosmiconfig@9.0.2(typescript@5.9.3): + dependencies: + env-paths: 2.2.1 + import-fresh: 3.3.1 + js-yaml: 4.3.2 + parse-json: 5.2.0 + optionalDependencies: + typescript: 5.9.3 + crelt@1.0.7: {} + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + cssesc@3.0.0: {} + csstype@3.2.3: {} + d3-array@3.2.4: + dependencies: + internmap: 2.0.3 + + d3-color@3.1.0: {} + + d3-ease@3.0.1: {} + + d3-format@3.1.2: {} + + d3-interpolate@3.0.1: + dependencies: + d3-color: 3.1.0 + + d3-path@3.1.0: {} + + d3-scale@4.0.2: + dependencies: + d3-array: 3.2.4 + d3-format: 3.1.2 + d3-interpolate: 3.0.1 + d3-time: 3.1.0 + d3-time-format: 4.1.0 + + d3-shape@3.2.0: + dependencies: + d3-path: 3.1.0 + + d3-time-format@4.1.0: + dependencies: + d3-time: 3.1.0 + + d3-time@3.1.0: + dependencies: + d3-array: 3.2.4 + + d3-timer@3.0.1: {} + + date-fns@4.4.0: {} + + debounce-fn@4.0.0: + dependencies: + mimic-fn: 3.1.0 + debug@4.4.3: dependencies: ms: 2.1.3 + decimal.js-light@2.5.1: {} + + dedent@1.7.2: {} + + deepmerge@4.3.1: {} + + default-browser-id@5.0.1: {} + + default-browser@5.5.1: + dependencies: + bundle-name: 4.1.0 + default-browser-id: 5.0.1 + + define-lazy-prop@2.0.0: {} + + define-lazy-prop@3.0.0: {} + + depd@2.0.0: {} + detect-libc@2.1.2: {} detect-node-es@1.1.0: {} + diff@8.0.4: {} + + dot-prop@6.0.1: + dependencies: + is-obj: 2.0.0 + + dotenv@17.4.2: {} + + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-errors: 1.3.0 + gopd: 1.2.0 + + ee-first@1.1.1: {} + electron-to-chromium@1.5.422: {} + emoji-regex@10.6.0: {} + + encodeurl@2.0.0: {} + enhanced-resolve@5.24.5: dependencies: graceful-fs: 4.2.11 tapable: 2.3.3 + enquirer@2.4.1: + dependencies: + ansi-colors: 4.1.3 + strip-ansi: 6.0.1 + + env-paths@2.2.1: {} + + error-ex@1.3.4: + dependencies: + is-arrayish: 0.2.1 + + es-define-property@1.0.1: {} + + es-errors@1.3.0: {} + es-module-lexer@2.3.2: {} + es-object-atoms@1.1.2: + dependencies: + es-errors: 1.3.0 + + es-toolkit@1.52.0: {} + esbuild@0.28.2: optionalDependencies: '@esbuild/aix-ppc64': 0.28.2 @@ -3266,35 +5074,324 @@ snapshots: '@esbuild/win32-ia32': 0.28.2 '@esbuild/win32-x64': 0.28.2 - escalade@3.2.0: {} + escalade@3.2.0: {} + + escape-html@1.0.3: {} + + esprima@4.0.1: {} + + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.9 + + etag@1.8.1: {} + + eventemitter3@5.0.4: {} + + eventsource-parser@3.1.1: {} + + eventsource@3.0.7: + dependencies: + eventsource-parser: 3.1.1 + + execa@5.1.1: + dependencies: + cross-spawn: 7.0.6 + get-stream: 6.0.1 + human-signals: 2.1.0 + is-stream: 2.0.1 + merge-stream: 2.0.0 + npm-run-path: 4.0.1 + onetime: 5.1.2 + signal-exit: 3.0.7 + strip-final-newline: 2.0.0 + + execa@9.6.1: + dependencies: + '@sindresorhus/merge-streams': 4.0.0 + cross-spawn: 7.0.6 + figures: 6.1.0 + get-stream: 9.0.1 + human-signals: 8.0.1 + is-plain-obj: 4.1.0 + is-stream: 4.0.1 + npm-run-path: 6.0.0 + pretty-ms: 9.3.1 + signal-exit: 4.1.0 + strip-final-newline: 4.0.0 + yoctocolors: 2.2.0 + + expect-type@1.4.0: {} + + express-rate-limit@8.7.0(express@5.2.1): + dependencies: + debug: 4.4.3 + express: 5.2.1 + ip-address: 10.7.0 + transitivePeerDependencies: + - supports-color + + express@5.2.1: + dependencies: + accepts: 2.0.0 + body-parser: 2.3.0 + content-disposition: 1.1.0 + content-type: 1.0.5 + cookie: 0.7.2 + cookie-signature: 1.2.2 + debug: 4.4.3 + depd: 2.0.0 + encodeurl: 2.0.0 + escape-html: 1.0.3 + etag: 1.8.1 + finalhandler: 2.1.1 + fresh: 2.0.0 + http-errors: 2.0.1 + merge-descriptors: 2.0.0 + mime-types: 3.0.2 + on-finished: 2.4.1 + once: 1.4.0 + parseurl: 1.3.3 + proxy-addr: 2.0.7 + qs: 6.16.0 + range-parser: 1.3.0 + router: 2.2.0 + send: 1.2.1 + serve-static: 2.2.1 + statuses: 2.0.2 + type-is: 2.1.0 + vary: 1.1.2 + transitivePeerDependencies: + - supports-color + + fast-deep-equal@3.1.3: {} + + fast-glob@3.3.3: + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + + fast-uri@3.1.7: {} + + fastq@1.20.3: + dependencies: + reusify: 1.1.0 + + fdir@6.5.0(picomatch@4.0.7): + optionalDependencies: + picomatch: 4.0.7 + + figures@6.1.0: + dependencies: + is-unicode-supported: 2.1.0 + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + + finalhandler@2.1.1: + dependencies: + debug: 4.4.3 + encodeurl: 2.0.0 + escape-html: 1.0.3 + on-finished: 2.4.1 + parseurl: 1.3.3 + statuses: 2.0.2 + transitivePeerDependencies: + - supports-color + + find-up@3.0.0: + dependencies: + locate-path: 3.0.0 + + forwarded@0.2.0: {} + + fresh@2.0.0: {} + + fs-extra@11.4.0: + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.2.1 + universalify: 2.0.1 + + fsevents@2.3.3: + optional: true + + function-bind@1.1.2: {} + + fuzzysort@3.1.0: {} + + gensync@1.0.0-beta.2: {} + + get-east-asian-width@1.6.0: {} + + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.2 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.4 + math-intrinsics: 1.1.0 + + get-nonce@1.0.1: {} + + get-own-enumerable-keys@1.0.0: {} + + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.1.2 + + get-stream@6.0.1: {} + + get-stream@9.0.1: + dependencies: + '@sec-ant/readable-stream': 0.4.1 + is-stream: 4.0.1 + + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + + gopd@1.2.0: {} + + graceful-fs@4.2.11: {} + + has-symbols@1.1.0: {} + + hasown@2.0.4: + dependencies: + function-bind: 1.1.2 + + hono@4.13.7: {} + + http-errors@2.0.1: + dependencies: + depd: 2.0.0 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 2.0.2 + toidentifier: 1.0.1 + + human-signals@2.1.0: {} + + human-signals@8.0.1: {} + + iconv-lite@0.7.3: + dependencies: + safer-buffer: 2.1.2 + + ignore@5.3.2: {} + + immer@10.2.0: {} + + immer@11.1.18: {} + + import-fresh@3.3.1: + dependencies: + parent-module: 1.0.1 + resolve-from: 4.0.0 + + inherits@2.0.4: {} + + internmap@2.0.3: {} + + ip-address@10.7.0: {} + + ipaddr.js@1.9.1: {} + + is-arrayish@0.2.1: {} + + is-docker@2.2.1: {} + + is-docker@3.0.0: {} + + is-extglob@2.1.1: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + is-in-ssh@1.0.0: {} - estree-walker@3.0.3: + is-inside-container@1.0.0: dependencies: - '@types/estree': 1.0.9 + is-docker: 3.0.0 - expect-type@1.4.0: {} + is-interactive@2.0.0: {} - fdir@6.5.0(picomatch@4.0.7): - optionalDependencies: - picomatch: 4.0.7 + is-number@7.0.0: {} - fsevents@2.3.3: - optional: true + is-obj@2.0.0: {} - gensync@1.0.0-beta.2: {} + is-obj@3.0.0: {} - get-nonce@1.0.1: {} + is-plain-obj@4.1.0: {} - graceful-fs@4.2.11: {} + is-promise@4.0.0: {} + + is-regexp@3.1.0: {} + + is-stream@2.0.1: {} + + is-stream@4.0.1: {} + + is-unicode-supported@1.3.0: {} + + is-unicode-supported@2.1.0: {} + + is-wsl@2.2.0: + dependencies: + is-docker: 2.2.1 + + is-wsl@3.1.1: + dependencies: + is-inside-container: 1.0.0 + + isexe@2.0.0: {} + + isexe@3.1.5: {} jiti@2.7.0: {} + jose@6.2.12: {} + js-tokens@4.0.0: {} + js-yaml@4.3.2: + dependencies: + argparse: 2.0.1 + jsesc@3.1.0: {} + json-parse-even-better-errors@2.3.1: {} + + json-schema-traverse@1.0.0: {} + + json-schema-typed@7.0.3: {} + + json-schema-typed@8.0.2: {} + json5@2.2.3: {} + jsonfile@6.2.1: + dependencies: + universalify: 2.0.1 + optionalDependencies: + graceful-fs: 4.2.11 + + kleur@3.0.3: {} + + kleur@4.1.5: {} + lightningcss-android-arm64@1.32.0: optional: true @@ -3344,10 +5441,26 @@ snapshots: lightningcss-win32-arm64-msvc: 1.32.0 lightningcss-win32-x64-msvc: 1.32.0 + lines-and-columns@1.2.4: {} + + locate-path@3.0.0: + dependencies: + p-locate: 3.0.0 + path-exists: 3.0.0 + + log-symbols@6.0.0: + dependencies: + chalk: 5.6.2 + is-unicode-supported: 1.3.0 + lru-cache@5.1.1: dependencies: yallist: 3.1.1 + lucide-react@1.45.0(react@19.2.8): + dependencies: + react: 19.2.8 + magic-string@0.30.21: dependencies: '@jridgewell/sourcemap-codec': 1.6.0 @@ -3356,24 +5469,192 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.6.0 + math-intrinsics@1.1.0: {} + + media-typer@1.1.1: {} + + merge-descriptors@2.0.0: {} + + merge-stream@2.0.0: {} + + merge2@1.4.1: {} + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.2 + + mime-db@1.54.0: {} + + mime-types@3.0.2: + dependencies: + mime-db: 1.54.0 + + mimic-fn@2.1.0: {} + + mimic-fn@3.1.0: {} + + mimic-function@5.0.1: {} + + minimatch@10.2.6: + dependencies: + brace-expansion: 5.0.9 + + minimist@1.2.8: {} + ms@2.1.3: {} nanoid@3.3.18: {} + negotiator@1.1.0: + dependencies: + content-type: 2.1.0 + node-releases@2.0.54: {} + npm-run-path@4.0.1: + dependencies: + path-key: 3.1.1 + + npm-run-path@6.0.0: + dependencies: + path-key: 4.0.0 + unicorn-magic: 0.3.0 + + object-assign@4.1.1: {} + + object-inspect@1.13.4: {} + + object-treeify@1.1.33: {} + obug@2.2.1: {} + on-finished@2.4.1: + dependencies: + ee-first: 1.1.1 + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + onetime@5.1.2: + dependencies: + mimic-fn: 2.1.0 + + onetime@7.0.0: + dependencies: + mimic-function: 5.0.1 + + open@11.0.3: + dependencies: + default-browser: 5.5.1 + define-lazy-prop: 3.0.0 + is-in-ssh: 1.0.0 + is-inside-container: 1.0.0 + powershell-utils: 0.2.1 + wsl-utils: 1.0.0 + + open@8.4.2: + dependencies: + define-lazy-prop: 2.0.0 + is-docker: 2.2.1 + is-wsl: 2.2.0 + + ora@8.2.0: + dependencies: + chalk: 5.6.2 + cli-cursor: 5.0.0 + cli-spinners: 2.9.2 + is-interactive: 2.0.0 + is-unicode-supported: 2.1.0 + log-symbols: 6.0.0 + stdin-discarder: 0.2.2 + string-width: 7.2.0 + strip-ansi: 7.2.0 + + p-limit@2.3.0: + dependencies: + p-try: 2.2.0 + + p-locate@3.0.0: + dependencies: + p-limit: 2.3.0 + + p-try@2.2.0: {} + + parent-module@1.0.1: + dependencies: + callsites: 3.1.0 + + parse-json@5.2.0: + dependencies: + '@babel/code-frame': 7.29.7 + error-ex: 1.3.4 + json-parse-even-better-errors: 2.3.1 + lines-and-columns: 1.2.4 + + parse-ms@4.0.0: {} + + parseurl@1.3.3: {} + + path-browserify@1.0.1: {} + + path-exists@3.0.0: {} + + path-key@3.1.1: {} + + path-key@4.0.0: {} + + path-to-regexp@8.4.2: {} + picocolors@1.1.1: {} + picomatch@2.3.2: {} + picomatch@4.0.7: {} + pkce-challenge@5.0.1: {} + + pkg-up@3.1.0: + dependencies: + find-up: 3.0.0 + + postcss-selector-parser@7.1.6: + dependencies: + cssesc: 3.0.0 + util-deprecate: 1.0.2 + postcss@8.5.28: dependencies: nanoid: 3.3.18 picocolors: 1.1.1 source-map-js: 1.2.1 + powershell-utils@0.1.0: {} + + powershell-utils@0.2.1: {} + + pretty-ms@9.3.1: + dependencies: + parse-ms: 4.0.0 + + prompts@2.4.2: + dependencies: + kleur: 3.0.3 + sisteransi: 1.0.5 + + proxy-addr@2.0.7: + dependencies: + forwarded: 0.2.0 + ipaddr.js: 1.9.1 + + qs@6.16.0: + dependencies: + es-define-property: 1.0.1 + side-channel: 1.1.1 + + queue-microtask@1.2.3: {} + radix-ui@1.6.7(@types/react-dom@19.2.7(@types/react@19.2.18))(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8): dependencies: '@radix-ui/primitive': 1.1.7 @@ -3437,11 +5718,39 @@ snapshots: '@types/react': 19.2.18 '@types/react-dom': 19.2.7(@types/react@19.2.18) + range-parser@1.3.0: {} + + raw-body@3.0.2: + dependencies: + bytes: 3.1.2 + http-errors: 2.0.1 + iconv-lite: 0.7.3 + unpipe: 1.0.0 + + react-day-picker@10.0.1(@types/react@19.2.18)(react@19.2.8): + dependencies: + '@date-fns/tz': 1.5.0 + date-fns: 4.4.0 + react: 19.2.8 + optionalDependencies: + '@types/react': 19.2.18 + react-dom@19.2.8(react@19.2.8): dependencies: react: 19.2.8 scheduler: 0.27.0 + react-is@19.3.0: {} + + react-redux@9.3.0(@types/react@19.2.18)(react@19.2.8)(redux@5.0.1): + dependencies: + '@types/use-sync-external-store': 0.0.6 + react: 19.2.8 + use-sync-external-store: 1.7.0(react@19.2.8) + optionalDependencies: + '@types/react': 19.2.18 + redux: 5.0.1 + react-refresh@0.18.0: {} react-remove-scroll-bar@2.3.8(@types/react@19.2.18)(react@19.2.8): @@ -3463,6 +5772,11 @@ snapshots: optionalDependencies: '@types/react': 19.2.18 + react-resizable-panels@4.12.4(react-dom@19.2.8(react@19.2.8))(react@19.2.8): + dependencies: + react: 19.2.8 + react-dom: 19.2.8(react@19.2.8) + react-style-singleton@2.2.3(@types/react@19.2.18)(react@19.2.8): dependencies: get-nonce: 1.0.1 @@ -3473,6 +5787,55 @@ snapshots: react@19.2.8: {} + recast@0.23.21: + dependencies: + ast-types: 0.16.3 + esprima: 4.0.1 + source-map: 0.6.1 + tiny-invariant: 1.3.3 + tslib: 2.8.1 + + recharts@3.8.0(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react-is@19.3.0)(react@19.2.8)(redux@5.0.1): + dependencies: + '@reduxjs/toolkit': 2.12.0(react-redux@9.3.0(@types/react@19.2.18)(react@19.2.8)(redux@5.0.1))(react@19.2.8) + clsx: 2.1.1 + decimal.js-light: 2.5.1 + es-toolkit: 1.52.0 + eventemitter3: 5.0.4 + immer: 10.2.0 + react: 19.2.8 + react-dom: 19.2.8(react@19.2.8) + react-is: 19.3.0 + react-redux: 9.3.0(@types/react@19.2.18)(react@19.2.8)(redux@5.0.1) + reselect: 5.1.1 + tiny-invariant: 1.3.3 + use-sync-external-store: 1.7.0(react@19.2.8) + victory-vendor: 37.3.6 + transitivePeerDependencies: + - '@types/react' + - redux + + redux-thunk@3.1.0(redux@5.0.1): + dependencies: + redux: 5.0.1 + + redux@5.0.1: {} + + require-from-string@2.0.2: {} + + reselect@5.1.1: {} + + reselect@5.3.0: {} + + resolve-from@4.0.0: {} + + restore-cursor@5.1.0: + dependencies: + onetime: 7.0.0 + signal-exit: 4.1.0 + + reusify@1.1.0: {} + rollup@4.63.1: dependencies: '@types/estree': 1.0.9 @@ -3505,24 +5868,204 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.63.1 fsevents: 2.3.3 + router@2.2.0: + dependencies: + debug: 4.4.3 + depd: 2.0.0 + is-promise: 4.0.0 + parseurl: 1.3.3 + path-to-regexp: 8.4.2 + transitivePeerDependencies: + - supports-color + + run-applescript@7.1.0: {} + + run-parallel@1.2.0: + dependencies: + queue-microtask: 1.2.3 + + safer-buffer@2.1.2: {} + scheduler@0.27.0: {} semver@6.3.1: {} + semver@7.8.5: {} + + send@1.2.1: + 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.3.0 + statuses: 2.0.2 + transitivePeerDependencies: + - supports-color + + serve-static@2.2.1: + dependencies: + encodeurl: 2.0.0 + escape-html: 1.0.3 + parseurl: 1.3.3 + send: 1.2.1 + transitivePeerDependencies: + - supports-color + + setprototypeof@1.2.0: {} + + shadcn@4.21.0(typescript@5.9.3): + dependencies: + '@babel/core': 7.29.7 + '@babel/parser': 7.29.8 + '@babel/plugin-transform-typescript': 7.29.7(@babel/core@7.29.7) + '@babel/preset-typescript': 7.29.7(@babel/core@7.29.7) + '@dotenvx/dotenvx': 1.75.1 + '@modelcontextprotocol/sdk': 1.30.0(zod@3.25.76) + '@types/validate-npm-package-name': 4.0.2 + browserslist: 4.28.9 + cn: 0.2.6 + commander: 14.0.3 + cosmiconfig: 9.0.2(typescript@5.9.3) + dedent: 1.7.2 + deepmerge: 4.3.1 + diff: 8.0.4 + execa: 9.6.1 + fast-glob: 3.3.3 + fs-extra: 11.4.0 + fuzzysort: 3.1.0 + kleur: 4.1.5 + open: 11.0.3 + ora: 8.2.0 + postcss: 8.5.28 + postcss-selector-parser: 7.1.6 + prompts: 2.4.2 + recast: 0.23.21 + socks: 2.8.10 + stringify-object: 5.0.0 + ts-morph: 26.0.0 + tsconfig-paths: 4.2.0 + undici: 7.29.1 + validate-npm-package-name: 7.0.2 + zod: 3.25.76 + zod-to-json-schema: 3.25.2(zod@3.25.76) + transitivePeerDependencies: + - '@cfworker/json-schema' + - babel-plugin-macros + - supports-color + - typescript + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + side-channel-list@1.0.1: + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.4 + + side-channel-map@1.0.1: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + + side-channel-weakmap@1.0.2: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + side-channel-map: 1.0.1 + + side-channel@1.1.1: + 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 + siginfo@2.0.0: {} + signal-exit@3.0.7: {} + + signal-exit@4.1.0: {} + + sisteransi@1.0.5: {} + + smart-buffer@4.2.0: {} + + socks@2.8.10: + dependencies: + ip-address: 10.7.0 + smart-buffer: 4.2.0 + + sonner@2.0.8(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8): + dependencies: + react: 19.2.8 + react-dom: 19.2.8(react@19.2.8) + optionalDependencies: + '@types/react': 19.2.18 + source-map-js@1.2.1: {} + source-map@0.6.1: {} + stackback@0.0.2: {} + statuses@2.0.2: {} + std-env@4.2.0: {} + stdin-discarder@0.2.2: {} + + string-width@7.2.0: + dependencies: + emoji-regex: 10.6.0 + get-east-asian-width: 1.6.0 + strip-ansi: 7.2.0 + + stringify-object@5.0.0: + dependencies: + get-own-enumerable-keys: 1.0.0 + is-obj: 3.0.0 + is-regexp: 3.1.0 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-ansi@7.2.0: + dependencies: + ansi-regex: 6.3.0 + + strip-bom@3.0.0: {} + + strip-final-newline@2.0.0: {} + + strip-final-newline@4.0.0: {} + style-mod@4.1.3: {} + systeminformation@5.33.10: {} + + tailwind-merge@3.7.0: {} + tailwindcss@4.3.3: {} tapable@2.3.3: {} + tiny-invariant@1.3.3: {} + tinybench@6.1.4: {} tinyexec@1.3.0: {} @@ -3532,12 +6075,45 @@ snapshots: fdir: 6.5.0(picomatch@4.0.7) picomatch: 4.0.7 + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + toidentifier@1.0.1: {} + + ts-morph@26.0.0: + dependencies: + '@ts-morph/common': 0.27.0 + code-block-writer: 13.0.3 + + tsconfig-paths@4.2.0: + dependencies: + json5: 2.2.3 + minimist: 1.2.8 + strip-bom: 3.0.0 + tslib@2.8.1: {} + tw-animate-css@1.4.0: {} + + type-is@2.1.0: + dependencies: + content-type: 2.1.0 + media-typer: 1.1.1 + mime-types: 3.0.2 + typescript@5.9.3: {} undici-types@8.9.0: {} + undici@7.29.1: {} + + unicorn-magic@0.3.0: {} + + universalify@2.0.1: {} + + unpipe@1.0.0: {} + update-browserslist-db@1.3.2(browserslist@4.28.9): dependencies: browserslist: 4.28.9 @@ -3559,6 +6135,33 @@ snapshots: optionalDependencies: '@types/react': 19.2.18 + use-sync-external-store@1.7.0(react@19.2.8): + dependencies: + react: 19.2.8 + + util-deprecate@1.0.2: {} + + validate-npm-package-name@7.0.2: {} + + vary@1.1.2: {} + + victory-vendor@37.3.6: + dependencies: + '@types/d3-array': 3.2.2 + '@types/d3-ease': 3.0.2 + '@types/d3-interpolate': 3.0.4 + '@types/d3-scale': 4.0.9 + '@types/d3-shape': 3.2.0 + '@types/d3-time': 3.0.4 + '@types/d3-timer': 3.0.2 + d3-array: 3.2.4 + d3-ease: 3.0.1 + d3-interpolate: 3.0.1 + d3-scale: 4.0.2 + d3-shape: 3.2.0 + d3-time: 3.1.0 + d3-timer: 3.0.1 + vite@7.3.6(@types/node@26.5.1)(jiti@2.7.0)(lightningcss@1.32.0): dependencies: esbuild: 0.28.2 @@ -3596,9 +6199,36 @@ snapshots: w3c-keyname@2.2.8: {} + which@2.0.2: + dependencies: + isexe: 2.0.0 + + which@4.0.0: + dependencies: + isexe: 3.1.5 + why-is-node-running@2.3.0: dependencies: siginfo: 2.0.0 stackback: 0.0.2 + wrappy@1.0.2: {} + + wsl-utils@1.0.0: + dependencies: + is-wsl: 3.1.1 + powershell-utils: 0.1.0 + yallist@3.1.1: {} + + yocto-spinner@1.2.2: + dependencies: + yoctocolors: 2.2.0 + + yoctocolors@2.2.0: {} + + zod-to-json-schema@3.25.2(zod@3.25.76): + dependencies: + zod: 3.25.76 + + zod@3.25.76: {} diff --git a/skills-lock.json b/skills-lock.json new file mode 100644 index 00000000..a13c77b0 --- /dev/null +++ b/skills-lock.json @@ -0,0 +1,17 @@ +{ + "version": 1, + "skills": { + "migrate-radix-to-base": { + "source": "shadcn/ui", + "sourceType": "github", + "skillPath": "skills/migrate-radix-to-base/SKILL.md", + "computedHash": "e1f2030ee5059be3dff0812ca0e4b995ee9fa3132176f049ebe6c90346a6755e" + }, + "shadcn": { + "source": "shadcn/ui", + "sourceType": "github", + "skillPath": "skills/shadcn/SKILL.md", + "computedHash": "f615de216e085a84e31593ad0fa9062232adc40cd87b7c7ab2b8e49abf6500be" + } + } +} diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 03bd094e..874be3e9 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4188,7 +4188,7 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tw-api" version = "0.1.0" -source = "git+https://github.com/ThinkWatchProject/ThinkWatch-Core.git?branch=main#4d777064540fcefa052d063eab676989351655a0" +source = "git+https://github.com/ThinkWatchProject/ThinkWatch-Core.git?branch=main#512ddb970f375a43c323fd201a9f04858129f2de" dependencies = [ "serde", "serde_json", diff --git a/src-tauri/src/control.rs b/src-tauri/src/control.rs index 89cbcd58..a8c0ad11 100644 --- a/src-tauri/src/control.rs +++ b/src-tauri/src/control.rs @@ -166,9 +166,23 @@ impl ControlClient { self.post_json("/l1", &req).await } - /// 今天的汇总。 - pub async fn summary(&self) -> Result { - Ok(serde_json::from_slice(&self.get("/summary").await?)?) + /// 一个时间窗内的汇总。不给窗口就是 core 的默认口径(今天)。 + pub async fn summary(&self, from_ms: Option) -> Result { + let path = match from_ms { + Some(f) => format!("/summary?from_ms={f}"), + None => "/summary".to_string(), + }; + Ok(serde_json::from_slice(&self.get(&path).await?)?) + } + + /// 一段闭区间的汇总。**概览拿它算「较上一个区间」** —— 一个没有 + /// 参照系的金额只能读,不能判断。 + pub async fn summary_range(&self, from_ms: i64, to_ms: i64) -> Result { + Ok(serde_json::from_slice( + &self + .get(&format!("/summary?from_ms={from_ms}&to_ms={to_ms}")) + .await?, + )?) } /// 按时间分桶的花费(概览的趋势图)。 @@ -191,6 +205,25 @@ impl ControlClient { /// 按模型或上游分组的花费。`dim` 只有 `model` / `provider` 两个值 —— /// core 那边是个枚举,写错的值在那里被拒掉。 + /// 按时间分桶、再按模型分层的花费(概览那张堆叠面积图)。 + /// + /// 桶边界和 `cost_buckets` 是同一套算法,**必须如此**:界面按同一个 + /// 起点补空桶,差一格就会把有数据的那一格画在空位置上。 + pub async fn cost_buckets_by( + &self, + dim: &str, + from_ms: i64, + bucket_ms: i64, + ) -> Result> { + Ok(serde_json::from_slice( + &self + .get(&format!( + "/summary/buckets/by?dim={dim}&from_ms={from_ms}&bucket_ms={bucket_ms}" + )) + .await?, + )?) + } + pub async fn cost_by(&self, dim: &str, from_ms: i64) -> Result> { Ok(serde_json::from_slice( &self @@ -272,13 +305,6 @@ impl ControlClient { .await } - /// 把一条真实请求导出成回放用例(YAML,已脱敏)。 - pub async fn fixture(&self, id: i64) -> Result { - Ok(String::from_utf8( - self.get(&format!("/request/{id}/fixture")).await?, - )?) - } - /// 诊断包的正文(Markdown,已脱敏)。 pub async fn diagnostics(&self) -> Result { Ok(String::from_utf8(self.get("/diagnostics").await?)?) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 4b61caa9..ee812c1a 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -22,8 +22,30 @@ use supervisor::{CoreState, Supervisor}; pub struct AppState { pub control: ControlClient, - pub core_state: Arc>, pub supervisor: Arc, + /// 连 twcore 都没找到时,那句话。 + /// + /// **找不到不该让应用起不来。**在此之前这里是 `locate_core(&handle)?` + /// —— `setup` 返回 Err 会让 Tauri 中止启动,**窗口根本不开**,用户 + /// 看到的是「点了没反应」。而这正是最需要把话说清楚的一种失败: + /// 消息里写着找过哪些路径。 + pub core_missing: Option, + /// 守护循环还在跑吗。 + /// + /// 它会退出:安全模式下的 core 也退了,或者 core 根本起不来。 + /// 退了之后没人再拉它 —— 界面上那个「重新启动」要能把它接回来, + /// 而**不能接出第二条循环**。 + pub supervising: Arc, + /// 菜单栏该重新收一次数了。 + /// + /// **菜单栏原来是每秒醒一次的**,而它每醒一次就走两趟控制面(额度、 + /// 汇总)。那两个数字只在请求落地或者额度头出现之后才会变 —— 也就是 + /// 说,一台闲着的机器上每秒两次往返问到的全是上一次的同一个答案, + /// 而菜单栏是这个应用唯一常驻的东西。 + /// + /// 现在由事件叫醒。`Notify` 攒一个许可,所以一串请求只会换来一次 + /// 重收,不是一串。 + pub menubar: Arc, } /// twcore 在哪。 @@ -84,6 +106,24 @@ pub fn locate_core(app: &tauri::AppHandle) -> anyhow::Result { } } + /* + **装好的应用和开发布局要说两句不同的话。** + + 那一串 `../../thinkwatch-core/target/debug/twcore` 和一句 + `cargo build -p twcore`,对开发者是答案,对用户是噪音 —— 他 + 既没有那个仓库,也不会去跑 cargo。他需要知道的只有一件事: + 这份安装包缺东西,重装。 + + 判据是 macOS 上打包应用的资源目录形状:`.app/Contents/Resources`。 + */ + let bundled = app + .path() + .resource_dir() + .map(|d| d.ends_with("Contents/Resources")) + .unwrap_or(false); + if bundled { + anyhow::bail!("安装包里缺少 twcore 组件。请重新下载安装一次。"); + } anyhow::bail!( "找不到 twcore。找过这些位置(以及 PATH):\n{}\n\n 用 THINKWATCH_CORE_BIN 指一个绝对路径,或者在 core 仓库里跑一次 \ `cargo build -p twcore`。", @@ -119,14 +159,56 @@ async fn core_status(state: tauri::State<'_, AppState>) -> Result) -> Result { - let s = state.core_state.lock().await; - Ok(match &*s { + // 连 core 都没找到时,守护状态说什么都没意义 —— 那句话才是答案 + if let Some(why) = &state.core_missing { + return Ok(format!("missing:{why}")); + } + Ok(describe_state(&state.supervisor.state())) +} + +/// 把 core 拉起来。 +/// +/// 两种情形:守护还在跑,那这就是一次普通的重启;守护已经退出了 +/// (安全模式下的 core 也退了、或者 core 根本起不来),那要把循环接 +/// 回来 —— 而**不能接出第二条**,所以用一个标志守着。 +#[tauri::command] +async fn restart_core( + app: tauri::AppHandle, + state: tauri::State<'_, AppState>, +) -> Result<(), String> { + use std::sync::atomic::Ordering; + if let Some(why) = &state.core_missing { + return Err(why.clone()); + } + if state.supervising.swap(true, Ordering::SeqCst) { + return state + .supervisor + .request_restart() + .await + .map_err(|e| format!("{e:#}")); + } + let sup = state.supervisor.clone(); + let flag = state.supervising.clone(); + tauri::async_runtime::spawn(async move { + supervise(sup, app).await; + flag.store(false, Ordering::SeqCst); + }); + Ok(()) +} + +/// 守护状态说成界面认得的那个字符串。 +/// +/// **只有这一处。**开窗时问一次、之后每次转换推一条,两条路必须说出 +/// 一模一样的话 —— 各写一遍的话,「重启中(第 3 次)」和「重启中」会 +/// 在某次改动之后悄悄分岔。 +fn describe_state(s: &CoreState) -> String { + match s { CoreState::Starting => "starting".into(), CoreState::Running { pid } => format!("running:{pid}"), CoreState::Restarting { attempt, in_ms } => format!("restarting:{attempt}:{in_ms}"), CoreState::SafeMode => "safe_mode".into(), CoreState::Stopped => "stopped".into(), - }) + } } #[tauri::command] @@ -170,18 +252,32 @@ async fn speed_test( /// **四个一起取。**界面上它们是同一块,分四次 invoke 会让那一块在几十 /// 毫秒里分四次跳变。 #[tauri::command] -async fn dashboard(state: tauri::State<'_, AppState>) -> Result { +async fn dashboard( + state: tauri::State<'_, AppState>, + // 时间窗的起点,以及趋势图一格多宽。 + // + // **两个都由界面给,这一层不再自己算。**原来这里收的是「往前看多少 + // 毫秒」,起点是 `now - window` —— 每刷新一次就往前挪一点,于是所有 + // 格子的边界跟着挪:没有任何新请求,柱子的高低也会变,而那是「你 + // 什么时候看」造成的,不是数据。格子边界该对齐到**本地**日历(本地 + // 零点、整点),而本地时区只有界面知道。 + // + // 另一个理由是这两个数原来在两边各算了一遍:一边算窗口,一边算格宽, + // 而补空桶要求两边算出来的格子完全重合。对不上的表现是整张图全是零。 + since_ms: Option, + bucket_ms: Option, +) -> Result { let c = &state.control; - // 趋势图看最近 24 小时、每小时一格。**不是「今天」** —— 今天零点 - // 刚过的时候「今天」只有一根柱子,而用户想看的是「最近在怎么用」。 - // 别的数字仍然按今天算(那是账单的口径)。 - let since = std::time::SystemTime::now() + let now = std::time::SystemTime::now() .duration_since(std::time::UNIX_EPOCH) .map(|d| d.as_millis() as i64) - .unwrap_or(0) - - 24 * 3_600_000; + .unwrap_or(0); + // 兜底是「最近 24 小时、一小时一格」—— 界面总会把这两个值带上, + // 这里只是不让缺参数变成一次失败。 + let since = since_ms.unwrap_or(now - 24 * 3_600_000).min(now); + let bucket = bucket_ms.unwrap_or(3_600_000).max(60_000); Ok(Dashboard { - summary: c.summary().await.map_err(|e| format!("{e:#}"))?, + summary: c.summary(Some(since)).await.map_err(|e| format!("{e:#}"))?, latency: c.latency().await.unwrap_or_default(), latency_by_provider: c.latency_by_provider().await.unwrap_or_default(), history: c.history(200).await.unwrap_or_default(), @@ -190,9 +286,15 @@ async fn dashboard(state: tauri::State<'_, AppState>) -> Result, /// 出站密钥检测攒下的证据(观察态) leaks: Vec, - /// 最近 24 小时、每小时一格。**稀疏的** —— 空桶由界面补 + /// 按界面给的格宽分格。**稀疏的** —— 空桶由界面补 buckets: Vec, - by_model: Vec, - by_provider: Vec, - /// 那三样的时间窗起点,界面补空桶要用 + /// 同样的格子,再按模型分层。趋势图靠它把「什么时候花的」和 + /// 「花在哪个模型上」画成同一张图 + buckets_by_model: Vec, + /// 上一个等长区间的汇总。拿不到就是没有对比,不是零 + prev: Option, + /// 实际用上的时间窗起点。**原样回传** —— 界面补空桶要从它数起, + /// 而兜底路径上它不等于界面送来的那个值 since_ms: i64, } @@ -424,28 +530,6 @@ async fn mcp_apply( .map_err(|e| format!("{e:#}")) } -/// 把一条真实请求存成回放用例。 -/// -/// **写文件在这一侧**,和诊断包同一个理由。 -#[tauri::command] -async fn save_fixture(state: tauri::State<'_, AppState>, id: i64) -> Result { - let text = state - .control - .fixture(id) - .await - .map_err(|e| format!("{e:#}"))?; - let dir = data_dir().join("fixtures"); - std::fs::create_dir_all(&dir).map_err(|e| format!("建不了 {}:{e}", dir.display()))?; - let path = dir.join(format!("请求-{id}.yaml")); - std::fs::write(&path, text).map_err(|e| format!("写不了 {}:{e}", path.display()))?; - #[cfg(unix)] - { - use std::os::unix::fs::PermissionsExt; - let _ = std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o600)); - } - Ok(path.display().to_string()) -} - /// 攒一份诊断包,写到磁盘上,把路径交回去。 /// /// **写文件是这一侧的事,不是 core 的。**core 只负责把内容攒出来 —— @@ -815,6 +899,7 @@ pub fn run() { interfaces, new_key, core_state, + restart_core, overview, probe_upstream, speed_test, @@ -858,28 +943,60 @@ pub fn run() { replay_quote, replay_run, save_diagnostics, - save_fixture ]) .setup(|app| { let handle = app.handle().clone(); - let binary = locate_core(&handle)?; + // **找不到 core 也要把窗口开起来。**这里原来是 `?` —— + // 而它把「找不到一个文件」变成了「应用打不开」。 + let located = locate_core(&handle); let socket = default_socket(); - let sup = Arc::new(Supervisor::new(binary, None)); - let core_state = sup.state_handle(); + let sup = Arc::new(Supervisor::new( + located + .as_ref() + .cloned() + .unwrap_or_else(|_| PathBuf::from("twcore")), + None, + )); + let supervising = Arc::new(std::sync::atomic::AtomicBool::new(false)); app.manage(AppState { control: ControlClient::new(socket), - core_state: core_state.clone(), supervisor: sup.clone(), + core_missing: located.as_ref().err().map(|e| format!("{e:#}")), + supervising: supervising.clone(), + menubar: Arc::new(tokio::sync::Notify::new()), }); + // **状态变化推给界面,不要让它来问。**「core 起来没、是不是 + // 在重启、有没有进安全模式」一天变不了几次,而界面原来是每 + // 两秒问一遍的 —— 那三次 IPC 往返里绝大多数得到的是同一个 + // 答案。字符串和 `core_state` 命令走同一个函数,两条路不会 + // 说出不一样的话。 + { + let h = handle.clone(); + let mut rx = sup.watch(); + tauri::async_runtime::spawn(async move { + while rx.changed().await.is_ok() { + let now = rx.borrow().clone(); + let _ = h.emit("core-state", describe_state(&now)); + } + }); + } + // 守护循环。**它跑在后台任务里而不是阻塞 setup** —— core 起 // 不来的时候,界面必须还能打开,否则用户连错误都看不到。 - let h = handle.clone(); - let sup_for_loop = sup.clone(); - tauri::async_runtime::spawn(async move { - supervise(sup_for_loop, h).await; - }); + if located.is_ok() { + supervising.store(true, std::sync::atomic::Ordering::SeqCst); + let h = handle.clone(); + let sup_for_loop = sup.clone(); + let flag = supervising.clone(); + tauri::async_runtime::spawn(async move { + supervise(sup_for_loop, h).await; + flag.store(false, std::sync::atomic::Ordering::SeqCst); + }); + } else if let Err(e) = &located { + tracing::error!("找不到 core:{e:#}"); + } // 自启的路径校验。插件把 `enable()` 那一刻的绝对路径快照写 // 进 plist,用户把 App 挪个位置就静默失效 —— 而它的 @@ -993,7 +1110,7 @@ async fn heartbeat_loop(socket: PathBuf, sup: Arc, app: tauri::AppHa // 只在 core 应该在跑的时候探。启动中、重启中、安全模式下探测 // 失败是**预期的**,把它算进连续失败会让守护自己制造重启循环。 - let running = matches!(&*sup.state_handle().lock().await, CoreState::Running { .. }); + let running = matches!(sup.state(), CoreState::Running { .. }); if !running { tracker.reset(); was_running = false; @@ -1047,6 +1164,19 @@ async fn bridge_events(socket: PathBuf, app: tauri::AppHandle) { // 什么样」和「它来自哪个上游」。用户看到批准提示的同时 // 看到这条,判断质量完全不一样。 notify_if_dangerous(&a, &ev); + // 菜单栏上那两个数只跟这几种事件有关:花了多少(请求 + // 落地之后存储层才算得出来)、额度还剩多少。别的事件 + // 叫醒它只是让它白跑一趟。 + if matches!( + ev, + tw_api::Event::RequestFinished { .. } + | tw_api::Event::RequestFailed { .. } + | tw_api::Event::QuotaSeen { .. } + | tw_api::Event::ConfigReloaded { .. } + ) && let Some(st) = a.try_state::() + { + st.menubar.notify_one(); + } let _ = a.emit("core-event", &ev); }) .await; @@ -1416,69 +1546,90 @@ fn build_tray_menu(app: &tauri::AppHandle, f: &TrayFacts) -> tauri::Result().map(|s| s.menubar.clone()) else { + return; + }; + // 守护状态自己是一路:core 起来、重启、进安全模式都要立刻反映到 + // 菜单栏上,而那和请求流没有关系。 + let Some(mut core_rx) = app.try_state::().map(|s| s.supervisor.watch()) else { + return; + }; + let mut prev = menubar::MenuBarState::default(); let mut prev_tray = TrayFacts::default(); - let mut tick: u64 = 0; // 第一帧无条件画,之后靠 needs_redraw let mut first = true; loop { - tokio::time::sleep(std::time::Duration::from_secs(1)).await; - - let next = match app.try_state::() { - Some(state) => collect_menubar_state(&state).await, - None => continue, + // 应用正在退出,状态已经撤了 —— 收摊,别再画了 + let Some(state) = app.try_state::() else { + return; }; - // 托盘菜单跟着一起更。**只在内容真的变了的时候重建** - // —— 每秒重建一次是浪费,而且 macOS 上菜单正开着时重建会把它 - // 收起来,用户点到一半菜单没了。 - // - // 而**收数据本身也要限频**:菜单要的东西(策略组、历史)得走两次 - // 控制面往返,一秒两次是在为一个几分钟才变一次的菜单持续付钱, - // 而这个应用的第一条约束就是空闲时约等于不存在。 - // 五秒一次 —— 改完配置最多等五秒菜单跟上,那完全够。 - tick = tick.wrapping_add(1); - // 第一轮无条件建一次,否则托盘头五秒是个空菜单 - if (tick == 1 || tick % 5 == 0) - && let Some(state) = app.try_state::() - { - let facts = collect_tray_facts(&state, &next).await; - if first || facts != prev_tray { - match build_tray_menu(&app, &facts) { - Ok(m) => { - let _ = tray.set_menu(Some(m)); - prev_tray = facts; - } - Err(e) => tracing::debug!("托盘菜单没建起来:{e}"), + let next = collect_menubar_state(&state).await; + // 托盘菜单跟着一起更。**只在内容真的变了的时候重建** —— 而且 + // macOS 上菜单正开着时重建会把它收起来,用户点到一半菜单没了。 + let facts = collect_tray_facts(&state, &next).await; + if first || facts != prev_tray { + match build_tray_menu(&app, &facts) { + Ok(m) => { + let _ = tray.set_menu(Some(m)); + prev_tray = facts; } + Err(e) => tracing::debug!("托盘菜单没建起来:{e}"), } } - if !first && !next.needs_redraw(&prev) { - continue; + if first || next.needs_redraw(&prev) { + first = false; + draw_menubar(&tray, &next); + prev = next; + } + + // 等一个理由。**两路都要等** —— 只等事件的话,core 挂了之后 + // 菜单栏会停在最后那个数字上,而那正是最该说实话的时候。 + tokio::select! { + _ = wake.notified() => {} + _ = core_rx.changed() => {} } - first = false; - - let template = next.is_template(); - let (rgba, w, h) = menubar::render_rgba( - &next.line1(), - &next.line2(), - template, - menubar::Appearance::Dark, - ); - let _ = tray.set_icon(Some(Image::new_owned(rgba, w, h))); - // **模板标志要跟着状态一起切**:告警时关掉它才能上色, - // 恢复时再打开才能重新自动适配亮暗。 - let _ = tray.set_icon_as_template(template); - prev = next; + // 攒一下。`Notify` 只攒一个许可,所以这三秒里来多少条事件, + // 醒来之后也只多跑一轮。 + tokio::time::sleep(MENUBAR_SETTLE).await; } } +/// 把一帧画到菜单栏上。 +fn draw_menubar(tray: &tauri::tray::TrayIcon, next: &menubar::MenuBarState) { + let template = next.is_template(); + let (rgba, w, h) = menubar::render_rgba( + &next.line1(), + &next.line2(), + template, + menubar::Appearance::Dark, + ); + let _ = tray.set_icon(Some(Image::new_owned(rgba, w, h))); + // **模板标志要跟着状态一起切**:告警时关掉它才能上色, + // 恢复时再打开才能重新自动适配亮暗。 + let _ = tray.set_icon_as_template(template); +} + async fn collect_menubar_state(state: &tauri::State<'_, AppState>) -> menubar::MenuBarState { - let core = state.core_state.lock().await.clone(); + let core = state.supervisor.state(); let status = match core { CoreState::Running { .. } => menubar::Status::Normal, CoreState::Starting | CoreState::Restarting { .. } => menubar::Status::Starting, @@ -1508,7 +1659,7 @@ async fn collect_menubar_state(state: &tauri::State<'_, AppState>) -> menubar::M } else { state .control - .summary() + .summary(None) .await .ok() // **只用实测的那部分。**把估算混进这个数字里,就是在一块 diff --git a/src-tauri/src/supervisor/mod.rs b/src-tauri/src/supervisor/mod.rs index 462ca195..b87e360a 100644 --- a/src-tauri/src/supervisor/mod.rs +++ b/src-tauri/src/supervisor/mod.rs @@ -9,7 +9,7 @@ use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use std::time::{Duration, Instant}; -use tokio::sync::Mutex; +use tokio::sync::{Mutex, watch}; pub mod health; pub mod policy; @@ -42,7 +42,9 @@ pub struct Supervisor { binary: PathBuf, config: Option, policy: Mutex, - state: Arc>, + /// 当前状态。**用 watch 而不是 Mutex,是为了能被订阅** —— 界面 + /// 需要的是「变了就告诉我」,而拿一个 Mutex 只能反复去问。 + state: watch::Sender, /// 这次退出是我们自己要求的吗。 /// /// **主动重启不该算进退避阶梯** —— 改一次配置就重启一次,配五次就 @@ -57,13 +59,28 @@ impl Supervisor { binary, config, policy: Mutex::new(RestartPolicy::new()), - state: Arc::new(Mutex::new(CoreState::Stopped)), + state: watch::channel(CoreState::Stopped).0, intentional: Arc::new(AtomicBool::new(false)), } } - pub fn state_handle(&self) -> Arc> { - self.state.clone() + /// 现在是什么状态。 + pub fn state(&self) -> CoreState { + self.state.borrow().clone() + } + + /// 订阅状态变化。 + /// + /// **每一次转换都推出去。**「core 起来没、是不是在重启、有没有进 + /// 安全模式」这三个答案一天变不了几次,而界面原来是每两秒问一遍的。 + pub fn watch(&self) -> watch::Receiver { + self.state.subscribe() + } + + /// 换一个状态。**`send_replace` 不在乎有没有订阅者** —— 没人听的 + /// 时候状态照样要更新,那是真相本身,不是一条通知。 + fn set(&self, next: CoreState) { + self.state.send_replace(next); } /// core 活着但不响应了,把它换掉。 @@ -71,8 +88,8 @@ impl Supervisor { /// **和 `request_restart` 的区别在于计不计入退避**:这是一次失败, /// 如果 core 反复卡死,最终应该进安全模式。改配置那种重启不是。 pub async fn report_wedged(&self) -> anyhow::Result<()> { - let pid = match &*self.state.lock().await { - CoreState::Running { pid } => *pid, + let pid = match self.state() { + CoreState::Running { pid } => pid, other => anyhow::bail!("core 现在是 {other:?},不用管"), }; tracing::error!(pid, "core 活着但不响应,换掉它"); @@ -97,8 +114,8 @@ impl Supervisor { /// 做法是标记意图然后杀掉它,让守护循环自己把它拉起来 —— 而不是在 /// 这里再写一遍启动逻辑。两处启动逻辑就是两处会漂移。 pub async fn request_restart(&self) -> anyhow::Result<()> { - let pid = match &*self.state.lock().await { - CoreState::Running { pid } => *pid, + let pid = match self.state() { + CoreState::Running { pid } => pid, other => anyhow::bail!("core 现在是 {other:?},没在跑,不用重启"), }; self.intentional.store(true, Ordering::SeqCst); @@ -137,7 +154,7 @@ impl Supervisor { /// /// 返回 false 表示别再循环了(进了安全模式或被主动停掉)。 pub async fn run_once(&self, safe: bool) -> anyhow::Result { - *self.state.lock().await = CoreState::Starting; + self.set(CoreState::Starting); let args = self.command_args(safe); let started = Instant::now(); @@ -148,7 +165,7 @@ impl Supervisor { .spawn()?; if let Some(pid) = child.id() { - *self.state.lock().await = CoreState::Running { pid }; + self.set(CoreState::Running { pid }); tracing::info!(pid, safe, "core 已启动"); } @@ -160,17 +177,17 @@ impl Supervisor { if safe { // 安全模式下的 core 退出了,说明用户主动停的或者更严重的问题。 - *self.state.lock().await = CoreState::Stopped; + self.set(CoreState::Stopped); return Ok(false); } if self.intentional.swap(false, Ordering::SeqCst) { // 我们自己要求的退出。立刻重起,不计入失败。 tracing::info!("按要求重启 core"); - *self.state.lock().await = CoreState::Restarting { + self.set(CoreState::Restarting { attempt: 0, in_ms: 0, - }; + }); return Ok(true); } @@ -185,17 +202,17 @@ impl Supervisor { match decision { Decision::RestartAfter(d) => { - *self.state.lock().await = CoreState::Restarting { + self.set(CoreState::Restarting { attempt: failures, in_ms: d.as_millis() as u64, - }; + }); if !d.is_zero() { tokio::time::sleep(d).await; } Ok(true) } Decision::SafeMode => { - *self.state.lock().await = CoreState::SafeMode; + self.set(CoreState::SafeMode); tracing::error!(failures, "连续失败太多,进安全模式"); Ok(false) } @@ -262,6 +279,6 @@ mod tests { #[tokio::test] async fn state_starts_stopped() { - assert_eq!(*sup().state_handle().lock().await, CoreState::Stopped); + assert_eq!(sup().state(), CoreState::Stopped); } } diff --git a/src/AddUpstream.tsx b/src/AddUpstream.tsx index 7167bb16..7809ca9a 100644 --- a/src/AddUpstream.tsx +++ b/src/AddUpstream.tsx @@ -1,7 +1,17 @@ import { useState } from "react"; -import { Tip } from "./ui/Tooltip"; +import { Tip } from "@/ui/tip"; import { invoke } from "@tauri-apps/api/core"; import type { ModelList, ProbeResponse, SetupResponse } from "./types"; +import { Button } from "@/ui/button"; +import { Input } from "@/ui/input"; +import { toast } from "sonner"; +import { + Empty, + EmptyContent, + EmptyDescription, + EmptyHeader, + EmptyTitle, +} from "@/ui/empty"; /** * 加第一个上游 —— **长在配置页里,不是一个把人挡在外面的独立页面。** @@ -28,7 +38,6 @@ export default function AddUpstream({ onDone }: { onDone: () => void }) { const [key, setKey] = useState(""); const [probe, setProbe] = useState(null); const [busy, setBusy] = useState(false); - const [error, setError] = useState(null); // 从 URL 猜一个名字。用户几乎不会想改它,改名走配置页。 const guessedName = (() => { @@ -44,13 +53,12 @@ export default function AddUpstream({ onDone }: { onDone: () => void }) { async function doProbe() { setBusy(true); - setError(null); setProbe(null); try { // Tauri 的 invoke 用**字符串** reject,不是 Error 对象 setProbe(await invoke("probe_upstream", { baseUrl, key })); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -58,7 +66,6 @@ export default function AddUpstream({ onDone }: { onDone: () => void }) { async function doSetup() { setBusy(true); - setError(null); try { await invoke("setup_first_provider", { name: guessedName, @@ -67,7 +74,7 @@ export default function AddUpstream({ onDone }: { onDone: () => void }) { }); onDone(); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -84,28 +91,33 @@ export default function AddUpstream({ onDone }: { onDone: () => void }) { case "not_implemented": return "。它没有模型列表接口,照样能转发,只是按模型名路由那类功能对它用不上"; case "unrecognized": - return "。模型列表是个未识别的形状 —— 转发不受影响,值得报一个 issue"; + // **不要在这儿叫用户去报 issue。**那是我们的工作流,不是他的; + // 他要知道的只是「这会不会影响我」。想告诉我们的话,「设置」里 + // 的诊断包本来就在那儿。 + return "。它的模型列表是个不认识的形状 —— 转发不受影响,只是按模型名路由那类功能对它用不上"; case "empty": return "。它的模型列表是空的,照样能转发"; } } return ( -
-

- 还没有上游。加一个就能开始转发。 -

-

- 只要地址和密钥。 - - 其余都有默认值 - -

+ + + 尚未配置上游 + + 只要地址和密钥。 + + 其余都有默认值 + + + +
- + {/* 说清这一下不花钱,否则谨慎的用户不会点 */} 不花钱,可以随便点 {probe?.ok && ( - + )}
@@ -185,9 +198,8 @@ export default function AddUpstream({ onDone }: { onDone: () => void }) {

)} - {error && ( -

{error}

- )} -
+ + + ); } diff --git a/src/App.tsx b/src/App.tsx index 65d85007..29c5d646 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,7 +3,7 @@ import { invoke } from "@tauri-apps/api/core"; import { listen } from "@tauri-apps/api/event"; import { useRequests } from "./useRequests"; import { useStableState } from "./useStable"; -import { ago, bytes, latency, repeated, statusTone } from "./format"; +import { bucketStart, latency, money, repeated, statusTone, tokens, when } from "./format"; import { EMPTY_FILTER, facets, @@ -19,8 +19,7 @@ import Keys from "./Keys"; import Routes from "./Routes"; import Security from "./Security"; import Guard from "./Guard"; -import { Dialog, DialogButton } from "./ui/Dialog"; -import { Tip, TooltipRoot } from "./ui/Tooltip"; +import { Tip, TooltipRoot } from "@/ui/tip"; import { IconClient, IconDashboard, @@ -33,13 +32,69 @@ import { IconKey, IconServer, IconSettings, - IconSidebar, } from "./ui/icons"; -import { RowMenu } from "./ui/ContextMenu"; +import { RowMenu } from "@/ui/row-menu"; import Sessions from "./Sessions"; import Dashboard from "./Dashboard"; import RequestDrawer from "./RequestDrawer"; import type { CoreStatus, Overview } from "./types"; +import { Button } from "@/ui/button"; +import { Input } from "@/ui/input"; +import { cn } from "@/lib/utils"; +import { Toggle } from "@/ui/toggle"; +import { Alert, AlertDescription, AlertTitle } from "@/ui/alert"; +import type { LucideIcon } from "lucide-react"; +import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyTitle } from "@/ui/empty"; +import { Kbd, KbdGroup } from "@/ui/kbd"; +import { Toaster } from "@/ui/sonner"; +import { NativeSelect, NativeSelectOption } from "@/ui/native-select"; +import { Split } from "@/ui/split"; +import Connect, { trouble } from "./Connect"; +import { Skeleton } from "@/ui/skeleton"; +import { + Sidebar, + SidebarContent, + SidebarFooter, + SidebarGroup, + SidebarGroupContent, + SidebarHeader, + SidebarMenu, + SidebarMenuBadge, + SidebarMenuButton, + SidebarMenuItem, + SidebarProvider, + SidebarSeparator, + SidebarTrigger, +} from "@/ui/sidebar"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/ui/table"; +import { + AlertDialog, + AlertDialogCancel, + AlertDialogAction, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, +} from "@/ui/alert-dialog"; + +const DAY_MS = 24 * 3_600_000; + +/** + * 连控制面最多退避重试几次。 + * + * **到了上限就停手**,不再往下试 —— 再试下去就成了轮询。守护状态一变 + * (启动中 → 运行中、进了重启、进了安全模式)那个 effect 会重跑,那才 + * 是它该被叫醒的时机。 + */ +const MAX_TRIES = 8; /** core 的状态字符串来自 Rust 侧的 CoreState,见 supervisor/mod.rs。 */ /** @@ -66,7 +121,8 @@ type Surface = | "settings" | "clients"; -type SourceIcon = (p: { size?: number }) => React.ReactElement; +/** lucide 的图标类型。尺寸走 `size`,颜色走 `currentColor`。 */ +type SourceIcon = LucideIcon; const SOURCES: { group: string; items: { id: Surface; label: string; icon: SourceIcon }[]; @@ -163,26 +219,63 @@ function Th({ }) { const active = sort === k; return ( - - - + + + ); +} + +/** + * 表身的骨架。 + * + * **开窗时这一页要先去库里读两百条记录。**读完之前画「暂无请求记录」, + * 是在说一件当时还不知道真假的事 —— 而且记录一到,版面会先塌一次再弹 + * 回来。骨架把行的位置占住,内容落在原地。 + * + * 六行:够说明这里将要出现一张表,又不至于在真的没有记录时留下一屏假 + * 内容 —— 那种情况下接上的是空状态,不是骨架。 + */ +function BodySkeleton({ widths }: { widths: string[] }) { + return ( + + {Array.from({ length: 6 }, (_, row) => ( + + {widths.map((w, col) => ( + + + + ))} + + ))} + ); } export default function App() { - const { rows: allRows, locallyAnswered, rejected, configVersion, alerts, rotated, clearRotated, clearAlerts } = - useRequests(); + const { + rows: allRows, + seeded, + settled, + health, + locallyAnswered, + rejected, + configVersion, + alerts, + rotated, + clearRotated, + clearAlerts, + } = useRequests(); // 排序与过滤。默认按时间倒序 —— 那是「刚才发生了什么」,也是打开这 // 一页最常见的意图。 const [sortKey, setSortKey] = useState("time"); @@ -193,6 +286,14 @@ export default function App() { [allRows, filter, sortKey, sortDir], ); const facet = useMemo(() => facets(allRows), [allRows]); + /** + * 客户端这一列只在真的分得开的时候才出现。 + * + * 目标用户「一个 key 就够」,那时整列二十五行是同一个值 —— 占着宽度 + * 却零信息,而那点宽度给模型名用正好。**按实际出现过的算,不按配置里 + * 有几个算**:配了两个而只有一个在发请求时,这一列同样是常量。 + */ + const showClient = facet.clients.length > 1; const searchRef = useRef(null); /** @@ -212,7 +313,16 @@ export default function App() { } const [status, setStatus] = useStableState(null); const [core, setCore] = useState("stopped"); - const [error, setError] = useState(null); + /** + * 这次会话连上过控制面吗。 + * + * **决定的是「整窗初始化面」还是「保留页面 + 顶部状态带」。**冷启动 + * 时后面确实没东西可看;而断线重连时用户本来在看数据,把它清空比留着 + * 一个旧值更糟 —— 旧值加一句「已断开」至少还回答得了「刚才是什么样」。 + */ + const [linked, setLinked] = useState(false); + /** 连了第几次了。只用来在界面上说清楚,不参与重试逻辑 */ + const [tries, setTries] = useState(0); /** * 托盘按了「退出」,等确认。 * @@ -238,14 +348,6 @@ export default function App() { */ const [cursor, setCursor] = useState(-1); const [tab, setTab] = useState("dashboard"); - /** Dashboard 每两秒跟着状态轮询一起刷。它查的是库,不是实时流 */ - const [dashTick, setDashTick] = useState(0); - /** - * 轮询里要读当前在哪一页,但**不能把 `tab` 加进那个 effect 的依赖** - * —— 那样每切一次页都会重建计时器,于是切页的瞬间会多打一轮请求。 - * 用 ref 读最新值,依赖数组保持不变。 - */ - const tabRef = useRef("dashboard"); /** * 窗口够不够宽拆成两栏。 * @@ -255,17 +357,26 @@ export default function App() { * 应用,窗口是用户随手拖的。 */ /** - * 相对时间要自己走,否则「3s」会一直停在 3s。 + * 今天从哪一刻算起。 * - * **10 秒一跳,不是 1 秒。**这一列的精度到「秒」就够了,而每秒重渲染 - * 整张表正是刚修掉的那个毛病 —— 为了让一个数字走起来把它请回来, - * 是这类计时器最常见的退化方式。 + * 时间那一列只有一处跟「现在」有关:今天的记录给到秒,更早的带上 + * 日期。**那条界线一天只过一次**,所以定时器就定在下一个零点 —— + * 原来是每十秒问一遍现在几点,而每问一遍就把整张表重画一遍。 + * + * 跨零点用 `setDate(+1)` 再归零,不是加 86400000:夏令时那两天 + * 一天不是 24 小时,加毫秒会错开一个钟头。 */ - const [nowTick, setNowTick] = useState(Date.now()); + const [today, setToday] = useState(() => bucketStart(Date.now(), DAY_MS)); useEffect(() => { - const h = setInterval(() => setNowTick(Date.now()), 10_000); - return () => clearInterval(h); - }, []); + const next = new Date(today); + next.setDate(next.getDate() + 1); + next.setHours(0, 0, 0, 0); + const h = setTimeout( + () => setToday(bucketStart(Date.now(), DAY_MS)), + Math.max(1_000, next.getTime() - Date.now()), + ); + return () => clearTimeout(h); + }, [today]); const [wide, setWide] = useState(() => window.innerWidth >= 1040); useEffect(() => { const on = () => setWide(window.innerWidth >= 1040); @@ -273,11 +384,43 @@ export default function App() { return () => window.removeEventListener("resize", on); }, []); const split = wide && tab === "requests" && open != null; + /* + 分栏的宽度记在本地。**v4 的 react-resizable-panels 去掉了 + `autoSaveId`**(那一版自己写 localStorage),所以这里自己接一下 —— + 一共就是读一次、写一次。 + */ + const [splitLayout] = useState | undefined>(() => { + try { + const raw = window.localStorage.getItem("tw-split"); + const v: unknown = raw ? JSON.parse(raw) : null; + if (!v || typeof v !== "object" || Array.isArray(v)) return undefined; + const ok = Object.values(v as Record).every( + (n) => typeof n === "number", + ); + return ok ? (v as Record) : undefined; + } catch { + return undefined; + } + }); const [ov, setOv] = useStableState(null); // 加完第一个上游之后立刻重拉一次。等那两秒的轮询的话,用户刚点完 // 「保存」还看着「还没有上游」,会以为没生效(和那条一样的理由)。 const [nudge, setNudge] = useState(0); + /** + * 概览页什么时候重新拉数。 + * + * **不是定时轮询。**它原来跟着那个两秒一次的状态轮询走,而概览查的是 + * 库 —— 库只在请求落地之后才变。没有流量的时候,那两秒一次做的全是 + * 无用功:同一份数据重新序列化、重新渲染、图表重新动画一遍,而屏幕上 + * 什么都没变。**看起来就是价格一直在闪。** + * + * 现在跟着对账走:`settled` 每涨一次,说明库里确实多了东西(见 + * useRequests,它由事件流触发、2.5 秒节流)。`nudge` 是手动刷新。 + * 都没动的时候,这一页一次请求都不发。 + */ + const dashTick = settled + nudge; + /** * 源列表收起还是展开。 * @@ -415,49 +558,95 @@ export default function App() { setCursor((c) => (c >= rows.length ? rows.length - 1 : c)); }, [rows.length]); + /** + * 守护状态。**推过来的,不是问出来的。** + * + * 「core 起来没、是不是在重启、有没有进安全模式」一天变不了几次, + * 而这三个答案原来是每两秒问一遍的。 + * + * **先挂监听再读一次当前值**,顺序不能反:事件只报变化,而两者之间 + * 发生的那一次转换会丢 —— 表现是启动瞬间界面卡在「已停止」,直到 + * 下一次转换才跟上。 + */ + useEffect(() => { + let alive = true; + const un = listen("core-state", (e) => { + if (alive) setCore(e.payload); + }); + void un + .then(() => invoke("core_state")) + .then((c) => { + if (alive) setCore(c); + }) + .catch(() => { + /* core 还没起来。它起来的那一刻会推一条过来 */ + }); + return () => { + alive = false; + void un.then((f) => f()); + }; + }, []); + + /** + * 状态与配置概览。**只在真的有理由重读的时候重读。** + * + * 原来这一段是每两秒一轮的轮询:两次 IPC 往返,而绝大多数轮得到的是 + * 一模一样的答案。它变化的时机是数得清的,而每一个现在都有事件: + * + * · 配置换了一份(`configVersion` 跟着 `config_reloaded` 走) + * · 某家上游熔断了或恢复了(`health`,core 现在会报) + * · 守护状态变了 —— 重启之后监听地址和 pid 都可能不一样 + * · 用户自己刚改完东西(`nudge`) + */ useEffect(() => { let alive = true; - const tick = async () => { + let timer: ReturnType | null = null; + let n = 0; + const read = async () => { try { - // Tauri 的 invoke 用**字符串** reject,不是 Error —— - // `e instanceof Error` 永远是 false,所以按字符串处理。 const s = await invoke("core_status"); - if (alive) { - setStatus(s); - setError(null); + if (!alive) return; + setStatus(s); + setLinked(true); + setTries(0); + } catch { + /* + **连不上不是错误,是启动过程中的一段。**在此之前这里弹一条 + toast,而它说的是 `Connection refused (os error 61)` —— 那是 + 给写代码的人看的,用户从中得不到任何该做什么的信息。而且这个 + effect 跟着守护状态重跑(已停止 → 启动中 → 运行中),于是同样 + 的话会堆三条。 + + 真正要处理的是一个很具体的窗口期:**core 进程起来了,控制面 + socket 还没 bind**。退避重试几次就过去了,界面上说第几次。 + */ + if (!alive) return; + n += 1; + setTries(n); + if (n <= MAX_TRIES) { + timer = setTimeout(() => void read(), Math.min(1600, 200 * 2 ** Math.min(n - 1, 3))); } - } catch (e) { - if (alive) setError(typeof e === "string" ? e : String(e)); + // 到上限就停手,**不再重试** —— 再试下去就是轮询了。守护状态 + // 一变这个 effect 会重跑,那才是它该被叫醒的时机。 + return; } try { const o = await invoke("overview"); if (alive) setOv(o); } catch { - /* 概览拿不到不该盖掉上面那条更有用的错误 */ - } - // **只在概览页可见时才推 tick。**它唯一的用途是让 Dashboard - // 重新拉数,而每 2 秒自增一次会让整个 App 重渲染一遍 —— 包括 - // 用户正在看的请求表。别的页开着的时候,这个计数没有消费者。 - if (alive && tabRef.current === "dashboard") setDashTick((t) => t + 1); - try { - const c = await invoke("core_state"); - if (alive) setCore(c); - } catch { - /* core_state 不该失败;失败了也不该盖掉上面那条更有用的错误 */ + /* 概览拿不到不影响状态那一半 —— 连上了就是连上了 */ } }; - tick(); - const h = setInterval(tick, 2000); + void read(); return () => { alive = false; - clearInterval(h); + if (timer) clearTimeout(timer); }; - // configVersion 变了就立刻再拉一次 —— 不然用户在编辑器里改完, - // 界面上最多要等两秒才跟上,而那两秒里他会以为没生效。 - }, [configVersion, nudge]); + }, [configVersion, nudge, health, core, setStatus, setOv]); - tabRef.current = tab; const c = describeCore(core); + /** 连上过、又断了。**只在这时候挂那条带子** */ + const lost = linked && tries > 0 ? trouble(core, tries) : null; // **不再有独立的初始化页面。**原来这里有两道全屏门禁:零上游时是 // 一个填表向导,填完是一个「等第一个请求」的页面。两道都拆了。 @@ -473,221 +662,221 @@ export default function App() { return ( -
{/* 源列表。整条都是拖拽区 —— 窗口用的是 Overlay 标题栏(红绿灯浮在 - 内容上),没有一条真的标题栏可以抓,不给拖拽区窗口就挪不动。 + 内容上),没有一条真的标题栏可以抓,不给拖拽区窗口就挪不动。所以 + `data-tauri-drag-region` 要一路传到 `Sidebar` 上。 **可以收起。**收起之后只剩图标,内容区多出 116px —— 对一个开着 不关、一直在看图表的应用,这是唯一真正改善主界面的方向。名字进 悬浮说明,所以收起来不是把信息丢掉,是把它推迟到需要的时候。 - **收起宽度 80px 不是审美选的,是红绿灯定的。**标题栏是 Overlay, - 三颗灯浮在内容上,最右那颗绿灯的右边缘落在约 71pt 处。侧栏窄于 - 这个数,右边框就会从绿灯身上穿过去 —— 之前用 60px 正是如此。 - 80 给了它 9pt 余量。**改窄之前先量一遍那三颗灯。** + **两个宽度都是覆盖掉 shadcn 默认值的,而且各有各的理由。** + 展开 196px(默认 256px 是给网页后台的,这里只放一列短词);收起 + 80px(默认 48px) —— 这个数不是审美选的,是红绿灯定的:标题栏是 + Overlay,三颗灯浮在内容上,最右那颗绿灯的右边缘落在约 71pt 处, + 侧栏窄于这个数,右边框就会从绿灯身上穿过去。80 给了它 9pt 余量。 + **改窄之前先量一遍那三颗灯。** - **没有分组标题,只有细分隔线。**四个标题原本吃掉列表约三分之一 - 的高度,而它们说的事情分隔线也说得出:这两项和上面那两项不一样。 - 代价是分组的**名字**没了 —— 认下这笔,换来整列读起来是一个对象, - 而不是四个小区块。 + 开合状态仍然自己管(localStorage),没用 `SidebarProvider` 默认的 + cookie —— 这是个本地应用,没有服务端要读它。 */} - + + {/* 右侧:横幅 + 内容。只有这一列滚动,源列表不跟着滚 */} {/* 分栏时滚动交给两栏各自管,外层不能再滚 —— 否则是两层滚动条, 而外面那层会把整个分栏一起推走。 */} -
+
{/* - 标题栏那一条。整条是拖拽区,按钮不是 —— 拖拽区只作用在带那个 - 属性的元素上,不带的子元素照常可点。 + 工具栏。整条是拖拽区,按钮不是 —— 拖拽区只作用在带那个属性的 + 元素上,不带的子元素照常可点。 + + **它在滚动容器外面。**之前它是滚动区的第一个子元素,于是往下 + 翻表格时整条跟着卷走了 —— 而这上面放的是「我在哪一页」和收起 + 源列表的开关,两样都是任何时候都该在的。现在滚的是它下面那层。 **收起源列表的按钮放在这儿,不放在源列表里。**收起之后源列表 - 只有 60px 宽,按钮塞进去要么挤掉一个图标位,要么小到点不准; + 只有 80px 宽,按钮塞进去要么挤掉一个图标位,要么小到点不准; 而放在内容这一侧,它在两种状态下都在同一个位置。系统应用 (访达、邮件)也是这么放的。 */}
- - + /> + + {/* + 当前在哪一页。**收起源列表之后这是唯一的答案** —— 那时候 + 列表里只剩图标,「我在哪」只能靠认图形。展开时它和列表里的 + 高亮互相印证。 + + 用 `tw-head` 不是 `tw-title`:它是位置指示,不是页面大标题, + 抢戏就变成两个标题打架。 + */} + + {SOURCES.flatMap((g) => g.items).find((i) => i.id === tab)?.label} +
- {error && ( -
- {error} -
- )} + + {/* + 只有这一层滚。工具栏在它上面,钉住不动。 + 分栏时滚动交给两栏各自管,这一层就不能再滚 —— 否则是两层 + 滚动条,而外面那层会把整个分栏一起推走。 + */} + {/* + 工具栏之下这一层。**滚动不在这儿** —— 请求页交给 `Split` + (分栏时两栏各滚各的),其余页面各自在自己的容器里滚。 + 在这儿再加一层滚动就是两层滚动条。 + */} +
{/* 配置没通过校验。**这条要一直挂着,直到下一次成功换入** —— @@ -696,10 +885,9 @@ export default function App() { 第一句先说「还在按旧配置转发」,因为那是他最想知道的:会不会断。 */} {rejected && ( -
-

- 配置没能生效,还在按上一份转发。 -

+ + 配置校验未通过,仍在使用上一版本 +

{rejected.stage}错误 {rejected.line != null && `(第 ${rejected.line} 行)`}:{rejected.message} @@ -709,7 +897,8 @@ export default function App() { {rejected.line}│ {rejected.excerpt} )} -

+ + )} {/* @@ -724,10 +913,10 @@ export default function App() { r.persisted ? (
-

- +

+ {r.provider} {" "} 的 token 端点换发了新凭据,已写回 config.yaml @@ -735,12 +924,14 @@ export default function App() { 编辑器要重载

- +
) : (
重启之前不处理,这家会一直 401。

- +
), )} - {tab === "sessions" ? ( + {/* + 断线重连。**不是 toast,也不清空页面。** + + 用户本来在看数据,清空之后连「刚才是什么样」都没了;而 toast + 会飘走,飘走之后界面上一点痕迹都不留 —— 于是那些凝固的数字看 + 起来还是新鲜的。一条常驻的带子两件事都解决:数字留着,旁边写着 + 它们为什么不动了。 + */} + {linked && tries > 0 && lost && ( +
+ + {lost.what} —— 下面的数字停在断开之前 + + {lost.next} + {lost.retry && ( + + )} +
+ )} + + {/* + **每一面自己滚。**工具栏钉在上面不动,这一层只负责给出高度; + 真正滚的是下面这个容器(请求页是 `Split` 里的两栏各滚各的)。 + */} +
+ {/* + **这次会话还没连上过控制面 —— 整窗让给初始化面。** + 每一页的数据都来自那条 socket,连不上的时候后面确实没东西。 + + 和「不再有独立初始化页面」那条决定不冲突:那两道门挡的是配置 + 状态(还没配上游),而门后面的东西是存在、可用的;这一道挡的是 + 连接状态。**控制面一答应就立刻让开** —— 哪怕网关还没起来(安全 + 模式下配置、回滚、还原接管都能用,那时绝不能再挡)。 + */} + {!linked ? ( + + ) : tab === "sessions" ? ( ) : tab === "dashboard" ? ( - + ) : tab === "clients" ? ( c.name)} @@ -790,7 +1032,7 @@ export default function App() { onChanged={() => setNudge((n) => n + 1)} /> ) : ( -

读取配置中…

+

读取配置中…

) ) : tab === "keys" ? ( ov ? ( @@ -800,7 +1042,7 @@ export default function App() { onChanged={() => setNudge((n) => n + 1)} /> ) : ( -

读取配置中…

+

读取配置中…

) ) : tab === "routing" ? ( ov ? ( @@ -820,7 +1062,7 @@ export default function App() { /> ) : ( -

读取配置中…

+

读取配置中…

) ) : tab === "upstreams" || tab === "config" || tab === "settings" ? ( ov ? ( @@ -835,78 +1077,101 @@ export default function App() { onProviderAdded={() => setNudge((n) => n + 1)} /> ) : ( -

读取配置中…

+

读取配置中…

) ) : ( -
-
+ { + try { + window.localStorage.setItem("tw-split", JSON.stringify(l)); + } catch { + // 隐私模式之类。记不住而已,不值得为它中断 + } + }} + detail={ + split && open != null ? ( + setOpen(null)} inline /> + ) : null + } + > {/* 过滤条。**一直在,不是「有数据才出现」** —— 一个时有时无的 工具条,用户每次都要重新找它在哪儿。没有请求时它是禁用的。 */} {allRows.length > 0 && (
- setFilter((f) => ({ ...f, q: e.target.value }))} placeholder="搜索路径、客户端、上游、错误… ⌘F" spellCheck={false} - className="w-64 rounded-md border border-neutral-300 bg-transparent px-2 py-1 tw-body outline-none focus:border-neutral-500 dark:border-neutral-700" /> - + {/* 下拉里只列**出现过的** —— 配了三家而只有一家在收流量时, 另外两家出现在这里只会让人以为自己筛错了 */} {facet.clients.length > 1 && ( - + )} {facet.providers.length > 1 && ( - + )} {/* **筛掉了多少要说出来。**只显示「12 条」而不说「共 340 条」 的话,用户会以为总共就这么多 —— 这是过滤器最常见的骗人方式。 */} - + {hasAnyFilter(filter) ? `${rows.length} / ${allRows.length} 条` : `${allRows.length} 条`} {hasAnyFilter(filter) && ( - + )}
)} @@ -917,77 +1182,108 @@ export default function App() { 以及去哪儿加。最后一件给一条能点的路,不是一句「请去配置」。 */} {status?.providers === 0 && ( -
+

先加一个上游

-

+

网关已经起来了,在{" "} http://{status.gateway_addr} {" "} 听着,但还没有地方可以转发。加一个上游只要地址和密钥。

- +
)} - {rows.length === 0 ? ( - // 空状态永远在回答「接下来该做什么」。 -
-

- 还没有请求经过。 -

-

- 把客户端指到{" "} - - http://{status?.gateway_addr ?? "127.0.0.1:8788"} - - ,用配置里那把 tw- 开头的密钥。 -
- 第一个请求进来时,它会出现在这里。 -

- {locallyAnswered > 0 && ( - // **这句话信息量很大**:客户端已经连上了,只是还没发过真实 - // 请求。没有它,用户会以为整条链路都不通。 -

- 已经本地应答了 {locallyAnswered} 次客户端探测 —— 客户端连上了,而这些探测一分钱没花。 -

- )} - {/* - **空状态永远在回答「接下来该做什么」**。原来只说 - 了「把客户端指过来」,而没给他一条走过去的路 —— 那句话对 - 一个不想自己改 settings.json 的人等于没说。 - */} - -
+ {seeded && rows.length === 0 ? ( + allRows.length > 0 ? ( + /* + 有记录,只是全被筛掉了。**这时候说「暂无请求记录」是错的** + —— 用户会以为网关断了,而实际上清掉条件就看得见。 + */ + + + 没有符合条件的请求 + + 共 {allRows.length} 条记录,当前筛选条件下没有匹配项。 + + + + + + + ) : ( + // 空状态永远在回答「接下来该做什么」。 + + + 暂无请求记录 + + 把客户端指到{" "} + + http://{status?.gateway_addr ?? "127.0.0.1:8788"} + + ,用配置里那把 tw- 开头的密钥。 +
+ 第一个请求进来时,它会出现在这里。 +
+ {/* 一次都没有的时候不说这句 —— 「已经本地应答了 0 次」是在 + 拿一个零冒充证据 */} + {locallyAnswered > 0 && ( + + 已经本地应答了 {locallyAnswered} 次客户端探测 —— 客户端连上了,而这些探测一分钱没花。 + + )} +
+
+ ) ) : ( - +
{/* **表头必须钉住。**这张表滚两屏之后就没有列名了,而并排的 两列毫秒数,不看列名根本分不出哪个是首字节哪个是总耗时 —— 那恰恰是排查时唯一要看的区别。 */} - - + + - - + {/* 只有一个客户端时这一列每行都一样 —— 那是零信息 */} + {showClient && 客户端} + 模型 + 上游 {/* 首字节和总耗时合成一列 —— 非流式请求两者几乎相同 */} - - + { setCursor(rows.indexOf(r)); setOpen(r.id); @@ -1051,7 +1354,7 @@ export default function App() { 状态用色点编码。**25 个灰色 200 排成一列是零信息** —— 眼睛要能一眼扫到那个 5xx,而不是逐行读数字。 */} - - {/* 时间:列表要的是「刚才那条」,绝对时间留给悬停 */} - + {/* 和上一行相同就淡化 —— 眼睛要找的是变化的那一行 */} - - - + {/* 数字右对齐。左对齐时 253ms 和 1486ms 的个位对不齐, 扫一列找最慢的那条要逐行读 —— 而这一列存在的意义就是 扫出极值。 */} - - - + + + {tokens(r.inputTokens, r.outputTokens)} + + {/* + **估算值必须带记号。**猜出来的金额和账单上的数字在 + 列表里长得一模一样,而它们不是一回事。 + */} + + {r.costEstimated ? ( + + + {money(r.costMicros, true)} + + + ) : ( + + {money(r.costMicros, false)} + + )} + + ))} - -
- 客户端上游路径 - -
+ + + + {/* + 走到这里还是空的,只可能是历史没读完 —— 「读完了,确实一条 + 都没有」在上面那一支里已经处理掉了。**事件流先到的行不能被 + 骨架盖住**:那时数据已经在手上了。 + */} + {rows.length === 0 ? ( + + ) : ( + {rows.map((r, i) => ( setFilter((f) => ({ ...f, provider: r.provider })), }, - { - kind: "item", - label: `只看客户端 ${r.client}`, - onSelect: () => setFilter((f) => ({ ...f, client: r.client })), - }, + ...(showClient + ? ([ + { + kind: "item", + label: `只看客户端 ${r.client}`, + onSelect: () => setFilter((f) => ({ ...f, client: r.client })), + }, + ] as const) + : []), { kind: "sep" }, { kind: "item", @@ -1021,10 +1321,13 @@ export default function App() { [ new Date(r.atMs).toLocaleString(), r.client, + r.model ?? "", r.provider, r.path, r.status ?? r.state, r.durationMs != null ? `${r.durationMs}ms` : "", + tokens(r.inputTokens, r.outputTokens), + money(r.costMicros, r.costEstimated), r.error ?? "", ] .filter(Boolean) @@ -1033,7 +1336,7 @@ export default function App() { }, ]} > -
+ {(() => { const tone = statusTone(r.status, r.state); const dot = @@ -1075,18 +1378,37 @@ export default function App() { ); })()} - + + {/* + 时间用绝对值。**相对时间在这一列会塌掉** —— 打开应用 + 看昨天那次时,整列全是「1d」,而这一列的用途就是把 + 某一行对上号。相对时间留给悬停。 + */} + - {ago(r.atMs, nowTick)} + {when(r.atMs, today)} - x.client) ? "text-neutral-400/50" : ""}> - {r.client} - x.provider) ? "text-neutral-400/50" : ""}> + {showClient && ( + x.client) ? "text-neutral-400/50" : ""}> + {r.client} + + )} + {/* + 模型。**这一列决定了这次多贵、多慢** —— 同一个客户端 + 连着发的两次请求,差别往往只在这里。 + */} + x.model ?? "") ? "text-neutral-400/50" : ""} + > + {/* 截断要套在里面一层:`max-width` 加在 td 上会被表格 + 自己的列宽算法吃掉,长名字照样把这一列撑开 */} +
+ {r.model ?? "—"} +
+
+ x.provider) ? "text-neutral-400/50" : ""}> {r.provider} {/* **看不见的安全功能会被用户关掉**,因为他们会怀疑 是脱敏搞坏了功能。所以脱敏发生了就要在 @@ -1142,83 +1464,88 @@ export default function App() { {r.flagged.some((f) => f.blocked) ? "已拦截" : "可疑调用"} )} -
x.path) - ? "text-neutral-400/50" - : "text-neutral-500") - } - > - {r.path} - + {latency(r.ttfbMs, r.durationMs)} - - {bytes(r.bytes)} -
+ + )} + )} {locallyAnswered > 0 && rows.length > 0 && ( -

+

另有 {locallyAnswered} 次客户端探测被本地应答,没有发给任何上游。

)} -
- {/* 检查器常驻右栏:看详情的时候列表还在,两边能来回对照 */} - {split && ( -
- setOpen(null)} inline /> -
- )} -
+ )} {/* 右侧抽屉。Dashboard 那边早就接了,请求页反而没有 —— 而 这里才是主战场 */} +
+
{/* 浮层挂在最外层,不跟着右列滚动 */} - -

+ + + + 退出 ThinkWatch Lite? + 所有接管过的客户端会立刻失联 —— 它们指着的端口后面就没东西在听了。 -

-

- 只是想关窗口的话,按 ⌘W 就行,进程会留在菜单栏。 -

- - } - footer={ - <> - setAskQuit(false)}>取消 - void invoke("quit_app")}> + + +

+ 仅关闭窗口请按 ⌘W,进程将保留在菜单栏。 +

+ + 取消 + void invoke("quit_app")} + > 退出 -
- - } - /> + + + + {/* 窄窗口回退到浮层 —— 拆两栏会让列表窄到没法看 */} {open != null && !split && ( setOpen(null)} /> )} - + {/* + **所有出错都走这里。**在此之前每个页面各自在表单旁边挂一条错误, + 于是同一句「还没读到配置版本」有六份实现,而滚出视野的那几份用户 + 根本看不到。吐司统一在右下角,谁触发的都一样。 + */} + +
); } diff --git a/src/Clients.tsx b/src/Clients.tsx index 5cfc9e64..26dbe9fd 100644 --- a/src/Clients.tsx +++ b/src/Clients.tsx @@ -1,5 +1,5 @@ import { useCallback, useEffect, useState } from "react"; -import { Tip } from "./ui/Tooltip"; +import { Tip } from "@/ui/tip"; import { invoke } from "@tauri-apps/api/core"; import type { AdoptResponse, @@ -8,6 +8,18 @@ import type { FindingView, PlanView, } from "./types"; +import { Button } from "@/ui/button"; +import { Badge } from "@/ui/badge"; +import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/ui/empty"; +import { toast } from "sonner"; +import { useCoreEvent } from "./useCoreEvent"; +import { patchConfig } from "./patch"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from "@/ui/dialog"; /** * 客户端接管页。 @@ -38,7 +50,7 @@ export default function Clients({ const [done, setDone] = useState(null); const [why, setWhy] = useState<{ id: string; found: FindingView[] } | null>(null); const [busy, setBusy] = useState(false); - /** 「全部还原」按了一次,等第二次确认。**不弹浏览器的 confirm** —— + /** 「不限还原」按了一次,等第二次确认。**不弹浏览器的 confirm** —— * 这个项目里所有破坏性操作都走自己的确认界面(接管走 diff 弹窗) */ const [confirmAll, setConfirmAll] = useState(false); @@ -48,17 +60,31 @@ export default function Clients({ setError(null); } catch (e) { // Tauri 的 invoke 用字符串 reject,不是 Error - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } }, []); useEffect(() => { void load(); - // 观察窗口靠轮询:等的是「第一个真实请求」,而它可能几分钟后才来 - const t = setInterval(() => void load(), 5000); - return () => clearInterval(t); }, [load]); + /* + 这一页有两件事会变,而它们各自都有事件: + + · **磁盘上那几个配置文件被改了** —— 用户在编辑器里把地址改回去, + 接管状态就该跟着变。core 盯着那几个目录,改动会报 `clients_changed`。 + · **第一个真实请求到了** —— 「已验证」这个标记等的就是它,而它可能 + 几分钟后才来。 + + 原来两件事都靠每 5 秒重扫一遍磁盘来发现。空闲的机器上那是每分钟 + 十二次白扫,而用户多半根本没打开这一页。 + */ + useCoreEvent( + ["clients_changed", "request_finished", "request_failed"], + () => void load(), + 3_000, + ); + async function ask(c: DetectedClient, restore: boolean) { setBusy(true); setError(null); @@ -68,7 +94,7 @@ export default function Clients({ }); setPlan({ p, c, restore }); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -89,16 +115,20 @@ export default function Clients({ 全线失效。** 没有同名密钥就先建一把。建和用是两次写入,中间那一刻只是「多了 - 一把还没人用的密钥」—— 一个无害的状态,而反过来(先接管再建) + 一把还未被引用的密钥」—— 一个无害的状态,而反过来(先接管再建) 那一刻客户端配的是一把不存在的密钥。 */ const keyName = plan.c.id; if (!plan.restore && !clientKeys.includes(keyName)) { + // **类型查出来的。**这里原本直接把 `configVersion` 递进去,而它 + // 可能还是 null(core 刚起来、第一次配置读回来之前)。那种时候 + // 建密钥会失败,而接管照样往下走 —— 客户端配上一把不存在的密钥。 + if (!configVersion) { + toast.error("还没读到配置版本,稍等一下再试"); + return; + } const key = await invoke("new_key"); - await invoke("patch_config", { - ops: [{ op: "append", path: "/clients", item: `name: ${keyName}\nkey: ${key}` }], - baseVersion: configVersion, - }); + await patchConfig([{ op: "append", path: "/clients", item: `name: ${keyName}\nkey: ${key}` }], configVersion); } const r = await invoke(plan.restore ? "restore_client" : "adopt_client", { client: plan.c.id, @@ -108,7 +138,7 @@ export default function Clients({ setDone(r); await load(); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); setPlan(null); } finally { setBusy(false); @@ -120,14 +150,14 @@ export default function Clients({ try { setWhy({ id, found: await invoke("diagnose_client", { client: id }) }); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } } if (!data) { - return
{error ?? "扫描中…"}
; + return
{error ?? "扫描中…"}
; } const here = data.clients.filter((c) => c.installed); @@ -135,14 +165,10 @@ export default function Clients({ return (
- {error && ( -
- {error} -
- )} +
-
+
接管会把这些客户端指向 {data.gateway_base}。 只改端点和密钥两个字段,其余不动,随时可还原。
@@ -158,7 +184,9 @@ export default function Clients({ 把 {data.clients.filter((c) => c.adopted_at_ms !== null).length}{" "} 个客户端改回原样?它们会立刻不再经过 ThinkWatch。 - - +
) : ( - + 不限还原 + ))}
@@ -210,13 +240,11 @@ export default function Clients({ 或者手动把端点指过来」。 */} {here.length === 0 && ( -
-

- 这台机器上没有找到已识别的客户端。 -

-

- 装了 Claude Code、Codex、Gemini CLI 的话 - + + + 未检测到已支持的客户端 + 装了 Claude Code、Codex、Gemini CLI 的话 + 先跑一次再回来 。
@@ -224,9 +252,9 @@ export default function Clients({ {data.gateway_base} - 。 -

-
+ 。 + + )} {here.map((c) => ( @@ -234,7 +262,7 @@ export default function Clients({ ))} {gone.length > 0 && ( -
+
这台机器上没找到的({gone.length})
    {gone.map((c) => ( @@ -247,14 +275,14 @@ export default function Clients({ )} {/* **不假装能接管。**显示成「已接管」会让用户以为所有流量都在我们这儿 */} -
    +
    接管不了,只能给你步骤
    -
      +
        {data.manual.map((m) => (
      • - {m.name} + {m.name}
        {m.how.replace("网关地址", data.gateway_base)}
        -
        {m.caveat}
        +
        {m.caveat}
      • ))}
      @@ -287,39 +315,41 @@ function Card({ const nagging = c.warns_when_silent && silentFor > 5 * 60 * 1000; return ( -
      +
      {c.name} {verified ? ( - 已验证 · 收到过它的请求 + 已验证 · 收到过它的请求 ) : adopted ? ( - 已接管 · 等第一个请求 + 已接管 · 等第一个请求 ) : ( - 没接管 + 没接管 )}
      {adopted && ( - + )} - +
      -
      +
      {c.real} {/* 用户以为在改 ~/.claude/settings.json,实际写的可能是他 @@ -344,28 +374,36 @@ function Card({ ); } -function Badge({ tone, children }: { tone: "ok" | "wait" | "idle"; children: React.ReactNode }) { - const cls = { - ok: "bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-300", - wait: "bg-amber-100 text-amber-800 dark:bg-amber-950 dark:text-amber-300", - idle: "bg-neutral-100 text-neutral-600 dark:bg-neutral-800 dark:text-neutral-400", - }[tone]; - return {children}; -} -function Shell({ children, onClose }: { children: React.ReactNode; onClose: () => void }) { +/** + * 这几屏共用的对话框外壳。 + * + * **原来是手写的 `fixed inset-0` 浮层。**它缺的东西和另外三处一模一样: + * Esc 关不掉、Tab 会跑到背景里去、打开时焦点不进来、关上之后焦点不回到 + * 触发它的那个按钮、读屏软件不知道这是个对话框。每一件都能自己补,而四 + * 份手写的实现里一定有几份是错的。 + * + * `title` 是新收的参数:shadcn 的 `DialogContent` 要求必须有 + * `DialogTitle`,那正是读屏软件念出来的那一句。 + */ +function Shell({ + title, + children, + onClose, +}: { + title: React.ReactNode; + children: React.ReactNode; + onClose: () => void; +}) { return ( -
      -
      e.stopPropagation()} - > + !o && onClose()}> + + + {title} + {children} -
      -
      + + ); } @@ -386,11 +424,8 @@ function PlanDialog({ onConfirm: () => void; }) { return ( - -
      - {restore ? "还原" : "接管"} {c.name} -
      -
      + +
      要改 {p.path}
      @@ -410,7 +445,7 @@ function PlanDialog({ {/* 接管的代价要在这里列出来,不能等用户自己发现 */} {p.notes.length > 0 && ( -
        +
          {p.notes.map((n) => (
        • {n}
        • ))} @@ -419,7 +454,7 @@ function PlanDialog({ -
          +
          写入前整份备份,除上面这几个字段外一字节不动。 {p.carries_secret && "(diff 里的密钥已打码,实际写入的是 config.yaml 里那把真的。)"}
          @@ -427,17 +462,17 @@ function PlanDialog({ )}
          - + {!p.noop && ( - + )}
          @@ -503,7 +538,7 @@ function Diff({ before, after }: { before: string | null; after: string }) { ? "bg-emerald-50 text-emerald-900 dark:bg-emerald-950/50 dark:text-emerald-300" : r.kind === "del" ? "bg-red-50 text-red-900 line-through dark:bg-red-950/50 dark:text-red-300" - : "text-neutral-500" + : "text-muted-foreground" } > {r.kind === "add" ? "+ " : r.kind === "del" ? "- " : " "} @@ -517,9 +552,8 @@ function Diff({ before, after }: { before: string | null; after: string }) { /** 接管完成。**不说「成功」** —— 只有请求能证明它真的生效了。 */ function DoneDialog({ r, onClose }: { r: AdoptResponse; onClose: () => void }) { return ( - -
          写好了
          -
          + +
          {r.takes_effect_note}
          改的是 {r.real} @@ -537,9 +571,9 @@ function DoneDialog({ r, onClose }: { r: AdoptResponse; onClose: () => void }) {
          - +
          ); @@ -548,8 +582,7 @@ function DoneDialog({ r, onClose }: { r: AdoptResponse; onClose: () => void }) { /** 优先级链的诊断结果。**查干净的也要说出来**,而不是让那一项消失。 */ function WhyDialog({ found, onClose }: { found: FindingView[]; onClose: () => void }) { return ( - -
          为什么没生效
          +
            {found.map((f, i) => (
          • @@ -566,7 +599,7 @@ function WhyDialog({ found, onClose }: { found: FindingView[]; onClose: () => vo
            {f.title}
            -
            {f.detail}
            +
            {f.detail}
            {/* 命令给出来,执行与否是他的事 */} {f.fix && ( @@ -578,9 +611,9 @@ function WhyDialog({ found, onClose }: { found: FindingView[]; onClose: () => vo ))}
          - +
          ); diff --git a/src/Config.tsx b/src/Config.tsx index 80dcbfc4..7e82f42d 100644 --- a/src/Config.tsx +++ b/src/Config.tsx @@ -1,5 +1,7 @@ import { Fragment, useRef, useState } from "react"; -import { Tip } from "./ui/Tooltip"; +import { Tip } from "@/ui/tip"; +import { Checkbox } from "@/ui/checkbox"; +import { Field, FieldContent, FieldDescription, FieldLabel } from "@/ui/field"; import AddUpstream from "./AddUpstream"; import Proxies from "./Proxies"; import { invoke } from "@tauri-apps/api/core"; @@ -17,6 +19,30 @@ import type { Overview, PatchOp, } from "./types"; +import { Button } from "@/ui/button"; +import { Input } from "@/ui/input"; +import { cn } from "@/lib/utils"; +import { ToggleGroup, ToggleGroupItem } from "@/ui/toggle-group"; +import { Alert, AlertDescription, AlertTitle } from "@/ui/alert"; +import { Spinner } from "@/ui/spinner"; +import { Switch } from "@/ui/switch"; +import { toast } from "sonner"; +import { patchConfig } from "./patch"; +import { NativeSelect, NativeSelectOption } from "@/ui/native-select"; +import { ButtonGroup } from "@/ui/button-group"; +import { + Collapsible, + CollapsibleContent, + CollapsibleTrigger, +} from "@/ui/collapsible"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/ui/table"; /** * 一个能改的字段。 @@ -31,13 +57,11 @@ function EditableCell({ value, path, version, - onSaved, mono, }: { value: string; path: string; version: string | null; - onSaved: (err: string | null) => void; mono?: boolean; }) { const [draft, setDraft] = useState(value); @@ -62,7 +86,7 @@ function EditableCell({ // 组字中不提交 —— 中间态提交上去的是一段还没成形的文本 if (composing.current || draft === value || busy) return; if (!version) { - onSaved("还没读到配置版本,稍等一下再试"); + toast.error("还没读到配置版本,稍等一下再试"); setDraft(value); return; } @@ -70,20 +94,19 @@ function EditableCell({ try { const ops: PatchOp[] = [{ op: "replace", path, value: draft }]; // Tauri 的 invoke 用字符串 reject,不是 Error - await invoke("patch_config", { ops, baseVersion: version }); - onSaved(null); + await patchConfig(ops, version); } catch (e) { // **失败时把草稿退回原值。**留着一个没保存成功的值,用户下次 // 看这一行会以为它已经生效了。 setDraft(value); - onSaved(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } } return ( - setDraft(e.target.value)} @@ -112,12 +135,8 @@ function EditableCell({ e.currentTarget.blur(); } }} - className={ - "w-full min-w-0 rounded border border-transparent bg-transparent px-1 py-0.5 " + - "hover:border-neutral-300 focus:border-neutral-400 focus:outline-none " + - "disabled:opacity-50 dark:hover:border-neutral-700 dark:focus:border-neutral-600 " + - (mono ? "font-mono" : "") - } + variant="inline" + className={cn(mono && "font-mono")} /> ); } @@ -134,7 +153,6 @@ function SelectCell({ options, path, version, - onSaved, onDone, }: { value: string; @@ -142,48 +160,42 @@ function SelectCell({ options: [string, string][]; path: string; version: string | null; - onSaved: (err: string | null) => void; onDone?: () => void; }) { const [busy, setBusy] = useState(false); return ( - + ); } @@ -198,14 +210,14 @@ function SpeedRows({ r }: { r: L1Result }) { return (
          {r.segments.map((seg) => ( -
          +
          {seg.name} {seg.ms} ms
          ))} {r.ok && (
          - 建连总计 + 建连总计 {r.total_ms} ms
          )} @@ -235,9 +247,9 @@ function SpeedRows({ r }: { r: L1Result }) { * · **仅本机** `loopback` —— 绑 127.0.0.1。别的设备连不过来。 * · **指定网卡** `` —— 绑某一张网卡自己的地址。只有那张网卡所在的 * 网络连得上。 - * · **全部网卡** `all` —— 绑 0.0.0.0。**每一张**网卡,包括对着公网的那张。 + * · **不限网卡** `all` —— 绑 0.0.0.0。**每一张**网卡,包括对着公网的那张。 * - * 以前中间那档叫「局域网」,而它绑的也是 0.0.0.0 —— 和「全部网卡」是同 + * 以前中间那档叫「局域网」,而它绑的也是 0.0.0.0 —— 和「不限网卡」是同 * 一个地址,区别只在来源白名单的默认值。**那是个白名单概念,伪装成了网卡 * 选择**:用户以为网关只在局域网那张网卡上听,实际它在所有网卡上听。 * @@ -258,7 +270,7 @@ const KINDS: { id: BindKind; label: string; what: string }[] = [ { id: "loopback", label: "仅本机", - what: "绑 127.0.0.1。只有这台电脑上的程序连得上,别的设备连不过来。", + what: "绑定 127.0.0.1。仅本机程序可连接,同网络的其他设备无法访问。", }, { id: "nic", @@ -267,7 +279,7 @@ const KINDS: { id: BindKind; label: string; what: string }[] = [ }, { id: "all", - label: "全部网卡", + label: "不限网卡", what: "绑 0.0.0.0,每一张网卡都在听 —— 包括对着公网的那张。密钥校验强制开启。", }, ]; @@ -282,27 +294,24 @@ const KINDS: { id: BindKind; label: string; what: string }[] = [ function CidrList({ items, configVersion, - onErr, }: { items: string[]; configVersion: string | null; - onErr: (e: string | null) => void; }) { const [adding, setAdding] = useState(""); const [busy, setBusy] = useState(false); async function run(ops: PatchOp[]) { if (!configVersion) { - onErr("还没读到配置版本,稍等一下再试"); + toast.error("还没读到配置版本,稍等一下再试"); return; } setBusy(true); - onErr(null); try { - await invoke("patch_config", { ops, baseVersion: configVersion }); + await patchConfig(ops, configVersion); setAdding(""); } catch (e) { - onErr(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -310,24 +319,26 @@ function CidrList({ return (
          - {items.length === 0 && (全放行)} + {items.length === 0 && (全放行)} {items.map((c, i) => ( {c} - + ))} -
          ); @@ -365,25 +375,20 @@ function ProbesSection({ ov: Overview; configVersion: string | null; }) { - const [err, setErr] = useState(null); const [busy, setBusy] = useState(null); const probes = ov.client_probes ?? []; if (probes.length === 0) return null; async function set(id: string, mode: string) { if (!configVersion) { - setErr("还没读到配置版本,稍等一下再试"); + toast.error("还没读到配置版本,稍等一下再试"); return; } setBusy(id); - setErr(null); try { - await invoke("patch_config", { - ops: [{ op: "replace", path: `/client_probes/${id}`, value: mode }], - baseVersion: configVersion, - }); + await patchConfig([{ op: "replace", path: `/client_probes/${id}`, value: mode }], configVersion); } catch (e) { - setErr(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(null); } @@ -391,47 +396,45 @@ function ProbesSection({ return (
          -

          客户端的辅助请求

          -

          +

          客户端探测请求

          +

          客户端自己发的、你没点过的那些请求。它们也花钱。

            {probes.map((p) => (
          • {p.label} -
            + v && void set(p.id, v)} + > {PROBE_MODES.map((m) => ( - + ))} -
            +
            -

            {p.what}

            -

            +

            {p.what}

            +

            {PROBE_MODES.find((m) => m.id === p.mode)?.what}

          • ))}
          -

          +

          路由规则里的「辅助请求」条件,只有在这一类选了「交给路由」时才可能命中。

          - {err &&

          {err}

          }
          ); } @@ -444,14 +447,13 @@ function LimitsSection({ ov: Overview; configVersion: string | null; }) { - const [err, setErr] = useState(null); const l = ov.limits; if (!l) return null; const rows: [string, keyof typeof l, string][] = [ ["全局并发", "max_concurrent", "同时在飞的请求上限。超了先排队。"], - ["单个上游", "per_provider", "一家上游同时最多几个。防止一家慢拖垮全部。"], - ["队列上限", "queue_depth", "排队排到这么多就真的拒绝了。"], - ["排队超时", "queue_timeout_secs", "排这么多秒还没轮到就放弃(秒)。"], + ["单个上游", "per_provider", "一家上游同时最多几个。防止一家慢拖垮不限。"], + ["队列上限", "queue_depth", "队列达到此长度后拒绝新请求。"], + ["排队超时", "queue_timeout_secs", "排队超过此时长后放弃(秒)。"], ]; return (
          @@ -459,20 +461,18 @@ function LimitsSection({
          {rows.map(([label, key, what]) => ( -
          {label}
          +
          {label}
          -
          {what}
          +
          {what}
          ))}
          - {err &&

          {err}

          }
          ); } @@ -484,7 +484,6 @@ function ListenSection({ ov: Overview; configVersion: string | null; }) { - const [err, setErr] = useState(null); const [busy, setBusy] = useState(false); const [nics, setNics] = useState(null); const cur = ov.listen.bind; @@ -509,18 +508,14 @@ function ListenSection({ async function write(value: string) { if (value === cur || busy) return; if (!configVersion) { - setErr("还没读到配置版本,稍等一下再试"); + toast.error("还没读到配置版本,稍等一下再试"); return; } setBusy(true); - setErr(null); try { - await invoke("patch_config", { - ops: [{ op: "replace", path: "/listen/gateway/bind", value }], - baseVersion: configVersion, - }); + await patchConfig([{ op: "replace", path: "/listen/gateway/bind", value }], configVersion); } catch (e) { - setErr(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -532,7 +527,7 @@ function ListenSection({ // 选「指定网卡」时先落到第一张,用户再从选单里换 const first = nics?.[0]; if (!first) { - setErr("没找到可以绑的网卡。插着网线或连着 Wi-Fi 吗?"); + toast.error("没找到可以绑的网卡。插着网线或连着 Wi-Fi 吗?"); return; } void write(first.addr); @@ -544,52 +539,75 @@ function ListenSection({

          监听与访问

          -
          + v && pickKind(v as BindKind)} + > {KINDS.map((k) => ( - + ))} -
          +
          -

          +

          {picked?.what}

          + {/* + **「已经不只是本机了」这句话得有人说。**原来是把选中的那一档染成 + 琥珀色 —— 那是这个控件里唯一的暴露信号,而换成 ToggleGroup 之后 + 选中态是统一的,信号就没了。与其在一个按钮上盖颜色,不如让库里 + 那个专门说这种话的组件来说。 + */} + {ov.listen.exposed && ( + + 网关已暴露在局域网 + + 同一个网络里的机器都能连过来。来源白名单还在起作用,但它挡的是 + 地址,不是人。 + + + 密钥强制校验 + + + + + )} + {kind === "nic" && (
          - - - + + + 地址会变 @@ -597,48 +615,32 @@ function ListenSection({ )}
          -
          正在监听
          +
          正在监听
          {ov.listen.bind} : setErr(e)} />
          -
          客户端密钥
          +
          客户端密钥
          {ov.clients.map((c) => `${c.name} ${c.key}`).join(",")}
          {ov.listen.exposed && ( <> -
          来源白名单
          +
          来源白名单
          )}
          - {ov.listen.exposed && ( -

          - 监听在非本机地址上,局域网里的机器能连过来 - - - 密钥强制校验 - - -

          - )} - - {err && ( -

          {err}

          - )} {/* 白名单还只能读不能改:`PatchOp::Replace` 只吃标量,而 `allow_from` @@ -694,11 +696,9 @@ export default function Config({ const multi = t.health; const [cfg, setCfg] = useState(null); const [history, setHistory] = useState([]); - const [saveError, setSaveError] = useState(null); // 开机自启。**出厂是关的** —— null 表示还没读到,别在读到之前先画一个 // 勾或不勾出来:那一瞬间画错的话,用户会以为是自己之前设的。 const [autostart, setAutostart] = useState(null); - const [autostartErr, setAutostartErr] = useState(null); const [showHistory, setShowHistory] = useState(false); /** * 表单还是文本。**默认表单** —— 大多数改动是改一个值,而文本模式要求 @@ -726,7 +726,7 @@ export default function Config({ const h = await invoke("config_history"); if (alive) setHistory(h); } catch (e) { - if (alive) setSaveError(typeof e === "string" ? e : String(e)); + if (alive) toast.error(typeof e === "string" ? e : String(e)); } })(); return () => { @@ -771,15 +771,16 @@ export default function Config({

          配置文件

          - +
          {cfg ? ( setReloadKey((k) => k + 1)} /> ) : ( -

          读取中…

          +

          读取中…

          )}
          ); @@ -810,47 +811,51 @@ export default function Config({
          {section === "upstreams" && (
          +

          上游

          {t.comparison && ( - + {testing === "*" && } + 不限测一遍 + )} {/* 说清这一下不花钱。**不说的话,谨慎的用户就不会点** —— 而 这是排查线路问题最直接的一个动作 */} 只握手,不发请求,不花钱 - - + + {/* + **展开这件事交给 Collapsible。**手写的 `{show && …}` 少的是 + `aria-expanded` 和 `aria-controls` —— 读屏软件不知道这个按钮 + 管的是哪一块,也不知道现在是开是关。 + */} + + +
          {/* 保存失败要说出来。**尤其是 409** —— 它不是「你写错了」,是 「有人抢先改了」,正确的反应是刷新再改 */} - {saveError && ( -

          - 没能保存:{saveError} -

          - )} - {showHistory && ( -
          + +
          {history.length === 0 && ( -

          - 还没有历史版本 —— 第一次改配置之后就有了。 +

          + 暂无历史版本

          )} {history.map((v) => ( @@ -858,8 +863,8 @@ export default function Config({ key={v.version} className="flex items-baseline gap-3 border-b border-neutral-100 px-3 py-1.5 tw-body last:border-b-0 dark:border-neutral-900" > - {v.version.slice(7)} - {v.origin} + {v.version.slice(7)} + {v.origin} {new Date(v.at_ms).toLocaleString()} @@ -867,24 +872,26 @@ export default function Config({ // 不标出来的话,用户会以为第一条是「上一版」然后回滚到自己身上 现在这版 ) : ( - + )}
          ))}
          - )} + +
          {/* 一个上游都没有时,这一节是「加第一个」而不是一张空表头。 原来这件事是一个全屏的首次运行页面做的 —— 把人挡在产品外面, @@ -895,48 +902,49 @@ export default function Config({
          ) : ( - - - - - - - - - - +
          名字地址协议密钥代理计费信任
          + + + 名字 + 地址 + 协议 + 密钥 + 代理 + 计费 + 信任 {/* 只有一家的时候熔断是旁路的,显示健康列没有意义 */} - {multi && } - - - - + {multi && 状态} + + + + {ov.providers.map((p) => ( - - - - + {/* 来源,不是值 */} - - + {/* 计费方式:它同时决定成本栏怎么显示和 `cheapest` 怎么排 —— 订阅制的边际成本是零。 */} - + {/* 信任级别。**没显式写过的时候要说清是自动判的** —— 否则用户会以为这一格改不动,或者以为是他自己设的。 */} - + {multi && ( - + )} - - + {testing === p.name && } + 测试 + + + ))} - -
          状态
          + + {p.name} - + - + + - + + {/* 猜不出协议不是错误 —— 但要能改。自动判错的时候, 这一格就是修它的地方,而原来只能去改 YAML。 @@ -952,13 +960,12 @@ export default function Config({ ]} path={`/providers/${p.name}/protocol`} version={cfg?.version ?? null} - onSaved={setSaveError} onDone={() => setReloadKey((k) => k + 1)} /> - {p.key_source} + {p.key_source} + setReloadKey((k) => k + 1)} /> - + setReloadKey((k) => k + 1)} /> - + setReloadKey((k) => k + 1)} /> - + {p.health === "ok" ? ( 正常 ) : ( @@ -1020,21 +1024,23 @@ export default function Config({ 熔断中 )} - - -
          + + )} {/* 结果放在表下面而不是挤进单元格:分段有三到四行,塞进表格会把 每一行都撑高,而大多数时候它们并不存在 */} @@ -1044,12 +1050,12 @@ export default function Config({ return (
          {r.ok ? "✅" : "❌"} {p.name} - {r.via && 经 {r.via}} + {r.via && 经 {r.via}}
          @@ -1076,20 +1082,21 @@ export default function Config({
        • {g.name} - + setReloadKey((k) => k + 1)} /> - + {g.providers.join(" → ")}
          @@ -1123,80 +1129,77 @@ export default function Config({ */} {g.kind === "手动选" && (
          - 优先用 - - + + 其余的仍然是它的故障转移备选
          )} {/* **会话粘滞要摆在明面上,因为它直接决定账单。** - 关掉它,一次长会话每轮跳一家,prompt cache 全部失效, + 关掉它,一次长会话每轮跳一家,prompt cache 不限失效, 而缓存命中与否成本差 5 到 10 倍。 */} {g.kind === "轮流" && ( - + + 会话粘滞(同一次对话固定走同一家) + + )} {g.hurts_cache && ( // 这句必须在界面上直说:它决定了用户的账单。 @@ -1216,15 +1219,18 @@ export default function Config({ {section === "settings" && (

          开机启动

          - - {autostartErr && ( -

          - {autostartErr} -

          - )} + + +
          )} @@ -1315,8 +1316,8 @@ function About() {
          {rows.map(([k, v]) => (
          -
          {k}
          -
          +
          {k}
          +
          {v}
          @@ -1332,47 +1333,47 @@ function About() { * 遇到问题时一次性交出「我这儿是什么情况」,省掉来回问一轮(版本?配置? * 哪家上游?)—— 而每一趟都可能问漏。 * - * **里面的东西全部脱敏过,但仍然要求用户自己看一眼再交出去。**我们是个 + * **里面的东西不限脱敏过,但仍然要求用户自己看一眼再交出去。**我们是个 * 看得见所有 API key 的网关,这一步值得多花十秒。 */ function Diagnostics() { const [path, setPath] = useState(null); const [busy, setBusy] = useState(false); - const [error, setError] = useState(null); return (

          诊断包

          -

          +

          版本、上游、熔断状态、最近的失败、脱敏后的配置原文。 不含请求与响应正文 。

          - - {error &&
          {error}
          } + {busy && } + 生成 + {path && (
          写好了:{path} -
          - 里面的密钥和地址都打过码了,但交出去之前请自己扫一眼。 +
          + 其中的密钥与地址已脱敏,提交前请自行核对。
          )} @@ -1401,9 +1402,9 @@ function Uninstall() { if (step === "done") { return ( -
          +

          卸载完成

          -
            +
              {log.map((l, i) => (
            • · {l}
            • ))} @@ -1413,42 +1414,50 @@ function Uninstall() { } return ( -
              +

              完全卸载

              {step === "idle" ? (
              -

              +

              把接管过的客户端改回原样,注销开机自启。 直接把应用拖进废纸篓不会做这些 —— 那时客户端会指着一个没有东西在听的端口。

              - +
              ) : (
              -

              要做这几件事:

              -
                +

                要做这几件事:

                +
                • · 把所有接管过的客户端改回接管之前的样子
                • · 注销开机自启
                - -
                - - -
                + +
              )}
              diff --git a/src/ConfigText.tsx b/src/ConfigText.tsx index dd006581..4dfacc3d 100644 --- a/src/ConfigText.tsx +++ b/src/ConfigText.tsx @@ -2,6 +2,10 @@ import { useEffect, useMemo, useRef, useState } from "react"; import { invoke } from "@tauri-apps/api/core"; import YamlEditor from "./YamlEditor"; import type { ConfigAt, ConfigText as Doc } from "./types"; +import { Button } from "@/ui/button"; +import { Alert, AlertDescription, AlertTitle } from "@/ui/alert"; +import { Spinner } from "@/ui/spinner"; +import { toast } from "sonner"; /** * 文本模式:直接改 config.yaml。 @@ -37,7 +41,6 @@ export default function ConfigTextMode({ }) { const [draft, setDraft] = useState(doc.text); const [busy, setBusy] = useState(false); - const [error, setError] = useState(null); /** 打开这一版时文件是什么样。**保存时带的就是它** */ const base = useRef(doc.version); const dirty = draft !== doc.text; @@ -48,7 +51,6 @@ export default function ConfigTextMode({ if (!dirty) { setDraft(doc.text); base.current = doc.version; - setError(null); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [doc.version]); @@ -110,14 +112,13 @@ export default function ConfigTextMode({ async function save() { setBusy(true); - setError(null); try { // Tauri 的 invoke 用字符串 reject,不是 Error await invoke("put_config", { text: draft, baseVersion: base.current }); base.current = ""; onSaved(); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -128,34 +129,35 @@ export default function ConfigTextMode({ {/* 文件在你编辑期间被改过了。**给选择,不替他做决定** —— 两边都是真实的改动,只有他知道哪个该留 */} {stale && ( -
              -

              - 这个文件在你编辑期间被改过了。 -

              + + 文件已被其他进程修改 +

              现在保存会覆盖掉外面那次改动。

              - - +
              -
              + + )} +

              光标在 {at.name} {at.section ? `(${at.section})` : ""} 这一段里 {onJumpToForm && ( - + )}

              )}
              - + {busy && } + 保存 + {dirty && !busy && 有未保存的改动} {doc.version} {doc.path} @@ -201,11 +206,7 @@ export default function ConfigTextMode({ {/* 保存失败最常见的两种:写错了(语法/字段/语义),和有人抢先改了。 两者的下一步完全不同,所以原样把 core 那句话显示出来 */} - {error && ( -
              -          {error}
              -        
              - )} +
              ); } diff --git a/src/Connect.tsx b/src/Connect.tsx new file mode 100644 index 00000000..aef99c32 --- /dev/null +++ b/src/Connect.tsx @@ -0,0 +1,146 @@ +import { invoke } from "@tauri-apps/api/core"; +import { useEffect, useState } from "react"; +import { Button } from "@/ui/button"; +import { Skeleton } from "@/ui/skeleton"; +import { toast } from "sonner"; + +/** + * 沉默多久之后才开口。 + * + * **大多数启动不该看到任何文字。**冷启动通常一秒出头,而一个只闪一下 + * 的进度条是噪音 —— 它从不停留,也就从不被读。超过这个时间还没连上, + * 才说明这次不一样。 + */ +const QUIET_MS = 1_500; + +/** 把守护状态翻成「现在怎么了、能做什么」。 */ +export interface Trouble { + /** 一句话说清现在什么情况 */ + what: string; + /** 接下来会自动发生什么,或者用户该做什么 */ + next: string; + /** 这是个需要人介入的状态吗 —— 决定要不要上告警色 */ + bad: boolean; + /** 能不能点一下重来 */ + retry: boolean; +} + +/** + * `core_state` 的字符串 → 界面要说的话。 + * + * **不说 socket 层的错误。**「Connection refused (os error 61)」是给 + * 写代码的人看的;而这一层其实知道得多得多 —— 守护正在报「第 3 次 + * 重启,2 秒后」,那才是用户该看到的。 + */ +export function trouble(raw: string, tries: number): Trouble | null { + if (raw.startsWith("missing:")) { + return { + what: "找不到 core 程序", + next: raw.slice("missing:".length), + bad: true, + retry: false, + }; + } + if (raw.startsWith("restarting:")) { + const [, attempt = "1", inMs = "0"] = raw.split(":"); + const secs = Math.max(1, Math.round(Number(inMs) / 1000)); + return { + what: `core 退出了,正在第 ${attempt} 次重启`, + next: `${secs} 秒后重试`, + bad: Number(attempt) >= 3, + retry: false, + }; + } + if (raw === "safe_mode") { + return { + what: "安全模式:网关未运行", + next: "配置、回滚、还原接管仍然可用 —— 多半是配置有问题,去网关页看看", + bad: true, + retry: true, + }; + } + if (raw === "stopped") { + return { what: "core 未运行", next: "点「重新启动」把它拉起来", bad: true, retry: true }; + } + if (raw === "starting") { + return { what: "正在启动 core", next: "马上就好", bad: false, retry: false }; + } + // running:pid —— 进程起来了,控制面还没答应。**这是一个真实的窗口 + // 期**:core 刚 exec 出来,socket 还没 bind 上。 + return { + what: "正在连接控制面", + next: tries > 1 ? `第 ${tries} 次尝试` : "马上就好", + bad: tries > 6, + retry: tries > 6, + }; +} + +/** + * 还没连上控制面时,整窗显示的那一面。 + * + * **只在这次会话从没连上过的时候出现。**断线重连是另一回事:那时候 + * 用户本来在看数据,把页面清空比留着旧值更糟。 + * + * 和「不再有独立初始化页面」那条决定不冲突,边界是这个:那两道门挡的 + * 是**配置状态**(还没配上游),而门后面的东西是存在、可用的;这一道 + * 挡的是**连接状态**,控制面不答应的时候每一页的数据都没有来源。所以 + * 纪律是 —— **控制面一答应就立刻让开**,哪怕网关还没起来。 + * + * 三层递进:先只画骨架不说话,超过一秒半才出现一行状态,需要人介入时 + * 才把出路摆出来。 + */ +export default function Connect({ state, tries }: { state: string; tries: number }) { + const [spoke, setSpoke] = useState(false); + const [busy, setBusy] = useState(false); + useEffect(() => { + const h = setTimeout(() => setSpoke(true), QUIET_MS); + return () => clearTimeout(h); + }, []); + const t = trouble(state, tries); + // 需要人介入的状态不等那一秒半 —— 它不是「还没好」,是「不会好了」 + const show = spoke || t?.bad === true; + + return ( +
              + {/* 骨架先占住版面。读完之后内容落在它原来的位置上 */} +
              + +
              + {[0, 1, 2].map((i) => ( +
              + + +
              + ))} +
              + +
              + + {show && t && ( +
              +

              + {t.what} +

              +

              + {t.next} +

              + {t.retry && ( + + )} +
              + )} +
              + ); +} diff --git a/src/Dashboard.tsx b/src/Dashboard.tsx index e3d0429e..cb9b6053 100644 --- a/src/Dashboard.tsx +++ b/src/Dashboard.tsx @@ -1,217 +1,890 @@ import { useEffect, useState } from "react"; -import { Tip } from "./ui/Tooltip"; +import { useStableState } from "./useStable"; +import { Tip } from "@/ui/tip"; import { invoke } from "@tauri-apps/api/core"; import RequestDrawer from "./RequestDrawer"; import { triggers } from "./triggers"; -import { BarChart, BarRows } from "./ui/Chart"; -import { densify } from "./format"; -import { usd, type Dashboard as Data } from "./types"; +import { StackedArea } from "@/ui/charts"; +import { bucketStart, compact, densify } from "./format"; +import { usd, type Dashboard as Data, type LatencyView, type Overview } from "./types"; +import { Alert, AlertDescription } from "@/ui/alert"; +import { DEFAULT_RANGE, RangePicker, type Range } from "@/ui/range"; +import { ToggleGroup, ToggleGroupItem } from "@/ui/toggle-group"; +import { Skeleton } from "@/ui/skeleton"; +import { LIVE_BUCKET_MS, useLive } from "./useLive"; +import { useCountUp } from "./useCountUp"; -function Stat({ label, value, hint }: { label: string; value: string; hint?: string }) { +const HOUR = 3_600_000; +const DAY = 24 * HOUR; + +/** 每一栏最多列几项。超出的写出来有几项,**不静默丢掉**。 */ +const ROWS = 6; + +/** + * 一格多宽。 + * + * **比「一小时一格」细得多,这是故意的。**少而肥的格子只能看出「这段 + * 时间有没有用过」;细到四五十格以上,图上开始能看出**作息** —— 白天 + * 成片、夜里断开、周末矮一截。一张能看出作息的图才是仪表。 + * + * 上限压在 120 格上下:再密就是把噪声当细节,而每一格还要再乘上模型 + * 个数去查库。 + */ +function bucketFor(rangeMs: number): number { + if (rangeMs > 7 * DAY) return 6 * HOUR; + if (rangeMs > 2 * DAY) return 2 * HOUR; + return HOUR / 2; +} + +/** 一格的时间标签。跨度大到按天分格时就只写日期。 */ +function fmtBucket(atMs: number, bucketMs: number): string { + const t = new Date(atMs); + const p = (n: number) => String(n).padStart(2, "0"); + if (bucketMs >= DAY) return `${t.getMonth() + 1}/${t.getDate()}`; + if (bucketMs < 60_000) return `${p(t.getMinutes())}:${p(t.getSeconds())}`; + return `${t.getMonth() + 1}/${t.getDate()} ${p(t.getHours())}:${p(t.getMinutes())}`; +} + +/** + * 读数据时的骨架。 + * + * **不是一句「读取中…」。**那一行字占的地方和真正的内容差着两百像素, + * 读完之后整页会跳一次;而这一页最大的那几个数字恰好在跳动的位置上。 + */ +function OverviewSkeleton() { return ( -
              -
              {label}
              -
              {value}
              - {hint &&
              {hint}
              } + <> +
              + {[0, 1, 2].map((i) => ( +
              + + +
              + ))} +
              + +
              + + + +
              + + ); +} + +/** 一块密排信息。左边那列标签把所有块钉在同一条竖线上。 */ +function Block({ name, children }: { name: string; children: React.ReactNode }) { + return ( +
              + {name} +
              {children}
              +
              + ); +} + +/** + * 延迟的分位区间。 + * + * **区间条,不是两列数字。**并排的两列毫秒数要逐行读才能比较,而这张 + * 图要回答的是「哪个又慢又不稳定」—— 那是条的起点加长度,一次扫视 + * 就能得到。亮线标的是 P50:多数请求落在它附近。 + * + * 用分位数不用平均值:AI 延迟是长尾分布,平均值会被极端值拉偏。 + */ +function Spread({ rows, max }: { rows: LatencyView[]; max: number }) { + const shown = [...rows].sort((a, b) => b.samples - a.samples).slice(0, ROWS); + return ( + <> + {shown.map((l) => ( +
              + + {l.model} + + {/* 条宽固定:两栏的条这样才对齐,能横着比 */} + + + + + + {l.p50} – {l.p95}ms + + {/* + **样本数要显示**:「800ms」是 3 个样本还是 300 个,含义完全 + 不同。不可靠的是**样本数**,不是延迟值 —— 所以只标这个数。 + */} + + {l.samples} 次 + +
              + ))} + {rows.length > shown.length && ( +

              + 另有 {rows.length - shown.length} 项未列出 +

              + )} + + ); +} + +/** + * 页眉上的一个大数。 + * + * **三栏等宽,说明那一行固定占两行高。**在此之前这三组是并排的弹性 + * 块,而「较上一个区间」在没有可比数据时整个消失 —— 于是切一次时间 + * 范围,三个数字的横向位置全变了,眼睛每次都要重新找。 + * + * 所以限定语一律放到第二行:第一行只留那个数和单位,宽度由它决定, + * 而它在各种区间下长得都差不多。 + */ +function Stat({ + n, + unit, + after, + note, +}: { + n: string; + unit?: string; + after?: React.ReactNode; + note: React.ReactNode; +}) { + return ( +
              +
              + {n} + {unit && {unit}} + {after} +
              + {/* 高度写死两行:少一条限定语时不该把整页往上收 */} +

              + {note} +

              ); } /** - * 今天的账。 + * 一个环比。 + * + * **没有参照系的数字只能读,不能判断。**只有花费那一侧有「好坏」: + * 少花是好事,所以降下来才上色。用量那一侧两个方向都不上色 —— 多用掉 + * 一些 token 不是问题,少用也不是成绩。 + */ +function Delta({ v, more, good }: { v: number; more: string; good?: "down" }) { + const better = good === "down" && v < 0; + return ( + + 较上一个{more} {v < 0 ? "↓" : "↑"} {Math.abs(v * 100).toFixed(0)}% + + ); +} + +/** 缓存构成条上的一段。 */ +function Swatch({ color, name, n }: { color: string; name: string; n: number }) { + return ( + + + + {name} {compact(n)} + + + ); +} + +/** + * 用量概览。 * * 这一页的每一个数字都受那条约束:**绝不让估算值混进精确数字里 - * 假装准确。**所以成本是三个数并排,不是一个。 + * 假装准确。**所以金额旁边永远跟着它的限定词。 + * + * 版面上只有一个视觉锚点:那张图。其余全是发丝线分隔的密排行,左边 + * 一列标签把它们钉在同一条竖线上 —— **参照物是原生监控工具,不是网页 + * 后台**。圆角卡片的网格恰恰是最像后台的做法。 */ -export default function Dashboard({ tick }: { tick: number }) { - const [d, setD] = useState(null); +export default function Dashboard({ tick, ov }: { tick: number; ov: Overview | null }) { + const [range, setRange] = useState(DEFAULT_RANGE); + /** + * 图按哪个口径画。 + * + * **默认 token。**这一页叫用量概览,而按金额画时一次 opus 突发会把 + * 前后一周压平 —— 那张图好看,但除了「opus 贵」说不出别的。 + */ + const [by, setBy] = useState<"token" | "cost">("token"); + const live = range.live === true; + /* + **实时档只有图是实时的。**两分钟窗口里算不出有意义的延迟分位,也 + 统计不出缓存命中率;那些仍然按 24 小时算,图下面有一行小字说明。 + 所以这里查的窗口和图的窗口是两回事。 + */ + const queryMs = live ? DAY : range.ms; + const bucketMs = live ? LIVE_BUCKET_MS : bucketFor(range.ms); + const { samples, fails, inFlight } = useLive(live, range.ms); + /** + * **只在内容真的变了的时候才换。**每次 `invoke` 回来都是一个新对象, + * 直接 setState 会让整页重画一遍,而这一切发生在什么都没发生的时候。 + */ + const [d, setD] = useStableState(null); + const gatewayHint = "本机网关地址"; const [error, setError] = useState(null); - /** 点开的那一条。**抽屉是右侧覆盖的,不是跳页** —— 用户要能一边看 - 详情一边对着列表里的别的行 */ + /** 点开的那一条。**抽屉是右侧覆盖的,不是跳页** */ const [open, setOpen] = useState(null); + /* + 三个大数会走过去,不是跳过去。 + + **只在同一个口径里走**:换时间范围时那不是「涨了」,是换了一个东西 + 在看 —— 从 251k 滚到 661k 看起来像用量突然翻了三倍,所以 + `range.label` 一变就直接落值。 + + **这三个 hook 必须站在早返回之前。**下面有「还没读到数据」和 + 「出错了」两条 return,而 React 要求每次渲染调用的 hook 数量一致 + —— 放在后面的话,数据第一次到达的那一刻整页会崩。所以这里用 + `d?.` 取值,读不到就是 0。 + */ + const sum = d?.summary; + const tokensAt = useCountUp( + sum + ? sum.input_tokens + sum.cache_read_tokens + sum.cache_write_tokens + sum.output_tokens + : 0, + range.label, + ); + const spentAt = useCountUp( + sum ? sum.cost_micros_exact + sum.cost_micros_estimated : 0, + range.label, + ); + const requestsAt = useCountUp(sum?.requests ?? 0, range.label); + useEffect(() => { let alive = true; (async () => { try { + // 窗口起点对齐到格子边界,格宽一起送过去 —— 两边各算一遍的话, + // 补空桶时格子对不上,整张图会是零。见 bucketStart 的注释。 + // + // 实时档下这次查询要的是 24 小时的汇总,图另有来路,所以格宽 + // 取一小时就够 —— 一秒一格去查二十四小时是八万多个分组。 + const q = live ? HOUR : bucketMs; + const sinceMs = bucketStart(Date.now() - queryMs, q); // Tauri 的 invoke 用字符串 reject,不是 Error - const x = await invoke("dashboard"); + const x = await invoke("dashboard", { sinceMs, bucketMs: q }); if (alive) { setD(x); setError(null); } - } catch (e) { - if (alive) setError(typeof e === "string" ? e : String(e)); + } catch { + /* + **读不到不在这一层报。**连不上控制面是启动过程中的预期状态, + 而 App 那边已经用一整面(或一条带子)在说这件事了 —— 这儿再弹 + 一条 toast,就是同一件事说两遍,而且说得更难懂。 + + 上一次读到的值留着不动:一个凝固的旧数字加上面那句「已断开」, + 比清空成骨架有用。 + */ } })(); return () => { alive = false; }; - }, [tick]); + }, [tick, queryMs, bucketMs, live, setD]); + + /* + **两组控件不放在一起。**时间范围管的是整页(下面每一块都跟着它 + 走),口径只管那一张图 —— 两个不同维度的东西并排成一串同样的药丸, + 读起来就是一排七个平级选项。 + + 所以范围留在标题行右端(页面级),口径挪到图的正上方、左对齐 + (图级),中间隔着整排大数字。 + */ + const header = ( +
              +

              用量概览

              +
              + +
              +
              + ); + + /** + * 图按什么口径画。**两档都在实时下可用** —— core 会在算完价钱之后 + * 补一条 `request_priced`,所以金额也是推过来的,只比用量晚一拍。 + */ + const metric = ( + v && setBy(v as "token" | "cost")} + > + token + 花费 + + ); if (error) { return (
              -

              - {error} -

              + + {error} + +
              + ); + } + if (!d) { + return ( +
              +
              + {header} + +
              ); } - if (!d) return

              读取中…

              ; const s = d.summary; const t = triggers(null, d); - const hasEstimate = s.cost_micros_estimated > 0; - // 条件不满足就**不出现**,不是折叠。一个还没有任何数据的成本 - // 面板是在展示空壳,而它占的地方本来可以放「接下来该做什么」 + const spent = s.cost_micros_exact + s.cost_micros_estimated; const nothingYet = !t.cost; + /* + **「输入」是送往上游的全部上下文,包含命中缓存的那部分。** + `input_tokens` 单独一个字段说的是「没命中缓存的那部分」—— 命中率 + 高的时候它只有真实输入的零头,标成「输入」会让人以为自己几乎没用。 + */ + const ctx = s.input_tokens + s.cache_read_tokens + s.cache_write_tokens; + const tokensTotal = ctx + s.output_tokens; + const beforeCost = d.prev ? d.prev.cost_micros_exact + d.prev.cost_micros_estimated : 0; + const beforeTokens = d.prev + ? d.prev.input_tokens + + d.prev.cache_read_tokens + + d.prev.cache_write_tokens + + d.prev.output_tokens + : 0; + const hit = ctx > 0 ? s.cache_read_tokens / ctx : null; + const ratio = s.cache_write_tokens > 0 ? s.cache_read_tokens / s.cache_write_tokens : null; + + + /* + 趋势图按模型分层。**只保留前五项,其余合并为「其他」** —— 一家上游 + 可能报出十几个模型名,十几层叠在两百像素里已经分辨不出,而排在后面 + 的那些合计往往不到百分之一。 + */ + const byBucket = new Map>(); + const money = new Map(); + const volume = new Map(); + const count = new Map(); + const add = (at: number, name: string, v: number) => { + const slot = byBucket.get(at) ?? new Map(); + slot.set(name, (slot.get(name) ?? 0) + v); + byBucket.set(at, slot); + }; + if (live) { + for (const x of samples) { + volume.set(x.model, (volume.get(x.model) ?? 0) + x.tokens); + money.set(x.model, (money.get(x.model) ?? 0) + (x.cost ?? 0)); + count.set(x.model, (count.get(x.model) ?? 0) + 1); + add( + Math.floor(x.at / LIVE_BUCKET_MS) * LIVE_BUCKET_MS, + x.model, + by === "token" ? x.tokens : (x.cost ?? 0), + ); + } + } else { + for (const b of d.buckets_by_model ?? []) { + const name = b.name || "未知模型"; + const cost = b.cost_micros_exact + b.cost_micros_estimated; + const tok = b.input_tokens + b.output_tokens + b.cache_read_tokens + b.cache_write_tokens; + money.set(name, (money.get(name) ?? 0) + cost); + volume.set(name, (volume.get(name) ?? 0) + tok); + count.set(name, (count.get(name) ?? 0) + b.requests); + add(b.at_ms, name, by === "token" ? tok : cost); + } + } + const useTokens = by === "token"; + // 排行按当前口径排 —— 切到 token 之后,最贵的那个未必是用得最多的 + const ranked = [...(useTokens ? volume : money).entries()].sort((a, b) => b[1] - a[1]); + const top = ranked.slice(0, 5).map(([name]) => name); + const rest = ranked.slice(5); + // 画的顺序是从下往上:**占得少的垫底、占得多的在上**,最重的那一层 + // 在视觉上也该最重。颜色跟着走,chart-1 最亮给最多的那个。 + const keys = rest.length > 0 ? ["其他", ...[...top].reverse()] : [...top].reverse(); + const shade = [ + "var(--chart-5)", + "var(--chart-4)", + "var(--chart-3)", + "var(--chart-2)", + "var(--chart-1)", + ]; + const colors = keys.map( + (_, i) => shade[Math.max(0, shade.length - keys.length + i)] ?? "var(--chart-1)", + ); + const restMoney = rest.reduce((a, x) => a + (money.get(x[0]) ?? 0), 0); + const restVolume = rest.reduce((a, x) => a + (volume.get(x[0]) ?? 0), 0); + const restCount = rest.reduce((a, x) => a + (count.get(x[0]) ?? 0), 0); + // 条长按当前口径里**最大的那一项**归一。按总量归一的话,一个占七成 + // 的模型会把其余几条压成看不见的短线,而排行要比的正是它们的差距。 + const topBar = Math.max( + 1, + useTokens ? Math.max(restVolume, ...volume.values()) : Math.max(restMoney, ...money.values()), + ); + + /* + 实时档的格子自己铺:两分钟、一秒一格,一路铺到「现在」。 + 历史档沿用后端给的桶 —— 空桶由 `densify` 补成 0,这是面积图不会把 + 空档画成「连续在用」的前提。 + */ + const now = Date.now(); + const liveStart = Math.floor((now - range.ms) / LIVE_BUCKET_MS) * LIVE_BUCKET_MS; + const grid = live + ? Array.from({ length: Math.round(range.ms / LIVE_BUCKET_MS) }, (_, i) => ({ + at_ms: liveStart + i * LIVE_BUCKET_MS, + requests: 0, + failed: 0, + cost_micros_exact: 0, + cost_micros_estimated: 0, + unpriced_requests: 0, + })) + : densify(d.buckets ?? [], d.since_ms ?? 0, now, bucketMs); + if (live) { + for (const at of fails) { + const g = grid[Math.round((at - liveStart) / LIVE_BUCKET_MS)]; + if (g) g.failed += 1; + } + } + const area = grid.map((g) => { + const slot = byBucket.get(g.at_ms); + const sum = [...(slot?.values() ?? [])].reduce((a, v) => a + v, 0); + const row: Record = { + label: live + ? `${fmtBucket(g.at_ms, bucketMs)} ${useTokens ? `${compact(sum)} token` : usd(sum)}` + : `${fmtBucket(g.at_ms, bucketMs)} ${ + useTokens + ? `${compact(sum)} token` + : usd(g.cost_micros_exact + g.cost_micros_estimated) + } ${g.requests} 次${g.failed ? `(${g.failed} 次失败)` : ""}`, + }; + let other = 0; + for (const [name, v] of slot ?? []) { + // 金额从微分换成千分之一美元:纵轴上那几位小数没有意义 + const y = useTokens ? v : v / 1000; + if (top.includes(name)) row[name] = y; + else other += y; + } + // 没有值的那几层要显式给 0,否则 recharts 会把这一格整条断开 + for (const k of top) row[k] ??= 0; + if (rest.length > 0) row["其他"] = other; + return row; + }); + + const latMax = + Math.max(1, ...d.latency.map((l) => l.p95), ...d.latency_by_provider.map((l) => l.p95)) * 1.04; + + /* + 三条防线现在各在哪一档,以及这段时间各自看见了什么。 + + **档位和所见要一起说。**只说所见的话,「未发现」在关闭档下是句 + 空话;只说档位的话,用户不知道它到底拦下过什么。 + */ + const sec = ov?.security; + const label = (m: string) => (m === "enforce" ? "拦截" : m === "off" ? "关闭" : "观察"); + const leaked = d.leaks.reduce((a, l) => a + l.requests, 0); + const guards = sec + ? [ + { + key: "redact", + name: "出站脱敏", + mode: sec.redact, + /* + 两档留下的痕迹不是同一种:观察档记的是「检测到的外泄」, + 拦截档记的是「换掉了几处」。**分别说明** —— 用同一句话套 + 两档的话,切到拦截之后会显示成「未发现」。 + */ + hits: sec.redact === "enforce" ? s.redacted_requests : leaked, + saw: + sec.redact === "off" + ? "未启用,出站内容不做检查" + : sec.redact === "enforce" + ? s.redacted_requests > 0 + ? `已替换 ${s.redacted_requests} 个请求中的凭据` + : "未发现需要替换的内容" + : leaked > 0 + ? `检测到 ${leaked} 次凭据外泄,未做替换` + : "未检测到凭据外泄", + }, + { + key: "inspect", + name: "工具调用检查", + mode: sec.inspect_tools, + hits: s.flagged_requests, + saw: + sec.inspect_tools === "off" + ? "未启用,上游返回的工具调用不做检查" + : s.flagged_requests > 0 + ? `${s.flagged_requests} 个请求带回可疑工具调用` + + (sec.inspect_tools === "enforce" ? ",已切断" : "") + : "未发现可疑工具调用", + }, + { + key: "scan", + name: "配置面扫描", + mode: sec.scan_configs, + // **这一行不跟着时间区间变。**它说的是此刻磁盘上的状态,而 + // 文件现在什么样和你选了看几天没有关系。 + hits: 0, + saw: + sec.scan_configs === "off" + ? "未启用,客户端配置文件不做监控" + : "持续监控客户端配置文件,新增可疑内容会立即提示", + }, + ] + : []; + return ( -
              -
              -
              -

              今天

              - 从本地零点算起 +
              + {header} + + {/* + 三个数并排:**做了多少、花了多少、发了多少次**。它们是同一层的 + 事实,所以同一个字号、同一个宽度的栏。 + + **等宽栏,而不是并排的弹性块。**后者会让「较上一个区间」这类 + 时有时无的限定语改变每一栏的宽度,切一次范围三个数字就横向 + 挪一次位置。 + */} +
              + + {beforeTokens > 0 && ( + + )} + + + 输入 {compact(ctx)} · 输出 {compact(s.output_tokens)} + + + + } + /> + + + {beforeCost > 0 && ( + + )} + {s.cost_micros_estimated > 0 && ( + + + 含估算 {usd(s.cost_micros_estimated)} + + + )} + {s.unpriced_requests > 0 && ( + + + {s.unpriced_requests} 条未计价 + + + )} + {s.subscription_requests > 0 && ( + + + 订阅额度 {s.subscription_requests} 次 + + + )} + {s.cost_micros_estimated === 0 && + s.unpriced_requests === 0 && + s.subscription_requests === 0 && 全部按价目表实测} + + } + /> + + 0 && {s.failed} 次失败} + note={ + <> + 失败率 {((s.failed / Math.max(1, s.requests)) * 100).toFixed(1)}% + {live && {inFlight > 0 ? `${inFlight} 个进行中` : "当前空闲"}} + + } + /> +
              + +
              +
              {metric}
              + + {/* + 有失败的时段画在基线上。**不往高度里加** —— 加一格固定高度的 + 话,那一格在大桶上看不见、在小桶上直接翻倍,而它本来就不代表 + 任何数量。 + */} +
              + {grid.map((g) => ( + 0 ? "bg-destructive" : "")} /> + ))}
              +
              + {(live + ? ["2 分钟前", "90 秒", "60 秒", "30 秒"] + : [fmtBucket(d.since_ms ?? 0, bucketMs)] + ).map((x) => ( + {x} + ))} + 现在 +
              + {/* 这一行有没有话说都占一行高:少一句就把下面整块往上提, + 正是切换时的那种来回动 */} +

              + {grid.some((g) => g.failed > 0) && ( + <> + + 基线上的红色标出存在失败的时段 + + )} + {/* + 实时档下这一页有两个口径,必须说清哪个是哪个:**模型排行 + 是这张图的图例**(色块要对得上曲线里那一层),所以跟着图 + 走;而两分钟里算不出分位延迟和命中率,那些连同顶部的数字 + 一起按 24 小时算。 + */} + {live && ( + 顶部数字与缓存、延迟、安全按最近 24 小时统计;模型排行跟随上图 + )} +

              +
              - {nothingYet ? ( - // 空状态永远在回答「接下来该做什么」 -

              - 今天还没有请求。把客户端指过来,数字会出现在这里。 -

              - ) : ( - <> -
              - - {/* **估算值单独一格,带波浪号。**混进上面那个数里就是在 - 把一个不确定的东西说成确定的 */} - {hasEstimate && ( - + 将客户端指向{gatewayHint}后,用量与费用将在此处显示。 + {s.locally_answered > 0 && + ` 已本地应答 ${s.locally_answered} 次客户端探测 —— 客户端已连上,这些探测未产生费用。`} +

              + )} + +
              + {/* + 图例和构成合成一张排行。**药丸式的一行图例在模型一多就会折行, + 而且不携带比例。**这里的条长就是占比,色块和曲线里那一层同色 + —— 图例的职责就是那个映射,保留下来了。 + */} + {/* + **这一块永远在。**它在「有数据」和「没数据」之间消失的话, + 切一次时间范围整页就上下弹一次。没有数据时留一行字占住。 + */} + + {keys.length === 0 && ( +

              + {live ? "等待请求。" : "所选区间内无请求记录。"} +

              + )} + {[...keys].reverse().map((k, i) => { + const c = k === "其他" ? restMoney : (money.get(k) ?? 0); + const v = k === "其他" ? restVolume : (volume.get(k) ?? 0); + const n = k === "其他" ? restCount : (count.get(k) ?? 0); + const color = colors[keys.length - 1 - i]; + return ( +
              + + + {k === "其他" ? `其他 ${rest.length} 项` : k} + + + + + + + {compact(v)} + + + + {usd(c)} + + + {n} 次 + +
              + ); + })} +
              + + {/* + 缓存。**要的是率,不是累计量** —— 「省了多少」在一个长会话里 + 只会一路涨,它回答不了「缓存到底有没有在起作用」。 + */} + + {ctx === 0 ? ( +

              所选区间内无 token 记录。

              + ) : ( + <> +
              + + {hit == null ? "—" : `${Math.round(hit * 100)}%`} + + 命中 + {/* 这根条**就是命中率的公式本身**:三段按单价排,亮的越长越省 */} + + - )} - 0 ? `${s.failed} 条失败` : undefined} - /> + + + {/* - **第三栏:订阅调用量。**订阅制的边际成本是零,按 API 价目表 - 算出来的数字是纯虚构的 —— 所以它不进上面那个金额,而是单独 - 显示 token 量。 + **净额,不是毛额。**缓存写入通常按高于输入的单价计费, + 只统计命中省下的部分,等于声称缓存永远只会降低支出 —— + 而一份反复重建缓存、命中很少的用法,实际账单高于不使用 + 缓存。倍率各家不同,这个数是按每个模型自己的价目算的。 */} - {s.subscription_requests > 0 && ( - - )} + + {s.cache_saved_micros < 0 ? "净增成本" : "净节省"}{" "} + + {usd(Math.abs(s.cache_saved_micros))} + + {/* - 缓存省了多少。**算的是差额** —— 「如果这些 token - 没命中缓存,要多花多少」。对 Claude Code 用户,这通常是 - 成本结构里最大的一块。 + **不解释倍率。**读写各按几倍计费是某一家的价目,而这一 + 页上的模型可能来自任何一家上游 —— 把一家的计费规则写死 + 在界面上,对别家就是错的。 + + 旁边那个净节省已经说清了结论,而它是按**每个模型自己的 + 价目**算出来的;读写比只是那个结论的来路,摆在这里让人 + 能自己看一眼比例,不需要再加一段说明。 */} - {s.cache_saved_micros > 0 && ( - - )} - {s.locally_answered > 0 && ( - + {ratio != null && ( + + 读写比 {ratio.toFixed(1)} : 1 + )}
              + {/* 同上:不标倍率。三段的顺序本身就是从便宜到贵 */} +
              + + + +
              + + )} +
              - {/* **没有价格的那些要说出来。**不说的话,上面那个花费是偏低 - 的,而用户没有任何线索知道少算了什么 */} - {s.unpriced_requests > 0 && ( -

              - - - {s.unpriced_requests} 条请求算不出价钱 - - -

              - )} - - {/* - 最近一段时间的请求量。**画的是节奏,不是金额** —— 金额已经 - 在上面那几个数字里了,而「刚才发生了什么」是另一个问题。 - */} - {/* - 最近 24 小时的花费趋势。**画的是钱,不是请求数** —— - 这是一个 ToC 的工具,用户打开它第一个想知道的是花了多少。 - 请求数叠在同一根柱子上(淡色),因为「花得多」和「用得多」 - 不总是一回事,而分成两张图会让人来回对照。 - */} -
              -
              -

              最近 24 小时

              - 每格一小时 -
              -
              - ({ - at: b.at_ms, - // 主高度是花费,失败那部分单独叠一层 —— 一段红比 - // 一个「失败 3 条」的数字更容易在余光里被发现 - value: (b.cost_micros_exact + b.cost_micros_estimated) / 1000, - sub: b.failed > 0 ? 1 : 0, - label: `${new Date(b.at_ms).getHours()}:00 ${usd( - b.cost_micros_exact + b.cost_micros_estimated, - )} ${b.requests} 条${b.failed ? `(${b.failed} 条失败)` : ""}${ - b.unpriced_requests - ? `\n其中 ${b.unpriced_requests} 条算不出价钱,没有计入` - : "" - }`, - }), - )} - /> + {/* + **左右两栏,各自纵向长。**「哪个模型慢」的下一步是换模型, + 「哪家上游慢」的下一步是换上游 —— 两个问题各占一栏。排成一行 + 的话,上游一多就横向挤爆了。 + */} + + {d.latency.length === 0 ? ( +

              所选区间内样本不足,暂无分位数据。

              + ) : ( +
              +
              +

              按模型 · 首字节 P50 至 P95

              +
              + {t.comparison && d.latency_by_provider.length > 0 && ( +
              +

              按上游 · 同上

              + +
              + )}
              + )} +
              -
              -
              输入 / 输出
              -
              - {s.input_tokens.toLocaleString()} / {s.output_tokens.toLocaleString()} token -
              -
              缓存 读 / 写
              -
              - {s.cache_read_tokens.toLocaleString()} / {s.cache_write_tokens.toLocaleString()}{" "} - token -
              -
              - + {/* + 安全。**没有发现时也在,而且说「未发现」。**这一页别处的纪律 + 是「条件不满足就不出现」—— 那条对成本面板成立:一排零不构成 + 安心。但安全是反过来的:**看不见的防护会被当成没开**。 + */} + {guards.length > 0 && ( + + {guards.map((g) => ( +
              + 0 + ? "bg-destructive" + : "bg-cache-hit") + } + /> + {g.name} + {label(g.mode)} + 0 ? "text-destructive" : "text-muted-foreground"}> + {g.saw} + +
              + ))} +
              )} -
              +
              {/* - 出站密钥检测攒下的证据。**只在真的发现过东西时出现** —— - 没发现的时候显示一句「一切正常」是在占地方,而这一块的 - 全部说服力来自「它说的是已经发生在你身上的事」。 + 出站密钥检测攒下的证据。**只在真的发现过东西时出现** —— 这一块 + 的全部说服力来自「它说的是已经发生在你身上的事」。 */} {d.leaks.length > 0 && ( -
              +

              - 过去 7 天,有请求把密钥发了出去 + 凭据外泄检测

                {d.leaks.map((l) => ( @@ -233,212 +906,24 @@ export default function Dashboard({ tick }: { tick: number }) {

                观察模式:只记录,没有改变任何请求。 - 怎么真的拦 + + 怎么真的拦 +

              )} - {/* - **按上游分是另一个问题。**「哪个模型慢」的下一步是换模型, - 「哪家上游慢」的下一步是换上游 —— 合成一张表两个都答不好。 - 只有一家上游时不显示:那时这张表说的是「它就是这么快」。 - */} - {t.comparison && d.latency_by_provider.length > 1 && ( -
              -
              -

              哪家更快

              - 首字节,按上游分 -
              - - - - - - - - - - - {d.latency_by_provider.map((l) => ( - - - - - - - ))} - -
              上游通常(P50)最糟(P95)样本
              {l.model}{l.p50}ms{l.p95}ms - {l.samples} - {l.samples < 10 && " · 数据不足"} -
              -
              - )} - - {/* - 钱花在哪儿。**横条不是饼图** —— 饼图比不出 12% 和 15%,而这张图 - 的用途恰恰是排序和比例。 - */} - {(d.by_model ?? []).length > 0 && ( -
              -
              -

              花在哪儿

              - 最近 24 小时 -
              -
              -
              -

              按模型

              - ({ - name: g.name, - value: g.cost_micros, - // **算不出价钱的要说出来。**不说的话这根条是偏短的, - // 而看图的人没有线索知道少算了什么 - note: g.unpriced_requests - ? `${g.unpriced_requests} 条无价` - : undefined, - }))} - /> -
              - {/* 一家上游的时候这张图说的是「全都在这儿」,那已经知道了 */} - {(d.by_provider ?? []).length > 1 && ( -
              -

              按上游

              - ({ - name: g.name, - value: g.cost_micros, - note: g.unpriced_requests - ? `${g.unpriced_requests} 条无价` - : undefined, - }))} - /> -
              - )} -
              -
              - )} - - {/* 延迟排行只在有得比的时候才有意义 —— 一家上游一个模型的时候, - 这张表说的是「它就是这么快」,那已经写在上面了 */} - {d.latency.length > 1 && ( -
              -
              -

              延迟

              - {/* 用分位数不用平均值:AI 延迟是长尾分布,平均值会被极端值 - 拉偏 */} - 首字节,按模型分 -
              - - - - - - - - - - - {d.latency.map((l) => ( - - - - - {/* **样本数要显示。**「800ms」是 3 个样本还是 300 个, - 含义完全不同 —— 少了它这张表就是在假装确定 */} - - - ))} - -
              模型通常(P50)最糟(P95)样本
              {l.model}{l.p50}ms{l.p95}ms - {l.samples} - {l.samples < 10 && " · 数据不足"} -
              -
              - )} - - {d.history.length > 0 && ( -
              -

              历史

              - - - - - - - - - - - - - - {d.history.map((r) => ( - setOpen(r.id)} - className="cursor-pointer border-b border-neutral-100 hover:bg-neutral-100 dark:border-neutral-900 dark:hover:bg-neutral-900" - > - - - - - - - - - ))} - -
              时间模型上游状态首字节token花费
              - {new Date(r.at_ms).toLocaleTimeString()} - {r.local ? {r.path} : r.model}{r.local ? "本地应答" : r.provider} - {r.error ? ( - - 失败 - - ) : ( - {r.status} - )} - {r.ttfb_ms != null ? `${r.ttfb_ms}ms` : "—"} - {r.input_tokens != null - ? `${r.input_tokens.toLocaleString()} / ${(r.output_tokens ?? 0).toLocaleString()}` - : "—"} - - {r.billing === "subscription" ? ( - // **「订阅」而不是 $0.00。**后者看起来像一个算出来 - // 的结果,会让人误以为这次调用真的免费;「订阅」 - // 表达的是「这笔账不在这个维度上」 - - 订阅 - - ) : r.cost_micros == null ? ( - // **「没有价格」不是 $0.00。**显示成 0 会让它悄悄 - // 混进总额的心理预期里 - - — - - ) : r.cost_estimated ? ( - - ~{usd(r.cost_micros)} - - ) : ( - usd(r.cost_micros) - )} -
              -
              - )} - {open != null && setOpen(null)} />} {/* 存储状态。**正常时不显示** —— 没问题的时候不该占地方 */} {d.storage && d.storage.level !== "正常" && ( -

              - {d.storage.level} - {!d.storage.forwarding_affected && " —— 转发不受影响。"} -

              + + + {d.storage.level} + {!d.storage.forwarding_affected && " —— 转发不受影响。"} + + )}
              ); diff --git a/src/DryRun.tsx b/src/DryRun.tsx index 3dcae036..3b41226e 100644 --- a/src/DryRun.tsx +++ b/src/DryRun.tsx @@ -1,6 +1,20 @@ -import { useState } from "react"; +import { useId, useState } from "react"; import { invoke } from "@tauri-apps/api/core"; +import { Checkbox } from "@/ui/checkbox"; +import { Field, FieldLabel } from "@/ui/field"; import type { DryRunResult } from "./types"; +import { Button } from "@/ui/button"; +import { Input } from "@/ui/input"; +import { toast } from "sonner"; +import { + Combobox, + ComboboxContent, + ComboboxEmpty, + ComboboxInput, + ComboboxItem, + ComboboxList, + ComboboxTrigger, +} from "@/ui/combobox"; /** * 路由试算。 @@ -19,12 +33,11 @@ export default function DryRun({ models }: { models: string[] }) { const [thinking, setThinking] = useState(false); const [kTokens, setKTokens] = useState(8); const [r, setR] = useState(null); - const [error, setError] = useState(null); const [busy, setBusy] = useState(false); + const uid = useId(); async function run() { setBusy(true); - setError(null); try { setR( await invoke("dry_run", { @@ -46,7 +59,7 @@ export default function DryRun({ models }: { models: string[] }) { ); } catch (e) { // Tauri 的 invoke 用字符串 reject,不是 Error - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -54,29 +67,42 @@ export default function DryRun({ models }: { models: string[] }) { return (
              -

              试算一条请求

              -

              - 假设来这样一个请求,看它会走到哪儿、为什么没走别的。只算不发。 +

              路由试算

              +

              + 按给定条件计算该请求将匹配的路由及其原因。仅计算,不发起请求。

              - setModel(e.target.value)} - placeholder="模型名" - list="dryrun-models" - /> - - {models.map((m) => ( - + {/* + **自由输入 + 建议**,不是受限选择:模型名可能是刚发布的、也可能 + 是中转自己起的,列表里没有的照样得能敲进去。原来用的是原生 + `` —— 它能做到这件事,但样式完全不受控(系统画的), + 而且不支持模糊匹配。`Combobox` 的 `inputValue` 就是自由输入。 + */} + + + + + + 没有匹配的,直接敲全名也行 + + {(m: string) => ( + + {m} + + )} + + +
              - {error &&
              {error}
              } - {r && } + {r && }
              ); } function Result({ r }: { r: DryRunResult }) { return ( -
              +
              {r.outcome === "deny" ? (
              会被拒绝 —— 规则「{r.rule}」: @@ -173,7 +203,7 @@ function Result({ r }: { r: DryRunResult }) { {/* **「为什么没走我以为的那条」才是用户在问的问题。** */}
              - 逐条看规则怎么判的 + 逐条看规则怎么判的
                {r.trace.map((t) => (
              • @@ -187,7 +217,7 @@ function Result({ r }: { r: DryRunResult }) { {t.verdict === "matched" ? "✓" : t.verdict === "phase_two" ? "…" : "·"} {t.name} - {t.why ?? "命中"} + {t.why ?? "命中"}
              • ))}
              diff --git a/src/Guard.tsx b/src/Guard.tsx index 18644a58..a2269b9e 100644 --- a/src/Guard.tsx +++ b/src/Guard.tsx @@ -1,14 +1,31 @@ import { useState } from "react"; -import { Tip } from "./ui/Tooltip"; -import { invoke } from "@tauri-apps/api/core"; +import { Tip } from "@/ui/tip"; import type { Overview } from "./types"; +import { ToggleGroup, ToggleGroupItem } from "@/ui/toggle-group"; +import { toast } from "sonner"; +import { patchConfig } from "./patch"; +import { + Item, + ItemActions, + ItemDescription, + ItemHeader, + ItemTitle, +} from "@/ui/item"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/ui/table"; /** * 防护 —— 三条防线的策略。 * * 在这一页之前,这三个开关**只能改 config.yaml**。而整个设计 * 是:出厂全部停在「观察」,不打扰任何人,同时攒下属于用户自己的证据; - * 他看到「过去 7 天有 3 个请求把密钥发给了 relay-cn」之后,自己决定要 + * 他看到「过去 7 天有 3 个请求把密钥发给了 relay」之后,自己决定要 * 不要切到「拦截」。**证据在界面上,开关在 YAML 里,那条路就断了。** * * 三件事要在这一页说清楚: @@ -79,28 +96,23 @@ export default function Guard({ configVersion: string | null; onChanged: () => void; }) { - const [err, setErr] = useState(null); const [busy, setBusy] = useState(null); const sec = ov.security; async function set(path: string, mode: Mode) { if (!configVersion) { - setErr("还没读到配置版本,稍等一下再试"); + toast.error("还没读到配置版本,稍等一下再试"); return; } setBusy(path); - setErr(null); try { // 走和别的改动同一扇门:带版本号、span 补丁、三道校验。 // **写进去的是 slug 不是中文标签** —— 写「观察」的话下一次加载 // 会因为不是合法取值整份被拒,而这一层刻意不做静默回落。 - await invoke("patch_config", { - ops: [{ op: "set", path, value: mode }], - baseVersion: configVersion, - }); + await patchConfig([{ op: "replace", path, value: mode }], configVersion); onChanged(); } catch (e) { - setErr(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(null); } @@ -109,8 +121,7 @@ export default function Guard({ return (
              -

              防护

              -

              +

              三条防线,各自三档。出厂都停在「观察」 {/* 「我现在到底有没有被保护」是用户在这一页的第一个判断,而 @@ -132,36 +143,34 @@ export default function Guard({ LINES.map((l) => { const cur = (sec[l.key] as Mode) ?? "observe"; return ( -

              -
              -

              {l.title}

              -
              + /* + **一行 = 标题 + 说明 + 右侧操作**,这正是 `Item` 的形状。 + 原来是 `section` 里手拼 `flex items-baseline ml-auto`,而 + 「操作靠右、标题截断、说明换行」这几件事每次都得重写一遍。 + */ + + + {l.title} + + v && void set(l.path, v as Mode)} + > {MODES.map((m) => ( - + ))} -
              -
              + + + -

              - {l.what} -

              + {l.what} {/* 当前这一档到底在做什么 —— 一句话,随档变化。 @@ -169,16 +178,16 @@ export default function Guard({ */}

              {cur === "off" && ( - 现在:不检测,也不记录。 + 现在:不检测,也不记录。 )} {cur === "observe" && ( - + 现在:检测并记录,不改变任何请求。 发现会出现在「安全 › 发现」里。 )} {cur === "enforce" && ( - + 现在:{l.verb}。 )} @@ -190,14 +199,16 @@ export default function Guard({ 切到「拦截」:{l.cost}

              )} -
              + ); })} {sec && ( -
              -

              扫描规则

              -

              + + + 扫描规则 + +

              内置规则加上你自己的那几条。 {/* 语义是「加法加停用」而不是「整份替换」(core 那边改过一次)。 @@ -206,49 +217,50 @@ export default function Guard({ */} 自己写的是加进去,不是替换 - 为什么这么设计 + 设计说明

              -

              +

              你加了 {sec.scan_rules_added} 条,停用了 {sec.scan_rules_disabled} 条内置的。 增删规则要改 config.yaml:它是一组带正则的结构,表单填不了。

              -
              + )} {sec && ( -
              -

              按上游的脱敏类别

              -

              + + + 按上游配置脱敏范围 + + 上面那个总闸决定脱不脱,这里决定 每家脱哪几类。 官方端点默认一类都不脱 为什么 -

              - - - - - - - - - + +
              上游信任脱敏类别
              + + + 上游 + 信任 + 脱敏类别 + + + {ov.providers.map((p) => ( - - - - - + + ))} - -
              {p.name} + {p.name} + {p.trust} {!p.trust_explicit && ( (自动判) )} - + + {p.redact && p.redact.length > 0 ? ( p.redact.join(" · ") ) : ( @@ -256,15 +268,14 @@ export default function Guard({ {p.redact_explicit ? "显式设成不脱" : "不脱(官方端点)"} )} -
              -
              + + + )} - {err &&

              {err}

              } -
              +
              ); } diff --git a/src/Keys.tsx b/src/Keys.tsx index 12fadd7e..80d1c7f6 100644 --- a/src/Keys.tsx +++ b/src/Keys.tsx @@ -1,8 +1,31 @@ import { useState } from "react"; import { invoke } from "@tauri-apps/api/core"; -import { Tip } from "./ui/Tooltip"; -import { Dialog } from "./ui/Dialog"; +import { Tip } from "@/ui/tip"; import type { Overview, PatchOp } from "./types"; +import { Button } from "@/ui/button"; +import { Input } from "@/ui/input"; +import { Badge } from "@/ui/badge"; +import { toast } from "sonner"; +import { patchConfig } from "./patch"; +import { NativeSelect, NativeSelectOption } from "@/ui/native-select"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/ui/table"; +import { + AlertDialog, + AlertDialogCancel, + AlertDialogAction, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, +} from "@/ui/alert-dialog"; /** * 网关密钥。 @@ -22,12 +45,12 @@ import type { Overview, PatchOp } from "./types"; /** * 这把密钥能看到哪些模型。 * - * 三态,而且**第三态是「一个都不给」** —— 一个写成 `[]` 的空列表。 + * 三态,而且**第三态是「不允许任何模型」** —— 一个写成 `[]` 的空列表。 * 那不是坏状态,是「临时停掉这个客户端」的正当用法,所以界面上要能 * 明确选到它,而不是只能通过「删掉最后一条」意外抵达。 * - * 三态之间**每个方向都要能走回去**。第一版只有「全部 → 限制」这一 - * 扇单向门:进了限制态就再也回不到全部,因为协议里当时没有「把这个 + * 三态之间**每个方向都要能走回去**。第一版只有「不限 → 限制」这一 + * 扇单向门:进了限制态就再也回不到不限,因为协议里当时没有「把这个 * 键抹掉」的说法。回去的那条路是写 `null` —— 和路由解绑同一个做法。 */ function AllowCell({ @@ -45,50 +68,52 @@ function AllowCell({ if (allow === null) { return (
              - 全部 - +
              ); } return (
              {allow.length === 0 && ( - - 一个都不给 - +不允许任何模型 )} - + 不限 + {allow.map((m, i) => ( {m} - + ))} -
              ); @@ -116,7 +140,6 @@ export default function Keys({ configVersion: string | null; onChanged: () => void; }) { - const [err, setErr] = useState(null); const [busy, setBusy] = useState(null); const [adding, setAdding] = useState(false); const [newName, setNewName] = useState(""); @@ -127,17 +150,16 @@ export default function Keys({ async function patch(ops: PatchOp[], tag: string) { if (!configVersion) { - setErr("还没读到配置版本,稍等一下再试"); + toast.error("还没读到配置版本,稍等一下再试"); return false; } setBusy(tag); - setErr(null); try { - await invoke("patch_config", { ops, baseVersion: configVersion }); + await patchConfig(ops, configVersion); onChanged(); return true; } catch (e) { - setErr(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); return false; } finally { setBusy(null); @@ -148,7 +170,7 @@ export default function Keys({ const name = newName.trim(); if (!name) return; if (ov.clients.some((c) => c.name === name)) { - setErr(`已经有一把叫「${name}」的密钥了`); + toast.error(`已经有一把叫「${name}」的密钥了`); return; } setBusy("new"); @@ -167,7 +189,7 @@ export default function Keys({ setNewName(""); } } catch (e) { - setErr(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); setBusy(null); } } @@ -178,7 +200,7 @@ export default function Keys({ const key = await invoke("new_key"); await patch([{ op: "replace", path: `/clients/${name}/key`, value: key }], name); } catch (e) { - setErr(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); setBusy(null); } } @@ -187,21 +209,23 @@ export default function Keys({
              -

              网关密钥

              -

              +

              没有密钥连不上,本机也一样。

              - +
              {adding && ( -
              - + - - +
              )} - - - - - - - - - - - +
              名字密钥路由并发上限可见模型 -
              + + + 名字 + 密钥 + 路由 + 并发上限 + 可见模型 + + + + {ov.clients.map((c) => ( - - - - - - - - + + ))} - -
              {c.name}{c.key} + {c.name} + {c.key} + {/* 不绑就是走默认路由 —— 选项里把它写出来,而不是留一个 空白。**空白读起来是「还没配」,而它其实一直在生效。** */} - - - + + + - + + {/* - **三态,而且第三态是「一个都不给」。**留空 = 只按方言 + **三态,而且第三态是「不允许任何模型」。**留空 = 只按方言 过滤;写了 glob = 再按它保留;写一个空列表 = 这把密钥 看不到任何模型,也就用不了 —— 那是「临时停掉这个客户端」 的正当用法,而不是一个坏状态。 @@ -319,16 +346,17 @@ export default function Keys({ busy={busy === c.name} onPatch={(ops) => void patch(ops, c.name)} /> - + + - + {/* **最后一把不给删。**删光之后谁也连不上,而且配置会 @@ -342,50 +370,48 @@ export default function Keys({ : "删掉它。用着它的客户端立刻连不上。" } > - + -
              + + - {err &&

              {err}

              } -
              +
              - !o && setConfirmDelete(null)} - danger - title={`删掉密钥「${confirmDelete}」?`} - description="用着它的客户端会立刻连不上,要重新配一把。配置有版本历史,删错了能回滚。" - footer={ - <> - - - - } - /> + + + +
          ); } diff --git a/src/Pricing.tsx b/src/Pricing.tsx index 0e791edf..00221da7 100644 --- a/src/Pricing.tsx +++ b/src/Pricing.tsx @@ -1,7 +1,22 @@ import { useCallback, useEffect, useState } from "react"; -import { Tip } from "./ui/Tooltip"; +import { Tip } from "@/ui/tip"; import { invoke } from "@tauri-apps/api/core"; import type { PriceRow, PricingView, UpdateOffer, UpdatePreview } from "./types"; +import { Button } from "@/ui/button"; +import { Input } from "@/ui/input"; +import { cn } from "@/lib/utils"; +import { Spinner } from "@/ui/spinner"; +import { toast } from "sonner"; +import { ButtonGroup } from "@/ui/button-group"; +import { Progress } from "@/ui/progress"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/ui/table"; /** * 自定义价格(第三层)。 @@ -25,7 +40,6 @@ import type { PriceRow, PricingView, UpdateOffer, UpdatePreview } from "./types" export default function Pricing() { const [data, setData] = useState(null); const [rows, setRows] = useState([]); - const [err, setErr] = useState(null); const [busy, setBusy] = useState(false); const [open, setOpen] = useState(false); /** @@ -39,16 +53,17 @@ export default function Pricing() { const [offer, setOffer] = useState(null); const [preview, setPreview] = useState(null); const [step, setStep] = useState<"idle" | "offering" | "fetching" | "applying">("idle"); + /** 三步里的第几步。`offer`/`preview` 已经拿到就算这一步过了 */ + const stepAt = preview || step === "applying" ? 3 : offer || step === "fetching" ? 2 : 1; const load = useCallback(async () => { try { const d = await invoke("pricing"); setData(d); setRows(d.rows); - setErr(null); } catch (e) { // Tauri 的 invoke 用字符串 reject,不是 Error - setErr(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } }, []); useEffect(() => { @@ -65,16 +80,15 @@ export default function Pricing() { const d = await invoke("save_pricing", { rows }); setData(d); setRows(d.rows); - setErr(null); } catch (e) { - setErr(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } } return ( -
          +

          自定义价格

          @@ -92,41 +106,43 @@ export default function Pricing() { 。填上单价,成本栏就能算出来了。

          ) : ( -

          +

          经过的请求都能算出价钱。内置价目表是 {data.snapshot_date} 那份快照。

          )}
          - +
          {open && (
          -

          +

          单价按每百万 token 的美元填,和厂商定价页一致。 上游这一列

          - - - - - - - - - - - +
          上游模型输入 $/M输出 $/M
          + + + 上游 + 模型 + 输入 $/M + 输出 $/M + + + + {rows.map((r, i) => ( - - - - - - - + + ))} - -
          + + (j === i ? { ...x, provider: v || null } : x))) } /> - + + 覆盖内置 )} - + + setRows(rows.map((x, j) => (j === i ? { ...x, input: v } : x)))} /> - + + setRows(rows.map((x, j) => (j === i ? { ...x, output: v } : x)))} /> - + + - + -
          + +
          - - - {dirty && 有未保存的改动} + {busy && } + 保存 + + {dirty && 有未保存的改动}
          -

          +

          写进 pricing.yaml,和 config.yaml 放在一起。手改那个文件也可以,它只是一份普通 YAML。

          @@ -212,27 +231,44 @@ export default function Pricing() { 检查价格更新(第二层)。**绝不在启动时后台偷偷拉** —— 零上传的承诺同时意味着零静默下载。 */} -
          +
          + {/* + **三步走到哪儿了,要画出来。**原来只有按钮上一个转圈 —— + 转圈说的是「在忙」,说不出「第二步的下载在忙,还有第三步」。 + 零静默下载这件事的全部意义就是让人看见每一步,那就得把「一共 + 几步、现在第几步」也算进去。 + */} + {(offer || preview || step !== "idle") && ( +
          + +

          + 第 {stepAt} / 3 步 ·{" "} + {stepAt === 1 ? "看对面有没有新的" : stepAt === 2 ? "下载并对比" : "写入"} +

          +
          + )} + {!offer && !preview && (
          - - + {step === "offering" && } + 检查价格更新 + + 内置的是 {data.snapshot_date} 那份。不会自动检查。
          @@ -241,44 +277,45 @@ export default function Pricing() { {offer && !preview && (
          {/* **先说要连哪儿、多大。**这是零静默下载里最容易被省掉的一半 */} -

          +

          要访问:{offer.url}

          -

          +

          大小 {offer.bytes ? `${(offer.bytes / 1024 / 1024).toFixed(1)} MB` : "对面没说"} ;下载后先显示变更,确认才写入。

          -
          - - + -
          + +
          )} {preview && (
          -

          +

          拉回来 {preview.models} 个带价的模型, {preview.changes.length === 0 ? ( 和现在这份没有差别 @@ -290,13 +327,13 @@ export default function Pricing() { 。

          {preview.changes.length > 0 && ( -
          - - +
          +
          + {preview.changes.map((c) => ( - - - - + + ))} - -
          {c.model} + + {c.model} + {c.old_input === null ? ( "新增" ) : ( @@ -306,15 +343,16 @@ export default function Pricing() { {(c.new_output * 1e6).toFixed(2)} )} -
          + +
          )} -
          - - + -
          -

          + + +

          你的自定义价格不受影响,更新只换底下那份公共价目表。

          )}
          - {err &&

          {err}

          } -
          +
          ); } @@ -369,7 +406,7 @@ function Cell({ mono?: boolean; }) { return ( - onChange(e.target.value)} @@ -378,12 +415,8 @@ function Cell({ autoCorrect="off" autoCapitalize="off" spellCheck={false} - className={ - "w-full min-w-0 rounded border border-transparent bg-transparent px-1 py-0.5 " + - "hover:border-neutral-300 focus:border-neutral-400 focus:outline-none " + - "dark:hover:border-neutral-700 dark:focus:border-neutral-600 " + - (mono ? "font-mono" : "") - } + variant="inline" + className={cn(mono && "font-mono")} /> ); } @@ -393,7 +426,9 @@ function Num({ value, onChange }: { value: number; onChange: (v: number) => void const [text, setText] = useState(String(value)); useEffect(() => setText(String(value)), [value]); return ( - { @@ -401,7 +436,6 @@ function Num({ value, onChange }: { value: number; onChange: (v: number) => void const n = Number(e.target.value); if (Number.isFinite(n)) onChange(n); }} - className="w-20 rounded border border-transparent bg-transparent px-1 py-0.5 text-right font-mono hover:border-neutral-300 focus:border-neutral-400 focus:outline-none dark:hover:border-neutral-700 dark:focus:border-neutral-600" /> ); } diff --git a/src/Proxies.tsx b/src/Proxies.tsx index d36b5a29..11de5f62 100644 --- a/src/Proxies.tsx +++ b/src/Proxies.tsx @@ -1,7 +1,20 @@ import { useState } from "react"; -import { invoke } from "@tauri-apps/api/core"; -import { Tip } from "./ui/Tooltip"; +import { Tip } from "@/ui/tip"; +import { Button } from "@/ui/button"; +import { Input } from "@/ui/input"; import type { Overview, PatchOp } from "./types"; +import { toast } from "sonner"; +import { patchConfig } from "./patch"; +import { NativeSelect, NativeSelectOption } from "@/ui/native-select"; +import { ButtonGroup } from "@/ui/button-group"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/ui/table"; const KINDS: { id: string; label: string; what: string }[] = [ { @@ -39,7 +52,6 @@ export default function Proxies({ configVersion: string | null; onChanged: () => void; }) { - const [err, setErr] = useState(null); const [busy, setBusy] = useState(null); const [adding, setAdding] = useState(false); const [f, setF] = useState({ name: "", kind: "socks5h", addr: "", user: "", pass: "" }); @@ -48,17 +60,16 @@ export default function Proxies({ async function patch(ops: PatchOp[], tag: string) { if (!configVersion) { - setErr("还没读到配置版本,稍等一下再试"); + toast.error("还没读到配置版本,稍等一下再试"); return false; } setBusy(tag); - setErr(null); try { - await invoke("patch_config", { ops, baseVersion: configVersion }); + await patchConfig(ops, configVersion); onChanged(); return true; } catch (e) { - setErr(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); return false; } finally { setBusy(null); @@ -69,77 +80,75 @@ export default function Proxies({

          代理

          -

          +

          声明一次,每个上游各自选用。

          - +
          {adding && ( -
          +
          - setF({ ...f, name: e.target.value })} - className="w-48 rounded border border-neutral-300 bg-transparent px-2 py-1 outline-none focus:border-neutral-500 dark:border-neutral-700" /> - - + setF({ ...f, addr: e.target.value })} - className="w-44 rounded border border-neutral-300 bg-transparent px-2 py-1 font-mono outline-none focus:border-neutral-500 dark:border-neutral-700" />
          {KINDS.find((k) => k.id === f.kind)?.what && ( -

          +

          {KINDS.find((k) => k.id === f.kind)?.what}

          )}
          - 认证(可不填) - 认证(可不填) + setF({ ...f, user: e.target.value })} - className="w-32 rounded border border-neutral-300 bg-transparent px-2 py-1 outline-none focus:border-neutral-500 dark:border-neutral-700" /> - setF({ ...f, pass: e.target.value })} - className="w-32 rounded border border-neutral-300 bg-transparent px-2 py-1 outline-none focus:border-neutral-500 dark:border-neutral-700" /> - + 写进配置文件
          -
          - - + -
          + +
          )} {proxies.length === 0 && !adding ? ( -

          +

          还没有代理。上游默认直连;要走代理先在这里建一个。

          ) : ( - - - - - - - - - - - +
          名字类型地址认证在用 -
          + + + 名字 + 类型 + 地址 + 认证 + 在用 + + + + {proxies.map((p) => ( - - - - - - - - + + ))} - -
          {p.name}{p.kind}{p.addr}{p.has_auth ? "有" : "—"} - {p.used_by > 0 ? `${p.used_by} 家上游` : "没人用"} - + {p.name} + {p.kind} + {p.addr} + {p.has_auth ? "有" : "—"} + + {p.used_by > 0 ? `${p.used_by} 家上游` : "未被引用"} + + {/* **还有上游在用就不给删。**删了之后那几家的 `proxy` 指向一个不存在的名字,配置整份加载失败 —— 网关起不来, @@ -211,28 +215,28 @@ export default function Proxies({ 0 - ? `还有 ${p.used_by} 家上游在用它。先把它们改成别的,再删。` + ? `仍有 ${p.used_by} 个上游引用此代理,请先解除引用。` : "删掉它。" } > - + -
          + + )} - {err &&

          {err}

          } -
          +
          ); } diff --git a/src/RequestDrawer.tsx b/src/RequestDrawer.tsx index ea72a614..8662a61f 100644 --- a/src/RequestDrawer.tsx +++ b/src/RequestDrawer.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import { Tip } from "./ui/Tooltip"; +import { Tip } from "@/ui/tip"; import { invoke } from "@tauri-apps/api/core"; import { usd, @@ -9,13 +9,29 @@ import { type ReplayResult, type RequestDetail, } from "./types"; +import { Button } from "@/ui/button"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/ui/tabs"; +import { Spinner } from "@/ui/spinner"; +import { toast } from "sonner"; +import { Sheet, SheetContent, SheetHeader, SheetTitle } from "@/ui/sheet"; +import { NativeSelect, NativeSelectOption } from "@/ui/native-select"; +import { Collapsible, CollapsibleTrigger } from "@/ui/collapsible"; +import { XIcon } from "lucide-react"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/ui/table"; type Tab = "timeline" | "routing" | "payload" | "usage" | "replay"; function Row({ label, value }: { label: string; value: React.ReactNode }) { return (
          - {label} + {label} {value}
          ); @@ -34,7 +50,7 @@ function Body({ b, title }: { b: BodyView | null; title: string }) { return (
          {title}
          -

          +

          没有存下来 为什么 @@ -45,8 +61,13 @@ function Body({ b, title }: { b: BodyView | null; title: string }) { } const big = b.text.length > 2000; const shown = open || !big ? b.text : b.text.slice(0, 2000); + /* + **`Collapsible` 而不是 `Accordion`。**请求和响应两段是各自独立的, + 要能同时展开对着看;Accordion 是「一组里只开一个」,那正好是这里 + 不想要的行为。 + */ return ( -

          +
          {title} @@ -55,19 +76,18 @@ function Body({ b, title }: { b: BodyView | null; title: string }) { {b.truncated && " · 只存了开头"} {big && ( - + + + )}
                   {shown}
                   {big && !open && "\n…"}
                 
          -
          + ); } @@ -91,7 +111,6 @@ export default function RequestDrawer({ inline?: boolean; }) { const [d, setD] = useState(null); - const [error, setError] = useState(null); const [tab, setTab] = useState("timeline"); useEffect(() => { @@ -102,10 +121,9 @@ export default function RequestDrawer({ const x = await invoke("request_detail", { id }); if (alive) { setD(x); - setError(null); } } catch (e) { - if (alive) setError(typeof e === "string" ? e : String(e)); + if (alive) toast.error(typeof e === "string" ? e : String(e)); } })(); return () => { @@ -115,73 +133,68 @@ export default function RequestDrawer({ const r = d?.row; - return ( -
          + /* + **两种壳,一份内容。**分栏时它是右边那一列(排查要来回对照,看详情 + 的时候得同时看见列表);窄窗口时它浮在右边。 + + 浮的那一半原来是手写的 `fixed inset-y-0 right-0` —— 缺的和另外那几个 + 浮层一样:Esc 关不掉、Tab 会走到背景里、焦点不回到那一行。`Sheet` 就是 + 干这个的,而嵌入那一半它管不着,所以壳分两种、内容只写一遍。 + */ + const body = ( + <> {/* **「关闭」两个字被折成了两行。**那不是设计,是 flex 里没人声明 自己不能收缩:标题一长,浏览器就去挤按钮,而按钮挤无可挤就换行。 标题截断、按钮 shrink-0 + nowrap,两条缺一不可。 */} -
          +
          {r?.model || `第 ${id} 号请求`} {r && ( - + {new Date(r.at_ms).toLocaleTimeString()} )} - {/* 「录制」不是一个新功能,这一条请求本来就在存储里 */} - - + +
          - {error && ( -

          - {error} -

          - )} + {d && r && ( - <> - + setTab(v as Tab)} + className="flex min-h-0 flex-1 flex-col" + > + {/* 换成 Tabs 之后左右方向键能在标签间走 —— 这是手写那版没有的 */} + + 时间线 + 路由 + 内容 + 用量 + 重放 +
          - {tab === "replay" && } - {tab === "timeline" && ( + + + +
          {/* **TTFT 放在最显眼的位置。**对 AI 来说它才是体感的 一切 —— 一眼看出慢在网络还是慢在模型 */} @@ -219,10 +232,10 @@ export default function RequestDrawer({ />
          - )} +
          - {tab === "routing" && - (r.routing ? ( + + {r.routing ? (
          {/* **「命中第 4 条」远不如「命中『带缓存的必须走官方』」 有用** */} @@ -236,7 +249,7 @@ export default function RequestDrawer({ {r.routing.attempts.map((a, i) => (
        • {i + 1} {a.provider} @@ -252,7 +265,7 @@ export default function RequestDrawer({ > {a.outcome} - {a.ms}ms + {a.ms}ms
        • ))} @@ -260,22 +273,23 @@ export default function RequestDrawer({ // **用户能看见故障转移在替他工作,这是信任的来源**。 // 一个静默切换过的请求和一个一次就成的 // 请求,在他眼里应该是不同的。 -

          +

          发生了故障转移:前 {r.routing.attempts.length - 1} 家失败,自动换到了下一家。

          )}
          ) : ( -

          +

          这条没有路由信息 两种可能

          - ))} + )} + - {tab === "payload" && ( +
          @@ -283,13 +297,13 @@ export default function RequestDrawer({ 这两段已脱敏:像密钥的内容都打了码。

          - )} +
          - {tab === "usage" && ( +
          {r.input_tokens == null ? ( // **没有 usage 不是「用了 0」** -

          +

          这家上游没有报用量 为什么 @@ -306,12 +320,12 @@ export default function RequestDrawer({ value={ r.billing === "subscription" ? ( // 「订阅」而不是 $0.00 - + 订阅 —— 这家是订阅制,这笔账不在金额这个维度上 ) : r.cost_micros == null ? ( // 「没有价格」和「花了 0 元」是两件事 - + 算不出来 —— 这个模型不在价目表里 ) : r.cost_estimated ? ( @@ -326,60 +340,48 @@ export default function RequestDrawer({ )}

          - )} +
          - + )} -
          + ); -} -/** - * 另存为回放用例。 - * - * **上游漂移是我们的单元测试永远抓不到的那一类故障** —— Codex 在一个 - * patch 版本里改了 `auth.json` 的语义、`reasoning_content` 在不同上游 - * 有三个别名。防它只有一个办法:拿真实流量反复回放。 - * - * 导出时已经走过脱敏,但**它会进 git**,所以那句「自己看一眼」 - * 必须写在按钮旁边而不是文档里。 - */ -function SaveFixture({ id }: { id: number }) { - const [path, setPath] = useState(null); - const [busy, setBusy] = useState(false); - const [error, setError] = useState(null); + if (inline) { + return ( +
          + {body} +
          + ); + } return ( - - {path && ( - - 写好了,记得自己看一眼再交出去 - - )} - {error && {error}} - - - - + {/* 标题在上面那个 header 里,这里只是读屏软件要的那一句 */} + + 请求详情 + + {body} + + ); } + /** * 把这条请求原样发给另一个上游(M6+)。 * @@ -397,7 +399,6 @@ function Replay({ id, originalProvider }: { id: number; originalProvider: string const [quote, setQuote] = useState(null); const [result, setResult] = useState(null); const [busy, setBusy] = useState(false); - const [error, setError] = useState(null); useEffect(() => { void (async () => { @@ -407,20 +408,19 @@ function Replay({ id, originalProvider }: { id: number; originalProvider: string // 默认选一个**和原来那次不同的**上游 —— 重放的价值在对比 setProvider(o.providers.find((p) => p.name !== originalProvider)?.name ?? o.providers[0]?.name ?? ""); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } })(); }, [originalProvider]); async function ask() { setBusy(true); - setError(null); setResult(null); try { setQuote(await invoke("replay_quote", { id, provider })); } catch (e) { // Tauri 的 invoke 用字符串 reject,不是 Error - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); setQuote(null); } finally { setBusy(false); @@ -433,7 +433,7 @@ function Replay({ id, originalProvider }: { id: number; originalProvider: string setResult(await invoke("replay_run", { id, provider })); setQuote(null); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -441,15 +441,15 @@ function Replay({ id, originalProvider }: { id: number; originalProvider: string return (
          -

          +

          把这条请求原样发给另一个上游,并排对比 原样是指

          - - +
          - {error &&
          {error}
          } - {quote && ( -
          +
          {/* **触发前必须显示预估消耗**,而不是点了才知道 */}
          发 {quote.body_bytes} 字节给 {quote.provider}, @@ -483,38 +482,40 @@ function Replay({ id, originalProvider }: { id: number; originalProvider: string
          {quote.note}
          {quote.will_redact && ( -
          +
          发出去之前会按这家的规则脱敏,回显会换回来。
          )} -
          价目表日期 {quote.pricing_date}。
          -
          + + {busy && } + 确认发送 +
          )} {result && ( -
          - - - - - - - - - +
          +
          {result.original.provider}(原来){result.provider}(重放)
          + + + + {result.original.provider}(原来) + {result.provider}(重放) + + + - -
          + +
                       {result.body}
                     
          @@ -536,14 +537,14 @@ function Cmp({ unit?: string; }) { return ( - - {label} + + {label} {/* **原来那次可能没有这个数**(失败的请求没有耗时)。写「—」而不是 0 */} - {a == null ? "—" : `${a}${unit}`} - + {a == null ? "—" : `${a}${unit}`} + {b} {unit} - - + + ); } diff --git a/src/Routes.tsx b/src/Routes.tsx index 691afc9f..c5d9af3f 100644 --- a/src/Routes.tsx +++ b/src/Routes.tsx @@ -1,8 +1,30 @@ -import { useState } from "react"; -import { invoke } from "@tauri-apps/api/core"; -import { Tip } from "./ui/Tooltip"; -import { Dialog } from "./ui/Dialog"; +import { useId, useState } from "react"; +import { Tip } from "@/ui/tip"; +import { Checkbox } from "@/ui/checkbox"; +import { Field, FieldLabel } from "@/ui/field"; import type { Overview, PatchOp, RouteView } from "./types"; +import { Button } from "@/ui/button"; +import { Input } from "@/ui/input"; +import { toast } from "sonner"; +import { patchConfig } from "./patch"; +import { NativeSelect, NativeSelectOption } from "@/ui/native-select"; +import { + Card, + CardAction, + CardDescription, + CardHeader, + CardTitle, +} from "@/ui/card"; +import { + AlertDialog, + AlertDialogCancel, + AlertDialogAction, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, +} from "@/ui/alert-dialog"; /** * 路由。 @@ -12,7 +34,7 @@ import type { Overview, PatchOp, RouteView } from "./types"; * 模型的支点:前者意味着求值永远只看一张规则表。 * * 在此之前这一页只能看不能建:`to` 能通过策略组的下拉改,而 `when` 的 - * 十三个条件、`set`、`deny`、`guard` 全部只读,新建一条规则更无从谈起。 + * 十三个条件、`set`、`deny`、`guard` 不限只读,新建一条规则更无从谈起。 * **一个只能查看的路由页,等于没有路由这个功能。** */ export default function Routes({ @@ -24,7 +46,6 @@ export default function Routes({ configVersion: string | null; onChanged: () => void; }) { - const [err, setErr] = useState(null); const [busy, setBusy] = useState(null); const [adding, setAdding] = useState(false); const [newName, setNewName] = useState(""); @@ -40,17 +61,16 @@ export default function Routes({ async function patch(ops: PatchOp[], tag: string) { if (!configVersion) { - setErr("还没读到配置版本,稍等一下再试"); + toast.error("还没读到配置版本,稍等一下再试"); return false; } setBusy(tag); - setErr(null); try { - await invoke("patch_config", { ops, baseVersion: configVersion }); + await patchConfig(ops, configVersion); onChanged(); return true; } catch (e) { - setErr(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); return false; } finally { setBusy(null); @@ -63,10 +83,13 @@ export default function Routes({ 默认路由单独一块,因为它在模型里就是单独的一个字段 (顶层的 `default_route`)—— 不是某条路由身上的标志。 */} -
          -
          -

          默认路由

          - -

          + + + 没绑路由的密钥走这条。不是所有人都要过的那条。 -

          -
          -
          + + +
          -

          路由

          -

          +

          一条路由里,从上往下匹配,第一条命中的决定去向。

          - +
          {adding && ( -
          - + { if (e.key === "Escape") setAdding(false); }} - className="flex-1 rounded border border-neutral-300 bg-transparent px-2 py-1 tw-body outline-none focus:border-neutral-500 dark:border-neutral-700" /> - - +
          )} @@ -163,20 +188,20 @@ export default function Routes({ {routes.map((r) => (
          -
          +
          {r.name} {r.default && ( 默认 )} - + {/* 绑了这条的密钥。默认路由这里通常是空的 —— 走它的人是 「没绑」,不是「绑了它」。把这件事说出来,否则空白读起来 - 像是「没人用」。 + 像是「未被引用」。 */} {r.clients.length > 0 ? `${r.clients.join("、")} 绑了它` @@ -184,28 +209,31 @@ export default function Routes({ ? "没绑路由的密钥走它" : "还没有密钥绑它"} - + 0 ? `还有 ${r.clients.length} 把密钥绑着它,删了它们会退回默认路由。` : "删掉这条路由。" } > - +
          @@ -233,7 +261,7 @@ export default function Routes({ > {i + 1} {rule.name} - + {rule.conditions.length === 0 ? ( // 兜底规则要标出来。少了它,用户会以为「没有兜底」 // 而反复调试一条其实一直在生效的规则。 @@ -244,10 +272,12 @@ export default function Routes({ rule.conditions.join(" 且 ") )} - + → {rule.to} - +
        • ))} {r.rules.length === 0 && (
        • - 这条路由一条规则都没有。绑上它的密钥会匹配不到任何规则,请求全部失败。 + 这条路由一条规则都没有。绑上它的密钥会匹配不到任何规则,请求不限失败。
        • )} @@ -271,28 +300,24 @@ export default function Routes({ ))}
          - {err &&

          {err}

          } -
          + - !o && setConfirmDelete(null)} - danger - title={`删掉路由「${confirmDelete?.name}」?`} - description={ - confirmDelete && confirmDelete.clients.length > 0 - ? `${confirmDelete.clients.join("、")} 绑着它,删掉之后它们会退回默认路由。` - : "这条路由没有密钥绑着,删掉不影响任何请求。" - } - footer={ - <> - - - - } - /> + + + +
          ); } @@ -343,6 +367,7 @@ function NewRule({ onCancel: () => void; onCreate: (item: string) => void; }) { + const uid = useId(); const [name, setName] = useState(""); const [model, setModel] = useState(""); const [tools, setTools] = useState(false); @@ -361,54 +386,49 @@ function NewRule({ } return ( -
          +
          - setName(e.target.value)} - className="min-w-52 flex-1 rounded border border-neutral-300 bg-transparent px-2 py-1 outline-none focus:border-neutral-500 dark:border-neutral-700" /> - 去向 - +
          - 当 - 当 + setModel(e.target.value)} - className="w-52 rounded border border-neutral-300 bg-transparent px-2 py-1 font-mono outline-none focus:border-neutral-500 dark:border-neutral-700" /> - setTokens(e.target.value)} - className="w-40 rounded border border-neutral-300 bg-transparent px-2 py-1 font-mono outline-none focus:border-neutral-500 dark:border-neutral-700" + className="w-40 font-mono" /> - + 带工具调用 + - + 都留空 = 兜底 @@ -418,19 +438,20 @@ function NewRule({ {route} / {build().replace(/\n/g, " ")} - - +
          ); diff --git a/src/Security.tsx b/src/Security.tsx index 5ec30e41..a6d029d5 100644 --- a/src/Security.tsx +++ b/src/Security.tsx @@ -1,5 +1,5 @@ import { useCallback, useEffect, useState } from "react"; -import { Tip } from "./ui/Tooltip"; +import { Tip } from "@/ui/tip"; import { invoke } from "@tauri-apps/api/core"; import type { AdoptResponse, @@ -11,6 +11,24 @@ import type { ScanFinding, ScanResponse, } from "./types"; +import { Button } from "@/ui/button"; +import { Alert, AlertDescription } from "@/ui/alert"; +import { Spinner } from "@/ui/spinner"; +import { toast } from "sonner"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/ui/table"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from "@/ui/dialog"; /** * 客户端配置面。 @@ -57,7 +75,7 @@ export default function Security({ setError(null); } catch (e) { // Tauri 的 invoke 用字符串 reject,不是 Error - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -70,7 +88,7 @@ export default function Security({ try { setPending({ req, plan: await invoke("mcp_plan", { req }) }); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -84,7 +102,7 @@ export default function Security({ setPending(null); await load(); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); setPending(null); } finally { setBusy(false); @@ -96,36 +114,36 @@ export default function Security({ }, [load]); if (!data) { - return
          {error ?? "扫描中…"}
          ; + return
          {error ?? "扫描中…"}
          ; } const high = data.findings.filter((f) => f.level === "high").length; return (
          - {error && ( -
          - {error} -
          - )} + -
          +
          扫了 {data.scanned} 份文件,规则来自{data.rules_origin}。 - + {busy && } + 重扫 +
          {data.rules_warning && ( -
          + + {data.rules_warning} -
          + + )} {/* 悄悄跳过比不扫更糟:它会给人一种「查过了」的错觉 */} @@ -141,12 +159,14 @@ export default function Security({

          刚刚新出现的 · {alerts.length} 处

          - +
          {/* 「一个用了半年的 skill 突然多了一段零宽字符」这个信号, 比「这个文件里有可疑内容」强得多 */} @@ -156,12 +176,16 @@ export default function Security({
            {alerts.map((f, i) => (
          • - +
          • ))}
          @@ -175,18 +199,22 @@ export default function Security({ {data.findings.length === 0 ? ( // 没风险的时候要说「安全」,而不是让这一块消失 -
          + + ✓ 没发现问题 查了四类 -
          + + ) : (
            {data.findings.map((f, i) => (
          • - +
          • ))}
          @@ -221,16 +249,16 @@ export default function Security({

          hook · {data.hooks.length}

          {/* 危险度第一:不需要模型参与就能拿到执行权 */} -

          +

          hook 在工具调用前后直接执行 shell 命令 - + 为什么单列

            {data.hooks.map((h, i) => ( -
          • - {h.event}{" "} +
          • + {h.event}{" "} {h.command}
          • ))} @@ -242,7 +270,7 @@ export default function Security({

            skill · {data.skills.length}

            {/* skill 只看不搬 —— 跨客户端的格式还没有事实标准 */} -

            +

            只列出来看,不做跨客户端搬动 为什么 @@ -250,11 +278,11 @@ export default function Security({

              {data.skills.map((s, i) => ( -
            • +
            • {s.name} - {s.client} + {s.client} {s.allowed_tools.length > 0 && ( - 工具:{s.allowed_tools.join("、")} + 工具:{s.allowed_tools.join("、")} )}
            • ))} @@ -314,7 +342,7 @@ function Matrix({ return (

              MCP server

              -

              这台机器上没有配置任何 MCP server。

              +

              这台机器上没有配置任何 MCP server。

              ); } @@ -323,43 +351,45 @@ function Matrix({ return (

              MCP server · {names.length}

              -

              +

              每一个都是能执行程序、或能取走上下文的入口。 点格子可改

              - - - - +
              名字
              + + + 名字 {clients.map((c) => ( - + ))} - - - - + 是什么 + + + {names.map((n) => { const any = mcp.find((m) => m.name === n)!; return ( - - + {clients.map((c) => { const m = at(n, c); const writable = canWrite(c); @@ -374,14 +404,10 @@ function Matrix({ ? `从 ${source.client} 复制过来` : "没有能抄的来源"; return ( - + + ); })} - - + + ); })} - -
              + {c} - 是什么
              + + {conflicting.includes(n) && ( - + )} {n} - - - + {/* **同名不同配置时,不能只显示其中一份。**挑一个显示 等于替用户选了个「正确答案」,而这一行的记号说的 恰恰是「没有正确答案,它们不一样」 */} @@ -424,12 +450,12 @@ function Matrix({ {any.env_keys.length > 0 && (
              读环境变量:{any.env_keys.join("、")}
              )} -
              + +
              {/* @@ -437,17 +463,19 @@ function Matrix({ 没回答「哪儿不一样」** —— 而用户要做的决定恰恰是「以哪边为准」。 */} {compare && ( -
              + +

              {compare} 在各客户端里配得不一样

              - +
              {mcp @@ -470,7 +498,7 @@ function Matrix({ {cmd(m)}
              {(m.env_keys.length > 0 || differs((x) => x.env_keys.join(","))) && ( -
              +
              环境变量{" "} x.env_keys.join(",")))}> {m.env_keys.length > 0 ? m.env_keys.join(" · ") : "(没有)"} @@ -478,7 +506,7 @@ function Matrix({ {/* **只有名字没有值** —— 值里常常就是密钥 */}
              )} -
              +
              String(x.enabled)))}> {m.enabled ? "已启用" : "已关闭"} @@ -489,9 +517,10 @@ function Matrix({ })}

              - 要统一:点矩阵里你想保留的那一格,复制到别的客户端。写入前会显示 diff。 + 如需统一:选择矩阵中要保留的配置,复制到其他客户端。写入前将显示差异。

              -
              + + )}
              ); @@ -517,15 +546,16 @@ function McpConfirm({ onConfirm: () => void; }) { return ( -
              -
              e.stopPropagation()} - > -
              - {req.op === "copy" ? `把 ${req.name} 复制到 ${req.to}` : `从 ${req.to} 移除 ${req.name}`} -
              -
              + !o && onCancel()}> + + + + {req.op === "copy" + ? `把 ${req.name} 复制到 ${req.to}` + : `从 ${req.to} 移除 ${req.name}`} + + +
              要改 {plan.path}
              {plan.noop ? ( @@ -535,7 +565,7 @@ function McpConfirm({
                             {plan.after}
                           
              -
              +
              写入前整份备份,除这一项外一字节不动。 {req.op === "copy" && ( @@ -546,21 +576,21 @@ function McpConfirm({ )}
              - + {!plan.noop && ( - + )}
              -
              -
              +
              +
              ); } @@ -580,7 +610,7 @@ function Baseline({ b }: { b: BaselineResponse }) { return (

              上游行为

              -

              +

              观测层没启动,这段时间的请求没有记录 所以没法比 @@ -594,7 +624,7 @@ function Baseline({ b }: { b: BaselineResponse }) { return (

              上游行为

              -

              +

              最近 {b.recent_hours} 小时 对比 之前 {b.baseline_days} 天 样本要求 @@ -602,14 +632,16 @@ function Baseline({ b }: { b: BaselineResponse }) {

              {withDrift.length === 0 ? ( // 没风险的时候要说「安全」,而不是让这一块消失 -
              + + ✓ 每个上游的行为都和之前一致 {b.providers.length > 0 && ( (比过的:{b.providers.map((p) => p.provider).join("、")}) )} -
              + + ) : (
                {withDrift.map((p) => ( @@ -621,7 +653,7 @@ function Baseline({ b }: { b: BaselineResponse }) { {p.drifts.map((d) => (
                {d.label}:{pct(d.recent)} - + ,之前是 {pct(d.baseline)} {/* **样本量必须一起给** —— 没有它,比率是个没法判断 可信度的数字 */} @@ -631,7 +663,7 @@ function Baseline({ b }: { b: BaselineResponse }) { ))} {/* 数过形状的和总数不同时要说清楚 */} {p.recent_inspected < p.recent_total && ( -
                +
                {p.recent_total} 条里数过形状的有 {p.recent_inspected} 条 差额去哪了 @@ -668,13 +700,12 @@ function Shape({ m }: { m: McpView }) { /** 一处发现的详情。**没有删除按钮** —— 删不删由用户自己去改文件。 */ function Detail({ f, onClose }: { f: ScanFinding; onClose: () => void }) { return ( -
                -
                e.stopPropagation()} - > -
                {f.title}
                -
                + !o && onClose()}> + + + {f.title} + +
                {f.detail}
                @@ -684,16 +715,16 @@ function Detail({ f, onClose }: { f: ScanFinding; onClose: () => void }) { {/* 不可见字符已经换成可见记号,否则这一行看起来和正常行一样, 用户会以为我们在误报 */}
                {f.excerpt}
                -
                +
                只报告,不改动任何文件。打开上面的路径看过再决定。
                - +
                -
                -
                +
                +
                ); } diff --git a/src/Sessions.tsx b/src/Sessions.tsx index f16045b1..202d0c1c 100644 --- a/src/Sessions.tsx +++ b/src/Sessions.tsx @@ -1,7 +1,24 @@ import { useCallback, useEffect, useState } from "react"; -import { Tip } from "./ui/Tooltip"; +import { Tip } from "@/ui/tip"; import { invoke } from "@tauri-apps/api/core"; import { usd, type SessionDetail, type SessionView, type TurnView } from "./types"; +import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/ui/empty"; +import { toast } from "sonner"; +import { useCoreEvent } from "./useCoreEvent"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/ui/table"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from "@/ui/dialog"; /** * 会话页。 @@ -24,81 +41,81 @@ export default function Sessions() { setError(null); } catch (e) { // Tauri 的 invoke 用字符串 reject,不是 Error - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } }, []); useEffect(() => { void load(); - const t = setInterval(() => void load(), 10000); - return () => clearInterval(t); }, [load]); - if (!rows) return
                {error ?? "读取中…"}
                ; + // 会话是把存下来的请求聚起来算的,**只在有请求落地之后才会变** —— + // 原来每 10 秒重算一遍,空闲时每一遍都算出同一个答案。 + useCoreEvent(["request_finished", "request_failed"], () => void load()); + + if (!rows) return
                {error ?? "读取中…"}
                ; if (rows.length === 0) { // 空状态永远在回答「接下来该做什么」 return (
                -
                -

                还没有会话。

                -

                - 按「同一段对话」把请求聚起来。正常用一阵子之后会出现在这里。 -

                -
                + + + 暂无会话记录 + 按「同一段对话」把请求聚起来。正常用一阵子之后会出现在这里。 + +
                ); } return (
                - {error &&
                {error}
                } - - - - - - - - - - - - - +
                开始客户端轮次时长上下文峰值缓存省下花费
                + + + 开始 + 客户端 + 轮次 + 时长 + 上下文峰值 + 缓存省下 + 花费 + + + {rows.map((s) => ( - { try { setOpen(await invoke("session_detail", { id: s.id })); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } }} > - - - - - - - - + + ))} - -
                {when(s.started_ms)}{s.client} + {when(s.started_ms)} + {s.client} + {/* 轮次和失败数之间要有间隔 —— 挨着写会读成「181 失败」 */} {s.turns} {s.errors > 0 && ( {s.errors} 失败 )} - {dur(s.ended_ms - s.started_ms)}{tokens(s.peak_input_tokens)} + + {dur(s.ended_ms - s.started_ms)} + {tokens(s.peak_input_tokens)} + {s.cache_saved_micros > 0 ? usd(s.cache_saved_micros) : "—"} - + + -
                + + {open && setOpen(null)} />}
                ); @@ -113,14 +130,14 @@ export default function Sessions() { function Cost({ s }: { s: SessionView }) { const priced = s.turns - s.unpriced_turns; if (priced === 0) { - return 没有价格; + return 没有价格; } return ( <> {usd(s.cost_micros)} {s.unpriced_turns > 0 && ( - +{s.unpriced_turns} 轮无价 + +{s.unpriced_turns} 轮无价 )} @@ -149,23 +166,22 @@ function tokens(n: number) { function Detail({ d, onClose }: { d: SessionDetail; onClose: () => void }) { const { session: s, turns } = d; return ( -
                -
                e.stopPropagation()} - > -
                - {when(s.started_ms)} 的会话 · {s.turns} 轮 · {dur(s.ended_ms - s.started_ms)} -
                -
                + !o && onClose()}> + + + + {when(s.started_ms)} 的会话 · {s.turns} 轮 · {dur(s.ended_ms - s.started_ms)} + + +
                {s.models.join("、")} · 输入 {tokens(s.input_tokens)} / 输出 {tokens(s.output_tokens)} · 缓存读 {tokens(s.cache_read_tokens)}
                -
                -
                + + ); } @@ -179,7 +195,7 @@ function Growth({ turns }: { turns: TurnView[] }) { const max = Math.max(1, ...turns.map((t) => t.input_tokens ?? 0)); return (
                -
                上下文增长(每轮的输入 token)
                +
                上下文增长(每轮的输入 token)
                {turns.map((t) => { const v = t.input_tokens ?? 0; @@ -212,12 +228,12 @@ function Waterfall({ turns }: { turns: TurnView[] }) { const max = Math.max(1, ...turns.map((t) => t.cost_micros ?? 0)); return (
                -
                每轮花费
                +
                每轮花费
                  {turns.map((t, i) => (
                • {i + 1} - {t.model.replace(/^claude-/, "")} + {t.model.replace(/^claude-/, "")} (null); const [results, setResults] = useState(null); const [busy, setBusy] = useState(false); - const [error, setError] = useState(null); async function ask() { setBusy(true); - setError(null); setResults(null); try { // Tauri 的 invoke 用字符串 reject,不是 Error setQuote(await invoke("speed_quote", { model })); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -31,12 +50,11 @@ export default function SpeedTest({ models }: { models: string[] }) { async function run() { setBusy(true); - setError(null); try { setResults(await invoke("speed_run", { model })); setQuote(null); } catch (e) { - setError(typeof e === "string" ? e : String(e)); + toast.error(typeof e === "string" ? e : String(e)); } finally { setBusy(false); } @@ -45,7 +63,7 @@ export default function SpeedTest({ models }: { models: string[] }) { return (
                  -

                  模型测速

                  +

                  上游性能测试

                  {/* **说清这一下花钱。**L1 那一栏写的是「不花钱」,两句话必须 一样醒目,否则用户会以为所有测速都一样 */} @@ -54,33 +72,38 @@ export default function SpeedTest({ models }: { models: string[] }) {
                  - setModel(e.target.value)} - placeholder="claude-sonnet-4-5" - list="tw-models" - className="w-72 rounded border border-neutral-300 bg-transparent px-2 py-1 font-mono tw-body dark:border-neutral-700" - /> - - {models.map((m) => ( - - + {busy && !quote && } + 预估用量 +
                  {/* **报价。**这一步不能省 */} {quote && ( -
                  -

                  - 即将测速 · {model} -

                  + + 即将测速 · {model} +
                    {quote.items.map((i) => (
                  • @@ -91,7 +114,7 @@ export default function SpeedTest({ models }: { models: string[] }) {

                  {/* **有一项算不出来就不给总计。**给一个看起来完整的数字, - 用户会以为那就是全部代价 */} + 用户会以为那就是不限代价 */} 合计{" "} {quote.total_micros != null ? ( {usd(quote.total_micros)} @@ -104,70 +127,70 @@ export default function SpeedTest({ models }: { models: string[] }) {

                  - - + +
                  -
                  + + )} {results && ( - - - - - +
                  上游建连
                  + + + 上游 + 建连 {/* TTFT 才是这一层唯一值得测的东西 */} - - - - - - + 首 token + 总计 + 实际消耗 + + + {results.map((r) => ( - - + + {r.provider} {r.error ? ( - + ) : ( <> - - - + + {r.total_ms}ms {/* **实际消耗和预估对照。**有些上游会附加 system prompt,那时实际比预估多 */} - + )} - + ))} - -
                  首 token总计实际消耗
                  {r.provider} + {r.error} - {r.connect_ms}ms + {r.connect_ms}ms + {r.ttft_ms != null ? `${r.ttft_ms}ms` : "—"} - {r.total_ms}ms + {r.input_tokens != null ? `${r.input_tokens} / ${r.output_tokens ?? 0}` : "上游没报"} -
                  + + )} - {error && ( -

                  - {error} -

                  - )} +
                  ); } diff --git a/src/YamlEditor.tsx b/src/YamlEditor.tsx index f0ba0b0e..d1dc422c 100644 --- a/src/YamlEditor.tsx +++ b/src/YamlEditor.tsx @@ -126,7 +126,7 @@ export default function YamlEditor({ return (
                  ); } diff --git a/src/copy.test.ts b/src/copy.test.ts index 1ed39b67..29e63036 100644 --- a/src/copy.test.ts +++ b/src/copy.test.ts @@ -91,18 +91,106 @@ describe("界面文案", () => { }); /** - * 字号只能从那四级里选。 + * 字号只能从那五级里选(tw-display 是概览上那个金额,只此一处)。 * * 按尺寸命名的类(`text-xs`)和硬编码的 `text-[12px]` 是同一个毛病: * 下一个人按「看起来差不多大」来选,于是层级又没了。 + * + * **`src/ui/` 不在此列。**那里放的是 shadcn 抄进来的组件,它们统一 + * 写 `text-sm` / `text-xs`。这不是破例:下面那条检查保证这两个名字 + * 在 `index.css` 里被绑到 13px 和 11px —— 也就是 tw-body 和 tw-label + * 本身。同一个字阶,两个名字,不是第五第六级。 */ it("没有绕过 type scale 的字号", () => { const bad: string[] = []; for (const f of files) { + if (f.path.startsWith(join(SRC, "ui"))) continue; for (const m of f.text.matchAll(/text-(xs|sm|base|\[\d+px\])/g)) { bad.push(`${f.path}: ${m[0]}`); } } expect(bad).toEqual([]); }); + + /** + * **书面语,不是口语。** + * + * 这是一个给人管账和排查的工具,界面上的每一句都是产品文案,不是 + * 聊天。「花在哪儿」「哪家更快」「排这么多秒还没轮到就放弃」这类 + * 写法读着亲切,但它们在一个要给人看账单的界面里显得不可靠。 + * + * 这里列的是几个反复出现的口语标记,不是完整的语感检查 —— 那件事 + * 机器做不了。它拦的是最容易滑回去的那几个。 + */ + it("文案是书面语", () => { + const spoken = [ + "就好了", + "就行", + "怎么办", + "哪家", + "哪儿", + "啥", + "扫一眼", + "攒着", + "别的设备", + "这么多秒", + // 画图那一轮滑回去的几个:把 bar 叫「条子」、把成本说成「亏钱」 + "条子", + "亏钱", + "回本", + "送上去", + "白跑", + ]; + const bad: string[] = []; + for (const f of files) { + for (const w of spoken) { + if (f.text.includes(w)) bad.push(`${f.path}: 「${w}」`); + } + } + expect(bad).toEqual([]); + }); + + /** + * **界面上不许出现我们的工作流。** + * + * 「值得报一个 issue」曾经写在上游探测的结果里 —— 那是把维护者的流程 + * 塞给用户。他要知道的只是「这会不会影响我」;想告诉我们的话,设置里 + * 的诊断包本来就在那儿。 + * + * 同理不该出现在界面上的还有:仓库、提交、编译、单元测试、调试。这些 + * 词一旦出现,说明这个功能服务的是我们,不是用他产品的人。 + */ + it("文案里没有开发流程的词", () => { + const words = [ + "issue", + "git", + "仓库", + "提交代码", + "编译", + "单元测试", + "回归", + "调试", + "堆栈", + ]; + const bad: string[] = []; + for (const f of files) { + for (const w of words) { + if (f.text.includes(w)) bad.push(`${f.path}: 「${w}」`); + } + } + expect(bad).toEqual([]); + }); + + /** + * 上面那条豁免赖以成立的前提。 + * + * 绑定一旦没了,`text-sm` 会悄悄退回 Tailwind 默认的 14px —— 一个 + * 字阶里没有的字号,而且是从组件里渗进来的,不会有任何一处代码看起来 + * 是错的。 + */ + it("text-sm / text-xs 绑在字阶上", () => { + const css = readFileSync(join(SRC, "index.css"), "utf8"); + expect(css).toContain("--text-sm: 0.8125rem"); // 13px = tw-body + expect(css).toContain("--text-xs: 0.6875rem"); // 11px = tw-label + }); }); diff --git a/src/events.test.ts b/src/events.test.ts new file mode 100644 index 00000000..08b81a1a --- /dev/null +++ b/src/events.test.ts @@ -0,0 +1,89 @@ +import { describe, expect, it } from "vitest"; +import { applyEvent, type CoreEvent, type RequestRow } from "./types"; + +/** + * 事件流缝出来的那一行。 + * + * **这里断了不会报错。**模型和 token 两列会永远显示「—」,而那看起来 + * 和「上游没报用量」一模一样 —— 没有任何东西会提示是镜像少了个字段。 + * 手抄的类型镜像最容易在这上面出问题,所以这几条盯着它。 + */ +function started(over: Partial> = {}) { + return { + kind: "request_started", + id: 1, + client: "claude-code", + provider: "relay", + model: "claude-sonnet-4-5", + method: "POST", + path: "/v1/messages", + at_ms: 1_000_000, + ...over, + } satisfies CoreEvent; +} + +describe("从事件缝出一行", () => { + it("开始就带着模型", () => { + const rows = new Map(); + applyEvent(rows, started()); + expect(rows.get(1)?.model).toBe("claude-sonnet-4-5"); + }); + + /** 老记录没有这个字段,core 补的是空串 —— 空串不是一个模型名 */ + it("模型是空串时当作不知道", () => { + const rows = new Map(); + applyEvent(rows, started({ model: "" })); + expect(rows.get(1)?.model).toBeUndefined(); + }); + + it("跑完之后接上用量", () => { + const rows = new Map(); + applyEvent(rows, started()); + applyEvent(rows, { + kind: "request_finished", + id: 1, + status: 200, + bytes: 4_096, + duration_ms: 1_827, + usage: { input: 2_345, output: 463, cache_read: 0, cache_write: 0 }, + }); + expect(rows.get(1)?.inputTokens).toBe(2_345); + expect(rows.get(1)?.outputTokens).toBe(463); + }); + + /** + * 上游没报用量时**两个字段都不填**。填 0 的话,表上会出现一行 + * `0→0`,而那说的是「这次没用 token」—— 一件没有发生过的事。 + */ + it("上游没报用量就不填,不是填零", () => { + const rows = new Map(); + applyEvent(rows, started()); + applyEvent(rows, { + kind: "request_finished", + id: 1, + status: 200, + bytes: 4_096, + duration_ms: 1_827, + }); + expect(rows.get(1)?.inputTokens).toBeUndefined(); + expect(rows.get(1)?.outputTokens).toBeUndefined(); + }); + + /** + * 价钱**不在事件流里** —— 它是存储层落库时按价目表算的。刚跑完的 + * 那一行必然没有金额,几秒后由 useRequests 回库里对账补上。 + */ + it("事件流给不出金额", () => { + const rows = new Map(); + applyEvent(rows, started()); + applyEvent(rows, { + kind: "request_finished", + id: 1, + status: 200, + bytes: 1, + duration_ms: 1, + usage: { input: 1, output: 1, cache_read: 0, cache_write: 0 }, + }); + expect(rows.get(1)?.costMicros).toBeUndefined(); + }); +}); diff --git a/src/format.test.ts b/src/format.test.ts index 7230af2e..3070700a 100644 --- a/src/format.test.ts +++ b/src/format.test.ts @@ -1,22 +1,16 @@ import { describe, expect, it } from "vitest"; -import { ago, bytes, densify, latency, repeated, statusTone } from "./format"; +import { + bucketStart, + densify, + latency, + money, + repeated, + statusTone, + tokens, + when, +} from "./format"; import { usd } from "./types"; -describe("相对时间", () => { - const now = 1_000_000_000; - it("按秒、分、时、天分档", () => { - expect(ago(now - 3_000, now)).toBe("3s"); - expect(ago(now - 90_000, now)).toBe("1m"); - expect(ago(now - 3_600_000 * 5, now)).toBe("5h"); - expect(ago(now - 86_400_000 * 3, now)).toBe("3d"); - }); - - /** 时钟回拨或者服务端时间靠前时,不要显示负数 */ - it("未来的时间不显示负数", () => { - expect(ago(now + 5_000, now)).toBe("0s"); - }); -}); - describe("延迟合成一列", () => { /** * 这条是合并的理由:非流式请求两个数几乎相同,两列只有一个信息。 @@ -40,15 +34,49 @@ describe("延迟合成一列", () => { }); }); -describe("字节", () => { - it("四位数以上换单位", () => { - expect(bytes(85)).toBe("85"); - expect(bytes(2048)).toBe("2.0K"); - expect(bytes(3_145_728)).toBe("3.0M"); +describe("绝对时间", () => { + // 2026-09-15 14:07:09 本地时间 + const now = new Date(2026, 8, 15, 14, 7, 9).getTime(); + + it("今天的给到秒", () => { + // 同一分钟内的几次请求要能分开 —— 少了秒就对不上号了 + expect(when(new Date(2026, 8, 15, 9, 3, 4).getTime(), now)).toBe("09:03:04"); + }); + + it("更早的带上日期", () => { + expect(when(new Date(2026, 8, 14, 23, 5).getTime(), now)).toBe("09-14 23:05"); + }); + + /** 「今天」按日历天算,不是按 24 小时 —— 隔着零点的两分钟是两天 */ + it("零点两侧分属两天", () => { + expect(when(new Date(2026, 8, 15, 0, 1, 0).getTime(), now)).toBe("00:01:00"); + expect(when(new Date(2026, 8, 14, 23, 59, 0).getTime(), now)).toBe("09-14 23:59"); + }); +}); + +describe("token", () => { + it("四位数以上换 k", () => { + expect(tokens(463, 87)).toBe("463→87"); + expect(tokens(2_345, 463)).toBe("2.3k→463"); + expect(tokens(128_000, 1_200)).toBe("128k→1.2k"); }); - it("没有值不显示 0", () => { - // 0 和「没记到」是两件事 —— 显示 0 会让人以为上游返回了空响应 - expect(bytes(undefined)).toBe("—"); + + it("没有用量就不显示 0", () => { + // 还在跑的行、以及上游没报用量的行。0 会让它在排序里冒充一个测量结果 + expect(tokens(undefined, undefined)).toBe("—"); + expect(tokens(100, undefined)).toBe("—"); + }); +}); + +describe("一行的金额", () => { + it("估算的带记号", () => { + expect(money(18_000, true)).toBe("~$0.018"); + expect(money(18_000, false)).toBe("$0.018"); + }); + + it("算不出来的不显示 0", () => { + // 订阅制上游、价目表里没有的模型 —— 都不是「零元」 + expect(money(undefined, false)).toBe("—"); }); }); @@ -76,6 +104,37 @@ describe("状态分档", () => { }); }); +describe("格子边界", () => { + const HOUR = 3_600_000; + + it("一小时一格落到整点", () => { + const t = new Date(2026, 8, 15, 14, 37, 21, 500).getTime(); + expect(bucketStart(t, HOUR)).toBe(new Date(2026, 8, 15, 14, 0, 0, 0).getTime()); + }); + + it("六小时一格从本地零点数起", () => { + const t = new Date(2026, 8, 15, 14, 37).getTime(); + expect(bucketStart(t, 6 * HOUR)).toBe(new Date(2026, 8, 15, 12, 0, 0, 0).getTime()); + }); + + /** + * **一天一格是本地的一天。**按纪元对齐的话,UTC+8 看到的「9/15」 + * 那一格装的是 9/14 08:00 到 9/15 08:00 —— 格子上写着一个日期, + * 里面装的是另一个。 + */ + it("一天一格落到本地零点", () => { + const t = new Date(2026, 8, 15, 14, 37).getTime(); + expect(bucketStart(t, 24 * HOUR)).toBe(new Date(2026, 8, 15, 0, 0, 0, 0).getTime()); + }); + + /** 这才是它存在的理由:同一格里的任何时刻,落点都一样 */ + it("同一格里的两个时刻落到同一个点", () => { + const a = new Date(2026, 8, 15, 14, 0, 1).getTime(); + const b = new Date(2026, 8, 15, 14, 59, 59).getTime(); + expect(bucketStart(a, HOUR)).toBe(bucketStart(b, HOUR)); + }); +}); + describe("补空桶", () => { const b = (at_ms: number, requests: number) => ({ at_ms, diff --git a/src/format.ts b/src/format.ts index 7683c3c2..9505a4d4 100644 --- a/src/format.ts +++ b/src/format.ts @@ -4,25 +4,7 @@ * 抽出来是因为这几条都有「边界看起来对、其实不对」的地方,而它们错了 * 不会报错,只会让一列数字读起来是错的。 */ - -/** - * 相对时间。 - * - * 列表里要的是「刚才那条」而不是一个绝对时间戳 —— 排查时的定位方式是 - * 「我刚发的那次」。绝对时间留给悬停。 - * - * **不做「刚刚」这种模糊档**:两条相差 3 秒的记录都显示「刚刚」,就没法 - * 按时间对上号了,而这一列存在的全部意义就是对号。 - */ -export function ago(atMs: number, now = Date.now()): string { - const s = Math.max(0, Math.round((now - atMs) / 1000)); - if (s < 60) return `${s}s`; - const m = Math.floor(s / 60); - if (m < 60) return `${m}m`; - const h = Math.floor(m / 60); - if (h < 24) return `${h}h`; - return `${Math.floor(h / 24)}d`; -} +import { usd } from "./types"; /** * 首字节和总耗时合成一列。 @@ -44,16 +26,56 @@ export function latency( } /** - * 字节数。 + * 列表里的绝对时间。 + * + * **相对时间在这一列会塌掉。**开着窗口看实时流量时「3s / 1m」是有用的, + * 而打开应用看昨天那次时,整列二十五行全是 `1d` —— 一个所有行都相同的 + * 值不携带任何信息,而这一列存在的意义就是把某一行对上号。 * - * 四位数以上换 KB —— 一列 `1486` 和 `85` 混排时,位数差本身会被误读成 - * 数量级差。 + * 今天的记录给到秒(同一分钟内的几次请求要能分开),更早的给到分并带上 + * 日期。完整时间戳留给悬停。 */ -export function bytes(n: number | undefined): string { - if (n == null) return "—"; - if (n < 1024) return String(n); - if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)}K`; - return `${(n / 1024 / 1024).toFixed(1)}M`; +export function when(atMs: number, now = Date.now()): string { + const t = new Date(atMs); + const p = (n: number) => String(n).padStart(2, "0"); + const today = new Date(now); + const sameDay = + t.getFullYear() === today.getFullYear() && + t.getMonth() === today.getMonth() && + t.getDate() === today.getDate(); + if (sameDay) return `${p(t.getHours())}:${p(t.getMinutes())}:${p(t.getSeconds())}`; + return `${p(t.getMonth() + 1)}-${p(t.getDate())} ${p(t.getHours())}:${p(t.getMinutes())}`; +} + +/** + * 一个大数收成三四位。 + * + * 四位数以上换 k:一列 `128000` 和 `463` 混排时,位数差本身会被误读成 + * 数量级差。而一个逗号分隔的 `514,567` 读起来是账本上的条目,不是一个 + * 能一眼掂量的量 —— 精确值留给悬停。 + */ +export function compact(n: number): string { + if (n < 1000) return String(n); + if (n < 10_000) return `${(n / 1000).toFixed(1)}k`; + if (n < 1_000_000) return `${Math.round(n / 1000)}k`; + return `${(n / 1_000_000).toFixed(1)}M`; +} + +/** + * 输入与输出 token。 + * + * 合成一列,因为读的时候要的是两者的**比例**:输入远大于输出 = 上下文 + * 在变贵;输出远大于输入 = 在长篇生成。分成两列反而要来回扫。 + * + * **上游没报用量就是没有,不是零。**还在跑的行同理 —— 显示 0 会让它在 + * 排序和求和里冒充一个测量结果。 + */ +export function tokens( + input: number | undefined, + output: number | undefined, +): string { + if (input == null || output == null) return "—"; + return `${compact(input)}→${compact(output)}`; } /** @@ -72,6 +94,23 @@ export function repeated(rows: T[], i: number, get: (r: T) => string): boolea return get(prev) === get(cur); } +/** + * 这一行花了多少。 + * + * **估算值必须带记号。**一个 `$0.018` 和一个按输入长度猜出来的 + * `$0.018` 在列表里长得一模一样,而后者不该被当成账单上的数。 + * + * 算不出来的显示「—」:订阅制上游的边际成本不在这个维度上,价目表里 + * 没有的模型也是 —— 两种都不是「零」。 + */ +export function money( + micros: number | undefined, + estimated: boolean | undefined, +): string { + if (micros == null) return "—"; + return (estimated ? "~" : "") + usd(micros); +} + /** 状态码的语义分档。**眼睛要能一眼扫到那个 5xx。** */ export function statusTone( status: number | undefined, @@ -95,6 +134,29 @@ export interface CostBucket { unpriced_requests: number; } +/** + * 把一个时刻落到它所在那一格的开头。 + * + * **时间窗必须对齐到格子,不能是「现在往前推 24 小时」。**后者每刷新 + * 一次就往前挪一点,于是每一格的边界跟着挪:一条固定时间的记录会在两格 + * 之间来回滑,柱子的高低随之变化 —— 而那是「你什么时候看」造成的, + * 不是数据变了。对齐之后,同一个小时里读到的是同一张图。 + * + * **对齐到本地日历,不是对齐到纪元。**一天一格时,纪元对齐的「一天」是 + * UTC 零点到零点,而格子上写的是本地日期 —— 两者差着时区那几个小时。 + * 半小时偏移的时区里连整点都对不上。 + */ +export function bucketStart(atMs: number, bucketMs: number): number { + const d = new Date(atMs); + if (bucketMs >= 24 * 3_600_000) { + d.setHours(0, 0, 0, 0); + return d.getTime(); + } + const hours = Math.max(1, Math.round(bucketMs / 3_600_000)); + d.setHours(Math.floor(d.getHours() / hours) * hours, 0, 0, 0); + return d.getTime(); +} + /** * 把稀疏的桶补成稠密的一排。 * diff --git a/src/hooks/use-mobile.ts b/src/hooks/use-mobile.ts new file mode 100644 index 00000000..2b0fe1df --- /dev/null +++ b/src/hooks/use-mobile.ts @@ -0,0 +1,19 @@ +import * as React from "react" + +const MOBILE_BREAKPOINT = 768 + +export function useIsMobile() { + const [isMobile, setIsMobile] = React.useState(undefined) + + React.useEffect(() => { + const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) + const onChange = () => { + setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) + } + mql.addEventListener("change", onChange) + setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) + return () => mql.removeEventListener("change", onChange) + }, []) + + return !!isMobile +} diff --git a/src/icons.test.ts b/src/icons.test.ts new file mode 100644 index 00000000..28277d77 --- /dev/null +++ b/src/icons.test.ts @@ -0,0 +1,40 @@ +import { describe, expect, it } from "vitest"; +import { readFileSync } from "node:fs"; + +/** + * 图标这一层的纪律,原来只写在注释里。 + * + * 换成 lucide 重导出之后,一次手滑就能让两个概念指到同一个图形,而那在 + * 类型上完全合法、在界面上只是「怎么两个格子长一样」。 + */ +describe("源列表图标", () => { + const src = readFileSync("src/ui/icons.tsx", "utf8"); + const pairs = [...src.matchAll(/export \{ (\w+) as (Icon\w+) \}/g)].flatMap( + // `noUncheckedIndexedAccess` 下捕获组是 `string | undefined` + (m) => (m[1] && m[2] ? [{ lucide: m[1], name: m[2] }] : []), + ); + + it("每个概念都映到一个图形", () => { + expect(pairs.length).toBeGreaterThanOrEqual(12); + }); + + /** + * **最要紧的一条。**收起源列表之后只剩图标,路由 / 网关 / 客户端 / + * 上游是四个最容易混的概念,认错的代价是点错页。 + */ + it("没有两个概念共用同一个图形", () => { + const seen = new Map(); + const clashes: string[] = []; + for (const { lucide, name } of pairs) { + const had = seen.get(lucide); + if (had) clashes.push(`${had} 和 ${name} 都用了 ${lucide}`); + else seen.set(lucide, name); + } + expect(clashes).toEqual([]); + }); + + it("全部来自 lucide,没有留下手画的", () => { + expect(src).not.toContain("`。**`appearance: none` 是 - * 在这个 input 自己身上改样子,不是拿 span 假扮一个 —— 键盘、空格键、 - * 点标签文字、`:disabled`、辅助功能全都还是浏览器在管,一行 JS 都不用 - * 写。换成自绘的那一刻,这些就得一样一样补回来,而漏掉哪一样没人会 - * 发现。 - * - * 勾上之后跟系统强调色走,和选中项同一条纪律。 - */ -:root { - --check-line: #c3c8d0; /* 没勾时的边 */ - --check-ground: #ffffff; -} -@media (prefers-color-scheme: dark) { - :root { - --check-line: #4a515c; - --check-ground: rgb(255 255 255 / 6%); - } -} -@utility tw-check { - appearance: none; - -webkit-appearance: none; - flex: none; /* 在 flex 行里不许被文字压扁 */ - width: 16px; - height: 16px; - margin: 0; - border: 1px solid var(--check-line); - border-radius: 4px; - background: var(--check-ground); - background-position: center; - background-repeat: no-repeat; - transition: - background-color 100ms ease-out, - border-color 100ms ease-out; - - &:hover:not(:disabled) { - border-color: color-mix(in srgb, var(--check-line) 70%, currentColor); - } - &:checked { - border-color: transparent; - background-color: #0a84ff; - background-color: AccentColor; - /* 白勾。描边画的,和 ui/icons.tsx 里那套同一个画法 */ - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.2 8.3 6.7 10.8 11.8 5.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); - } - &:disabled { - opacity: 0.4; - } - &:focus-visible { - outline: 2px solid #0a84ff; - outline: 2px solid AccentColor; - outline-offset: 2px; - } -} body { margin: 0; @@ -140,6 +306,14 @@ body { * * 数字用等宽:金额和延迟要按位对齐,否则一列数字读起来要重新对焦。 */ +/* 概览上那个金额。**字阶里唯一一个展示级** —— 它是这一页要回答的那 + * 个问题的答案,其余都是它的注解。只此一处,多一处就不是展示级了。 */ +@utility tw-display { + font-size: 34px; + font-weight: 600; + line-height: 1; + letter-spacing: -0.01em; +} @utility tw-title { font-size: 15px; font-weight: 600; diff --git a/src/lib/utils.ts b/src/lib/utils.ts new file mode 100644 index 00000000..6ef8857e --- /dev/null +++ b/src/lib/utils.ts @@ -0,0 +1,7 @@ +import { clsx, type ClassValue } from "clsx"; +import { twMerge } from "tailwind-merge"; + +/** shadcn 组件合并 className 用的。条件类一律走它,不要手拼模板字符串。 */ +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)); +} diff --git a/src/patch.test.ts b/src/patch.test.ts new file mode 100644 index 00000000..c2510af2 --- /dev/null +++ b/src/patch.test.ts @@ -0,0 +1,48 @@ +import { describe, expect, it } from "vitest"; +import { readdirSync, readFileSync } from "node:fs"; +import { join } from "node:path"; + +/** + * 改配置必须走 `patchConfig()`。 + * + * **这不是洁癖,是一个真出过的 bug。**`invoke()` 的参数类型是 + * `Record`,所以 `ops` 里写什么都能编译过去。`Guard.tsx` + * 里写的是 `op: "set"` —— 协议里没有这个操作,于是防护模式那三个按钮 + * 从第一天起一次都没生效过,每次点都被后端拒掉。 + * + * 包一层之后 `PatchOp[]` 才真的被检查。这条测试保证没人绕开它。 + */ +function tsFiles(dir: string): string[] { + const out: string[] = []; + for (const e of readdirSync(dir, { withFileTypes: true })) { + const p = join(dir, e.name); + if (e.isDirectory()) out.push(...tsFiles(p)); + else if (e.name.endsWith(".tsx") || e.name.endsWith(".ts")) out.push(p); + } + return out; +} + +describe("配置补丁", () => { + it("没有人绕过 patchConfig 直接 invoke", () => { + const bad = tsFiles("src") + .filter((f) => !f.endsWith("patch.ts") && !f.endsWith("patch.test.ts")) + .filter((f) => readFileSync(f, "utf8").includes('invoke("patch_config"')) + .map((f) => `${f}:改配置要走 patchConfig(),那里 PatchOp[] 才会被类型检查`); + expect(bad).toEqual([]); + }); + + it("用到的 op 都在协议里", () => { + const allowed = new Set(["replace", "append", "remove", "clear"]); + const bad: string[] = []; + for (const f of tsFiles("src")) { + const text = readFileSync(f, "utf8"); + // 只看紧跟在 patchConfig( 之后的那些,别把别的 op 字段算进来 + for (const m of text.matchAll(/patchConfig\(\s*\[?([\s\S]{0,400}?)\]?,\s*\w/g)) { + for (const o of (m[1] ?? "").matchAll(/\bop: "(\w+)"/g)) { + if (!allowed.has(o[1]!)) bad.push(`${f}: op "${o[1]}"`); + } + } + } + expect(bad).toEqual([]); + }); +}); diff --git a/src/patch.ts b/src/patch.ts new file mode 100644 index 00000000..54c0e938 --- /dev/null +++ b/src/patch.ts @@ -0,0 +1,17 @@ +import { invoke } from "@tauri-apps/api/core"; +import type { PatchOp } from "./types"; + +/** + * 改配置。**所有改配置的地方都走这里。** + * + * 直接调 `invoke("patch_config", { ops })` 的问题是 `invoke` 的参数类型是 + * `Record` —— `ops` 里写什么都能编译过去。`Guard.tsx` 里 + * 有一处写的是 `op: "set"`,协议里根本没有这个操作,于是防护模式那三个 + * 按钮**从第一天起就没有一次生效过**:每次点都被后端拒掉,而拒绝的话 + * 挂在页面角落里,很容易当成没反应。 + * + * 这个函数唯一的作用就是让 `PatchOp[]` 这个类型真的被检查一次。 + */ +export function patchConfig(ops: PatchOp[], baseVersion: string) { + return invoke<{ version: string }>("patch_config", { ops, baseVersion }); +} diff --git a/src/requestTable.test.ts b/src/requestTable.test.ts index 2d825c8b..4c900c95 100644 --- a/src/requestTable.test.ts +++ b/src/requestTable.test.ts @@ -44,6 +44,36 @@ describe("排序", () => { sortRows(rows, "duration", "asc"); expect(rows.map((r) => r.id)).toEqual([1, 2]); }); + + /** + * 金额同理,而且更要紧:算不出价钱的那几行(订阅制上游、价目表里没有 + * 的模型)当成 $0 的话,按花费升序排出来的「最便宜的几次」全是它们, + * 而它们根本没参加这场比较。 + */ + it("按花费排,算不出价钱的排最后", () => { + const rows = [ + row({ id: 1, costMicros: 18_000 }), + row({ id: 2 }), // 订阅制,没有金额 + row({ id: 3, costMicros: 400 }), + ]; + expect(sortRows(rows, "cost", "asc").map((r) => r.id)).toEqual([3, 1, 2]); + expect(sortRows(rows, "cost", "desc").map((r) => r.id)).toEqual([1, 3, 2]); + }); + + /** 按 token 排的是输入加输出 —— 只看输出会把长上下文那几次藏起来 */ + it("按 token 排看的是总量", () => { + const rows = [ + row({ id: 1, inputTokens: 100, outputTokens: 900 }), + row({ id: 2, inputTokens: 120_000, outputTokens: 20 }), + row({ id: 3, inputTokens: 50, outputTokens: 50 }), + ]; + expect(sortRows(rows, "tokens", "desc").map((r) => r.id)).toEqual([2, 1, 3]); + }); + + it("只有一半用量的行不参加 token 排序", () => { + const rows = [row({ id: 1, inputTokens: 100 }), row({ id: 2, inputTokens: 1, outputTokens: 1 })]; + expect(sortRows(rows, "tokens", "desc").map((r) => r.id)).toEqual([2, 1]); + }); }); describe("过滤", () => { @@ -74,6 +104,15 @@ describe("过滤", () => { expect(filterRows(rows, { ...EMPTY_FILTER, q: "CODEX" })).toHaveLength(1); }); + /** 模型现在是表上的一列,「只看 opus 那几条」就该搜得出来 */ + it("自由文本也搜模型", () => { + const withModel = [ + row({ id: 1, model: "claude-opus-4-5" }), + row({ id: 2, model: "claude-haiku-4-5" }), + ]; + expect(filterRows(withModel, { ...EMPTY_FILTER, q: "opus" }).map((x) => x.id)).toEqual([1]); + }); + it("客户端和上游是与的关系", () => { const r = filterRows(rows, { ...EMPTY_FILTER, diff --git a/src/requestTable.ts b/src/requestTable.ts index cafeea2c..a07b8e31 100644 --- a/src/requestTable.ts +++ b/src/requestTable.ts @@ -8,7 +8,7 @@ import type { RequestRow } from "./types"; * 任何东西会回答;而这两种恰恰是排查时最该看见的行。 */ -export type SortKey = "time" | "duration" | "ttfb" | "bytes" | "status"; +export type SortKey = "time" | "duration" | "ttfb" | "tokens" | "cost" | "status"; export type SortDir = "asc" | "desc"; export interface Filter { @@ -41,8 +41,14 @@ function valueOf(r: RequestRow, key: SortKey): number | null { return r.durationMs ?? null; case "ttfb": return r.ttfbMs ?? null; - case "bytes": - return r.bytes ?? null; + case "tokens": + // 按总量排。**只按输出排会把长上下文的那几次藏起来**,而那恰恰是 + // 账单上最贵的部分。 + return r.inputTokens != null && r.outputTokens != null + ? r.inputTokens + r.outputTokens + : null; + case "cost": + return r.costMicros ?? null; case "status": return r.status ?? null; } @@ -80,12 +86,13 @@ export function filterRows(rows: RequestRow[], f: Filter): RequestRow[] { if (f.client && r.client !== f.client) return false; if (f.provider && r.provider !== f.provider) return false; if (!q) return true; - // 路径、客户端、上游、错误信息都算 —— 排查时你记得住的往往是错误 - // 里的那半句话,而不是哪个字段装着它。 + // 路径、客户端、上游、模型、错误信息都算 —— 排查时你记得住的往往是 + // 错误里的那半句话,而不是哪个字段装着它。 return ( r.path.toLowerCase().includes(q) || r.client.toLowerCase().includes(q) || r.provider.toLowerCase().includes(q) || + (r.model ?? "").toLowerCase().includes(q) || (r.error ?? "").toLowerCase().includes(q) ); }); diff --git a/src/types.ts b/src/types.ts index 17f31e62..727cea64 100644 --- a/src/types.ts +++ b/src/types.ts @@ -7,9 +7,9 @@ import type { CostBucket } from "./format"; // (ts-rs 之类),现在还不值得。 export type CoreEvent = - | { kind: "request_started"; id: number; client: string; provider: string; method: string; path: string; at_ms: number } + | { kind: "request_started"; id: number; client: string; provider: string; model: string; method: string; path: string; at_ms: number } | { kind: "request_headers"; id: number; status: number; ttfb_ms: number } - | { kind: "request_finished"; id: number; status: number; bytes: number; duration_ms: number } + | { kind: "request_finished"; id: number; status: number; bytes: number; duration_ms: number; usage?: UsageView } | { kind: "request_failed"; id: number; source: string; message: string } /** * 客户端的辅助请求被本地应答了,一个字节都没发给上游。 @@ -43,6 +43,38 @@ export type CoreEvent = * 打开安全页的时候已经全部看过了。 */ | { kind: "scan_alert"; id: number; alerts: ScanFinding[]; at_ms: number } + /** + * 客户端配置面上的文件动了 —— **不管改了什么**。 + * + * 和 `scan_alert` 是两件事:那条说的是「出现了可疑内容」,值得打断 + * 用户;这条只说「那几个文件变了」,客户端那一页据此重读一遍接管 + * 状态。用户在编辑器里把地址改回原样一点都不可疑,但界面必须跟上。 + */ + /** + * 这次请求花了多少 —— **在它跑完之后一小会儿才知道**。 + * + * 价钱不在数据面的职责里:网关知道用了多少 token,而单价是存储层 + * 落库时查价目表算出来的。所以它是一条独立事件。 + * + * 三个值都可能是 `null`:上游没报用量、模型不在价目表里、或者那家 + * 是订阅计费 —— **那都不是零**。 + */ + | { + kind: "request_priced"; + id: number; + cost_micros?: number | null; + cost_estimated?: boolean; + cache_saved_micros?: number | null; + at_ms: number; + } + | { kind: "clients_changed"; id: number; at_ms: number } + /** + * 某家上游的熔断器开了或者合上了。 + * + * **这是少数几个不挂在任何一次请求上的状态变化**,而它在概览和上游 + * 列表上都看得见。没有它,界面只能定时重读整份配置概览才能发现。 + */ + | { kind: "health_changed"; id: number; provider: string; state: "open" | "closed"; at_ms: number } /** * 出站脱敏动手了。 * @@ -111,6 +143,20 @@ export type CoreEvent = at_ms: number; }; +/** + * 上游报回来的 token 用量。 + * + * **上游不给就是没有**,不是零 —— 记一笔 0 是在撒谎,而它会一路混进 + * 「这次花了多少」里。所以整个字段是可选的。 + */ +export interface UsageView { + input: number; + output: number; + cache_read: number; + cache_write: number; + cache_1h?: boolean; +} + export interface CoreStatus { api_version: number; version: string; @@ -127,6 +173,8 @@ export interface RequestRow { id: number; client: string; provider: string; + /** 哪个模型。**决定这次多贵、多慢的就是它** */ + model?: string; path: string; atMs: number; /** 进行中的行也要立刻画出来 —— 流式请求可能要跑几分钟 */ @@ -135,6 +183,18 @@ export interface RequestRow { ttfbMs?: number; durationMs?: number; bytes?: number; + inputTokens?: number; + outputTokens?: number; + /** + * 这次花了多少微分。 + * + * **事件流里没有它。**价钱是存储层落库时按价目表算出来的,算在 + * 事件之后 —— 所以刚跑完的那一行先是空的,几秒后由历史补上 + * (见 useRequests 的对账)。空着显示「—」,不显示 0。 + */ + costMicros?: number; + /** 上游没给用量、只能按输入长度估的。显示时要带 `~` */ + costEstimated?: boolean; error?: string; /** 这次发出去之前换掉了什么。只有类别和计数,没有原值 */ redacted?: { kind: string; what: string; count: number }[]; @@ -151,6 +211,8 @@ export function applyEvent(rows: Map, ev: CoreEvent): void { id: ev.id, client: ev.client, provider: ev.provider, + // 老记录里没有这个字段,空串当作「不知道」 + model: ev.model || undefined, path: ev.path, atMs: ev.at_ms, state: "in_flight", @@ -171,6 +233,10 @@ export function applyEvent(rows: Map, ev: CoreEvent): void { r.status = ev.status; r.bytes = ev.bytes; r.durationMs = ev.duration_ms; + if (ev.usage) { + r.inputTokens = ev.usage.input; + r.outputTokens = ev.usage.output; + } } break; } @@ -178,8 +244,10 @@ export function applyEvent(rows: Map, ev: CoreEvent): void { case "config_reloaded": case "config_rejected": case "scan_alert": - // 都不进请求列表。配置事件和扫描告警是另一回事,App 单独接 —— - // 后者说的是磁盘上的文件,和请求没有关系。 + case "clients_changed": + case "health_changed": + // 都不进请求列表。配置事件、扫描告警、熔断状态说的都是「现在 + // 什么情况」,而这张表装的是「刚才发生过什么」。App 单独接。 break; case "redacted": { const r = rows.get(ev.id); @@ -196,6 +264,14 @@ export function applyEvent(rows: Map, ev: CoreEvent): void { if (r) r.translated = { from: ev.from, to: ev.to, dropped: ev.dropped }; break; } + case "request_priced": { + const r = rows.get(ev.id); + if (r && ev.cost_micros != null) { + r.costMicros = ev.cost_micros; + r.costEstimated = ev.cost_estimated === true; + } + break; + } case "credential_rotated": // 不进请求列表:它说的是配置文件该改了,跟哪一次请求无关。 // App 单独接,挂一条一直在的提示。 @@ -277,9 +353,27 @@ export interface Summary { subscription_requests: number; /** 那些请求用掉的 token。**它才是订阅用户该看的量** */ subscription_tokens: number; - /** 缓存命中一共省下了多少微分。**算的是差额** */ + /** + * 用了缓存之后净省下多少微分。 + * + * **净额:命中节省的部分,减去写入产生的溢价。**缓存写入通常按高于 + * 输入的单价计费,所以这个数可以是负的 —— 而负数是一条结论:这份 + * 用法上,缓存反而抬高了总支出。 + * + * 具体倍率各家不同,由价目表按模型给出;界面上不写死任何一家的数字。 + */ cache_saved_micros: number; - /** 价目表的快照日期。**成本旁边要标它** */ + /** 本区间有多少个请求带回了可疑工具调用(防线三) */ + flagged_requests: number; + /** + * 本区间有多少个请求在出站时被脱敏换过内容(防线一的拦截档)。 + * + * **观察档不产生这个数**,它产生的是外泄证据。两档各有各的痕迹, + * 界面上要分别说明 —— 否则切到拦截之后看起来像什么都没发生,而那 + * 是防护更强的一档。 + */ + redacted_requests: number; + /** 价目表的快照日期 */ pricing_date: string; } @@ -356,7 +450,7 @@ export interface RequestDetail { } /** - * 「过去 7 天,有 3 个请求把你的 API key 发给了 relay-cn」。 + * 「过去 7 天,有 3 个请求把你的 API key 发给了 relay」。 * * **这比任何功能介绍都有说服力**,因为它说的是已经发生在你身上的事。 */ @@ -378,25 +472,41 @@ export interface Dashboard { storage: StorageStatus | null; leaks: LeakGroup[]; /** - * 最近 24 小时、每小时一格。**稀疏的** —— core 那边只产出有数据的桶, + * 按所选时间范围分格。**稀疏的** —— core 那边只产出有数据的桶, * 空桶由 `densify` 在界面补(只有界面知道要画多少格)。 */ buckets?: CostBucket[]; - by_model?: CostGroup[]; - by_provider?: CostGroup[]; - /** 上面三样的时间窗起点,补空桶要用 */ + /** + * 同样的格子,再按模型分层。 + * + * 趋势图靠它把两个问题画成同一张图:**什么时候花的**,以及**花在 + * 哪个模型上**。拆成两张图的话,读的人要在它们之间自己对时间。 + */ + buckets_by_model?: CostBucketGroup[]; + /** 上一个等长区间的汇总。**没有就是没有对比,不是零** */ + prev?: Summary | null; + /** 上面几样的时间窗起点,补空桶要用 */ since_ms?: number; } -/** 按模型或上游分组的花费。 */ -export interface CostGroup { +/** 一个时间桶里,某一个模型的那部分。 */ +export interface CostBucketGroup { + at_ms: number; name: string; requests: number; - cost_micros: number; - /** **算不出价钱的条数要单独给** —— 当成 0 加进去,那根条就是偏短的 */ - unpriced_requests: number; + failed: number; + cost_micros_exact: number; + cost_micros_estimated: number; + /** + * 这一格里这一项用掉的 token。 + * + * **四类分开给。**它们的单价差十倍以上,加成一个数之后既算不回钱, + * 也说不清这段时间是在写新上下文还是在吃缓存。 + */ input_tokens: number; output_tokens: number; + cache_read_tokens: number; + cache_write_tokens: number; } /** diff --git a/src/ui/Chart.tsx b/src/ui/Chart.tsx deleted file mode 100644 index cd98319e..00000000 --- a/src/ui/Chart.tsx +++ /dev/null @@ -1,125 +0,0 @@ -import { Tip } from "./Tooltip"; - -/** - * 概览上的两种图。 - * - * **手写 SVG,不引图表库。**recharts 是给 Web 后台的:坐标轴、图例、 - * 响应式容器、动画 —— 一百多 KB 里我们要的只有「一排柱子」和「一排 - * 横条」。而它的默认视觉(圆角柱、渐变、浮动图例)在一个菜单栏应用里 - * 一眼就是网页。 - * - * 两种图共用同一条纪律:**没有数据的那一格要画出来,不能跳过**。 - * 跳过的话,一天里的空档会被两边的柱子挤没,图上看起来就是连续在用 —— - * 而「昨天下午我根本没用」正是看这张图想确认的事。 - */ - -/** 一根柱子。`value` 是主高度,`sub` 叠在上面(失败/估算那部分)。 */ -export interface Bar { - at: number; - value: number; - sub?: number; - label: string; -} - -export function BarChart({ - bars, - height = 56, - /** 主色之外,叠加部分的色。默认是失败的红 */ - subClass = "fill-red-500/70", - barClass = "fill-neutral-400 dark:fill-neutral-600", - empty, -}: { - bars: Bar[]; - height?: number; - subClass?: string; - barClass?: string; - empty?: string; -}) { - const max = Math.max(1, ...bars.map((b) => b.value + (b.sub ?? 0))); - if (bars.length === 0) { - return

                  {empty ?? "还没有数据"}

                  ; - } - // 柱宽按格子数平分,留 1px 缝。**不设最小宽度** —— 一格窄到 2px 也 - // 要画,那正是「这段时间几乎没用」的形状。 - const w = 100 / bars.length; - return ( - - {bars.map((b, i) => { - const total = b.value + (b.sub ?? 0); - const h = (total / max) * height; - const subH = ((b.sub ?? 0) / max) * height; - return ( - - - {/* 透明的整列热区:柱子矮的时候也要能悬停到 */} - - {h > 0 && ( - - )} - {subH > 0 && ( - - )} - - - ); - })} - - ); -} - -/** - * 横条排行(钱花在哪儿)。 - * - * 横条而不是饼图:**饼图比不出 12% 和 15%**,而这张图的用途恰恰是排序 - * 和比例。条目也不多,前五个之外的意义很小。 - */ -export function BarRows({ - rows, - unit, -}: { - rows: { name: string; value: number; note?: string }[]; - unit: (v: number) => string; -}) { - const max = Math.max(1, ...rows.map((r) => r.value)); - if (rows.length === 0) { - return

                  还没有数据

                  ; - } - return ( -
                  - {rows.map((r) => ( -
                  - {r.name} -
                  -
                  -
                  - {unit(r.value)} - {r.note && ( - - {r.note} - - )} -
                  - ))} -
                  - ); -} diff --git a/src/ui/ContextMenu.tsx b/src/ui/ContextMenu.tsx deleted file mode 100644 index 631437fc..00000000 --- a/src/ui/ContextMenu.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { ContextMenu as C } from "radix-ui"; -import type { ReactNode } from "react"; - -/** - * 行右键菜单。 - * - * 桌面应用里,列表行右键是肌肉记忆 —— 这个项目之前一处都没有 - * (`onContextMenu` 全 app 零次),所以在请求列表上想复制一个请求 id、 - * 或者只看这个上游,都只能靠眼睛和手打。 - * - * 键盘也能开(菜单键 / Shift+F10),焦点、方向键、Esc 都是 Radix 带的。 - */ -export function RowMenu({ - children, - items, -}: { - children: ReactNode; - items: ( - | { kind: "sep" } - | { kind: "item"; label: string; onSelect: () => void; danger?: boolean } - )[]; -}) { - return ( - - {children} - - - {items.map((it, i) => - it.kind === "sep" ? ( - - ) : ( - - {it.label} - - ), - )} - - - - ); -} diff --git a/src/ui/Dialog.tsx b/src/ui/Dialog.tsx deleted file mode 100644 index b66fbf5a..00000000 --- a/src/ui/Dialog.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import { Dialog as D } from "radix-ui"; -import type { ReactNode } from "react"; - -/** - * 对话框。 - * - * **拿的是行为,不是样式。**自造的 `fixed inset-0` 浮层在这个项目里有 - * 五处,它们共同缺的东西是一样的:Esc 关不掉、Tab 会跑到背景里去、打开 - * 时焦点不进来、关闭后焦点不回到触发它的那个按钮、读屏软件不知道这是个 - * 对话框。这几件每一件都能自己写,而五份手写的实现里一定有几份是错的 - * —— 事实上现在全 app 只有一个 `onKeyDown`。 - * - * 视觉全部自己定,按 macOS 的度量:正文 13px、次要 11px、圆角 10px、 - * 0.5px 的分隔线、120ms 的淡入。**不抄企业版那套** —— 那是给 Web 后台 - * 的卡片阴影和大圆角,放在一个 1100px 的桌面窗口里会显得又大又软。 - */ -export function Dialog({ - open, - onOpenChange, - title, - description, - children, - footer, - /** 危险操作:标题前面挂一个红点,按钮区右对齐 */ - danger = false, - width = "max-w-md", -}: { - open: boolean; - onOpenChange: (v: boolean) => void; - title: string; - description?: ReactNode; - children?: ReactNode; - footer?: ReactNode; - danger?: boolean; - width?: string; -}) { - return ( - - - - - - {danger && ( - - )} - {title} - - {description && ( - -
                  - {description} -
                  -
                  - )} - {children &&
                  {children}
                  } - {footer && ( -
                  {footer}
                  - )} -
                  -
                  -
                  - ); -} - -/** 对话框里的按钮。三种分量,不要再有第四种。 */ -export function DialogButton({ - onClick, - children, - kind = "normal", - disabled, -}: { - onClick: () => void; - children: ReactNode; - kind?: "normal" | "primary" | "danger"; - disabled?: boolean; -}) { - const base = - "rounded-md px-3 py-1.5 tw-body disabled:opacity-40 outline-none focus-visible:ring-2 focus-visible:ring-neutral-400"; - const style = - kind === "danger" - ? "bg-red-600 text-white hover:bg-red-700" - : kind === "primary" - ? "bg-neutral-900 text-white hover:bg-neutral-700 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-neutral-300" - : "border border-neutral-300 hover:bg-neutral-200/60 dark:border-neutral-700 dark:hover:bg-neutral-800"; - return ( - - ); -} diff --git a/src/ui/Tooltip.tsx b/src/ui/Tooltip.tsx deleted file mode 100644 index 445a312c..00000000 --- a/src/ui/Tooltip.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { Tooltip as T } from "radix-ui"; -import type { ReactNode } from "react"; - -/** - * 悬浮说明。 - * - * 替掉 22 处 `title=`。原生 `title` 在 macOS 上有三个毛病:**要等一秒 - * 才出来**(那一秒足够用户放弃)、样式完全不受控(是操作系统画的,和 - * 应用长得不像)、而且**触发之后不能换行排版** —— 而这个项目里好几处 - * `title` 装的是两句话。 - * - * 一眼就能看出是网页的地方,这是其中之一。 - * - * 延迟 400ms:比系统的一秒短,但不至于扫过去就弹一片。 - */ -export function TooltipRoot({ children }: { children: ReactNode }) { - return ( - - {children} - - ); -} - -export function Tip({ - text, - children, - side = "top", -}: { - text: ReactNode; - children: ReactNode; - side?: "top" | "right" | "bottom" | "left"; -}) { - return ( - - {children} - - - {text} - - - - - ); -} diff --git a/src/ui/alert-dialog.tsx b/src/ui/alert-dialog.tsx new file mode 100644 index 00000000..bf107a25 --- /dev/null +++ b/src/ui/alert-dialog.tsx @@ -0,0 +1,197 @@ +import * as React from "react" +import { cn } from "@/lib/utils" +import { AlertDialog as AlertDialogPrimitive } from "radix-ui" + +import { Button } from "@/ui/button" + +function AlertDialog({ + ...props +}: React.ComponentProps) { + return +} + +function AlertDialogTrigger({ + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogPortal({ + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogOverlay({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogContent({ + className, + size = "default", + ...props +}: React.ComponentProps & { + size?: "default" | "sm" +}) { + return ( + + + + + ) +} + +function AlertDialogHeader({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( +
                  + ) +} + +function AlertDialogFooter({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( +
                  + ) +} + +function AlertDialogMedia({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( +
                  + ) +} + +function AlertDialogTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogAction({ + className, + variant = "default", + size = "default", + ...props +}: React.ComponentProps & + Pick, "variant" | "size">) { + return ( + + ) +} + +function AlertDialogCancel({ + className, + variant = "outline", + size = "default", + ...props +}: React.ComponentProps & + Pick, "variant" | "size">) { + return ( + + ) +} + +export { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogMedia, + AlertDialogOverlay, + AlertDialogPortal, + AlertDialogTitle, + AlertDialogTrigger, +} diff --git a/src/ui/alert.tsx b/src/ui/alert.tsx new file mode 100644 index 00000000..921e7139 --- /dev/null +++ b/src/ui/alert.tsx @@ -0,0 +1,79 @@ +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" +import { cn } from "@/lib/utils" + +const alertVariants = cva( + "group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", + { + variants: { + variant: { + default: "bg-card text-card-foreground", + destructive: + "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current", + // 加的一档。红是「失败/危险」,黄是「要花钱、要改东西、已经暴露」 + // —— 这两句话不能用同一个颜色说。 + warning: + "bg-card text-warning *:data-[slot=alert-description]:text-warning/90 *:[svg]:text-current", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +function Alert({ + className, + variant, + ...props +}: React.ComponentProps<"div"> & VariantProps) { + return ( +
                  + ) +} + +function AlertTitle({ className, ...props }: React.ComponentProps<"div">) { + return ( +
                  svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground", + className + )} + {...props} + /> + ) +} + +function AlertDescription({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( +
                  + ) +} + +function AlertAction({ className, ...props }: React.ComponentProps<"div">) { + return ( +
                  + ) +} + +export { Alert, AlertTitle, AlertDescription, AlertAction } diff --git a/src/ui/badge.tsx b/src/ui/badge.tsx new file mode 100644 index 00000000..9dc8e04c --- /dev/null +++ b/src/ui/badge.tsx @@ -0,0 +1,52 @@ +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" +import { cn } from "@/lib/utils" +import { Slot } from "radix-ui" + +const badgeVariants = cva( + "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", + { + variants: { + variant: { + default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80", + secondary: + "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80", + // 加的两档:红说「失败」,这两个说「要留意」和「在正常运转」。 + // 三件事不该用同一个颜色。 + warning: "border-transparent bg-warning/15 text-warning", + success: "border-transparent bg-success/15 text-success", + destructive: + "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20", + outline: + "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground", + ghost: + "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50", + link: "text-primary underline-offset-4 hover:underline", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +function Badge({ + className, + variant = "default", + asChild = false, + ...props +}: React.ComponentProps<"span"> & + VariantProps & { asChild?: boolean }) { + const Comp = asChild ? Slot.Root : "span" + + return ( + + ) +} + +export { Badge, badgeVariants } diff --git a/src/ui/button-group.tsx b/src/ui/button-group.tsx new file mode 100644 index 00000000..c0244583 --- /dev/null +++ b/src/ui/button-group.tsx @@ -0,0 +1,83 @@ +import { cva, type VariantProps } from "class-variance-authority" +import { cn } from "@/lib/utils" +import { Slot } from "radix-ui" + +import { Separator } from "@/ui/separator" + +const buttonGroupVariants = cva( + "group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", + { + variants: { + orientation: { + horizontal: + "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!", + vertical: + "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!", + }, + }, + defaultVariants: { + orientation: "horizontal", + }, + } +) + +function ButtonGroup({ + className, + orientation, + ...props +}: React.ComponentProps<"div"> & VariantProps) { + return ( +
                  + ) +} + +function ButtonGroupText({ + className, + asChild = false, + ...props +}: React.ComponentProps<"div"> & { + asChild?: boolean +}) { + const Comp = asChild ? Slot.Root : "div" + + return ( + + ) +} + +function ButtonGroupSeparator({ + className, + orientation = "vertical", + ...props +}: React.ComponentProps) { + return ( + + ) +} + +export { + ButtonGroup, + ButtonGroupSeparator, + ButtonGroupText, + buttonGroupVariants, +} diff --git a/src/ui/button.tsx b/src/ui/button.tsx new file mode 100644 index 00000000..0a7bbc5f --- /dev/null +++ b/src/ui/button.tsx @@ -0,0 +1,68 @@ +// 改过一处:`sm` 档原本带 `text-[0.8rem]`(12.8px),lite 的字阶里没有 +// 这个数。去掉之后它继承 13px(tw-body),28px 高的按钮配 13px 正合适。 +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" +import { cn } from "@/lib/utils" +import { Slot } from "radix-ui" + +const buttonVariants = cva( + "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + { + variants: { + variant: { + default: "bg-primary text-primary-foreground hover:bg-primary/80", + outline: + "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50", + secondary: + "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground", + ghost: + "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50", + destructive: + "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40", + link: "text-primary underline-offset-4 hover:underline", + }, + size: { + default: + "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", + xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3", + sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5", + lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", + icon: "size-8", + "icon-xs": + "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3", + "icon-sm": + "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg", + "icon-lg": "size-9", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, + } +) + +function Button({ + className, + variant = "default", + size = "default", + asChild = false, + ...props +}: React.ComponentProps<"button"> & + VariantProps & { + asChild?: boolean + }) { + const Comp = asChild ? Slot.Root : "button" + + return ( + + ) +} + +export { Button, buttonVariants } diff --git a/src/ui/calendar.tsx b/src/ui/calendar.tsx new file mode 100644 index 00000000..280720b6 --- /dev/null +++ b/src/ui/calendar.tsx @@ -0,0 +1,223 @@ +import * as React from "react" +import { cn } from "@/lib/utils" +import { + DayPicker, + getDefaultClassNames, + type DayButton, + type Locale, +} from "react-day-picker" + +import { Button, buttonVariants } from "@/ui/button" +import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react" + +function Calendar({ + className, + classNames, + showOutsideDays = true, + captionLayout = "label", + buttonVariant = "ghost", + locale, + formatters, + components, + ...props +}: React.ComponentProps & { + buttonVariant?: React.ComponentProps["variant"] +}) { + const defaultClassNames = getDefaultClassNames() + + return ( + svg]:rotate-180`, + String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, + className + )} + captionLayout={captionLayout} + locale={locale} + formatters={{ + formatMonthDropdown: (date) => + date.toLocaleString(locale?.code, { month: "short" }), + ...formatters, + }} + classNames={{ + root: cn("w-fit", defaultClassNames.root), + months: cn( + "relative flex flex-col gap-4 md:flex-row", + defaultClassNames.months + ), + month: cn("flex w-full flex-col gap-4", defaultClassNames.month), + nav: cn( + "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", + defaultClassNames.nav + ), + button_previous: cn( + buttonVariants({ variant: buttonVariant }), + "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", + defaultClassNames.button_previous + ), + button_next: cn( + buttonVariants({ variant: buttonVariant }), + "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", + defaultClassNames.button_next + ), + month_caption: cn( + "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", + defaultClassNames.month_caption + ), + dropdowns: cn( + "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", + defaultClassNames.dropdowns + ), + dropdown_root: cn( + "cn-calendar-dropdown-root relative rounded-(--cell-radius)", + defaultClassNames.dropdown_root + ), + dropdown: cn( + "absolute inset-0 bg-popover opacity-0", + defaultClassNames.dropdown + ), + caption_label: cn( + "font-medium select-none", + captionLayout === "label" + ? "cn-calendar-caption text-sm" + : "cn-calendar-caption-label flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", + defaultClassNames.caption_label + ), + month_grid: cn("w-full border-collapse", defaultClassNames.month_grid), + weekdays: cn("flex", defaultClassNames.weekdays), + weekday: cn( + "flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none", + defaultClassNames.weekday + ), + week: cn("mt-2 flex w-full", defaultClassNames.week), + week_number_header: cn( + "w-(--cell-size) select-none", + defaultClassNames.week_number_header + ), + week_number: cn( + "text-[0.8rem] text-muted-foreground select-none", + defaultClassNames.week_number + ), + day: cn( + "group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)", + props.showWeekNumber + ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" + : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)", + defaultClassNames.day + ), + range_start: cn( + "relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted", + defaultClassNames.range_start + ), + range_middle: cn("rounded-none", defaultClassNames.range_middle), + range_end: cn( + "relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted", + defaultClassNames.range_end + ), + today: cn( + "rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none", + defaultClassNames.today + ), + outside: cn( + "text-muted-foreground aria-selected:text-muted-foreground", + defaultClassNames.outside + ), + disabled: cn( + "text-muted-foreground opacity-50", + defaultClassNames.disabled + ), + hidden: cn("invisible", defaultClassNames.hidden), + ...classNames, + }} + components={{ + Root: ({ className, rootRef, ...props }) => { + return ( +
                  + ) + }, + Chevron: ({ className, orientation, ...props }) => { + if (orientation === "left") { + return ( + + ) + } + + if (orientation === "right") { + return ( + + ) + } + + return ( + + ) + }, + DayButton: ({ ...props }) => ( + + ), + WeekNumber: ({ children, ...props }) => { + return ( + +
                  + {children} +
                  + + ) + }, + ...components, + }} + {...props} + /> + ) +} + +function CalendarDayButton({ + className, + day, + modifiers, + locale, + ...props +}: React.ComponentProps & { locale?: Partial }) { + const defaultClassNames = getDefaultClassNames() + + const ref = React.useRef(null) + React.useEffect(() => { + if (modifiers.focused) ref.current?.focus() + }, [modifiers.focused]) + + return ( +