diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index d1b3e36512..b487591c47 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -24,6 +24,7 @@
"@json2csv/plainjs": "^7.0.6",
"@leeoniya/ufuzzy": "^1.0.8",
"@melt-ui/svelte": "^0.86.2",
+ "@pierre/diffs": "1.6.4",
"@popperjs/core": "^2.11.8",
"@redocly/json-to-json-schema": "^0.0.1",
"@scalar/openapi-parser": "^0.15.0",
@@ -1687,6 +1688,87 @@
"integrity": "sha512-8awtpHXCx/bNpFt4mt2xdkgtgVvKqty8VbjHI/WWWQuEw+KLzFot3f4+LkQY9YmOtq7A5GdOnqoIC8Pdygjk2g==",
"license": "MIT"
},
+ "node_modules/@pierre/diffs": {
+ "version": "1.6.4",
+ "resolved": "https://registry.npmjs.org/@pierre/diffs/-/diffs-1.6.4.tgz",
+ "integrity": "sha512-RsKoruCOp50qaDM3a7BQan5K77xMkGWT1NF01fiYP1PfT3v4CvIjwytNk5WjZG0BesBkMOP2UbrBIDigB1k0ug==",
+ "license": "apache-2.0",
+ "dependencies": {
+ "@pierre/highlights": "0.4.0",
+ "@pierre/theme": "2.0.0",
+ "@pierre/theming": "1.0.2",
+ "diff": "9.0.0",
+ "hast-util-to-html": "9.0.5",
+ "lru_map": "0.4.1",
+ "shiki": "^3.0.0 || ^4.0.0"
+ },
+ "peerDependencies": {
+ "react": "^18.3.1 || ^19.0.0",
+ "react-dom": "^18.3.1 || ^19.0.0"
+ },
+ "peerDependenciesMeta": {
+ "react": {
+ "optional": true
+ },
+ "react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@pierre/diffs/node_modules/diff": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-9.0.0.tgz",
+ "integrity": "sha512-svtcdpS8CgJyqAjEQIXdb3OjhFVVYjzGAPO8WGCmRbrml64SPw/jJD4GoE98aR7r25A0XcgrK3F02yw9R/vhQw==",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.3.1"
+ }
+ },
+ "node_modules/@pierre/highlights": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/@pierre/highlights/-/highlights-0.4.0.tgz",
+ "integrity": "sha512-2a38H7ep3KweGi1fGQpJk+Krod2OMpDIXagKPlqBd1Y9P460T7zQmc66Wm2JAH1SpIG93wCyyhZVrkc5dnAJVQ==",
+ "license": "apache-2.0"
+ },
+ "node_modules/@pierre/theme": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@pierre/theme/-/theme-2.0.0.tgz",
+ "integrity": "sha512-yNDd9GYLQl1mEUJR8AneJ5e4ohLIHQd/wZLWr4fagt78vS2RwwZNW530vVgHqXFAyFVcFlRmGUD5ramXH46OXw==",
+ "license": "apache-2.0",
+ "engines": {
+ "vscode": "^1.0.0"
+ }
+ },
+ "node_modules/@pierre/theming": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@pierre/theming/-/theming-1.0.2.tgz",
+ "integrity": "sha512-RmXLLqtx31UGcR8kZyO5hGAQ1EXz6loT1Cu0BFAGsbnBboIxp2BlomkLfWyvdT4WZXnBGyu25onL1gKpFQuSUw==",
+ "license": "apache-2.0",
+ "peerDependencies": {
+ "@pierre/theme": "^1.1.0 || ^2.0.0",
+ "@shikijs/themes": "^3.0.0 || ^4.0.0",
+ "react": "^18.3.1 || ^19.0.0",
+ "react-dom": "^18.3.1 || ^19.0.0",
+ "shiki": "^3.0.0 || ^4.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@pierre/theme": {
+ "optional": true
+ },
+ "@shikijs/themes": {
+ "optional": true
+ },
+ "react": {
+ "optional": true
+ },
+ "react-dom": {
+ "optional": true
+ },
+ "shiki": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@pkgjs/parseargs": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
@@ -1744,7 +1826,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1761,7 +1842,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1778,7 +1858,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1795,7 +1874,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1812,7 +1890,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1829,7 +1906,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1846,7 +1922,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1863,7 +1938,6 @@
"cpu": [
"ppc64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1880,7 +1954,6 @@
"cpu": [
"s390x"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1897,7 +1970,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1914,7 +1986,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1931,7 +2002,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1948,7 +2018,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1965,7 +2034,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1999,6 +2067,129 @@
"node": ">=20"
}
},
+ "node_modules/@shikijs/core": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.6.0.tgz",
+ "integrity": "sha512-bfd4OKgvoyXYiYmMRuleA656P4V7M/Du9lcTl38Ngm6KszMj7bq4J1IGZwSYR4c95Tv5UQALtYNWUwaI9UT3xw==",
+ "license": "MIT",
+ "dependencies": {
+ "@shikijs/primitive": "4.6.0",
+ "@shikijs/types": "4.6.0",
+ "@shikijs/vscode-textmate": "^10.1.0",
+ "@types/hast": "^3.0.5",
+ "hast-util-to-html": "^9.0.6"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@shikijs/core/node_modules/hast-util-to-html": {
+ "version": "9.0.6",
+ "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.6.tgz",
+ "integrity": "sha512-1SZUxCN3TtJAE7e2BQN2MBHsoZ1gnmi9GoCP5Di59CSWptIezSAW09yDZyVbanb78V9eCwrKqdQsjtfVTxYHWA==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/hast": "^3.0.0",
+ "@types/unist": "^3.0.0",
+ "ccount": "^2.0.0",
+ "comma-separated-tokens": "^2.0.0",
+ "hast-util-whitespace": "^3.0.0",
+ "html-void-elements": "^3.0.0",
+ "mdast-util-to-hast": "^13.0.0",
+ "property-information": "^7.0.0",
+ "space-separated-tokens": "^2.0.0",
+ "stringify-entities": "^4.0.0",
+ "zwitch": "^2.0.4"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/@shikijs/engine-javascript": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.6.0.tgz",
+ "integrity": "sha512-K0oqxFoL+kEMdz89mHLFO15Tsbv3kFZ6WR1cXZKMvLSc+oqaM00A6pyga1qSeXB22dP0tTiSApRcGBaKWsEccg==",
+ "license": "MIT",
+ "dependencies": {
+ "@shikijs/types": "4.6.0",
+ "@shikijs/vscode-textmate": "^10.1.0",
+ "oniguruma-to-es": "^4.3.6"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@shikijs/engine-oniguruma": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.6.0.tgz",
+ "integrity": "sha512-aggd6Q7SuJOXNnsUbfG2XesxBJKBMAw/PDTUo9PyRjMaaJJ2dNrI+q0C+25ARXAK9yLHAlwxc9oRT2u68YKZ7w==",
+ "license": "MIT",
+ "dependencies": {
+ "@shikijs/types": "4.6.0",
+ "@shikijs/vscode-textmate": "^10.1.0"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@shikijs/langs": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.6.0.tgz",
+ "integrity": "sha512-1yMEX3oCVV54LUq/ovfpRkDQoYDkcvjSWFFa/YLUDMiSoRzMi2uxLJYbv41ahT8Lu9lFMaa7hecd3Q39trqUyg==",
+ "license": "MIT",
+ "dependencies": {
+ "@shikijs/types": "4.6.0"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@shikijs/primitive": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.6.0.tgz",
+ "integrity": "sha512-c54+TQEo9ToqgfL/AU8FpjnV09+GA9Oa7M5ROkkXteZfp5XzpAJGXjjvZQFQioJOwm/w/6Z3lIzQstAkl8coag==",
+ "license": "MIT",
+ "dependencies": {
+ "@shikijs/types": "4.6.0",
+ "@shikijs/vscode-textmate": "^10.1.0",
+ "@types/hast": "^3.0.5"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@shikijs/themes": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.6.0.tgz",
+ "integrity": "sha512-qHAVAs80RiGD+IRuH9G+JPDOEc9A/kHsng4EzCUCwB9bLzW6Z0y9WETh2YyCcADJBmfrIaJ1Jp7KBNP6FHkgtQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@shikijs/types": "4.6.0"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@shikijs/types": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.6.0.tgz",
+ "integrity": "sha512-+ENG1adsKt/X7cRYw1Nl7BEpBmPOjmQ7bR/eGmHuMlT8gtOFf3KEi5l31DJYyAWhW6Y6bjP1plU7FmaxWGENFw==",
+ "license": "MIT",
+ "dependencies": {
+ "@shikijs/vscode-textmate": "^10.1.0",
+ "@types/hast": "^3.0.5"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@shikijs/vscode-textmate": {
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.1.0.tgz",
+ "integrity": "sha512-cVBuhDQjBZaNMTwBquYfPydrUP+E3hE6oYGasx8h6ZrODIM7/r+gxLDXdd66oszbrggZHEntdE6j+5gYIVyMWQ==",
+ "license": "MIT"
+ },
"node_modules/@smithy/types": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/@smithy/types/-/types-4.7.0.tgz",
@@ -2549,9 +2740,9 @@
"license": "MIT"
},
"node_modules/@types/hast": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
- "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.5.tgz",
+ "integrity": "sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==",
"license": "MIT",
"dependencies": {
"@types/unist": "*"
@@ -3977,6 +4168,26 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/character-entities-html4": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz",
+ "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==",
+ "license": "MIT",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/character-entities-legacy": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz",
+ "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==",
+ "license": "MIT",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/chart.js": {
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.5.1.tgz",
@@ -6953,6 +7164,29 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/hast-util-to-html": {
+ "version": "9.0.5",
+ "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz",
+ "integrity": "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/hast": "^3.0.0",
+ "@types/unist": "^3.0.0",
+ "ccount": "^2.0.0",
+ "comma-separated-tokens": "^2.0.0",
+ "hast-util-whitespace": "^3.0.0",
+ "html-void-elements": "^3.0.0",
+ "mdast-util-to-hast": "^13.0.0",
+ "property-information": "^7.0.0",
+ "space-separated-tokens": "^2.0.0",
+ "stringify-entities": "^4.0.0",
+ "zwitch": "^2.0.4"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
"node_modules/hast-util-to-parse5": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-8.0.0.tgz",
@@ -6982,6 +7216,19 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/hast-util-whitespace": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz",
+ "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/hast": "^3.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
"node_modules/hastscript": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/hastscript/-/hastscript-9.0.1.tgz",
@@ -7420,7 +7667,7 @@
"version": "1.21.7",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz",
"integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"bin": {
"jiti": "bin/jiti.js"
@@ -8126,7 +8373,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -8147,7 +8393,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -8168,7 +8413,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -8189,7 +8433,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -8210,7 +8453,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -8231,7 +8473,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -8252,7 +8493,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -8273,7 +8513,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -8294,7 +8533,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -8315,7 +8553,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -8336,7 +8573,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -8469,6 +8705,12 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/lru_map": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.4.1.tgz",
+ "integrity": "sha512-I+lBvqMMFfqaV8CJCISjI3wbjmwVu/VyOoU7+qtu9d7ioW5klMgsTTiUOUp+DJvfTTzKXoPbyC6YfgkNcyPSOg==",
+ "license": "MIT"
+ },
"node_modules/lru-cache": {
"version": "11.5.2",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz",
@@ -10061,6 +10303,23 @@
"wrappy": "1"
}
},
+ "node_modules/oniguruma-parser": {
+ "version": "0.12.2",
+ "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz",
+ "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==",
+ "license": "MIT"
+ },
+ "node_modules/oniguruma-to-es": {
+ "version": "4.3.6",
+ "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz",
+ "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==",
+ "license": "MIT",
+ "dependencies": {
+ "oniguruma-parser": "^0.12.2",
+ "regex": "^6.1.0",
+ "regex-recursion": "^6.0.2"
+ }
+ },
"node_modules/openai": {
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/openai/-/openai-6.9.1.tgz",
@@ -11724,6 +11983,30 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/regex": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/regex/-/regex-6.1.0.tgz",
+ "integrity": "sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==",
+ "license": "MIT",
+ "dependencies": {
+ "regex-utilities": "^2.3.0"
+ }
+ },
+ "node_modules/regex-recursion": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-6.0.2.tgz",
+ "integrity": "sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==",
+ "license": "MIT",
+ "dependencies": {
+ "regex-utilities": "^2.3.0"
+ }
+ },
+ "node_modules/regex-utilities": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz",
+ "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==",
+ "license": "MIT"
+ },
"node_modules/rehype-github-alerts": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/rehype-github-alerts/-/rehype-github-alerts-3.0.0.tgz",
@@ -12149,6 +12432,25 @@
"node": ">=8"
}
},
+ "node_modules/shiki": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.6.0.tgz",
+ "integrity": "sha512-imjLsVHgPuWhvpU3P+zOekvMYqnel7QmKsFC4Sn0fCuAvaaalBsxwKEsrU8Ko5BdFnZA6Go/8a0RzahS634UgA==",
+ "license": "MIT",
+ "dependencies": {
+ "@shikijs/core": "4.6.0",
+ "@shikijs/engine-javascript": "4.6.0",
+ "@shikijs/engine-oniguruma": "4.6.0",
+ "@shikijs/langs": "4.6.0",
+ "@shikijs/themes": "4.6.0",
+ "@shikijs/types": "4.6.0",
+ "@shikijs/vscode-textmate": "^10.1.0",
+ "@types/hast": "^3.0.5"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
"node_modules/side-channel": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
@@ -12500,6 +12802,20 @@
"node": ">=8"
}
},
+ "node_modules/stringify-entities": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz",
+ "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==",
+ "license": "MIT",
+ "dependencies": {
+ "character-entities-html4": "^2.0.0",
+ "character-entities-legacy": "^3.0.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
@@ -13007,21 +13323,6 @@
}
}
},
- "node_modules/svelte-check/node_modules/picomatch": {
- "version": "4.0.7",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
- "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
- "dev": true,
- "license": "MIT",
- "optional": true,
- "peer": true,
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/sponsors/jonschlinkert"
- }
- },
"node_modules/svelte-eslint-parser": {
"version": "0.43.0",
"resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-0.43.0.tgz",
@@ -13227,21 +13528,6 @@
"svelte": "^4.2.19 || ^5.1.0"
}
},
- "node_modules/svelte/node_modules/@typescript-eslint/types": {
- "version": "8.70.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.70.0.tgz",
- "integrity": "sha512-asTOIYhDg4zdzOScCyaytrsV3cR6B4ecPQlXw/dJIm7J/MZTtCtfVII9JD8Geh4jTCrK/Xe6cg5UevoleMcoJQ==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- }
- },
"node_modules/svelte/node_modules/esrap": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/esrap/-/esrap-2.3.7.tgz",
@@ -13827,7 +14113,7 @@
"version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
- "dev": true,
+ "devOptional": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
diff --git a/frontend/package.json b/frontend/package.json
index 3a91129bda..a5a68fc8b2 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -91,6 +91,7 @@
"@json2csv/plainjs": "^7.0.6",
"@leeoniya/ufuzzy": "^1.0.8",
"@melt-ui/svelte": "^0.86.2",
+ "@pierre/diffs": "1.6.4",
"@popperjs/core": "^2.11.8",
"@redocly/json-to-json-schema": "^0.0.1",
"@scalar/openapi-parser": "^0.15.0",
diff --git a/frontend/src/lib/components/pierre/PierreCodeView.svelte b/frontend/src/lib/components/pierre/PierreCodeView.svelte
new file mode 100644
index 0000000000..9bc3c55c13
--- /dev/null
+++ b/frontend/src/lib/components/pierre/PierreCodeView.svelte
@@ -0,0 +1,54 @@
+
+
+
diff --git a/frontend/src/lib/components/pierre/PierreDiff.svelte b/frontend/src/lib/components/pierre/PierreDiff.svelte
new file mode 100644
index 0000000000..a9eaf090ad
--- /dev/null
+++ b/frontend/src/lib/components/pierre/PierreDiff.svelte
@@ -0,0 +1,154 @@
+
+
+
diff --git a/frontend/src/lib/components/pierre/PierreFileEditor.svelte b/frontend/src/lib/components/pierre/PierreFileEditor.svelte
new file mode 100644
index 0000000000..510dd1f0ab
--- /dev/null
+++ b/frontend/src/lib/components/pierre/PierreFileEditor.svelte
@@ -0,0 +1,124 @@
+
+
+
diff --git a/frontend/src/lib/components/pierre/PierreMergeConflict.svelte b/frontend/src/lib/components/pierre/PierreMergeConflict.svelte
new file mode 100644
index 0000000000..ac93694c9c
--- /dev/null
+++ b/frontend/src/lib/components/pierre/PierreMergeConflict.svelte
@@ -0,0 +1,53 @@
+
+
+
diff --git a/frontend/src/lib/components/pierre/SnippetHost.svelte b/frontend/src/lib/components/pierre/SnippetHost.svelte
new file mode 100644
index 0000000000..3584eafdad
--- /dev/null
+++ b/frontend/src/lib/components/pierre/SnippetHost.svelte
@@ -0,0 +1,7 @@
+
+
+{@render snippet(arg)}
diff --git a/frontend/src/lib/components/pierre/pierre.ts b/frontend/src/lib/components/pierre/pierre.ts
new file mode 100644
index 0000000000..733f7d5361
--- /dev/null
+++ b/frontend/src/lib/components/pierre/pierre.ts
@@ -0,0 +1,56 @@
+import {
+ disposeHighlighter,
+ type HighlighterTypes,
+ type SupportedLanguages,
+ type ThemesType
+} from '@pierre/diffs'
+import { WorkerPoolManager } from '@pierre/diffs/worker'
+import PierreWorkerUrl from '@pierre/diffs/worker/worker.js?worker&url'
+
+export const PIERRE_THEME: ThemesType = { dark: 'pierre-dark', light: 'pierre-light' }
+
+// Keyed by the editor language `scriptLangToEditorLang` returns. Every other id is passed
+// through, since Monaco and Shiki share most names.
+// for related places search: ADD_NEW_LANG
+const SHIKI_LANG_BY_MONACO: Record = {
+ shell: 'shellscript',
+ nu: 'nushell',
+ plaintext: 'text'
+}
+
+export function pierreLang(monacoLang: string | undefined): SupportedLanguages | undefined {
+ if (!monacoLang) return undefined
+ return (SHIKI_LANG_BY_MONACO[monacoLang] ?? monacoLang) as SupportedLanguages
+}
+
+let mainThreadHighlighter: HighlighterTypes | undefined
+
+/**
+ * Components without a pool share one main-thread highlighter, created with the first backend
+ * any of them asked for; later `preferredHighlighter` values are ignored until it is disposed.
+ * Call before mounting a component that needs another backend, after unmounting the old ones.
+ */
+export async function switchMainThreadHighlighter(type: HighlighterTypes): Promise {
+ if (mainThreadHighlighter !== undefined && mainThreadHighlighter !== type) {
+ await disposeHighlighter()
+ }
+ mainThreadHighlighter = type
+}
+
+const pools = new Map()
+
+/** One pool per highlighter backend: a pool's backend is fixed when its workers start. */
+export function pierreWorkerPool(preferredHighlighter: HighlighterTypes): WorkerPoolManager {
+ let pool = pools.get(preferredHighlighter)
+ if (!pool) {
+ pool = new WorkerPoolManager(
+ {
+ workerFactory: () => new Worker(PierreWorkerUrl, { type: 'module' }),
+ poolSize: Math.min(4, navigator.hardwareConcurrency || 2)
+ },
+ { theme: PIERRE_THEME, preferredHighlighter }
+ )
+ pools.set(preferredHighlighter, pool)
+ }
+ return pool
+}
diff --git a/frontend/src/lib/components/pierre/snippetElements.ts b/frontend/src/lib/components/pierre/snippetElements.ts
new file mode 100644
index 0000000000..eecfec9422
--- /dev/null
+++ b/frontend/src/lib/components/pierre/snippetElements.ts
@@ -0,0 +1,27 @@
+import { mount, unmount, type Snippet } from 'svelte'
+import SnippetHost from './SnippetHost.svelte'
+
+/**
+ * Pierre's render callbacks return detached DOM nodes. This mounts a Svelte snippet into one
+ * and keeps every mount so the owner can unmount them all when it is destroyed.
+ */
+export function snippetElements() {
+ const mounted: Record[] = []
+ let destroyed = false
+ return {
+ render(snippet: Snippet<[T]>, arg: T, tag: 'div' | 'span' = 'div'): HTMLElement {
+ const target = document.createElement(tag)
+ // Pierre re-renders synchronously when an edit session ends, which can be inside an
+ // effect teardown, where Svelte refuses to create the mounted component's effects.
+ queueMicrotask(() => {
+ if (destroyed) return
+ mounted.push(mount(SnippetHost, { target, props: { snippet, arg } }))
+ })
+ return target
+ },
+ destroy() {
+ destroyed = true
+ for (const m of mounted.splice(0)) unmount(m)
+ }
+ }
+}
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/+page.svelte b/frontend/src/routes/(styled)/test_dev/diff-comparison/+page.svelte
index c473dbcb64..9104881d51 100644
--- a/frontend/src/routes/(styled)/test_dev/diff-comparison/+page.svelte
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/+page.svelte
@@ -1,94 +1,12 @@
@@ -96,44 +14,30 @@
-
- {#each cases as item}
- (activeCaseId = item.id)}>{item.label}
- {/each}
-
-
-
-
- Monaco
-
- {#key activeCase.id}
-
- {/key}
+
Diff comparison
+
+ Monaco, our highlight.js diff view and @pierre/diffs on the same inputs.
+
+
+
+
+
+
+
+ {#snippet content()}
+
+ {#if tab === 'diff'}
+
+ {:else if tab === 'review'}
+
+ {:else if tab === 'multi'}
+
+ {:else if tab === 'editor'}
+
+ {:else if tab === 'merge'}
+
+ {/if}
-
-
-
- Native
-
- {#key activeCase.id}
-
- {/key}
-
-
-
+ {/snippet}
+
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/Benchmark.svelte b/frontend/src/routes/(styled)/test_dev/diff-comparison/Benchmark.svelte
new file mode 100644
index 0000000000..69426b1816
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/Benchmark.svelte
@@ -0,0 +1,192 @@
+
+
+
+
+
Benchmark
+
+ Mounts each renderer alone on the current case. Run 1 includes loading code, grammars and
+ workers; run 2 is warm. Long tasks are main-thread blocks over 50 ms (Chromium only). "–"
+ under Highlighted means no colors within 10 s: the native view skips highlighting past 2,000
+ lines.
+
+
+
+ runAll(2)}>
+ Run benchmark
+
+ {#if running && current}
+ Rendering {current.label}…
+ {/if}
+
+
+ {#if results.length > 0}
+
+
+
+ Run
+ Renderer
+ First line
+ Highlighted
+ Long tasks
+ DOM nodes
+
+
+
+ {#each results as r (`${r.run}:${r.label}`)}
+
+ {r.run === 1 ? 'cold' : 'warm'}
+ {r.label}
+ {formatMs(r.painted)}
+ {formatMs(r.highlighted)}
+ {formatMs(r.longTasks)}
+ {r.nodes.toLocaleString()}
+
+ {/each}
+
+
+ {/if}
+
+
+ {#if current?.id === 'monaco'}
+
+ {:else if current?.id === 'native'}
+
+ {:else if current?.pierre?.virtualized}
+
+ {:else if current?.pierre}
+
+ {/if}
+
+
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/DiffTab.svelte b/frontend/src/routes/(styled)/test_dev/diff-comparison/DiffTab.svelte
new file mode 100644
index 0000000000..106f45a1b2
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/DiffTab.svelte
@@ -0,0 +1,115 @@
+
+
+
+
+ {#each cases as item (item.id)}
+ (activeCaseId = item.id)}>{item.label}
+ {/each}
+
+
{
+ workspaceCase = c
+ activeCaseId = c.id
+ }}
+ />
+
+
+
+ Monaco
+
+ {#key `${activeCase.id}:${settings.diffStyle}`}
+
+ {/key}
+
+
+
+
+ Native (highlight.js)
+
+ {#key activeCase.id}
+
+ {/key}
+
+
+
+
+
+
+
Pierre
+
+
+
+
+
+ {#key `${settings.useWorkers}:${settings.highlighter}:${virtualized}`}
+ {#await settings.useWorkers ? undefined : switchMainThreadHighlighter(settings.highlighter) then}
+ {@render pierre()}
+ {/await}
+ {/key}
+
+
+
+
+
+
+{#snippet pierre()}
+ {#if virtualized}
+
+ {:else}
+
+ {/if}
+{/snippet}
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/EditorTab.svelte b/frontend/src/routes/(styled)/test_dev/diff-comparison/EditorTab.svelte
new file mode 100644
index 0000000000..89841dc914
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/EditorTab.svelte
@@ -0,0 +1,171 @@
+
+
+
+
+ Pierre editor
+
+
+ Edit prediction
+
+
+
+ {model
+ ? `Model: ${model.provider}/${model.model}`
+ : 'No code completion model in this workspace: set one in workspace AI settings'}
+
+ {#if editor}
+ editor?.undo()}
+ />
+ editor?.redo()}
+ />
+ {/if}
+
+
+ Tab accepts a prediction, Esc dismisses it. Select text for the selection action. Markers come
+ from a demo linter and re-anchor as you type. Last prediction: {lastPrediction ?? '–'}
+
+
+ {#key predictionMode}
+
(editor = e)}
+ >
+ {#snippet selectionAction(ctx)}
+
+ {
+ ctx.replaceSelectionText(
+ ctx
+ .getSelectionText()
+ .split('\n')
+ .map((l) => `// ${l}`)
+ .join('\n')
+ )
+ ctx.close()
+ }}>Comment out
+ {
+ navigator.clipboard.writeText(ctx.getSelectionText())
+ ctx.close()
+ }}>Copy
+
+ {/snippet}
+
+ {/key}
+
+
+ {pierreCode.split('\n').length} lines, {markers.length} markers
+
+
+
+
+ Monaco (SimpleEditor)
+
+ Monaco brings the TypeScript language service (completions, hovers, real diagnostics) that
+ Pierre's editor does not have.
+
+
+
+
+
+
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/MergeTab.svelte b/frontend/src/routes/(styled)/test_dev/diff-comparison/MergeTab.svelte
new file mode 100644
index 0000000000..61bcb99a51
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/MergeTab.svelte
@@ -0,0 +1,44 @@
+
+
+
+
+
+
Pierre: merge conflicts (beta)
+ {
+ resolved = undefined
+ resetKey++
+ }}>Reset
+
+
+ Each conflict offers current, incoming or both. Windmill has no conflict UI today: a fork
+ merge or a git sync pull with diverged items would be the place for it.
+
+
+ {#key resetKey}
+
(resolved = c)}
+ />
+ {/key}
+
+
+
+ Resolved output
+ {resolved ?? 'Resolve a conflict to see the result'}
+
+
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/MultiFileTab.svelte b/frontend/src/routes/(styled)/test_dev/diff-comparison/MultiFileTab.svelte
new file mode 100644
index 0000000000..65de06b76e
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/MultiFileTab.svelte
@@ -0,0 +1,134 @@
+
+
+
+
+ A review of many changed files in one scroll, as a deployment or fork-merge review would show
+ them. Pierre's CodeView virtualizes the whole list; Monaco needs one editor per file.
+
+
+
+ Files
+ ({ value: n, label: `${n}` }))}
+ bind:value={count}
+ />
+
+ show('pierre')}>Render Pierre
+ show('monaco')}>
+ Render Monaco{count > MONACO_MAX ? ` (first ${MONACO_MAX})` : ''}
+
+ {#each ['pierre', 'monaco'] as const as side (side)}
+ {@const s = stats[side]}
+ {#if s}
+
+ {side}: first line {formatMs(s.painted)}, long tasks {formatMs(s.longTasks)},
+ {s.nodes.toLocaleString()} nodes
+
+ {/if}
+ {/each}
+
+
+
+
+ {#if shown === 'pierre'}
+ {#key `${settings.useWorkers}:${settings.highlighter}`}
+
+ {/key}
+ {:else if shown === 'monaco'}
+ {#each files.slice(0, MONACO_MAX) as f (f.name)}
+
{f.name}
+
+
+
+ {/each}
+ {/if}
+
+
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/PierreSettingsBar.svelte b/frontend/src/routes/(styled)/test_dev/diff-comparison/PierreSettingsBar.svelte
new file mode 100644
index 0000000000..4de28a22cb
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/PierreSettingsBar.svelte
@@ -0,0 +1,71 @@
+
+
+
+
+ Layout
+
+
+
+ Indicators
+
+
+
+ Inline diff
+
+
+
+ Hunk separators
+
+
+
+ Highlighter
+
+
+
+ Theme
+
+
+
+
+
+
+
+
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/ReviewTab.svelte b/frontend/src/routes/(styled)/test_dev/diff-comparison/ReviewTab.svelte
new file mode 100644
index 0000000000..da8be1ac50
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/ReviewTab.svelte
@@ -0,0 +1,262 @@
+
+
+{#snippet headerMetadata(_diff: FileDiffMetadata)}
+ 0 ? 'yellow' : 'green'}>
+ {remaining > 0 ? `${remaining} to review` : 'reviewed'}
+
+{/snippet}
+
+{#snippet note(a: DiffLineAnnotation)}
+ {#if a.metadata.kind === 'change'}
+ {@const m = a.metadata}
+
+
+ Change {m.change + 1} of hunk {m.hunk + 1}: +{m.additions} −{m.deletions}
+
+ resolve(m.hunk, m.change, 'accept')}>Accept
+ resolve(m.hunk, m.change, 'reject')}>Reject
+
+ {:else}
+ {@const id = a.metadata.id}
+
+
+ (comments = comments.filter((c) => c !== a))}
+ />
+
+ {/if}
+{/snippet}
+
+
+
+ Pierre: review an AI change
+
+ Accept or reject each change block, add a comment from the gutter (+), select lines, hover a
+ token, or edit the new side directly. Demo lint markers follow the edited text.
+
+
+ resolveAll('accept')}>Accept all ({remaining})
+ resolveAll('reject')}>Reject all
+ Reset
+
+ {#if editor}
+ editor?.undo()}
+ />
+ editor?.redo()}
+ />
+ {/if}
+
+
+
+ Selection: {selected ? `${selected.side ?? ''} ${selected.start}–${selected.end}` : 'none'}
+
+ Hovered token: {hoveredToken ?? '–'}
+ Markers: {markers.length}
+
+
+
(editor = e)}
+ onEditChange={(text) => (liveAfter = text)}
+ onEdited={(_text, fileDiff) => {
+ reviewDiff = fileDiff
+ liveAfter = undefined
+ log = ['edit session accepted', ...log]
+ }}
+ />
+
+
+
+
+ Monaco: editable diff
+
+ Monaco's equivalent: the new side is editable and the gutter arrow reverts a change. No
+ per-change accept, no inline comments.
+
+
+
+
+ Resulting file (Pierre side)
+ {liveAfter ?? resultText}
+ Events
+
+ {#each log as entry, i (log.length - i)}{entry} {/each}
+
+
+
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/WorkspaceScriptPicker.svelte b/frontend/src/routes/(styled)/test_dev/diff-comparison/WorkspaceScriptPicker.svelte
new file mode 100644
index 0000000000..54ea9c7dfb
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/WorkspaceScriptPicker.svelte
@@ -0,0 +1,84 @@
+
+
+
+ Workspace script
+ {#if !$workspaceStore}
+ Log in and pick a workspace to diff real script versions
+ {:else if error}
+ {error}
+ {:else}
+ ({ value: p, label: p }))}
+ bind:value={path}
+ />
+ {#if history.length > 0}
+
+ →
+
+ {/if}
+ {/if}
+
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/cases.ts b/frontend/src/routes/(styled)/test_dev/diff-comparison/cases.ts
new file mode 100644
index 0000000000..bf6860976f
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/cases.ts
@@ -0,0 +1,270 @@
+import { parseDiffFromFile, type FileDiffMetadata } from '@pierre/diffs'
+import type { ToolCodeDiff } from '$lib/components/copilot/chat/shared'
+import { pierreLang } from '$lib/components/pierre/pierre'
+
+export type ComparisonCase = {
+ id: string
+ label: string
+ filename: string
+ diff: ToolCodeDiff
+}
+
+export function caseFileDiff(c: ComparisonCase): FileDiffMetadata {
+ return parseDiffFromFile(
+ {
+ name: c.filename,
+ contents: c.diff.before,
+ lang: pierreLang(c.diff.beforeLang ?? c.diff.lang)
+ },
+ { name: c.filename, contents: c.diff.after, lang: pierreLang(c.diff.lang) }
+ )
+}
+
+const stableLines = Array.from(
+ { length: 14 },
+ (_, index) => ` const stableValue${index + 1} = getStableValue(${index + 1})`
+)
+
+/** A TypeScript module of `functions` functions, with every `editEvery`th one changed in `after`. */
+function largeModule(functions: number, editEvery: number): { before: string; after: string } {
+ const before: string[] = []
+ const after: string[] = []
+ for (let i = 0; i < functions; i++) {
+ const body = [
+ `export async function handler${i}(input: { id: string; count: number }) {`,
+ ` const result = await fetchRecord(input.id)`,
+ ` if (!result.ok) {`,
+ ` throw new Error(\`record \${input.id} not found\`)`,
+ ` }`,
+ ` return { ...result.value, total: input.count * ${i} }`,
+ `}`,
+ ``
+ ]
+ before.push(...body)
+ if (i % editEvery === 0) {
+ after.push(
+ `export async function handler${i}(input: { id: string; count: number; dryRun?: boolean }) {`,
+ ` const result = await fetchRecord(input.id, { cache: true })`,
+ ` if (!result.ok || input.dryRun) {`,
+ ` return { skipped: true }`,
+ ` }`,
+ ` return { ...result.value, total: input.count * ${i + 1} }`,
+ `}`,
+ ``
+ )
+ } else {
+ after.push(...body)
+ }
+ }
+ return { before: before.join('\n'), after: after.join('\n') }
+}
+
+const large = largeModule(1250, 25)
+
+const longLine = (n: number) =>
+ `const payload = ${JSON.stringify(
+ Object.fromEntries(Array.from({ length: n }, (_, i) => [`field_${i}`, `value number ${i}`]))
+ )}`
+
+export const cases: ComparisonCase[] = [
+ {
+ id: 'typescript-replacement',
+ label: 'TypeScript replacement',
+ filename: 'greeting.ts',
+ diff: {
+ lang: 'typescript',
+ before: `export function greeting(name: string) {
+ return \`Hello, \${name}\`
+}`,
+ after: `export function greeting(name: string) {
+ const message = \`Hello, \${name}!\`
+ return message
+}`
+ }
+ },
+ {
+ id: 'long-unchanged-sections',
+ label: 'Long unchanged sections',
+ filename: 'summary.ts',
+ diff: {
+ lang: 'typescript',
+ before: [
+ 'export function buildSummary() {',
+ ...stableLines,
+ '\treturn formatSummary("draft")',
+ '}'
+ ].join('\n'),
+ after: [
+ 'export function buildSummary() {',
+ ...stableLines,
+ '\treturn formatSummary("published")',
+ '}'
+ ].join('\n')
+ }
+ },
+ {
+ id: 'json-structure',
+ label: 'JSON structure',
+ filename: 'schedule.json',
+ diff: {
+ lang: 'json',
+ before: `{
+ "name": "daily-report",
+ "schedule": "0 9 * * 1-5",
+ "enabled": false
+}`,
+ after: `{
+ "name": "daily-report",
+ "schedule": "0 9 * * 1-5",
+ "timezone": "Europe/Paris",
+ "enabled": true
+}`
+ }
+ },
+ {
+ id: 'python-add-remove',
+ label: 'Python additions and removals',
+ filename: 'notify.py',
+ diff: {
+ lang: 'python',
+ before: `def notify(users):
+ for user in users:
+ send_email(user, "Weekly update")
+
+ return len(users)`,
+ after: `def notify(users):
+ active_users = [user for user in users if user.active]
+ for user in active_users:
+ send_email(user, "Your weekly update")
+
+ return len(active_users)`
+ }
+ },
+ {
+ id: 'flow-yaml',
+ label: 'Flow YAML',
+ filename: 'flow.yaml',
+ diff: {
+ lang: 'yaml',
+ before: `summary: Sync customers
+value:
+ modules:
+ - id: a
+ value:
+ type: script
+ path: f/sync/fetch_customers
+ input_transforms:
+ since:
+ type: javascript
+ expr: flow_input.since
+ - id: b
+ value:
+ type: rawscript
+ language: python3
+ content: |
+ def main(rows):
+ return [r for r in rows if r["active"]]
+schema:
+ properties:
+ since:
+ type: string
+`,
+ after: `summary: Sync active customers
+value:
+ modules:
+ - id: a
+ value:
+ type: script
+ path: f/sync/fetch_customers
+ input_transforms:
+ since:
+ type: javascript
+ expr: flow_input.since ?? "2024-01-01"
+ retry:
+ constant:
+ attempts: 3
+ seconds: 10
+ - id: b
+ value:
+ type: rawscript
+ language: python3
+ content: |
+ def main(rows):
+ return [r for r in rows if r["active"] and not r.get("deleted")]
+schema:
+ properties:
+ since:
+ type: string
+ format: date
+`
+ }
+ },
+ {
+ id: 'long-lines',
+ label: 'Long lines',
+ filename: 'payload.ts',
+ diff: {
+ lang: 'typescript',
+ before: [longLine(40), 'export default payload'].join('\n'),
+ after: [longLine(41), 'export default payload'].join('\n')
+ }
+ },
+ {
+ id: 'new-file',
+ label: 'New file',
+ filename: 'new.py',
+ diff: {
+ lang: 'python',
+ before: '',
+ after: `import wmill
+
+
+def main(name: str = "world"):
+ wmill.set_state({"last": name})
+ return f"Hello {name}"
+`
+ }
+ },
+ {
+ id: 'deleted-file',
+ label: 'Deleted file',
+ filename: 'old.sql',
+ diff: {
+ lang: 'sql',
+ before: `-- $1 email
+SELECT id, email, created_at
+FROM users
+WHERE email = $1
+ORDER BY created_at DESC;
+`,
+ after: ''
+ }
+ },
+ {
+ id: 'large',
+ label: `Large (${large.before.split('\n').length.toLocaleString()} lines)`,
+ filename: 'handlers.ts',
+ diff: { lang: 'typescript', ...large }
+ }
+]
+
+export const MERGE_CONFLICT_SAMPLE = `import * as wmill from 'windmill-client'
+
+export async function main(customerId: string) {
+<<<<<<< HEAD
+ const customer = await wmill.getResource('u/admin/crm')
+ return fetchCustomer(customer, customerId, { retries: 3 })
+=======
+ const crm = await wmill.getResource('f/sales/crm')
+ return fetchCustomer(crm, customerId)
+>>>>>>> fork/sales-crm
+}
+
+function fetchCustomer(resource: unknown, id: string, opts = { retries: 1 }) {
+<<<<<<< HEAD
+ return { resource, id, opts }
+=======
+ return { resource, id, opts, source: 'fork' }
+>>>>>>> fork/sales-crm
+}
+`
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/lint.ts b/frontend/src/routes/(styled)/test_dev/diff-comparison/lint.ts
new file mode 100644
index 0000000000..bfc7b85368
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/lint.ts
@@ -0,0 +1,30 @@
+import type { Marker } from '@pierre/diffs/edit'
+
+type Rule = { pattern: RegExp; severity: Marker['severity']; message: string }
+
+const RULES: Rule[] = [
+ { pattern: /(? {
+ for (const rule of RULES) {
+ for (const m of text.matchAll(rule.pattern)) {
+ const start = m.index ?? 0
+ markers.push({
+ severity: rule.severity,
+ message: rule.message,
+ source: 'demo-lint',
+ start: { line, character: start },
+ end: { line, character: start + m[0].length }
+ })
+ }
+ }
+ })
+ return markers
+}
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/measure.ts b/frontend/src/routes/(styled)/test_dev/diff-comparison/measure.ts
new file mode 100644
index 0000000000..1df0083b38
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/measure.ts
@@ -0,0 +1,68 @@
+/** `querySelector` that also descends into open shadow roots, where Pierre renders its lines. */
+function findDeep(root: ParentNode, selector: string): Element | null {
+ const direct = root.querySelector(selector)
+ if (direct) return direct
+ for (const el of Array.from(root.querySelectorAll('*'))) {
+ if (el.shadowRoot) {
+ const found = findDeep(el.shadowRoot, selector)
+ if (found) return found
+ }
+ }
+ return null
+}
+
+/** Resolves with `performance.now()` at the first frame where `selector` matches under `root`. */
+export function waitForSelector(
+ root: () => HTMLElement | undefined,
+ selector: string,
+ timeoutMs = 30_000
+): Promise {
+ const start = performance.now()
+ return new Promise((resolve) => {
+ const check = () => {
+ const r = root()
+ if (r && findDeep(r, selector)) return resolve(performance.now())
+ if (performance.now() - start > timeoutMs) return resolve(undefined)
+ requestAnimationFrame(check)
+ }
+ check()
+ })
+}
+
+/**
+ * Sums main-thread long tasks (>50ms) until `stop()`. Chromium only; elsewhere the total
+ * stays undefined.
+ */
+export function observeLongTasks(): { stop: () => number | undefined } {
+ if (!PerformanceObserver.supportedEntryTypes?.includes('longtask')) {
+ return { stop: () => undefined }
+ }
+ let total = 0
+ const observer = new PerformanceObserver((list) => {
+ for (const entry of list.getEntries()) total += entry.duration
+ })
+ observer.observe({ type: 'longtask' })
+ return {
+ stop: () => {
+ for (const entry of observer.takeRecords()) total += entry.duration
+ observer.disconnect()
+ return total
+ }
+ }
+}
+
+/** Counts DOM nodes under `root`, shadow roots included. */
+export function countNodes(root: ParentNode): number {
+ let n = 0
+ for (const el of Array.from(root.querySelectorAll('*'))) {
+ n++
+ if (el.shadowRoot) n += countNodes(el.shadowRoot)
+ }
+ return n
+}
+
+export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))
+
+export function formatMs(ms: number | undefined): string {
+ return ms === undefined ? '–' : `${Math.round(ms)} ms`
+}
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/pierreSettings.ts b/frontend/src/routes/(styled)/test_dev/diff-comparison/pierreSettings.ts
new file mode 100644
index 0000000000..5eea0a4ba3
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/pierreSettings.ts
@@ -0,0 +1,65 @@
+import type { BaseDiffOptions, HighlighterTypes, LineDiffTypes, ThemesType } from '@pierre/diffs'
+import type { WorkerPoolManager } from '@pierre/diffs/worker'
+import { pierreWorkerPool } from '$lib/components/pierre/pierre'
+
+export type PierreSettings = {
+ diffStyle: 'split' | 'unified'
+ diffIndicators: 'bars' | 'classic' | 'none'
+ lineDiffType: LineDiffTypes
+ hunkSeparators: 'line-info' | 'line-info-basic' | 'metadata' | 'simple'
+ wrap: boolean
+ disableBackground: boolean
+ disableLineNumbers: boolean
+ expandUnchanged: boolean
+ highlighter: HighlighterTypes
+ useWorkers: boolean
+ theme: string
+}
+
+export const DEFAULT_SETTINGS: PierreSettings = {
+ diffStyle: 'unified',
+ diffIndicators: 'bars',
+ lineDiffType: 'word-alt',
+ hunkSeparators: 'line-info',
+ wrap: false,
+ disableBackground: false,
+ disableLineNumbers: false,
+ expandUnchanged: false,
+ highlighter: 'shiki-js',
+ useWorkers: false,
+ theme: 'pierre'
+}
+
+export const THEMES: Record = {
+ pierre: { light: 'pierre-light', dark: 'pierre-dark' },
+ github: { light: 'github-light', dark: 'github-dark' },
+ vitesse: { light: 'vitesse-light', dark: 'vitesse-dark' },
+ one: { light: 'one-light', dark: 'one-dark-pro' },
+ catppuccin: { light: 'catppuccin-latte', dark: 'catppuccin-mocha' }
+}
+
+/** The options `FileDiff` and `CodeView` share. */
+export function diffOptions(
+ s: PierreSettings
+): BaseDiffOptions & { hunkSeparators: PierreSettings['hunkSeparators'] } {
+ return {
+ theme: THEMES[s.theme],
+ diffStyle: s.diffStyle,
+ diffIndicators: s.diffIndicators,
+ lineDiffType: s.lineDiffType,
+ hunkSeparators: s.hunkSeparators,
+ overflow: s.wrap ? 'wrap' : 'scroll',
+ disableBackground: s.disableBackground,
+ disableLineNumbers: s.disableLineNumbers,
+ expandUnchanged: s.expandUnchanged,
+ preferredHighlighter: s.highlighter
+ }
+}
+
+/** Theme and inline-diff granularity belong to the pool when one is used, not to the component. */
+export function settingsPool(s: PierreSettings): WorkerPoolManager | undefined {
+ if (!s.useWorkers) return undefined
+ const pool = pierreWorkerPool(s.highlighter)
+ void pool.setRenderOptions({ theme: THEMES[s.theme], lineDiffType: s.lineDiffType })
+ return pool
+}
diff --git a/frontend/src/routes/(styled)/test_dev/diff-comparison/reviewSample.ts b/frontend/src/routes/(styled)/test_dev/diff-comparison/reviewSample.ts
new file mode 100644
index 0000000000..b760ffd127
--- /dev/null
+++ b/frontend/src/routes/(styled)/test_dev/diff-comparison/reviewSample.ts
@@ -0,0 +1,94 @@
+// Four changes far enough apart to land in separate hunks, plus two blocks in one hunk.
+export const REVIEW_BEFORE = `import * as wmill from 'windmill-client'
+
+type Invoice = {
+ id: string
+ amount: number
+ currency: string
+ paid: boolean
+}
+
+export async function main(customerId: string) {
+ var invoices = await listInvoices(customerId)
+ const unpaid = invoices.filter((i) => i.paid == false)
+
+ let total = 0
+ for (const invoice of unpaid) {
+ total += invoice.amount
+ }
+
+ console.log('unpaid total', total)
+ return { customerId, total, count: unpaid.length }
+}
+
+async function listInvoices(customerId: string): Promise {
+ const stripe = await wmill.getResource('u/admin/stripe')
+ const response = await fetch(\`https://api.stripe.com/v1/invoices?customer=\${customerId}\`, {
+ headers: { Authorization: \`Bearer \${stripe.token}\` }
+ })
+ const body = await response.json()
+ return body.data.map(toInvoice)
+}
+
+function toInvoice(raw: any): Invoice {
+ return {
+ id: raw.id,
+ amount: raw.amount_due,
+ currency: raw.currency,
+ paid: raw.paid
+ }
+}
+
+export function formatAmount(invoice: Invoice) {
+ return invoice.amount / 100 + ' ' + invoice.currency
+}
+`
+
+export const REVIEW_AFTER = `import * as wmill from 'windmill-client'
+
+type Invoice = {
+ id: string
+ amount: number
+ currency: string
+ paid: boolean
+ dueDate: Date
+}
+
+export async function main(customerId: string, overdueOnly = false) {
+ const invoices = await listInvoices(customerId)
+ const now = new Date()
+ const unpaid = invoices.filter((i) => !i.paid && (!overdueOnly || i.dueDate < now))
+
+ const total = unpaid.reduce((sum, invoice) => sum + invoice.amount, 0)
+
+ return { customerId, total, count: unpaid.length }
+}
+
+async function listInvoices(customerId: string): Promise {
+ const stripe = await wmill.getResource('f/billing/stripe')
+ const response = await fetch(\`https://api.stripe.com/v1/invoices?customer=\${customerId}\`, {
+ headers: { Authorization: \`Bearer \${stripe.token}\` }
+ })
+ if (!response.ok) {
+ throw new Error(\`Stripe returned \${response.status}\`)
+ }
+ const body = await response.json()
+ return body.data.map(toInvoice)
+}
+
+function toInvoice(raw: any): Invoice {
+ return {
+ id: raw.id,
+ amount: raw.amount_due,
+ currency: raw.currency,
+ paid: raw.paid,
+ dueDate: new Date(raw.due_date * 1000)
+ }
+}
+
+export function formatAmount(invoice: Invoice) {
+ return new Intl.NumberFormat('en', { style: 'currency', currency: invoice.currency }).format(
+ invoice.amount / 100
+ )
+}
+`