diff --git a/AGENTS.md b/AGENTS.md index 4f45332c9..28f7e75e3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -62,6 +62,7 @@ This is a CLI tool for Continue Dev that provides an interactive AI-assisted dev - Configuration in `jest.config.mjs` - Tests should be written with `.test.ts` extension - No existing test files found - tests should be added when writing new functionality +- Run tests using `npm run test path/or/pattern` ### Build System diff --git a/package-lock.json b/package-lock.json index 9ad45ea98..6a4324126 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,7 +76,8 @@ "supertest": "^7.1.3", "ts-jest": "^29.2.3", "ts-node": "^10.9.2", - "tsx": "^4.20.3" + "tsx": "^4.20.3", + "vitest": "^3.2.4" } }, "node_modules/@alcalzone/ansi-tokenize": { @@ -127,6 +128,31 @@ "node": ">=6.0.0" } }, + "node_modules/@asamuzakjp/css-color": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.2.0.tgz", + "integrity": "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@csstools/css-calc": "^2.1.3", + "@csstools/css-color-parser": "^3.0.9", + "@csstools/css-parser-algorithms": "^3.0.4", + "@csstools/css-tokenizer": "^3.0.3", + "lru-cache": "^10.4.3" + } + }, + "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC", + "optional": true, + "peer": true + }, "node_modules/@aws-crypto/crc32": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz", @@ -1488,6 +1514,131 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@csstools/color-helpers": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.0.2.tgz", + "integrity": "sha512-JqWH1vsgdGcw2RR6VliXXdA0/59LttzlU8UlRT/iUUsEeWfYq8I+K0yhihEUTTHLRm1EXvpsCx3083EU15ecsA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "optional": true, + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@csstools/css-calc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-2.1.4.tgz", + "integrity": "sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^3.0.5", + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-3.0.10.tgz", + "integrity": "sha512-TiJ5Ajr6WRd1r8HSiwJvZBiJOqtH86aHpUjq5aEKWHiII2Qfjqd/HCWKPOW8EP4vcspXbHnXrwIDlu5savQipg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@csstools/color-helpers": "^5.0.2", + "@csstools/css-calc": "^2.1.4" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^3.0.5", + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz", + "integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz", + "integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=18" + } + }, "node_modules/@dabh/diagnostics": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz", @@ -3205,6 +3356,286 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", "license": "BSD-3-Clause" }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.46.2.tgz", + "integrity": "sha512-Zj3Hl6sN34xJtMv7Anwb5Gu01yujyE/cLBDB2gnHTAHaWS1Z38L7kuSG+oAh0giZMqG060f/YBStXtMH6FvPMA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.46.2.tgz", + "integrity": "sha512-nTeCWY83kN64oQ5MGz3CgtPx8NSOhC5lWtsjTs+8JAJNLcP3QbLCtDDgUKQc/Ro/frpMq4SHUaHN6AMltcEoLQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.46.2.tgz", + "integrity": "sha512-HV7bW2Fb/F5KPdM/9bApunQh68YVDU8sO8BvcW9OngQVN3HHHkw99wFupuUJfGR9pYLLAjcAOA6iO+evsbBaPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.46.2.tgz", + "integrity": "sha512-SSj8TlYV5nJixSsm/y3QXfhspSiLYP11zpfwp6G/YDXctf3Xkdnk4woJIF5VQe0of2OjzTt8EsxnJDCdHd2xMA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.46.2.tgz", + "integrity": "sha512-ZyrsG4TIT9xnOlLsSSi9w/X29tCbK1yegE49RYm3tu3wF1L/B6LVMqnEWyDB26d9Ecx9zrmXCiPmIabVuLmNSg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.46.2.tgz", + "integrity": "sha512-pCgHFoOECwVCJ5GFq8+gR8SBKnMO+xe5UEqbemxBpCKYQddRQMgomv1104RnLSg7nNvgKy05sLsY51+OVRyiVw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.46.2.tgz", + "integrity": "sha512-EtP8aquZ0xQg0ETFcxUbU71MZlHaw9MChwrQzatiE8U/bvi5uv/oChExXC4mWhjiqK7azGJBqU0tt5H123SzVA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.46.2.tgz", + "integrity": "sha512-qO7F7U3u1nfxYRPM8HqFtLd+raev2K137dsV08q/LRKRLEc7RsiDWihUnrINdsWQxPR9jqZ8DIIZ1zJJAm5PjQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.46.2.tgz", + "integrity": "sha512-3dRaqLfcOXYsfvw5xMrxAk9Lb1f395gkoBYzSFcc/scgRFptRXL9DOaDpMiehf9CO8ZDRJW2z45b6fpU5nwjng==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.46.2.tgz", + "integrity": "sha512-fhHFTutA7SM+IrR6lIfiHskxmpmPTJUXpWIsBXpeEwNgZzZZSg/q4i6FU4J8qOGyJ0TR+wXBwx/L7Ho9z0+uDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.46.2.tgz", + "integrity": "sha512-i7wfGFXu8x4+FRqPymzjD+Hyav8l95UIZ773j7J7zRYc3Xsxy2wIn4x+llpunexXe6laaO72iEjeeGyUFmjKeA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.46.2.tgz", + "integrity": "sha512-B/l0dFcHVUnqcGZWKcWBSV2PF01YUt0Rvlurci5P+neqY/yMKchGU8ullZvIv5e8Y1C6wOn+U03mrDylP5q9Yw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.46.2.tgz", + "integrity": "sha512-32k4ENb5ygtkMwPMucAb8MtV8olkPT03oiTxJbgkJa7lJ7dZMr0GCFJlyvy+K8iq7F/iuOr41ZdUHaOiqyR3iQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.46.2.tgz", + "integrity": "sha512-t5B2loThlFEauloaQkZg9gxV05BYeITLvLkWOkRXogP4qHXLkWSbSHKM9S6H1schf/0YGP/qNKtiISlxvfmmZw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.46.2.tgz", + "integrity": "sha512-YKjekwTEKgbB7n17gmODSmJVUIvj8CX7q5442/CK80L8nqOUbMtf8b01QkG3jOqyr1rotrAnW6B/qiHwfcuWQA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.46.2.tgz", + "integrity": "sha512-Jj5a9RUoe5ra+MEyERkDKLwTXVu6s3aACP51nkfnK9wJTraCC8IMe3snOfALkrjTYd2G1ViE1hICj0fZ7ALBPA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.46.2.tgz", + "integrity": "sha512-7kX69DIrBeD7yNp4A5b81izs8BqoZkCIaxQaOpumcJ1S/kmqNFjPhDu1LHeVXv0SexfHQv5cqHsxLOjETuqDuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.46.2.tgz", + "integrity": "sha512-wiJWMIpeaak/jsbaq2HMh/rzZxHVW1rU6coyeNNpMwk5isiPjSTx0a4YLSlYDwBH/WBvLz+EtsNqQScZTLJy3g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.46.2.tgz", + "integrity": "sha512-gBgaUDESVzMgWZhcyjfs9QFK16D8K6QZpwAaVNJxYDLHWayOta4ZMjGm/vsAEy3hvlS2GosVFlBlP9/Wb85DqQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.46.2.tgz", + "integrity": "sha512-CvUo2ixeIQGtF6WvuB87XWqPQkoFAFqW+HUo/WzHwuHDvIwZCtjdWXoYCcr06iKGydiqTclC4jU/TNObC/xKZg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@sec-ant/readable-stream": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz", @@ -4317,6 +4748,16 @@ "@types/node": "*" } }, + "node_modules/@types/chai": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.2.tgz", + "integrity": "sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*" + } + }, "node_modules/@types/connect": { "version": "3.4.38", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", @@ -4357,6 +4798,13 @@ "@types/node": "*" } }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/diff": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/@types/diff/-/diff-7.0.2.tgz", @@ -4364,6 +4812,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/express": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.3.tgz", @@ -4715,6 +5170,121 @@ "dev": true, "license": "MIT" }, + "node_modules/@vitest/expect": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.4.tgz", + "integrity": "sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/spy": "3.2.4", + "@vitest/utils": "3.2.4", + "chai": "^5.2.0", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.2.4.tgz", + "integrity": "sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "3.2.4", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.17" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.4.tgz", + "integrity": "sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.2.4.tgz", + "integrity": "sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "3.2.4", + "pathe": "^2.0.3", + "strip-literal": "^3.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.2.4.tgz", + "integrity": "sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.4", + "magic-string": "^0.30.17", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.2.4.tgz", + "integrity": "sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyspy": "^4.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.2.4.tgz", + "integrity": "sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.4", + "loupe": "^3.1.4", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, "node_modules/@workos-inc/node": { "version": "7.49.0", "resolved": "https://registry.npmjs.org/@workos-inc/node/-/node-7.49.0.tgz", @@ -4945,6 +5515,16 @@ "node": ">=12.0.0" } }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/async": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", @@ -5329,6 +5909,16 @@ "node": ">= 0.8" } }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", @@ -5399,6 +5989,23 @@ ], "license": "CC-BY-4.0" }, + "node_modules/chai": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.2.1.tgz", + "integrity": "sha512-5nFxhUrX0PqtyogoYOA8IPswy5sZFTOsBFl/9bNsmDLgsxYTzSZQJDPppDnZPTQbzSEm0hqGjWPzRemQCYbD6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/chalk": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", @@ -5421,6 +6028,16 @@ "node": ">=10" } }, + "node_modules/check-error": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", + "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -6201,6 +6818,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cssstyle": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz", + "integrity": "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@asamuzakjp/css-color": "^3.2.0", + "rrweb-cssom": "^0.8.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", @@ -6214,10 +6847,69 @@ "node": ">= 12" } }, + "node_modules/data-urls": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", + "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/data-urls/node_modules/tr46": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", + "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/data-urls/node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "license": "BSD-2-Clause", + "optional": true, + "peer": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/data-urls/node_modules/whatwg-url": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", + "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "tr46": "^5.1.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", "license": "MIT", "dependencies": { "ms": "^2.1.3" @@ -6231,6 +6923,15 @@ } } }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/dedent": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.6.0.tgz", @@ -6246,6 +6947,16 @@ } } }, + "node_modules/deep-eql": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -6530,6 +7241,21 @@ "node": ">= 0.8" } }, + "node_modules/entities": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", + "dev": true, + "license": "BSD-2-Clause", + "optional": true, + "peer": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/env-ci": { "version": "11.1.1", "resolved": "https://registry.npmjs.org/env-ci/-/env-ci-11.1.1.tgz", @@ -6737,6 +7463,13 @@ "node": ">= 0.4" } }, + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true, + "license": "MIT" + }, "node_modules/es-object-atoms": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", @@ -6848,6 +7581,16 @@ "node": ">=4" } }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -6983,6 +7726,16 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/expect-type": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.2.tgz", + "integrity": "sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/express": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", @@ -7927,6 +8680,21 @@ "dev": true, "license": "ISC" }, + "node_modules/html-encoding-sniffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", + "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "whatwg-encoding": "^3.1.1" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -8643,6 +9411,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/is-promise": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", @@ -10119,6 +10896,106 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsdom": { + "version": "26.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-26.1.0.tgz", + "integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "cssstyle": "^4.2.1", + "data-urls": "^5.0.0", + "decimal.js": "^10.5.0", + "html-encoding-sniffer": "^4.0.0", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.6", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.16", + "parse5": "^7.2.1", + "rrweb-cssom": "^0.8.0", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^5.1.1", + "w3c-xmlserializer": "^5.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^3.1.1", + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.1.1", + "ws": "^8.18.0", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "canvas": "^3.0.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/parse5": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", + "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "entities": "^6.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/jsdom/node_modules/tr46": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", + "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/jsdom/node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "license": "BSD-2-Clause", + "optional": true, + "peer": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/jsdom/node_modules/whatwg-url": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", + "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "tr46": "^5.1.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/jsesc": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", @@ -10429,6 +11306,13 @@ "loose-envify": "cli.js" } }, + "node_modules/loupe": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.0.tgz", + "integrity": "sha512-2NCfZcT5VGVNX9mSZIxLRkEAegDGBpuQZBy13desuHeVORmBDyAET4TkJr4SjqQy3A8JDofMN6LpkK8Xcm/dlw==", + "dev": true, + "license": "MIT" + }, "node_modules/lowlight": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-3.3.0.tgz", @@ -10461,6 +11345,16 @@ "yallist": "^3.0.2" } }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, "node_modules/make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -10758,6 +11652,25 @@ "thenify-all": "^1.0.0" } }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -13634,6 +14547,15 @@ "inBundle": true, "license": "ISC" }, + "node_modules/nwsapi": { + "version": "2.2.21", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.21.tgz", + "integrity": "sha512-o6nIY3qwiSXl7/LuOU0Dmuctd34Yay0yeuZRLFmDPrrdHpXKFndPj3hM+YEPVHYC5fx2otBx4Ilc/gyYSAUaIA==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -14083,6 +15005,23 @@ "node": ">=8" } }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathval": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz", + "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.16" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -14241,6 +15180,35 @@ "node": ">=4" } }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/posthog-node": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/posthog-node/-/posthog-node-5.6.0.tgz", @@ -14355,6 +15323,18 @@ "node": ">= 0.10" } }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, "node_modules/pure-rand": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", @@ -14759,6 +15739,46 @@ "node": ">=0.10.0" } }, + "node_modules/rollup": { + "version": "4.46.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.46.2.tgz", + "integrity": "sha512-WMmLFI+Boh6xbop+OAGo9cQ3OgX9MIg7xOQjn+pTCwOkk+FNDAeAemXkJ3HzDJrVXleLOFVa1ipuc1AmEx1Dwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.46.2", + "@rollup/rollup-android-arm64": "4.46.2", + "@rollup/rollup-darwin-arm64": "4.46.2", + "@rollup/rollup-darwin-x64": "4.46.2", + "@rollup/rollup-freebsd-arm64": "4.46.2", + "@rollup/rollup-freebsd-x64": "4.46.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.46.2", + "@rollup/rollup-linux-arm-musleabihf": "4.46.2", + "@rollup/rollup-linux-arm64-gnu": "4.46.2", + "@rollup/rollup-linux-arm64-musl": "4.46.2", + "@rollup/rollup-linux-loongarch64-gnu": "4.46.2", + "@rollup/rollup-linux-ppc64-gnu": "4.46.2", + "@rollup/rollup-linux-riscv64-gnu": "4.46.2", + "@rollup/rollup-linux-riscv64-musl": "4.46.2", + "@rollup/rollup-linux-s390x-gnu": "4.46.2", + "@rollup/rollup-linux-x64-gnu": "4.46.2", + "@rollup/rollup-linux-x64-musl": "4.46.2", + "@rollup/rollup-win32-arm64-msvc": "4.46.2", + "@rollup/rollup-win32-ia32-msvc": "4.46.2", + "@rollup/rollup-win32-x64-msvc": "4.46.2", + "fsevents": "~2.3.2" + } + }, "node_modules/router": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", @@ -14775,6 +15795,15 @@ "node": ">= 18" } }, + "node_modules/rrweb-cssom": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz", + "integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/run-applescript": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", @@ -14846,6 +15875,21 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "license": "MIT" }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "optional": true, + "peer": true, + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, "node_modules/scheduler": { "version": "0.23.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", @@ -15194,6 +16238,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -15401,6 +16452,16 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-support": { "version": "0.5.13", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", @@ -15493,6 +16554,13 @@ "node": ">=10" } }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -15502,6 +16570,13 @@ "node": ">= 0.8" } }, + "node_modules/std-env": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.9.0.tgz", + "integrity": "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==", + "dev": true, + "license": "MIT" + }, "node_modules/stream-combiner2": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", @@ -15639,6 +16714,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strip-literal": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-3.0.0.tgz", + "integrity": "sha512-TcccoMhJOM3OebGhSBEmp3UZ2SfDMZUEBdRA/9ynfLi8yYajyWX3JiXArcJt4Umh4vISpspkQIY8ZZoCqjbviA==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^9.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/strip-literal/node_modules/js-tokens": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", + "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", + "dev": true, + "license": "MIT" + }, "node_modules/strnum": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.1.1.tgz", @@ -15757,6 +16852,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/temp-dir": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", @@ -15917,6 +17021,119 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/tinypool": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz", + "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/tinyrainbow": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", + "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-4.0.3.tgz", + "integrity": "sha512-t2T/WLB2WRgZ9EpE4jgPJ9w+i66UZfDc8wHh0xrwiRNN+UwH98GIJkTeZqX9rg0i0ptwzqW+uYeIF0T4F8LR7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tldts": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz", + "integrity": "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "tldts-core": "^6.1.86" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz", + "integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -15946,6 +17163,21 @@ "node": ">=0.6" } }, + "node_modules/tough-cookie": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz", + "integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "peer": true, + "dependencies": { + "tldts": "^6.1.32" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -16375,6 +17607,233 @@ "node": ">= 0.8" } }, + "node_modules/vite": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.0.6.tgz", + "integrity": "sha512-MHFiOENNBd+Bd9uvc8GEsIzdkn1JxMmEeYX35tI3fv0sJBUTfW5tQsoaOwuY4KhBI09A3dUJ/DXf2yxPVPUceg==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.6", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.40.0", + "tinyglobby": "^0.2.14" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.2.4.tgz", + "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.4.1", + "es-module-lexer": "^1.7.0", + "pathe": "^2.0.3", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite/node_modules/fdir": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/vitest": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.4.tgz", + "integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/expect": "3.2.4", + "@vitest/mocker": "3.2.4", + "@vitest/pretty-format": "^3.2.4", + "@vitest/runner": "3.2.4", + "@vitest/snapshot": "3.2.4", + "@vitest/spy": "3.2.4", + "@vitest/utils": "3.2.4", + "chai": "^5.2.0", + "debug": "^4.4.1", + "expect-type": "^1.2.1", + "magic-string": "^0.30.17", + "pathe": "^2.0.3", + "picomatch": "^4.0.2", + "std-env": "^3.9.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.14", + "tinypool": "^1.1.1", + "tinyrainbow": "^2.0.0", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0", + "vite-node": "3.2.4", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/debug": "^4.1.12", + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@vitest/browser": "3.2.4", + "@vitest/ui": "3.2.4", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/debug": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -16412,6 +17871,33 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "license": "BSD-2-Clause" }, + "node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=18" + } + }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", @@ -16437,6 +17923,23 @@ "node": ">= 8" } }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/widest-line": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz", @@ -16694,6 +18197,27 @@ } } }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index 2fe02d0be..3239c5525 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ }, "scripts": { "test": "npm run lint && cross-env NODE_OPTIONS=--experimental-vm-modules jest", + "vitest": "vitest run", + "vitest:watch": "vitest watch", "build": "tsc -p tsconfig.build.json", "start": "node dist/index.js", "dev": "tsx src/index.ts", @@ -95,7 +97,8 @@ "supertest": "^7.1.3", "ts-jest": "^29.2.3", "ts-node": "^10.9.2", - "tsx": "^4.20.3" + "tsx": "^4.20.3", + "vitest": "^3.2.4" }, "engine": { "node": ">=18" diff --git a/src/commands/serve.ts b/src/commands/serve.ts index d1d404364..ca6d18cc7 100644 --- a/src/commands/serve.ts +++ b/src/commands/serve.ts @@ -4,21 +4,30 @@ import express, { Request, Response } from "express"; import type { ChatCompletionMessageParam } from "openai/resources.mjs"; import path from "path"; import { promisify } from "util"; -import { - getAssistantSlug, -} from "../auth/workos.js"; +import { getAssistantSlug } from "../auth/workos.js"; import { toolPermissionManager } from "../permissions/permissionManager.js"; import { saveSession } from "../session.js"; -import { getService, initializeServices, SERVICE_NAMES } from "../services/index.js"; -import { AuthServiceState, ConfigServiceState, ModelServiceState } from "../services/types.js"; -import { streamChatResponse, type StreamCallbacks } from "../streamChatResponse.js"; +import { + getService, + initializeServices, + SERVICE_NAMES, +} from "../services/index.js"; +import { + AuthServiceState, + ConfigServiceState, + ModelServiceState, +} from "../services/types.js"; +import { + streamChatResponse, + type StreamCallbacks, +} from "../streamChatResponse.js"; import { constructSystemMessage } from "../systemMessage.js"; import telemetryService from "../telemetry/telemetryService.js"; -import { getToolDisplayName } from "../tools.js"; import { DisplayMessage } from "../ui/types.js"; import { formatError } from "../util/formatError.js"; import logger from "../util/logger.js"; import { ExtendedCommandOptions } from "./BaseCommandOptions.js"; +import { getToolDisplayName } from "../tools/index.js"; const execAsync = promisify(exec); @@ -34,7 +43,6 @@ interface PendingPermission { timestamp: number; } - interface ServerState { chatHistory: ChatCompletionMessageParam[]; displayMessages: DisplayMessage[]; // Messages formatted for display with tool info @@ -89,15 +97,21 @@ export async function serve(prompt?: string, options: ServeOptions = {}) { } // Log configuration information - const organizationId = authState.organizationId || 'personal'; + const organizationId = authState.organizationId || "personal"; const assistantName = config.name; const assistantSlug = getAssistantSlug(authState.authConfig); const modelProvider = model.provider; const modelName = model.model; - + console.log(chalk.blue(`\nConfiguration:`)); console.log(chalk.dim(` Organization: ${organizationId}`)); - console.log(chalk.dim(` Assistant: ${assistantName}${assistantSlug ? ` (${assistantSlug})` : ''}`)); + console.log( + chalk.dim( + ` Assistant: ${assistantName}${ + assistantSlug ? ` (${assistantSlug})` : "" + }` + ) + ); console.log(chalk.dim(` Model: ${modelProvider}/${modelName}`)); if (options.config) { console.log(chalk.dim(` Config file: ${options.config}`)); @@ -177,31 +191,31 @@ export async function serve(prompt?: string, options: ServeOptions = {}) { state.lastActivity = Date.now(); const { requestId, approved } = req.body; - + if (!state.pendingPermission) { return res.status(400).json({ error: "No pending permission request" }); } - + if (state.pendingPermission.requestId !== requestId) { return res.status(400).json({ error: "Invalid request ID" }); } - + // Remove the permission request message const lastMsg = state.displayMessages[state.displayMessages.length - 1]; if (lastMsg && lastMsg.messageType === "tool-permission-request") { state.displayMessages.pop(); } - + // Send the permission response to the toolPermissionManager if (approved) { toolPermissionManager.approveRequest(requestId); } else { toolPermissionManager.rejectRequest(requestId); } - + // Clear pending permission state state.pendingPermission = null; - + res.json({ success: true, approved, @@ -290,15 +304,21 @@ export async function serve(prompt?: string, options: ServeOptions = {}) { console.log(chalk.dim("Endpoints:")); console.log(chalk.dim(" GET /state - Get current agent state")); console.log( - chalk.dim(" POST /message - Send a message (body: { message: string })") + chalk.dim( + " POST /message - Send a message (body: { message: string })" + ) ); console.log( - chalk.dim(" POST /permission - Approve/reject tool (body: { requestId, approved })") + chalk.dim( + " POST /permission - Approve/reject tool (body: { requestId, approved })" + ) ); console.log( chalk.dim(" GET /diff - Get git diff against main branch") ); - console.log(chalk.dim(" POST /exit - Gracefully shut down the server")); + console.log( + chalk.dim(" POST /exit - Gracefully shut down the server") + ); console.log( chalk.dim( `\nServer will shut down after ${timeoutSeconds} seconds of inactivity` @@ -573,4 +593,4 @@ async function streamChatResponseWithInterruption( // currentStreamingMessage.isStreaming = false; } } -} \ No newline at end of file +} diff --git a/src/streamChatResponse.ts b/src/streamChatResponse.ts index 31fd36fc6..daaebfb8a 100644 --- a/src/streamChatResponse.ts +++ b/src/streamChatResponse.ts @@ -17,9 +17,9 @@ import { import { toolPermissionManager } from "./permissions/permissionManager.js"; import telemetryService from "./telemetry/telemetryService.js"; import { calculateTokenCost } from "./telemetry/utils.js"; -import { executeToolCall } from "./tools.js"; import { BUILTIN_TOOLS, + executeToolCall, getAvailableTools, Tool, ToolCall, diff --git a/src/tools.ts b/src/tools.ts deleted file mode 100644 index 24935100a..000000000 --- a/src/tools.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { - BUILTIN_TOOLS, - executeToolCall, - extractToolCalls, - getToolsDescription, - getToolDisplayName, - type Tool, -} from "./tools/index.js"; - -// Re-export all tool functionality -export { - executeToolCall, - extractToolCalls, - getToolsDescription, - getToolDisplayName, - BUILTIN_TOOLS as tools, -}; - -export type { Tool }; diff --git a/src/tools/formatters.test.ts b/src/tools/formatters.test.ts index 9e35cbd68..5c677ab1c 100644 --- a/src/tools/formatters.test.ts +++ b/src/tools/formatters.test.ts @@ -1,9 +1,8 @@ import { jest } from "@jest/globals"; -import { formatToolCall, formatToolArgument } from "./formatters.js"; +import { formatToolArgument } from "./formatters.js"; +import { formatToolCall } from "./index.js"; describe("formatToolCall", () => { - const originalCwd = process.cwd(); - beforeEach(() => { // Mock process.cwd to return a consistent value jest.spyOn(process, "cwd").mockReturnValue("/Users/test/project"); diff --git a/src/tools/formatters.ts b/src/tools/formatters.ts index 0082ce557..1c6f56b43 100644 --- a/src/tools/formatters.ts +++ b/src/tools/formatters.ts @@ -1,25 +1,4 @@ import path from "path"; -import { getToolDisplayName } from "./index.js"; - -/** - * Formats a tool call with its arguments for display - * @param toolName The name of the tool - * @param args The tool arguments - * @returns A formatted string like "ToolName(arg)" or just "ToolName" if no args - */ -export function formatToolCall(toolName: string, args?: any): string { - const displayName = getToolDisplayName(toolName); - - if (!args || Object.keys(args).length === 0) { - return displayName; - } - - // Get the first argument value - const firstValue = Object.values(args)[0]; - const formattedValue = formatToolArgument(firstValue); - - return `${displayName}(${formattedValue})`; -} /** * Formats a single tool argument for display @@ -41,4 +20,4 @@ export function formatToolArgument(value: any): string { // Return other values as strings return String(value); -} \ No newline at end of file +} diff --git a/src/tools/index.test.ts b/src/tools/index.test.ts index 7a2ddef7f..edd0501a4 100644 --- a/src/tools/index.test.ts +++ b/src/tools/index.test.ts @@ -1,102 +1,76 @@ -import { getToolDisplayName, getToolsDescription, extractToolCalls } from './index.js'; +import { getToolDisplayName, extractToolCalls } from "./index.js"; -describe('tools/index utilities', () => { - describe('getToolDisplayName', () => { - it('should return display name for known tool', () => { +describe("tools/index utilities", () => { + describe("getToolDisplayName", () => { + it("should return display name for known tool", () => { // The actual implementation returns the first part of the displayName - const result = getToolDisplayName('read_file'); - expect(result).toBe('Read'); + const result = getToolDisplayName("read_file"); + expect(result).toBe("Read"); }); - it('should return original name for unknown tool', () => { - const result = getToolDisplayName('unknown_tool'); - expect(result).toBe('unknown_tool'); + it("should return original name for unknown tool", () => { + const result = getToolDisplayName("unknown_tool"); + expect(result).toBe("unknown_tool"); }); - it('should handle empty string', () => { - const result = getToolDisplayName(''); - expect(result).toBe(''); + it("should handle empty string", () => { + const result = getToolDisplayName(""); + expect(result).toBe(""); }); }); - describe('getToolsDescription', () => { - it('should return formatted JSON description of tools', () => { - const result = getToolsDescription(); - expect(result).toContain('"name": "read_file"'); - expect(result).toContain('"description": "Read the contents of a file at the specified path"'); - expect(result).toContain('"type": "string"'); - expect(result).toContain('"required": true'); - expect(result).toContain('"required": ['); - }); - - it('should include parameters for tools', () => { - const result = getToolsDescription(); - expect(result).toContain('"filepath"'); - expect(result).toContain('"content"'); - expect(result).toContain('"dirpath"'); - }); - - it('should format as valid JSON structure', () => { - const result = getToolsDescription(); - // Check that it contains JSON-like structure - expect(result).toMatch(/\{\s*"name":/); - expect(result).toMatch(/"parameters":\s*\{/); - expect(result).toMatch(/"properties":\s*\{/); - }); - }); - - describe('extractToolCalls', () => { - it('should extract single tool call', () => { + describe("extractToolCalls", () => { + it("should extract single tool call", () => { const response = `Here's the result: {"name": "read_file", "arguments": {"filepath": "/path/to/file.txt"}} Done.`; - + const result = extractToolCalls(response); expect(result).toEqual([ { - name: 'read_file', - arguments: { filepath: '/path/to/file.txt' } - } + name: "read_file", + arguments: { filepath: "/path/to/file.txt" }, + }, ]); }); - it('should extract multiple tool calls', () => { + it("should extract multiple tool calls", () => { const response = `First call: {"name": "read_file", "arguments": {"filepath": "/file1.txt"}} Second call: {"name": "write_file", "arguments": {"filepath": "/file2.txt", "content": "hello"}} Done.`; - + const result = extractToolCalls(response); expect(result).toEqual([ { - name: 'read_file', - arguments: { filepath: '/file1.txt' } + name: "read_file", + arguments: { filepath: "/file1.txt" }, }, { - name: 'write_file', - arguments: { filepath: '/file2.txt', content: 'hello' } - } + name: "write_file", + arguments: { filepath: "/file2.txt", content: "hello" }, + }, ]); }); - it('should handle tool calls with complex arguments', () => { + it("should handle tool calls with complex arguments", () => { const response = `{"name": "search_code", "arguments": {"pattern": "function.*test", "path": "/src", "options": {"recursive": true, "ignoreCase": false}}}`; - + const result = extractToolCalls(response); expect(result).toEqual([ { - name: 'search_code', - arguments: { - pattern: 'function.*test', - path: '/src', - options: { recursive: true, ignoreCase: false } - } - } + name: "search_code", + arguments: { + pattern: "function.*test", + path: "/src", + options: { recursive: true, ignoreCase: false }, + }, + }, ]); }); - it('should handle multiline tool calls', () => { + it("should handle multiline tool calls", () => { const response = `{ "name": "write_file", "arguments": { @@ -104,110 +78,110 @@ Done.`; "content": "Line 1\\nLine 2\\nLine 3" } }`; - + const result = extractToolCalls(response); expect(result).toEqual([ { - name: 'write_file', - arguments: { - filepath: '/path/to/file.txt', - content: 'Line 1\nLine 2\nLine 3' - } - } + name: "write_file", + arguments: { + filepath: "/path/to/file.txt", + content: "Line 1\nLine 2\nLine 3", + }, + }, ]); }); - it('should return empty array when no tool calls found', () => { + it("should return empty array when no tool calls found", () => { const response = `This is just regular text with no tool calls.`; - + const result = extractToolCalls(response); expect(result).toEqual([]); }); - it('should handle empty response', () => { - const response = ''; - + it("should handle empty response", () => { + const response = ""; + const result = extractToolCalls(response); expect(result).toEqual([]); }); - it('should ignore malformed tool calls', () => { + it("should ignore malformed tool calls", () => { // Capture console.error to avoid polluting test output const originalConsoleError = console.error; console.error = () => {}; - + const response = `Good call: {"name": "read_file", "arguments": {"filepath": "/file.txt"}} Bad call: {"name": "invalid_json", "arguments": {malformed json}} Another good call: {"name": "write_file", "arguments": {"filepath": "/file2.txt", "content": "test"}}`; - + const result = extractToolCalls(response); expect(result).toEqual([ { - name: 'read_file', - arguments: { filepath: '/file.txt' } + name: "read_file", + arguments: { filepath: "/file.txt" }, }, { - name: 'write_file', - arguments: { filepath: '/file2.txt', content: 'test' } - } + name: "write_file", + arguments: { filepath: "/file2.txt", content: "test" }, + }, ]); - + // Restore console.error console.error = originalConsoleError; }); - it('should ignore tool calls missing required fields', () => { + it("should ignore tool calls missing required fields", () => { const response = `Missing name: {"arguments": {"filepath": "/file.txt"}} Missing arguments: {"name": "read_file"} Valid call: {"name": "read_file", "arguments": {"filepath": "/file.txt"}}`; - + const result = extractToolCalls(response); expect(result).toEqual([ { - name: 'read_file', - arguments: { filepath: '/file.txt' } - } + name: "read_file", + arguments: { filepath: "/file.txt" }, + }, ]); }); - it('should handle tool calls with empty arguments', () => { + it("should handle tool calls with empty arguments", () => { const response = `{"name": "list_files", "arguments": {}}`; - + const result = extractToolCalls(response); expect(result).toEqual([ { - name: 'list_files', - arguments: {} - } + name: "list_files", + arguments: {}, + }, ]); }); - it('should handle tool calls with null arguments', () => { + it("should handle tool calls with null arguments", () => { const response = `{"name": "exit", "arguments": null}`; - + const result = extractToolCalls(response); expect(result).toEqual([]); }); - it('should handle nested tool tags', () => { + it("should handle nested tool tags", () => { const response = `{"name": "write_file", "arguments": {"filepath": "/file.txt", "content": "Some content with tags inside"}}`; - + const result = extractToolCalls(response); expect(result).toEqual([ { - name: 'write_file', - arguments: { - filepath: '/file.txt', - content: 'Some content with tags inside' - } - } + name: "write_file", + arguments: { + filepath: "/file.txt", + content: "Some content with tags inside", + }, + }, ]); }); }); -}); \ No newline at end of file +}); diff --git a/src/tools/index.ts b/src/tools/index.ts index 2c847ca63..60216a82a 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -4,6 +4,7 @@ import telemetryService from "../telemetry/telemetryService.js"; import logger from "../util/logger.js"; import { exitTool } from "./exit.js"; import { fetchTool } from "./fetch.js"; +import { formatToolArgument } from "./formatters.js"; import { listFilesTool } from "./listFiles.js"; import { readFileTool } from "./readFile.js"; import { runTerminalCommandTool } from "./runTerminalCommand.js"; @@ -50,32 +51,6 @@ export function getToolDisplayName(toolName: string): string { return tool?.displayName || toolName; } -export function getToolsDescription(): string { - return BUILTIN_TOOLS.map((tool) => { - const params = Object.entries(tool.parameters) - .map( - ([name, param]) => - ` "${name}": { "type": "${param.type}", "description": "${param.description}", "required": ${param.required} }` - ) - .join(",\n"); - - return `{ - "name": "${tool.name}", - "description": "${tool.description}", - "parameters": { - "type": "object", - "properties": { -${params} - }, - "required": [${Object.entries(tool.parameters) - .filter(([_, param]) => param.required) - .map(([name]) => `"${name}"`) - .join(", ")}] -} -}`; - }).join(",\n"); -} - export function extractToolCalls( response: string ): Array<{ name: string; arguments: Record }> { @@ -153,20 +128,6 @@ export async function getAvailableTools() { return allTools; } -export function validateToolCallArgsPresent(toolCall: ToolCall, tool: Tool) { - for (const [paramName, paramDef] of Object.entries(tool.parameters)) { - if ( - paramDef.required && - (toolCall.arguments[paramName] === undefined || - toolCall.arguments[paramName] === null) - ) { - throw new Error( - `Required parameter "${paramName}" missing for tool "${toolCall.name}"` - ); - } - } -} - export async function executeToolCall( toolCall: PreprocessedToolCall ): Promise { @@ -218,3 +179,37 @@ export async function executeToolCall( return `Error executing tool "${toolCall.name}": ${errorMessage}`; } } + +export function validateToolCallArgsPresent(toolCall: ToolCall, tool: Tool) { + for (const [paramName, paramDef] of Object.entries(tool.parameters)) { + if ( + paramDef.required && + (toolCall.arguments[paramName] === undefined || + toolCall.arguments[paramName] === null) + ) { + throw new Error( + `Required parameter "${paramName}" missing for tool "${toolCall.name}"` + ); + } + } +} + +/** + * Formats a tool call with its arguments for display + * @param toolName The name of the tool + * @param args The tool arguments + * @returns A formatted string like "ToolName(arg)" or just "ToolName" if no args + */ +export function formatToolCall(toolName: string, args?: any): string { + const displayName = getToolDisplayName(toolName); + + if (!args || Object.keys(args).length === 0) { + return displayName; + } + + // Get the first argument value + const firstValue = Object.values(args)[0]; + const formattedValue = formatToolArgument(firstValue); + + return `${displayName}(${formattedValue})`; +} diff --git a/src/tools/listFiles.ts b/src/tools/listFiles.ts index 6d4076f80..c6c952293 100644 --- a/src/tools/listFiles.ts +++ b/src/tools/listFiles.ts @@ -22,8 +22,8 @@ export const listFilesTool: Tool = { preview: [ { type: "text", - content: args.directory - ? `Will list files in: ${formatToolArgument(args.directory)}` + content: args.dirPath + ? `Will list files in: ${formatToolArgument(args.dirPath)}` : "Will list files in current directory", }, ], diff --git a/src/tools/preprocess.vitest.ts b/src/tools/preprocess.vitest.ts new file mode 100644 index 000000000..ba2d73c1a --- /dev/null +++ b/src/tools/preprocess.vitest.ts @@ -0,0 +1,472 @@ +import { vi, describe, it, expect, beforeEach } from "vitest"; + +// Mock fs module +vi.mock("fs", async () => { + // Use actual fs implementation for non-mocked functions + const actualFs = await vi.importActual("fs"); + return { + ...(actualFs as any), + existsSync: vi.fn(), + readFileSync: vi.fn(), + }; +}); + +// Mock telemetry service +vi.mock("./src/telemetry/telemetryService.js"); // Mock diff module +vi.mock("diff", () => ({ + createTwoFilesPatch: vi.fn(), +})); + +// Define mocks after vi.mock calls +const mockExistsSync = vi.mocked(await import("fs")).existsSync; +const mockReadFileSync = vi.mocked(await import("fs")).readFileSync; +const { createTwoFilesPatch: mockCreateTwoFilesPatch } = vi.mocked( + await import("diff") +); + +import { fetchTool } from "./fetch.js"; +import { listFilesTool } from "./listFiles.js"; +import { readFileTool } from "./readFile.js"; +import { runTerminalCommandTool } from "./runTerminalCommand.js"; +import { searchAndReplaceInFileTool } from "./searchAndReplace/index.js"; +import { searchCodeTool } from "./searchCode.js"; +import { viewDiffTool } from "./viewDiff.js"; +import { writeFileTool } from "./writeFile.js"; + +describe("Tool preprocess functions", () => { + beforeEach(() => { + vi.clearAllMocks(); + // Reset fs mock defaults + mockExistsSync.mockReturnValue(true); + mockReadFileSync.mockReturnValue("existing file content"); + // Reset diff mock + vi.mocked(mockCreateTwoFilesPatch).mockImplementation( + () => "mock diff content" + ); + }); + + describe("fetchTool.preprocess", () => { + it("should return preview with URL to fetch", async () => { + const args = { url: "https://example.com" }; + const result = await fetchTool.preprocess!(args); + + expect(result).toEqual({ + preview: [ + { + type: "text", + content: "Will fetch: https://example.com", + }, + ], + args, + }); + }); + + it("should handle URL with timeout parameter", async () => { + const args = { url: "https://example.com", timeout: 5000 }; + const result = await fetchTool.preprocess!(args); + + expect(result).toEqual({ + preview: [ + { + type: "text", + content: "Will fetch: https://example.com", + }, + ], + args, + }); + }); + }); + + describe("listFilesTool.preprocess", () => { + it("should return preview with directory path when directory arg present", async () => { + const args = { dirPath: "some/path" }; + const result = await listFilesTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: "Will list files in: some/path", + }, + ], + }); + }); + + it("should show current directory when no directory arg", async () => { + const args = {}; + const result = await listFilesTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: "Will list files in current directory", + }, + ], + }); + }); + }); + + describe("readFileTool.preprocess", () => { + it("should return formatted tool call preview", async () => { + const args = { filepath: "path/to/file.txt" }; + const result = await readFileTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: "Will read path/to/file.txt", + }, + ], + }); + }); + }); + + describe("runTerminalCommandTool.preprocess", () => { + it("should return preview with full command when short", async () => { + const args = { command: "ls -la" }; + const result = await runTerminalCommandTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: "Will run: ls -la", + }, + ], + }); + }); + + it("should truncate long commands", async () => { + const longCommand = "a".repeat(100); + const args = { command: longCommand }; + const result = await runTerminalCommandTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: `Will run: ${"a".repeat(60)}...`, + }, + ], + }); + }); + }); + + describe("searchCodeTool.preprocess", () => { + it("should return preview with full pattern when short", async () => { + const args = { pattern: "searchTerm" }; + const result = await searchCodeTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: 'Will search for: "searchTerm"', + }, + ], + }); + }); + + it("should truncate long patterns", async () => { + const longPattern = "a".repeat(100); + const args = { pattern: longPattern }; + const result = await searchCodeTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: `Will search for: "${"a".repeat(50)}..."`, + }, + ], + }); + }); + }); + + describe("viewDiffTool.preprocess", () => { + it("should return preview indicating git diff will be shown", async () => { + const args = { path: "/repo/path" }; + const result = await viewDiffTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: "Will show git diff", + }, + ], + }); + }); + + it("should handle empty args", async () => { + const args = {}; + const result = await viewDiffTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: "Will show git diff", + }, + ], + }); + }); + }); + + describe("writeFileTool.preprocess", () => { + it("should show diff preview when file exists", async () => { + // Setup mocks for this test + mockExistsSync.mockReturnValue(true); + mockReadFileSync.mockReturnValue("old content"); + + const args = { filepath: "path/to/file.txt", content: "new content" }; + const result = await writeFileTool.preprocess!(args); + + expect(mockExistsSync).toHaveBeenCalled(); + expect(mockReadFileSync).toHaveBeenCalled(); + expect(mockCreateTwoFilesPatch).toHaveBeenCalled(); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: "Preview of changes:", + }, + { + type: "diff", + content: "mock diff content", + }, + ], + }); + }); + + it("should show new file content preview when file doesn't exist", async () => { + mockExistsSync.mockReturnValue(false); + + const args = { + filepath: "path/to/file.txt", + content: "line 1\nline 2\nline 3\nline 4", + }; + const result = await writeFileTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: "New file content:", + }, + { + type: "text", + content: "line 1", + paddingLeft: 2, + }, + { + type: "text", + content: "line 2", + paddingLeft: 2, + }, + { + type: "text", + content: "line 3", + paddingLeft: 2, + }, + { + type: "text", + content: "... (1 more lines)", + }, + ], + }); + }); + + it("should handle empty lines in new file preview", async () => { + mockExistsSync.mockReturnValue(false); + + const args = { + filepath: "path/to/file.txt", + content: "line 1\n\nline 3", + }; + const result = await writeFileTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: "New file content:", + }, + { + type: "text", + content: "line 1", + paddingLeft: 2, + }, + { + type: "text", + content: " ", + paddingLeft: 2, + }, + { + type: "text", + content: "line 3", + paddingLeft: 2, + }, + ], + }); + }); + + it("should handle fs errors gracefully", async () => { + mockExistsSync.mockImplementation(() => { + throw new Error("Permission denied"); + }); + + const args = { filepath: "path/to/file.txt", content: "new content" }; + const result = await writeFileTool.preprocess!(args); + + expect(result).toEqual({ + args, + preview: [ + { + type: "text", + content: "New file content:", + }, + { + type: "text", + content: "new content", + paddingLeft: 2, + }, + ], + }); + }); + }); + + describe("searchAndReplaceInFileTool.preprocess", () => { + it("should process simple search and replace", async () => { + // Setup mocks + mockExistsSync.mockReturnValue(true); + mockReadFileSync.mockReturnValue("old line 1\nold line 2\nold line 3"); + + const args = { + filepath: "path/to/file.txt", + diffs: [ + `------- SEARCH +old line 2 +======= +new line 2 ++++++++ REPLACE`, + ], + }; + + const result = await searchAndReplaceInFileTool.preprocess!(args); + + expect(mockExistsSync).toHaveBeenCalled(); + expect(mockReadFileSync).toHaveBeenCalled(); + expect(mockCreateTwoFilesPatch).toHaveBeenCalled(); + + expect(result.args).toEqual({ + filepath: expect.any(String), + newContent: "old line 1\nnew line 2\nold line 3", + oldContent: "old line 1\nold line 2\nold line 3", + }); + + expect(result.preview).toEqual([ + { + type: "text", + content: "Will make the following changes:", + }, + { + type: "diff", + content: "mock diff content", + }, + ]); + }); + + it("should throw error when file doesn't exist", async () => { + mockExistsSync.mockReturnValue(false); + + const args = { + filepath: "/nonexistent/file.txt", + diffs: ["some diff"], + }; + + await expect( + searchAndReplaceInFileTool.preprocess!(args) + ).rejects.toThrowError(/file .* does not exist/); + }); + + it("should throw error when no search/replace blocks found", async () => { + mockExistsSync.mockReturnValue(true); + mockReadFileSync.mockReturnValue("file content"); + + const args = { + filepath: "path/to/file.txt", + diffs: ["invalid diff format"], + }; + + await expect( + searchAndReplaceInFileTool.preprocess!(args) + ).rejects.toThrowError( + "No complete search/replace blocks found in any diffs" + ); + }); + + it("should throw error when search content not found", async () => { + mockExistsSync.mockReturnValue(true); + mockReadFileSync.mockReturnValue("old line 1\nold line 2\nold line 3"); + + const args = { + filepath: "path/to/file.txt", + diffs: [ + `------- SEARCH +nonexistent content +======= +replacement ++++++++ REPLACE`, + ], + }; + + await expect( + searchAndReplaceInFileTool.preprocess!(args) + ).rejects.toThrowError(/Search content not found in block 1:/); + }); + + it("should process multiple search/replace blocks", async () => { + mockExistsSync.mockReturnValue(true); + mockReadFileSync.mockReturnValue("line 1\nline 2\nline 3\nline 4"); + + const args = { + filepath: "path/to/file.txt", + diffs: [ + `------- SEARCH +line 1 +======= +modified line 1 ++++++++ REPLACE + +------- SEARCH +line 3 +======= +modified line 3 ++++++++ REPLACE`, + ], + }; + + const result = await searchAndReplaceInFileTool.preprocess!(args); + + expect(result.args.newContent).toBe( + "modified line 1\nline 2\nmodified line 3\nline 4" + ); + }); + }); +}); diff --git a/src/tools/readFile.ts b/src/tools/readFile.ts index 8f6a289fe..c00049ee2 100644 --- a/src/tools/readFile.ts +++ b/src/tools/readFile.ts @@ -1,6 +1,6 @@ import * as fs from "fs"; import { Tool } from "./types.js"; -import { formatToolCall } from "./formatters.js"; +import { formatToolArgument } from "./formatters.js"; export const readFileTool: Tool = { name: "read_file", @@ -17,7 +17,12 @@ export const readFileTool: Tool = { preprocess: async (args) => { return { args, - preview: [{ type: "text", content: formatToolCall("read_file", args) }], + preview: [ + { + type: "text", + content: `Will read ${formatToolArgument(args.filepath)}`, + }, + ], }; }, run: async (args: { filepath: string }): Promise => { diff --git a/src/ui/ToolResultSummary.tsx b/src/ui/ToolResultSummary.tsx index ffb4687ee..5c3449029 100644 --- a/src/ui/ToolResultSummary.tsx +++ b/src/ui/ToolResultSummary.tsx @@ -1,8 +1,8 @@ import { Box, Text } from "ink"; import path from "path"; import React from "react"; -import { getToolDisplayName } from "../tools.js"; import { ColoredDiff } from "./ColoredDiff.js"; +import { getToolDisplayName } from "../tools/index.js"; interface ToolResultSummaryProps { toolName?: string; diff --git a/src/ui/components/ToolPermissionSelector.tsx b/src/ui/components/ToolPermissionSelector.tsx index 40b49253e..7cc8c1a44 100644 --- a/src/ui/components/ToolPermissionSelector.tsx +++ b/src/ui/components/ToolPermissionSelector.tsx @@ -1,6 +1,6 @@ import { Box, Text, useInput } from "ink"; import React, { useState } from "react"; -import { formatToolCall } from "../../tools/formatters.js"; +import { formatToolCall } from "../../tools/index.js"; import { ToolPreview } from "./ToolPreview.js"; import { ToolCallPreview } from "../../tools/types.js"; diff --git a/src/ui/components/ToolPreview.tsx b/src/ui/components/ToolPreview.tsx index 18d1a3cb6..4f04e3fec 100644 --- a/src/ui/components/ToolPreview.tsx +++ b/src/ui/components/ToolPreview.tsx @@ -1,8 +1,8 @@ import { Box, Text } from "ink"; import React from "react"; -import { getToolDisplayName } from "../../tools.js"; import { ColoredDiff } from "../ColoredDiff.js"; import { ToolCallPreview } from "../../tools/types.js"; +import { getToolDisplayName } from "../../tools/index.js"; interface ToolPreviewProps { toolCallPreview?: ToolCallPreview[]; diff --git a/src/ui/hooks/useChat.ts b/src/ui/hooks/useChat.ts index 130e26f89..35382771a 100644 --- a/src/ui/hooks/useChat.ts +++ b/src/ui/hooks/useChat.ts @@ -11,7 +11,6 @@ import { streamChatResponse, } from "../../streamChatResponse.js"; import telemetryService from "../../telemetry/telemetryService.js"; -import { formatToolCall } from "../../tools/formatters.js"; import { formatError } from "../../util/formatError.js"; import logger from "../../util/logger.js"; @@ -19,6 +18,7 @@ import { initializeChatHistory } from "../../commands/chat.js"; import { posthogService } from "../../telemetry/posthogService.js"; import { DisplayMessage } from "../types.js"; import { ToolCallPreview } from "../../tools/types.js"; +import { formatToolCall } from "../../tools/index.js"; interface UseChatProps { assistant?: AssistantUnrolled; diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 000000000..fdbb1b2c7 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + include: ['**/*.vitest.ts'], + exclude: ['**/node_modules/**', '**/dist/**'], + globals: true, + environment: 'node', + }, +}); \ No newline at end of file