Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: faster frontend type check with TypeScript 7 and bun check (#13986)
Etherl03fcdea0a996
diff --git a/.github/workflows/lint-ci.yml b/.github/workflows/lint-ci.ymlindex 25f60b71daa..09fbb51aa2e 100644--- a/.github/workflows/lint-ci.yml+++ b/.github/workflows/lint-ci.yml@@ -13,7 +13,7 @@# committed YAML / JSON config.## TypeScript and Rust are NOT duplicated here on purpose:-# - Unsloth Frontend CI runs `npm run typecheck` (= `tsc --noEmit`)+# - Unsloth Frontend CI runs `npm run typecheck` (tsc, and bun check)# and `npm run build` (vite/swc) on every studio/frontend/**# change, which is a full TS AST + type check.# - Unsloth Tauri CI runs `tauri build --debug --no-bundle` ondiff --git a/.github/workflows/studio-frontend-ci.yml b/.github/workflows/studio-frontend-ci.ymlindex e09a5897d7f..54dc2d2b307 100644--- a/.github/workflows/studio-frontend-ci.yml+++ b/.github/workflows/studio-frontend-ci.yml@@ -223,6 +223,24 @@ jobs:- name: Typecheckrun: npm run typecheck+ - name: Typecheck through bun check+ # `npm run typecheck` uses `bun check` when a Bun that has it is on PATH. Runners ship no+ # Bun, so the step above only proves the tsc path; UNSLOTH_TYPECHECK=bun forbids a silent+ # fallback to tsc here. Pinned binary, SHA-256 verified before it runs (value from the+ # release's SHASUMS256.txt). Bun 1.4.3 is the first release with `bun check`; it was+ # admitted before the usual 7-day release-age wait, by explicit maintainer decision.+ run: |+ set -euo pipefail+ BUN_VERSION="1.4.3"+ BUN_SHA256="3e730528d89775f03f87f05c06787c4df4099d0a37f3f252e7b829cb23816e18"+ curl --proto '=https' --tlsv1.2 -fsSL \+ --retry 5 --retry-delay 3 --retry-connrefused --retry-all-errors \+ -o "$RUNNER_TEMP/bun.zip" \+ "https://github.com/oven-sh/bun/releases/download/bun-v${BUN_VERSION}/bun-linux-x64.zip"+ echo "${BUN_SHA256} $RUNNER_TEMP/bun.zip" | sha256sum -c -+ unzip -q "$RUNNER_TEMP/bun.zip" -d "$RUNNER_TEMP/bun"+ PATH="$RUNNER_TEMP/bun/bun-linux-x64:$PATH" UNSLOTH_TYPECHECK=bun npm run typecheck+- name: Unit testsrun: npm testdiff --git a/studio/frontend/eslint.config.js b/studio/frontend/eslint.config.jsindex e76e0186970..5cdb1a30ca1 100644--- a/studio/frontend/eslint.config.js+++ b/studio/frontend/eslint.config.js@@ -1,6 +1,9 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0+// First, before typescript-eslint loads: it needs the TypeScript 6 API (see the script).+import "./scripts/eslint-typescript6.cjs";+import js from "@eslint/js";import reactHooks from "eslint-plugin-react-hooks";import reactRefresh from "eslint-plugin-react-refresh";diff --git a/studio/frontend/package-lock.json b/studio/frontend/package-lock.jsonindex 065f948e4d9..0ffc7794ada 100644--- a/studio/frontend/package-lock.json+++ b/studio/frontend/package-lock.json@@ -94,6 +94,7 @@"@types/node-forge": "^1.3.14","@types/react": "^19.2.5","@types/react-dom": "^19.2.3",+ "@typescript/typescript6": "6.0.2","@vitejs/plugin-react": "^6.0.1","eslint": "^9.39.1","eslint-plugin-react-hooks": "^7.0.1",@@ -102,7 +103,7 @@"postcss": "^8.5.28","postcss-selector-parser": "^7.1.6","rolldown": "1.0.3",- "typescript": "~5.9.3",+ "typescript": "7.0.2","typescript-eslint": "^8.55.0","vite": "^8.0.16"},@@ -7351,6 +7352,354 @@"url": "https://opencollective.com/eslint"}},+ "node_modules/@typescript/old": {+ "name": "typescript",+ "version": "6.0.3",+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",+ "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",+ "dev": true,+ "license": "Apache-2.0",+ "bin": {+ "tsc": "bin/tsc",+ "tsserver": "bin/tsserver"+ },+ "engines": {+ "node": ">=14.17"+ }+ },+ "node_modules/@typescript/typescript-aix-ppc64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz",+ "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==",+ "cpu": [+ "ppc64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "aix"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-darwin-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz",+ "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-darwin-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz",+ "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-freebsd-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz",+ "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-freebsd-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz",+ "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-arm": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz",+ "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==",+ "cpu": [+ "arm"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz",+ "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-loong64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz",+ "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==",+ "cpu": [+ "loong64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-mips64el": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz",+ "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==",+ "cpu": [+ "mips64el"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-ppc64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz",+ "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==",+ "cpu": [+ "ppc64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-riscv64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz",+ "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==",+ "cpu": [+ "riscv64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-s390x": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz",+ "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==",+ "cpu": [+ "s390x"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz",+ "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-netbsd-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz",+ "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-netbsd-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz",+ "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-openbsd-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz",+ "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-openbsd-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz",+ "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-sunos-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz",+ "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "sunos"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-win32-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz",+ "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-win32-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz",+ "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript6": {+ "version": "6.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript6/-/typescript6-6.0.2.tgz",+ "integrity": "sha512-mbCddXd+jm7hfx7w2YU64/Av4/NqqeG3GoRZgxPcgoTxYjhrcfJRw9ULch71SS4G+Q3bOXFhRvPqjguN0Hyp5w==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@typescript/old": "npm:typescript@^6"+ },+ "bin": {+ "tsc6": "bin/tsc6"+ }+ },"node_modules/@ungap/structured-clone": {"version": "1.3.0","resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz",@@ -15140,17 +15489,38 @@}},"node_modules/typescript": {- "version": "5.9.3",- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",- "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz",+ "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==","devOptional": true,"license": "Apache-2.0","bin": {- "tsc": "bin/tsc",- "tsserver": "bin/tsserver"+ "tsc": "bin/tsc"},"engines": {- "node": ">=14.17"+ "node": ">=16.20.0"+ },+ "optionalDependencies": {+ "@typescript/typescript-aix-ppc64": "7.0.2",+ "@typescript/typescript-darwin-arm64": "7.0.2",+ "@typescript/typescript-darwin-x64": "7.0.2",+ "@typescript/typescript-freebsd-arm64": "7.0.2",+ "@typescript/typescript-freebsd-x64": "7.0.2",+ "@typescript/typescript-linux-arm": "7.0.2",+ "@typescript/typescript-linux-arm64": "7.0.2",+ "@typescript/typescript-linux-loong64": "7.0.2",+ "@typescript/typescript-linux-mips64el": "7.0.2",+ "@typescript/typescript-linux-ppc64": "7.0.2",+ "@typescript/typescript-linux-riscv64": "7.0.2",+ "@typescript/typescript-linux-s390x": "7.0.2",+ "@typescript/typescript-linux-x64": "7.0.2",+ "@typescript/typescript-netbsd-arm64": "7.0.2",+ "@typescript/typescript-netbsd-x64": "7.0.2",+ "@typescript/typescript-openbsd-arm64": "7.0.2",+ "@typescript/typescript-openbsd-x64": "7.0.2",+ "@typescript/typescript-sunos-x64": "7.0.2",+ "@typescript/typescript-win32-arm64": "7.0.2",+ "@typescript/typescript-win32-x64": "7.0.2"}},"node_modules/typescript-eslint": {diff --git a/studio/frontend/package.json b/studio/frontend/package.jsonindex 8d513e8036d..2cbd41e1d10 100644--- a/studio/frontend/package.json+++ b/studio/frontend/package.json@@ -8,12 +8,12 @@},"scripts": {"dev": "vite",- "build": "tsc -b && vite build",+ "build": "node scripts/typecheck.mjs && vite build","lint": "eslint .","preview": "vite preview","test": "node --experimental-strip-types --test \"tests/**/*.test.ts\"","bundle:check": "node --experimental-strip-types scripts/check-bundle-budget.ts",- "typecheck": "tsc -b --pretty false && tsc -p tsconfig.test.json --pretty false",+ "typecheck": "node scripts/typecheck.mjs --tests","i18n:check": "node --experimental-strip-types --no-warnings src/i18n/check-parity.ts","catalog:refresh": "node scripts/refresh-model-catalog-snapshot.mjs","i18n:check:strict": "node --experimental-strip-types --no-warnings src/i18n/check-parity.ts --strict",@@ -115,7 +115,8 @@"browserslist@^4": "4.28.7","remend": "1.3.1","dompurify": "3.4.16",- "@babel/core": "7.29.7"+ "@babel/core": "7.29.7",+ "typescript": "$typescript"},"devDependencies": {"@biomejs/biome": "^1.9.4",@@ -127,6 +128,7 @@"@types/node-forge": "^1.3.14","@types/react": "^19.2.5","@types/react-dom": "^19.2.3",+ "@typescript/typescript6": "6.0.2","@vitejs/plugin-react": "^6.0.1","eslint": "^9.39.1","eslint-plugin-react-hooks": "^7.0.1",@@ -135,7 +137,7 @@"postcss": "^8.5.28","postcss-selector-parser": "^7.1.6","rolldown": "1.0.3",- "typescript": "~5.9.3",+ "typescript": "7.0.2","typescript-eslint": "^8.55.0","vite": "^8.0.16"},diff --git a/studio/frontend/scripts/eslint-typescript6.cjs b/studio/frontend/scripts/eslint-typescript6.cjsnew file mode 100644index 00000000000..3b113bec255--- /dev/null+++ b/studio/frontend/scripts/eslint-typescript6.cjs@@ -0,0 +1,33 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// Imported first by eslint.config.js, so the CLI and editors both get it. typescript-eslint needs+// the TypeScript JS API, which TypeScript 7 does not ship, so its require("typescript") goes to the+// TypeScript 6 copy that @typescript/typescript6 brings. Drop this once typescript-eslint supports+// TypeScript 7.++const Module = require("node:module");+const path = require("node:path");++const ts6Require = Module.createRequire(+ require.resolve("@typescript/typescript6", {+ paths: [path.join(__dirname, "..")],+ }),+);+const ts6Root = path.dirname(+ ts6Require.resolve("@typescript/old/package.json"),+);+const resolveFilename = Module._resolveFilename;++Module._resolveFilename = function (request, parent, isMain, options) {+ if (request === "typescript" || request.startsWith("typescript/")) {+ return resolveFilename.call(+ this,+ ts6Root + request.slice("typescript".length),+ parent,+ isMain,+ options,+ );+ }+ return resolveFilename.call(this, request, parent, isMain, options);+};diff --git a/studio/frontend/scripts/typecheck.mjs b/studio/frontend/scripts/typecheck.mjsnew file mode 100644index 00000000000..3128839cc1b--- /dev/null+++ b/studio/frontend/scripts/typecheck.mjs@@ -0,0 +1,175 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// Type-checks the frontend with `bun check` when a Bun that has it is on PATH, else with the+// pinned TypeScript compiler. Usage: node scripts/typecheck.mjs [--tests]+// UNSLOTH_TYPECHECK=auto (default) | tsc | bun. Bun is used only when the TypeScript version its+// `check` follows (process.versions.typescript) is the one the project pins, so both apply the+// same rules. In auto mode a red Bun result is also re-checked with tsc.++import { spawnSync } from "node:child_process";+import { readFileSync } from "node:fs";+import { join } from "node:path";+import { fileURLToPath } from "node:url";++const root = fileURLToPath(new URL("..", import.meta.url));+const withTests = process.argv.slice(2).includes("--tests");+const tscPath = join(root, "node_modules", "typescript", "bin", "tsc");+// biome-ignore lint/suspicious/noControlCharactersInRegex: matches ANSI escapes+const ansi = /\x1b\[[0-?]*[ -/]*[@-~]/g;++const tscSteps = [["-b", "--pretty", "false"]];+// The `check` subcommand with long flags. `bun --check` is Bun's global flag: it ignores+// --build/--project/--no-pretty, and there -b means --bun and -p means --print. `--pretty false`+// would be read as a script name.+const bunSteps = [["check", "--build", "--no-pretty"]];+if (withTests) {+ tscSteps.push(["-p", "tsconfig.test.json", "--pretty", "false"]);+ bunSteps.push(["check", "--project=tsconfig.test.json", "--no-pretty"]);+}++function fail(message, code = 1) {+ console.error(`typecheck: ${message}`);+ process.exit(code);+}++// `bun check` runs a package script named `check` instead of checking, if one exists.+// An unreadable package.json counts as having one.+function hasCheckScript() {+ try {+ const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));+ return Object.hasOwn(pkg?.scripts ?? {}, "check");+ } catch {+ return true;+ }+}++// Output of a short bun command, or null when bun is missing or the command fails.+function bunOutput(args) {+ const probe = spawnSync("bun", args, {+ cwd: root,+ encoding: "utf8",+ // biome-ignore lint/style/useNamingConvention: environment variable names+ env: { ...process.env, FORCE_COLOR: "0", NO_COLOR: "1" },+ shell: false,+ stdio: ["ignore", "pipe", "ignore"],+ timeout: 5000,+ windowsHide: true,+ });+ if (probe.error || probe.status !== 0 || typeof probe.stdout !== "string") {+ return null;+ }+ return probe.stdout.replace(ansi, "").replace(/\r/g, "");+}++// Returns the Bun version string ("" if unknown) when `bun check` exists, else null.+// Bun before 1.4.3 has no `check` command and would treat it as `bun run check`.+function probeBun() {+ const help = bunOutput(["--help"]);+ if (help === null || !/^ {2}check\s/m.test(help)) {+ return null;+ }+ return help.match(/\((\d+\.\d+\.\d+)[^)]*\)/)?.[1] ?? "";+}++// The TypeScript version `bun check` follows, "" if Bun does not say.+function bunTypeScript() {+ return bunOutput(["-p", "process.versions.typescript"])?.trim() ?? "";+}++function tsVersion() {+ try {+ const pkg = JSON.parse(+ readFileSync(+ join(root, "node_modules", "typescript", "package.json"),+ "utf8",+ ),+ );+ return typeof pkg.version === "string" ? pkg.version : "";+ } catch {+ return "";+ }+}++function run(command, steps) {+ for (const args of steps) {+ const result = spawnSync(command, args, {+ cwd: root,+ shell: false,+ stdio: "inherit",+ windowsHide: true,+ });+ if (result.error) {+ console.error(+ `typecheck: could not run ${command}: ${result.error.message}`,+ );+ return 1;+ }+ if (result.status !== 0) {+ return result.status ?? 1;+ }+ }+ return 0;+}++function runTsc() {+ const version = tsVersion();+ console.error(`typecheck: tsc${version ? ` (TypeScript ${version})` : ""}`);+ return run(+ process.execPath,+ tscSteps.map((args) => [tscPath, ...args]),+ );+}++function runBun(version) {+ console.error(`typecheck: bun check${version ? ` (Bun ${version})` : ""}`);+ return run("bun", bunSteps);+}++const mode = process.env.UNSLOTH_TYPECHECK || "auto";++if (mode === "tsc") {+ process.exit(runTsc());+}+if (mode === "bun") {+ if (hasCheckScript()) {+ fail(+ "UNSLOTH_TYPECHECK=bun, but package.json has a `check` script that `bun check` would run",+ );+ }+ const version = probeBun();+ if (version === null) {+ fail(+ "UNSLOTH_TYPECHECK=bun, but no Bun with a `check` command (Bun >= 1.4.3) is on PATH",+ );+ }+ const bunTs = bunTypeScript();+ if (bunTs !== tsVersion()) {+ fail(+ `UNSLOTH_TYPECHECK=bun, but Bun ${version} follows TypeScript ${bunTs || "unknown"} and the project pins ${tsVersion() || "unknown"}`,+ );+ }+ process.exit(runBun(version));+}+if (mode !== "auto") {+ fail(`unknown UNSLOTH_TYPECHECK=${mode} (expected auto, tsc or bun)`, 2);+}++let bunVersion = hasCheckScript() ? null : probeBun();+if (bunVersion !== null) {+ const bunTs = bunTypeScript();+ const projectTs = tsVersion();+ if (!bunTs || bunTs !== projectTs) {+ console.error(+ `typecheck: Bun ${bunVersion} follows TypeScript ${bunTs || "unknown"}, not the pinned ${projectTs || "unknown"}; using tsc`,+ );+ bunVersion = null;+ }+}+if (bunVersion !== null && runBun(bunVersion) === 0) {+ process.exit(0);+}+if (bunVersion !== null) {+ console.error("typecheck: bun check reported errors; confirming with tsc");+}+process.exit(runTsc());diff --git a/studio/frontend/src/features/training/lib/training-start-request-id.ts b/studio/frontend/src/features/training/lib/training-start-request-id.tsindex 2ce720051a2..6d31e9161a4 100644--- a/studio/frontend/src/features/training/lib/training-start-request-id.ts+++ b/studio/frontend/src/features/training/lib/training-start-request-id.ts@@ -2,7 +2,7 @@// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0interface RandomUuidCrypto {- getRandomValues?: <T extends ArrayBufferView>(array: T) => T;+ getRandomValues?: <T extends ArrayBufferView<ArrayBuffer>>(array: T) => T;randomUUID?: () => string;}diff --git a/studio/frontend/src/lib/latex.ts b/studio/frontend/src/lib/latex.tsindex 059eebc585a..7b637e05dcc 100644--- a/studio/frontend/src/lib/latex.ts+++ b/studio/frontend/src/lib/latex.ts@@ -997,7 +997,7 @@ function findLinkDestinationRegions(content: string): Array<[number, number]> {LINK_DEST_RE.lastIndex = 0;while ((match = LINK_DEST_RE.exec(content)) !== null) {// escaped separators make searches unsafe; use the `d` flag's bounds.- regions.push(match.indices![1]);+ regions.push(match.indices![1]!);}return regions;}diff --git a/studio/frontend/tests/action-menu-modal-layer.test.ts b/studio/frontend/tests/action-menu-modal-layer.test.tsindex 3f9ed628450..c3bef116f33 100644--- a/studio/frontend/tests/action-menu-modal-layer.test.ts+++ b/studio/frontend/tests/action-menu-modal-layer.test.ts@@ -25,7 +25,7 @@ import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";const THREAD = new URL("../src/components/assistant-ui/thread.tsx",diff --git a/studio/frontend/tests/artifact-frame-network-access.test.ts b/studio/frontend/tests/artifact-frame-network-access.test.tsindex 49b3daf1682..29b3648172b 100644--- a/studio/frontend/tests/artifact-frame-network-access.test.ts+++ b/studio/frontend/tests/artifact-frame-network-access.test.ts@@ -6,7 +6,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";import { openingTag } from "./helpers/tsx-ast.ts";diff --git a/studio/frontend/tests/audio-transcript-lifecycle.test.ts b/studio/frontend/tests/audio-transcript-lifecycle.test.tsindex ff76285f571..44234339612 100644--- a/studio/frontend/tests/audio-transcript-lifecycle.test.ts+++ b/studio/frontend/tests/audio-transcript-lifecycle.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc, readText } from "./helpers/kit.ts";import { readAudioWorkspaceSource } from "./helpers/audio-workspace.ts";import { AUTH_SESSION_ENDING_EVENT } from "../src/features/auth/session-events.ts";diff --git a/studio/frontend/tests/auto-compaction-settings.test.ts b/studio/frontend/tests/auto-compaction-settings.test.tsindex f1e0a7f6220..00103a698c9 100644--- a/studio/frontend/tests/auto-compaction-settings.test.ts+++ b/studio/frontend/tests/auto-compaction-settings.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import {apiCompactionRequestFields,ggufCompactionRequestFields,diff --git a/studio/frontend/tests/auto-load-mlx-precision.test.ts b/studio/frontend/tests/auto-load-mlx-precision.test.tsindex 9ab1d5b1a06..a0565f61daa 100644--- a/studio/frontend/tests/auto-load-mlx-precision.test.ts+++ b/studio/frontend/tests/auto-load-mlx-precision.test.ts@@ -6,7 +6,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";const adapterPath = fileURLToPath(new URL("../src/features/chat/api/chat-adapter.ts", import.meta.url),diff --git a/studio/frontend/tests/auto-load-target-key.test.ts b/studio/frontend/tests/auto-load-target-key.test.tsindex c7c8541d387..5f2b769c6f1 100644--- a/studio/frontend/tests/auto-load-target-key.test.ts+++ b/studio/frontend/tests/auto-load-target-key.test.ts@@ -6,7 +6,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";// The shipped helper is lifted out of chat-adapter.ts rather than copied, so// these assert against the real source. Importing the module would drag in thediff --git a/studio/frontend/tests/browser-page-frame-fullscreen.test.ts b/studio/frontend/tests/browser-page-frame-fullscreen.test.tsindex d74ac9c19d2..9b6264b658b 100644--- a/studio/frontend/tests/browser-page-frame-fullscreen.test.ts+++ b/studio/frontend/tests/browser-page-frame-fullscreen.test.ts@@ -6,7 +6,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";import { openingTag } from "./helpers/tsx-ast.ts";diff --git a/studio/frontend/tests/browser-shortcut-leaves-fullscreen.test.ts b/studio/frontend/tests/browser-shortcut-leaves-fullscreen.test.tsindex b9a1f7c4f29..b489eeaf0d9 100644--- a/studio/frontend/tests/browser-shortcut-leaves-fullscreen.test.ts+++ b/studio/frontend/tests/browser-shortcut-leaves-fullscreen.test.ts@@ -9,7 +9,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";const TAB_VIEW = fileURLToPath(new URL("../src/features/browser/tab-view.tsx", import.meta.url));diff --git a/studio/frontend/tests/chat-barrel-module-scope-reads.test.ts b/studio/frontend/tests/chat-barrel-module-scope-reads.test.tsindex 04cbda1a423..6b2c753669e 100644--- a/studio/frontend/tests/chat-barrel-module-scope-reads.test.ts+++ b/studio/frontend/tests/chat-barrel-module-scope-reads.test.ts@@ -27,7 +27,7 @@ import path from "node:path";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";const HERE = path.dirname(fileURLToPath(import.meta.url));const SRC = path.join(HERE, "..", "src");diff --git a/studio/frontend/tests/chat-export-system-prompt.test.ts b/studio/frontend/tests/chat-export-system-prompt.test.tsindex 44ade0b9eab..3ded24ab1f1 100644--- a/studio/frontend/tests/chat-export-system-prompt.test.ts+++ b/studio/frontend/tests/chat-export-system-prompt.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import test from "node:test";import vm from "node:vm";-import ts from "typescript";+import ts from "@typescript/typescript6";import {codexLocalToolRoundId,diff --git a/studio/frontend/tests/chat-menus-nonmodal.test.ts b/studio/frontend/tests/chat-menus-nonmodal.test.tsindex 325076fbd6a..84356726e61 100644--- a/studio/frontend/tests/chat-menus-nonmodal.test.ts+++ b/studio/frontend/tests/chat-menus-nonmodal.test.ts@@ -9,7 +9,7 @@ import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/chat-rename-ime.test.ts b/studio/frontend/tests/chat-rename-ime.test.tsindex d2066072c94..684e946be5e 100644--- a/studio/frontend/tests/chat-rename-ime.test.ts+++ b/studio/frontend/tests/chat-rename-ime.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";import {imeOwnsInputKeydown,diff --git a/studio/frontend/tests/chat-thread-tombstone-clears-owned.test.ts b/studio/frontend/tests/chat-thread-tombstone-clears-owned.test.tsindex bf0e9ac0006..6b0d37e98c2 100644--- a/studio/frontend/tests/chat-thread-tombstone-clears-owned.test.ts+++ b/studio/frontend/tests/chat-thread-tombstone-clears-owned.test.ts@@ -9,7 +9,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";const WRAPPERS = new Set(["forgetChatThread", "forgetChatThreads"]);const TOMBSTONES = new Set(["markChatThreadDeleted", "markChatThreadsDeleted"]);diff --git a/studio/frontend/tests/code-plugin-remount.test.ts b/studio/frontend/tests/code-plugin-remount.test.tsindex 6bd359c43bc..a372c8d7d95 100644--- a/studio/frontend/tests/code-plugin-remount.test.ts+++ b/studio/frontend/tests/code-plugin-remount.test.ts@@ -5,7 +5,7 @@ import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import type { CodePluginOptions } from "@streamdown/code";diff --git a/studio/frontend/tests/composer-steering.test.ts b/studio/frontend/tests/composer-steering.test.tsindex 57ee67a8e0a..6bd55d32b0c 100644--- a/studio/frontend/tests/composer-steering.test.ts+++ b/studio/frontend/tests/composer-steering.test.ts@@ -1,6 +1,6 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";import {localPromptQueueModelBoundary,diff --git a/studio/frontend/tests/composer-submit-path.test.ts b/studio/frontend/tests/composer-submit-path.test.tsindex 97457133b6a..ceae96c253c 100644--- a/studio/frontend/tests/composer-submit-path.test.ts+++ b/studio/frontend/tests/composer-submit-path.test.ts@@ -1,6 +1,6 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";import {composerKeyEventForImeSubmit,diff --git a/studio/frontend/tests/dataset-data-recipes-navigation.test.ts b/studio/frontend/tests/dataset-data-recipes-navigation.test.tsindex ba976b2a357..e82c0d16037 100644--- a/studio/frontend/tests/dataset-data-recipes-navigation.test.ts+++ b/studio/frontend/tests/dataset-data-recipes-navigation.test.ts@@ -6,7 +6,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";const DATASET_LISTS_PATH = fileURLToPath(new URL(diff --git a/studio/frontend/tests/download-panel-not-permanent.test.ts b/studio/frontend/tests/download-panel-not-permanent.test.tsindex 4bdd7fe0275..ac3800c7a10 100644--- a/studio/frontend/tests/download-panel-not-permanent.test.ts+++ b/studio/frontend/tests/download-panel-not-permanent.test.ts@@ -18,7 +18,7 @@ import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { openingTag } from "./helpers/tsx-ast.ts";diff --git a/studio/frontend/tests/external-model-selection-label.test.ts b/studio/frontend/tests/external-model-selection-label.test.tsindex c8056ca490d..49c7b55c540 100644--- a/studio/frontend/tests/external-model-selection-label.test.ts+++ b/studio/frontend/tests/external-model-selection-label.test.ts@@ -12,7 +12,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";import { modelDisplayName } from "../src/features/hub/lib/model-identity.ts";import type {diff --git a/studio/frontend/tests/external-preserve-thinking.test.ts b/studio/frontend/tests/external-preserve-thinking.test.tsindex 108a3c67076..c69a6e9f426 100644--- a/studio/frontend/tests/external-preserve-thinking.test.ts+++ b/studio/frontend/tests/external-preserve-thinking.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { registerBundlerResolver } from "./helpers/kit.ts";registerBundlerResolver();diff --git a/studio/frontend/tests/external-sampling-payload.test.ts b/studio/frontend/tests/external-sampling-payload.test.tsindex 61015049669..57af1501e15 100644--- a/studio/frontend/tests/external-sampling-payload.test.ts+++ b/studio/frontend/tests/external-sampling-payload.test.ts@@ -7,7 +7,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc, registerBundlerResolver } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/external-tool-loop-settings.test.ts b/studio/frontend/tests/external-tool-loop-settings.test.tsindex 646461d74fa..ea0aff08eb6 100644--- a/studio/frontend/tests/external-tool-loop-settings.test.ts+++ b/studio/frontend/tests/external-tool-loop-settings.test.ts@@ -8,7 +8,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/finetune-export-branches.test.ts b/studio/frontend/tests/finetune-export-branches.test.tsindex 71ec53e4745..911d181203c 100644--- a/studio/frontend/tests/finetune-export-branches.test.ts+++ b/studio/frontend/tests/finetune-export-branches.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import test from "node:test";import vm from "node:vm";-import ts from "typescript";+import ts from "@typescript/typescript6";import * as liveThreadHead from "../src/features/chat/utils/live-thread-head.ts";import {diff --git a/studio/frontend/tests/fork-boundary.test.ts b/studio/frontend/tests/fork-boundary.test.tsindex 07067465ab3..e9219141287 100644--- a/studio/frontend/tests/fork-boundary.test.ts+++ b/studio/frontend/tests/fork-boundary.test.ts@@ -9,7 +9,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc, registerBundlerResolver } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/generation-recovery-import-call-site.test.ts b/studio/frontend/tests/generation-recovery-import-call-site.test.tsindex 464819debe7..8296abaddfc 100644--- a/studio/frontend/tests/generation-recovery-import-call-site.test.ts+++ b/studio/frontend/tests/generation-recovery-import-call-site.test.ts@@ -12,7 +12,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";const SOURCE = fileURLToPath(new URL("../src/features/chat/runtime-provider.tsx", import.meta.url),diff --git a/studio/frontend/tests/generation-tool-recovery.test.ts b/studio/frontend/tests/generation-tool-recovery.test.tsindex 92af118956f..27c488b2002 100644--- a/studio/frontend/tests/generation-tool-recovery.test.ts+++ b/studio/frontend/tests/generation-tool-recovery.test.ts@@ -5,7 +5,7 @@ import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";import vm from "node:vm";-import ts from "typescript";+import ts from "@typescript/typescript6";import type { CarriedPart as Carried } from "../src/features/chat/utils/chat-generation-recovery.ts";import { registerBundlerResolver } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/gguf-delete-cache-reference.test.ts b/studio/frontend/tests/gguf-delete-cache-reference.test.tsindex f384de63456..6ddcebd211f 100644--- a/studio/frontend/tests/gguf-delete-cache-reference.test.ts+++ b/studio/frontend/tests/gguf-delete-cache-reference.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";function readSource(path: string) {const text = readFileSync(new URL(path, import.meta.url), "utf8");diff --git a/studio/frontend/tests/gguf-delete-pin-scope.test.ts b/studio/frontend/tests/gguf-delete-pin-scope.test.tsindex 3c2a7909a0d..764b8386edd 100644--- a/studio/frontend/tests/gguf-delete-pin-scope.test.ts+++ b/studio/frontend/tests/gguf-delete-pin-scope.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { pinKey, pinnedQuantEntries } from "../src/features/model-picker/components/model-selector/pinned-models.ts";import { ggufVariantsMatchForPicker, modelIdsMatchForPicker } from "../src/features/model-picker/components/model-selector/row-identity.ts";diff --git a/studio/frontend/tests/gguf-source-pins.test.ts b/studio/frontend/tests/gguf-source-pins.test.tsindex 38b47cd9c78..b3476fac4b6 100644--- a/studio/frontend/tests/gguf-source-pins.test.ts+++ b/studio/frontend/tests/gguf-source-pins.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import {pinKey,pinnedQuantEntries,diff --git a/studio/frontend/tests/helpers/module-stubs.ts b/studio/frontend/tests/helpers/module-stubs.tsindex 9821a2697f2..8bcbd79ff2b 100644--- a/studio/frontend/tests/helpers/module-stubs.ts+++ b/studio/frontend/tests/helpers/module-stubs.ts@@ -7,7 +7,7 @@import { existsSync, readFileSync } from "node:fs";import { fileURLToPath, pathToFileURL } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";/** A JSX element as the stub runtime below records it. */export type StubElement = {@@ -46,6 +46,8 @@ export function loadWithStubs<T>(target: ts.ScriptTarget.ES2022,module: ts.ModuleKind.CommonJS,jsx: ts.JsxEmit.ReactJSX,+ // TypeScript 6 turns this on by default, which would wrap the stubs in __importDefault.+ esModuleInterop: false,},});const loaded = { exports: {} as T };diff --git a/studio/frontend/tests/helpers/tsx-ast.ts b/studio/frontend/tests/helpers/tsx-ast.tsindex abfca99e506..d6a6f7b5cee 100644--- a/studio/frontend/tests/helpers/tsx-ast.ts+++ b/studio/frontend/tests/helpers/tsx-ast.ts@@ -4,7 +4,7 @@// Kept out of kit.ts on purpose: 24 test files import that, and only the handful// asserting JSX wiring should pay for loading the TypeScript compiler.-import ts from "typescript";+import ts from "@typescript/typescript6";/** The opening tag of `node`, for both `<x>` and `<x />`. */export const openingTag = (node: ts.Node): ts.JsxOpeningLikeElement | null => {diff --git a/studio/frontend/tests/hub-search-mixed-formats.test.ts b/studio/frontend/tests/hub-search-mixed-formats.test.tsindex b4a49588dad..6aabcb9566c 100644--- a/studio/frontend/tests/hub-search-mixed-formats.test.ts+++ b/studio/frontend/tests/hub-search-mixed-formats.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { classifyUnslothSupport } from "../src/features/hub/lib/unsloth-support.ts";// Execute the production mapper without loading React, the Hub client or the network hooks.diff --git a/studio/frontend/tests/image-gallery-delete.test.ts b/studio/frontend/tests/image-gallery-delete.test.tsindex ac4ca143279..0c55ae004a0 100644--- a/studio/frontend/tests/image-gallery-delete.test.ts+++ b/studio/frontend/tests/image-gallery-delete.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import test from "node:test";import { runInNewContext } from "node:vm";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";test("gallery delete accepts an externally removed image but still reports real failures", async () => {diff --git a/studio/frontend/tests/image-model-recall.test.ts b/studio/frontend/tests/image-model-recall.test.tsindex 39fd6ef8438..ea9e1f9ef6b 100644--- a/studio/frontend/tests/image-model-recall.test.ts+++ b/studio/frontend/tests/image-model-recall.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { explicitFamily } from "../src/features/model-picker/components/model-selector/family-override.ts";import {componentFilesMatch,diff --git a/studio/frontend/tests/image-restore-negative-prompt.test.ts b/studio/frontend/tests/image-restore-negative-prompt.test.tsindex dd91a1c5bef..616fdb95eb5 100644--- a/studio/frontend/tests/image-restore-negative-prompt.test.ts+++ b/studio/frontend/tests/image-restore-negative-prompt.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";function restoreSettingsWith(negativeCapable: boolean) {diff --git a/studio/frontend/tests/image-url-replay.test.ts b/studio/frontend/tests/image-url-replay.test.tsindex 6cc4933e98f..bed341e9feb 100644--- a/studio/frontend/tests/image-url-replay.test.ts+++ b/studio/frontend/tests/image-url-replay.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/images-precision-gate-native.test.ts b/studio/frontend/tests/images-precision-gate-native.test.tsindex c210c01fd29..96e463870ee 100644--- a/studio/frontend/tests/images-precision-gate-native.test.ts+++ b/studio/frontend/tests/images-precision-gate-native.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { isDenseQuantKind, isNativeEngineStatus } from "../src/lib/resolved-precision.ts";import { readSrc } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/manual-compaction.test.ts b/studio/frontend/tests/manual-compaction.test.tsindex ab058abfc84..7ca9986e56d 100644--- a/studio/frontend/tests/manual-compaction.test.ts+++ b/studio/frontend/tests/manual-compaction.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { getThreadState, LocalThreadRuntimeCore } from "@assistant-ui/core/internal";import {liveThreadRunning,diff --git a/studio/frontend/tests/markdown-block-boundary.test.ts b/studio/frontend/tests/markdown-block-boundary.test.tsindex 61575857655..29875a0932e 100644--- a/studio/frontend/tests/markdown-block-boundary.test.ts+++ b/studio/frontend/tests/markdown-block-boundary.test.ts@@ -5,7 +5,7 @@ import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import {markdownBlockFallback,diff --git a/studio/frontend/tests/markdown-block-remount-on-complete.test.ts b/studio/frontend/tests/markdown-block-remount-on-complete.test.tsindex a9be19bc951..924bdbf033b 100644--- a/studio/frontend/tests/markdown-block-remount-on-complete.test.ts+++ b/studio/frontend/tests/markdown-block-remount-on-complete.test.ts@@ -6,7 +6,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";const MARKDOWN_TEXT_PATH = fileURLToPath(new URL("../src/components/assistant-ui/markdown-text.tsx", import.meta.url),diff --git a/studio/frontend/tests/markdown-export-branches.test.ts b/studio/frontend/tests/markdown-export-branches.test.tsindex bc0c78f87a5..69bc0c65829 100644--- a/studio/frontend/tests/markdown-export-branches.test.ts+++ b/studio/frontend/tests/markdown-export-branches.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import test from "node:test";import vm from "node:vm";-import ts from "typescript";+import ts from "@typescript/typescript6";import { stripSearchImageTokens } from "../src/features/chat/search-images/search-images.ts";import {diff --git a/studio/frontend/tests/markdown-image-recovery.test.ts b/studio/frontend/tests/markdown-image-recovery.test.tsindex 81ee08f4d0d..ebb01d34d07 100644--- a/studio/frontend/tests/markdown-image-recovery.test.ts+++ b/studio/frontend/tests/markdown-image-recovery.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import test from "node:test";import { runInNewContext } from "node:vm";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/markdown-preview-literal-tags.test.ts b/studio/frontend/tests/markdown-preview-literal-tags.test.tsindex 19194e87aea..62977211ddf 100644--- a/studio/frontend/tests/markdown-preview-literal-tags.test.ts+++ b/studio/frontend/tests/markdown-preview-literal-tags.test.ts@@ -9,7 +9,7 @@ import * as jsxRuntime from "react/jsx-runtime";import * as streamdown from "streamdown";import * as streamdownMath from "@streamdown/math";import * as streamdownMermaid from "@streamdown/mermaid";-import ts from "typescript";+import ts from "@typescript/typescript6";import type * as ComposerDraftPreviewModule from "../src/components/assistant-ui/composer-draft-preview.tsx";import { createCodePlugin } from "../src/components/assistant-ui/code-plugin.ts";diff --git a/studio/frontend/tests/markdown-streaming-scheduling.test.ts b/studio/frontend/tests/markdown-streaming-scheduling.test.tsindex 00c48832536..ad7e0d26f5c 100644--- a/studio/frontend/tests/markdown-streaming-scheduling.test.ts+++ b/studio/frontend/tests/markdown-streaming-scheduling.test.ts@@ -5,7 +5,7 @@ import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";const MARKDOWN_TEXT_PATH = new URL("../src/components/assistant-ui/markdown-text.tsx",diff --git a/studio/frontend/tests/mcp-app-envelope.test.ts b/studio/frontend/tests/mcp-app-envelope.test.tsindex cefa5e8c1d9..e655ee65865 100644--- a/studio/frontend/tests/mcp-app-envelope.test.ts+++ b/studio/frontend/tests/mcp-app-envelope.test.ts@@ -5,7 +5,7 @@ import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { splitMcpImages } from "../src/features/chat/api/mcp-images.ts";import {diff --git a/studio/frontend/tests/message-jsonl-import.test.ts b/studio/frontend/tests/message-jsonl-import.test.tsindex bf99c3f22c3..e34ba626836 100644--- a/studio/frontend/tests/message-jsonl-import.test.ts+++ b/studio/frontend/tests/message-jsonl-import.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import vm from "node:vm";import { after, before, test } from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { type ViteDevServer, createServer } from "vite";import { toolCallReplayArguments } from "../src/features/chat/tool-call-arguments.ts";import { codexLocalToolRoundId, startsNewCodexToolRound } from "../src/features/chat/codex-reasoning.ts";diff --git a/studio/frontend/tests/model-config-run-selection.test.ts b/studio/frontend/tests/model-config-run-selection.test.tsindex 747a80d4a3c..7f1884e017e 100644--- a/studio/frontend/tests/model-config-run-selection.test.ts+++ b/studio/frontend/tests/model-config-run-selection.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { isExternalModelId } from "../src/features/chat/external-providers.ts";import { isLocalModelPath } from "../src/features/chat/utils/model-download-staging.ts";diff --git a/studio/frontend/tests/model-search-filters.test.ts b/studio/frontend/tests/model-search-filters.test.tsindex cc816f1da95..effab5f1546 100644--- a/studio/frontend/tests/model-search-filters.test.ts+++ b/studio/frontend/tests/model-search-filters.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import {filterModelListing,hasModelSearchFilters,diff --git a/studio/frontend/tests/module-scope-cycle-safety.test.ts b/studio/frontend/tests/module-scope-cycle-safety.test.tsindex 7efbb62c3e6..5078bfff53e 100644--- a/studio/frontend/tests/module-scope-cycle-safety.test.ts+++ b/studio/frontend/tests/module-scope-cycle-safety.test.ts@@ -16,7 +16,7 @@ import path from "node:path";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";const SRC = fileURLToPath(new URL("../src", import.meta.url));const KEYS = path.join(SRC, "features/chat/stores/sidebar-organization-keys.ts");diff --git a/studio/frontend/tests/open-link-scheme-without-slashes.test.ts b/studio/frontend/tests/open-link-scheme-without-slashes.test.tsindex 4d3e544a59a..d18eba71adf 100644--- a/studio/frontend/tests/open-link-scheme-without-slashes.test.ts+++ b/studio/frontend/tests/open-link-scheme-without-slashes.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { isSafeNavigableSourceUrl } from "../src/features/chat/utils/document-citation-source.ts";// open-link.ts imports `@/lib/api-base`; load it as the web build (isTauri = false) with window.open recorded.diff --git a/studio/frontend/tests/overlay-rail-floor-gating.test.ts b/studio/frontend/tests/overlay-rail-floor-gating.test.tsindex fc93b20c198..64650720e2d 100644--- a/studio/frontend/tests/overlay-rail-floor-gating.test.ts+++ b/studio/frontend/tests/overlay-rail-floor-gating.test.ts@@ -25,7 +25,7 @@ import { join } from "node:path";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";import { openingTag } from "./helpers/tsx-ast.ts";diff --git a/studio/frontend/tests/parallel-tool-call-arguments.test.ts b/studio/frontend/tests/parallel-tool-call-arguments.test.tsindex e6eee1be81c..00a7a677861 100644--- a/studio/frontend/tests/parallel-tool-call-arguments.test.ts+++ b/studio/frontend/tests/parallel-tool-call-arguments.test.ts@@ -9,7 +9,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import {createBoundaryScan,diff --git a/studio/frontend/tests/persisted-run-steering.test.ts b/studio/frontend/tests/persisted-run-steering.test.tsindex a0c63f91e80..4ff5df7789a 100644--- a/studio/frontend/tests/persisted-run-steering.test.ts+++ b/studio/frontend/tests/persisted-run-steering.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";// Execute the production adapter wrapper around a controlled pending history write.diff --git a/studio/frontend/tests/pr9057-video-simulation.test.ts b/studio/frontend/tests/pr9057-video-simulation.test.tsindex 32f8cf0234d..672553a167c 100644--- a/studio/frontend/tests/pr9057-video-simulation.test.ts+++ b/studio/frontend/tests/pr9057-video-simulation.test.ts@@ -12,7 +12,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import {MAX_VIDEO_SIZE,diff --git a/studio/frontend/tests/preset-reasoning-subscription.test.ts b/studio/frontend/tests/preset-reasoning-subscription.test.tsindex c007a734a8d..3dedde594c4 100644--- a/studio/frontend/tests/preset-reasoning-subscription.test.ts+++ b/studio/frontend/tests/preset-reasoning-subscription.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";const source = ts.createSourceFile(diff --git a/studio/frontend/tests/profile-login-name-spelling.test.ts b/studio/frontend/tests/profile-login-name-spelling.test.tsindex 78d6c538ad4..05438e02af4 100644--- a/studio/frontend/tests/profile-login-name-spelling.test.ts+++ b/studio/frontend/tests/profile-login-name-spelling.test.ts@@ -6,7 +6,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";import { loadWithStubs } from "./helpers/module-stubs.ts";import { openingTag } from "./helpers/tsx-ast.ts";diff --git a/studio/frontend/tests/project-name-ime.test.ts b/studio/frontend/tests/project-name-ime.test.tsindex de906fec1fc..f5468550139 100644--- a/studio/frontend/tests/project-name-ime.test.ts+++ b/studio/frontend/tests/project-name-ime.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import {imeOwnsInputKeydown,inputImeHandlers,diff --git a/studio/frontend/tests/queued-model-lifecycle.test.ts b/studio/frontend/tests/queued-model-lifecycle.test.tsindex aa26464024f..b04b62f1cc9 100644--- a/studio/frontend/tests/queued-model-lifecycle.test.ts+++ b/studio/frontend/tests/queued-model-lifecycle.test.ts@@ -1,6 +1,6 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";import {ModelLifecycleGate,diff --git a/studio/frontend/tests/recipe-selector-source-label.test.ts b/studio/frontend/tests/recipe-selector-source-label.test.tsindex af1403e3bf7..539956f8b0c 100644--- a/studio/frontend/tests/recipe-selector-source-label.test.ts+++ b/studio/frontend/tests/recipe-selector-source-label.test.ts@@ -11,7 +11,7 @@ import assert from "node:assert/strict";import { readFileSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { registerBundlerResolver } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/recommended-curated-row-metadata.test.ts b/studio/frontend/tests/recommended-curated-row-metadata.test.tsindex eda045f1327..221d692ceb7 100644--- a/studio/frontend/tests/recommended-curated-row-metadata.test.ts+++ b/studio/frontend/tests/recommended-curated-row-metadata.test.ts@@ -12,7 +12,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";import { detectCapabilities } from "../src/features/model-picker/components/model-selector/model-capabilities.ts";import {diff --git a/studio/frontend/tests/sandbox-image-lifecycle.test.ts b/studio/frontend/tests/sandbox-image-lifecycle.test.tsindex ecc65f2a89e..438fc5f21b6 100644--- a/studio/frontend/tests/sandbox-image-lifecycle.test.ts+++ b/studio/frontend/tests/sandbox-image-lifecycle.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import test from "node:test";import { runInNewContext } from "node:vm";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/saved-history-reconciliation.test.ts b/studio/frontend/tests/saved-history-reconciliation.test.tsindex 7606f310ee3..5fc236175ca 100644--- a/studio/frontend/tests/saved-history-reconciliation.test.ts+++ b/studio/frontend/tests/saved-history-reconciliation.test.ts@@ -6,7 +6,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";import type { MessageStatus } from "@assistant-ui/react";diff --git a/studio/frontend/tests/search-images.test.ts b/studio/frontend/tests/search-images.test.tsindex 3191a9d6653..9fcd3bfa186 100644--- a/studio/frontend/tests/search-images.test.ts+++ b/studio/frontend/tests/search-images.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import {SEARCH_IMAGES_MARKER,diff --git a/studio/frontend/tests/seeded-approval-terminal-run.test.ts b/studio/frontend/tests/seeded-approval-terminal-run.test.tsindex 150ab8af8ca..bbd99d59785 100644--- a/studio/frontend/tests/seeded-approval-terminal-run.test.ts+++ b/studio/frontend/tests/seeded-approval-terminal-run.test.ts@@ -20,7 +20,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";const SOURCE = fileURLToPath(new URL("../src/features/chat/runtime-provider.tsx", import.meta.url),diff --git a/studio/frontend/tests/settings-finetune-action-loading.test.ts b/studio/frontend/tests/settings-finetune-action-loading.test.tsindex 6b7f8d474b9..3f1988108be 100644--- a/studio/frontend/tests/settings-finetune-action-loading.test.ts+++ b/studio/frontend/tests/settings-finetune-action-loading.test.ts@@ -7,7 +7,7 @@ import path from "node:path";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";const SRC = fileURLToPath(new URL("../src", import.meta.url));const DATA_TAB = path.join(SRC, "features/settings/tabs/data-tab.tsx");diff --git a/studio/frontend/tests/settings-tab-panel-loading.test.ts b/studio/frontend/tests/settings-tab-panel-loading.test.tsindex 3889e5318c3..4f01be51e24 100644--- a/studio/frontend/tests/settings-tab-panel-loading.test.ts+++ b/studio/frontend/tests/settings-tab-panel-loading.test.ts@@ -13,7 +13,7 @@ import path from "node:path";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";const SRC = fileURLToPath(new URL("../src", import.meta.url));const SETTINGS = path.join(SRC, "features/settings");diff --git a/studio/frontend/tests/sharegpt-export-branches.test.ts b/studio/frontend/tests/sharegpt-export-branches.test.tsindex 3ac17ccbd88..204651970a4 100644--- a/studio/frontend/tests/sharegpt-export-branches.test.ts+++ b/studio/frontend/tests/sharegpt-export-branches.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import test from "node:test";import vm from "node:vm";-import ts from "typescript";+import ts from "@typescript/typescript6";import * as liveThreadHead from "../src/features/chat/utils/live-thread-head.ts";import { orderByParentChain } from "../src/features/chat/utils/message-order.ts";diff --git a/studio/frontend/tests/shortcut-dispatch-guards.test.ts b/studio/frontend/tests/shortcut-dispatch-guards.test.tsindex e0770e9deeb..ca6a811b0b0 100644--- a/studio/frontend/tests/shortcut-dispatch-guards.test.ts+++ b/studio/frontend/tests/shortcut-dispatch-guards.test.ts@@ -5,7 +5,7 @@ import assert from "node:assert/strict";import { readFile } from "node:fs/promises";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import {readSrc,diff --git a/studio/frontend/tests/sidebar-recents-paging.test.ts b/studio/frontend/tests/sidebar-recents-paging.test.tsindex 5d3da62ea35..9916d6d9249 100644--- a/studio/frontend/tests/sidebar-recents-paging.test.ts+++ b/studio/frontend/tests/sidebar-recents-paging.test.ts@@ -6,7 +6,7 @@ import test from "node:test";import * as React from "react";import { renderToStaticMarkup } from "react-dom/server";import * as jsxRuntime from "react/jsx-runtime";-import ts from "typescript";+import ts from "@typescript/typescript6";import type * as ProgressiveRowsModule from "../src/components/progressive-rows.tsx";import { readSrc } from "./helpers/kit.ts";import { loadWithStubs } from "./helpers/module-stubs.ts";diff --git a/studio/frontend/tests/sidebar-row-actions.test.ts b/studio/frontend/tests/sidebar-row-actions.test.tsindex 3a56aac1c62..337536b1783 100644--- a/studio/frontend/tests/sidebar-row-actions.test.ts+++ b/studio/frontend/tests/sidebar-row-actions.test.ts@@ -8,7 +8,7 @@import assert from "node:assert/strict";import test from "node:test";import vm from "node:vm";-import ts from "typescript";+import ts from "@typescript/typescript6";import * as liveThreadHead from "../src/features/chat/utils/live-thread-head.ts";import { en } from "../src/i18n/locales/en.ts";import { readSrcAsync } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/thread-ancestor-has-scope.test.ts b/studio/frontend/tests/thread-ancestor-has-scope.test.tsindex aab0b7394ee..e87fd668525 100644--- a/studio/frontend/tests/thread-ancestor-has-scope.test.ts+++ b/studio/frontend/tests/thread-ancestor-has-scope.test.ts@@ -46,7 +46,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { openingTag } from "./helpers/tsx-ast.ts";diff --git a/studio/frontend/tests/thread-scoped-pairing-composition.test.ts b/studio/frontend/tests/thread-scoped-pairing-composition.test.tsindex 400cf94cdb6..41b93271597 100644--- a/studio/frontend/tests/thread-scoped-pairing-composition.test.ts+++ b/studio/frontend/tests/thread-scoped-pairing-composition.test.ts@@ -15,7 +15,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/tool-activity-preference.test.ts b/studio/frontend/tests/tool-activity-preference.test.tsindex d93482a22d2..b3a14c001d1 100644--- a/studio/frontend/tests/tool-activity-preference.test.ts+++ b/studio/frontend/tests/tool-activity-preference.test.ts@@ -13,7 +13,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import {installLocalStorageFake,diff --git a/studio/frontend/tests/tool-card-arg-coercion.test.ts b/studio/frontend/tests/tool-card-arg-coercion.test.tsindex a8cfdccb6c7..37ef75355bd 100644--- a/studio/frontend/tests/tool-card-arg-coercion.test.ts+++ b/studio/frontend/tests/tool-card-arg-coercion.test.ts@@ -6,7 +6,7 @@ import { readFileSync, readdirSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";import { toolArgText } from "../src/components/assistant-ui/tool-arg-text.ts";diff --git a/studio/frontend/tests/training-cache-reconciliation.test.ts b/studio/frontend/tests/training-cache-reconciliation.test.tsindex 1442ac3481b..68c916f734a 100644--- a/studio/frontend/tests/training-cache-reconciliation.test.ts+++ b/studio/frontend/tests/training-cache-reconciliation.test.ts@@ -6,7 +6,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import { fileURLToPath } from "node:url";-import ts from "typescript";+import ts from "@typescript/typescript6";import { registerBundlerResolver } from "./helpers/kit.ts";registerBundlerResolver();diff --git a/studio/frontend/tests/transcript-gallery-mutation.test.ts b/studio/frontend/tests/transcript-gallery-mutation.test.tsindex e7b35b661ed..c6f8b88f9f2 100644--- a/studio/frontend/tests/transcript-gallery-mutation.test.ts+++ b/studio/frontend/tests/transcript-gallery-mutation.test.ts@@ -3,7 +3,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";test("pending transcript mutations use the current view and deletion callback", async () => {diff --git a/studio/frontend/tests/typecheck-script.test.ts b/studio/frontend/tests/typecheck-script.test.tsnew file mode 100644index 00000000000..fc01a38064d--- /dev/null+++ b/studio/frontend/tests/typecheck-script.test.ts@@ -0,0 +1,374 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++/**+ * Runs the real scripts/typecheck.mjs in a temp checkout with a fake tsc and a fake bun,+ * and asserts which checker ran with which arguments. The failure that matters is+ * `bun check` spawned on a Bun without it: that is `bun run check`, a false pass or a+ * "Script not found".+ */++import assert from "node:assert/strict";+import { spawnSync } from "node:child_process";+import {+ chmodSync,+ copyFileSync,+ existsSync,+ mkdirSync,+ mkdtempSync,+ readFileSync,+ rmSync,+ writeFileSync,+} from "node:fs";+import { tmpdir } from "node:os";+import { delimiter, dirname, join } from "node:path";+import { test } from "node:test";+import { fileURLToPath } from "node:url";++const SCRIPT = join(+ dirname(fileURLToPath(import.meta.url)),+ "..",+ "scripts",+ "typecheck.mjs",+);+const POSIX_ONLY = { skip: process.platform === "win32" };++const HELP_HEAD =+ "Bun is a fast JavaScript runtime, package manager, bundler, and test runner.";+const OLD_HELP = `${HELP_HEAD} (1.3.13+bf2e2cecf)++Usage: bun <command> [...flags] [...args]++Commands:+ run ./my-script.ts Execute a file with Bun+ lint Run a package.json script+ test Run unit tests with Bun+`;+const NEW_HELP = `${HELP_HEAD} (1.4.3+c6da4a4d3)++Usage: bun <command> [...flags] [...args]++Commands:+ run ./my-script.ts Execute a file with Bun+ lint Run a package.json script+ check Type check a TypeScript project+ test Run unit tests with Bun+`;+const COLOR_HELP = NEW_HELP.replace(+ " check ",+ " \x1b[1m\x1b[35mcheck\x1b[0m ",+).replace(/\n/g, "\r\n");++const TSC_ARGS = ["-b", "--pretty", "false"];+const TSC_TEST_ARGS = ["-p", "tsconfig.test.json", "--pretty", "false"];+const BUN_ARGS = ["check", "--build", "--no-pretty"];+const BUN_TEST_ARGS = ["check", "--project=tsconfig.test.json", "--no-pretty"];+const TS_PROBE = ["-p", "process.versions.typescript"];++const FAKE_TSC = `const { appendFileSync } = require("node:fs");+const { join } = require("node:path");+appendFileSync(join(__dirname, "..", "..", "..", "tsc.log"), JSON.stringify(process.argv.slice(2)) + "\\n");+process.exit(Number(process.env.FAKE_TSC_EXIT || 0));+`;++type Fixture = {+ root: string;+ env: NodeJS.ProcessEnv;+ tscCalls: () => string[][];+ bunCalls: () => string[][];+};++const roots: string[] = [];+test.after(() => {+ for (const root of roots) {+ rmSync(root, { recursive: true, force: true });+ }+});++function readLog(path: string): string[][] {+ if (!existsSync(path)) {+ return [];+ }+ return readFileSync(path, "utf8")+ .split("\n")+ .filter(Boolean)+ .map((line) => JSON.parse(line) as string[]);+}++function fixture(+ options: { bunHelp?: string; checkScript?: boolean } = {},+): Fixture {+ const root = mkdtempSync(join(tmpdir(), "typecheck-script-"));+ roots.push(root);+ mkdirSync(join(root, "scripts"));+ copyFileSync(SCRIPT, join(root, "scripts", "typecheck.mjs"));+ const scripts: Record<string, string> = { build: "vite build" };+ if (options.checkScript) {+ scripts.check = "echo hijacked";+ }+ writeFileSync(join(root, "package.json"), JSON.stringify({ scripts }));+ const ts = join(root, "node_modules", "typescript");+ mkdirSync(join(ts, "bin"), { recursive: true });+ writeFileSync(join(ts, "bin", "tsc"), FAKE_TSC);+ writeFileSync(join(ts, "package.json"), '{"version":"7.0.2"}');+ mkdirSync(join(root, "bin"));+ if (options.bunHelp !== undefined) {+ writeFileSync(join(root, "help.txt"), options.bunHelp);+ const bun = join(root, "bin", "bun");+ // A node script, not sh: PATH holds only bin/ and node's own directory, which has no+ // coreutils under setup-node, nvm and similar installs.+ writeFileSync(+ bun,+ `#!/usr/bin/env node+const { appendFileSync, readFileSync } = require("node:fs");+const { join } = require("node:path");+const here = join(__dirname, "..");+const args = process.argv.slice(2);+appendFileSync(join(here, "bun.log"), JSON.stringify(args) + "\\n");+if (args[0] === "--help") {+ process.stdout.write(readFileSync(join(here, "help.txt")));+ process.exit(0);+}+if (args[0] === "-p") {+ process.stdout.write((process.env.FAKE_BUN_TS || "7.0.2") + "\\n");+ process.exit(0);+}+process.exit(Number(process.env.FAKE_BUN_EXIT || 0));+`,+ );+ chmodSync(bun, 0o755);+ }+ const env: NodeJS.ProcessEnv = { ...process.env };+ for (const key of Object.keys(env)) {+ const upper = key.toUpperCase();+ if (+ upper === "PATH" ||+ upper === "UNSLOTH_TYPECHECK" ||+ upper === "FORCE_COLOR"+ ) {+ delete env[key];+ }+ }+ env.PATH = join(root, "bin") + delimiter + dirname(process.execPath);+ return {+ root,+ env,+ tscCalls: () => readLog(join(root, "tsc.log")),+ bunCalls: () => readLog(join(root, "bun.log")),+ };+}++function run(+ fx: Fixture,+ args: string[] = [],+ env: Record<string, string> = {},+) {+ const r = spawnSync(+ process.execPath,+ [join(fx.root, "scripts", "typecheck.mjs"), ...args],+ { encoding: "utf8", env: { ...fx.env, ...env }, timeout: 30_000 },+ );+ return { status: r.status, stderr: r.stderr };+}++test("without bun it runs tsc -b, then the test project with --tests", () => {+ const fx = fixture();+ const r = run(fx, ["--tests"]);+ assert.equal(r.status, 0, r.stderr);+ assert.match(r.stderr, /typecheck: tsc \(TypeScript 7\.0\.2\)/);+ assert.deepEqual(fx.tscCalls(), [TSC_ARGS, TSC_TEST_ARGS]);+});++test("build mode runs only tsc -b", () => {+ const fx = fixture();+ assert.equal(run(fx).status, 0);+ assert.deepEqual(fx.tscCalls(), [TSC_ARGS]);+});++test("a failing first step stops the second and passes its exit code through", () => {+ const fx = fixture();+ const r = run(fx, ["--tests"], { FAKE_TSC_EXIT: "2" });+ assert.equal(r.status, 2);+ assert.deepEqual(fx.tscCalls(), [TSC_ARGS]);+});++test(+ "Bun 1.3 (no check command) falls back to tsc and never spawns check",+ POSIX_ONLY,+ () => {+ const fx = fixture({ bunHelp: OLD_HELP });+ const r = run(fx, ["--tests"]);+ assert.equal(r.status, 0, r.stderr);+ assert.deepEqual(fx.bunCalls(), [["--help"]]);+ assert.deepEqual(fx.tscCalls(), [TSC_ARGS, TSC_TEST_ARGS]);+ },+);++test(+ "Bun 1.4.3 runs bun check for both projects and not tsc",+ POSIX_ONLY,+ () => {+ const fx = fixture({ bunHelp: NEW_HELP });+ const r = run(fx, ["--tests"]);+ assert.equal(r.status, 0, r.stderr);+ assert.match(r.stderr, /typecheck: bun check \(Bun 1\.4\.3\)/);+ assert.deepEqual(fx.bunCalls(), [+ ["--help"],+ TS_PROBE,+ BUN_ARGS,+ BUN_TEST_ARGS,+ ]);+ assert.deepEqual(fx.tscCalls(), []);+ },+);++test("colored CRLF help still counts as having check", POSIX_ONLY, () => {+ const fx = fixture({ bunHelp: COLOR_HELP });+ const r = run(fx);+ assert.equal(r.status, 0, r.stderr);+ assert.deepEqual(fx.bunCalls(), [["--help"], TS_PROBE, BUN_ARGS]);+ assert.deepEqual(fx.tscCalls(), []);+});++test("a check package script keeps bun off the path", POSIX_ONLY, () => {+ const fx = fixture({ bunHelp: NEW_HELP, checkScript: true });+ const r = run(fx, ["--tests"]);+ assert.equal(r.status, 0, r.stderr);+ assert.deepEqual(fx.bunCalls(), []);+ assert.deepEqual(fx.tscCalls(), [TSC_ARGS, TSC_TEST_ARGS]);+});++test(+ "auto: a red bun check is confirmed by tsc, whose verdict wins",+ POSIX_ONLY,+ () => {+ const green = fixture({ bunHelp: NEW_HELP });+ const r = run(green, ["--tests"], { FAKE_BUN_EXIT: "1" });+ assert.equal(r.status, 0, r.stderr);+ assert.match(r.stderr, /bun check reported errors; confirming with tsc/);+ assert.deepEqual(green.bunCalls(), [["--help"], TS_PROBE, BUN_ARGS]);+ assert.deepEqual(green.tscCalls(), [TSC_ARGS, TSC_TEST_ARGS]);++ const red = fixture({ bunHelp: NEW_HELP });+ const rr = run(red, ["--tests"], {+ FAKE_BUN_EXIT: "1",+ FAKE_TSC_EXIT: "1",+ });+ assert.equal(rr.status, 1);+ assert.deepEqual(red.tscCalls(), [TSC_ARGS]);+ },+);++test("UNSLOTH_TYPECHECK=tsc never probes bun", POSIX_ONLY, () => {+ const fx = fixture({ bunHelp: NEW_HELP });+ const r = run(fx, ["--tests"], { UNSLOTH_TYPECHECK: "tsc" });+ assert.equal(r.status, 0, r.stderr);+ assert.deepEqual(fx.bunCalls(), []);+ assert.deepEqual(fx.tscCalls(), [TSC_ARGS, TSC_TEST_ARGS]);+});++test("UNSLOTH_TYPECHECK=bun without bun fails loudly", () => {+ const fx = fixture();+ const r = run(fx, ["--tests"], { UNSLOTH_TYPECHECK: "bun" });+ assert.equal(r.status, 1);+ assert.match(r.stderr, /no Bun with a `check` command/);+ assert.deepEqual(fx.tscCalls(), []);+});++test(+ "UNSLOTH_TYPECHECK=bun with Bun 1.3 fails without spawning check",+ POSIX_ONLY,+ () => {+ const fx = fixture({ bunHelp: OLD_HELP });+ const r = run(fx, [], { UNSLOTH_TYPECHECK: "bun" });+ assert.equal(r.status, 1);+ assert.deepEqual(fx.bunCalls(), [["--help"]]);+ assert.deepEqual(fx.tscCalls(), []);+ },+);++test(+ "UNSLOTH_TYPECHECK=bun with a check script fails and runs nothing",+ POSIX_ONLY,+ () => {+ const fx = fixture({ bunHelp: NEW_HELP, checkScript: true });+ const r = run(fx, [], { UNSLOTH_TYPECHECK: "bun" });+ assert.equal(r.status, 1);+ assert.match(r.stderr, /`check` script/);+ assert.deepEqual(fx.bunCalls(), []);+ assert.deepEqual(fx.tscCalls(), []);+ },+);++test("UNSLOTH_TYPECHECK=bun passes bun's exit code through", POSIX_ONLY, () => {+ const fx = fixture({ bunHelp: NEW_HELP });+ const r = run(fx, ["--tests"], {+ UNSLOTH_TYPECHECK: "bun",+ FAKE_BUN_EXIT: "1",+ });+ assert.equal(r.status, 1);+ assert.deepEqual(fx.bunCalls(), [["--help"], TS_PROBE, BUN_ARGS]);+ assert.deepEqual(fx.tscCalls(), []);+});++test(+ "a Bun that follows another TypeScript version leaves auto mode on tsc",+ POSIX_ONLY,+ () => {+ const fx = fixture({ bunHelp: NEW_HELP });+ const r = run(fx, ["--tests"], { FAKE_BUN_TS: "7.1.0" });+ assert.equal(r.status, 0, r.stderr);+ assert.match(+ r.stderr,+ /follows TypeScript 7\.1\.0, not the pinned 7\.0\.2; using tsc/,+ );+ assert.deepEqual(fx.bunCalls(), [["--help"], TS_PROBE]);+ assert.deepEqual(fx.tscCalls(), [TSC_ARGS, TSC_TEST_ARGS]);+ },+);++test(+ "UNSLOTH_TYPECHECK=bun refuses a Bun that follows another TypeScript version",+ POSIX_ONLY,+ () => {+ const fx = fixture({ bunHelp: NEW_HELP });+ const r = run(fx, ["--tests"], {+ UNSLOTH_TYPECHECK: "bun",+ FAKE_BUN_TS: "7.1.0",+ });+ assert.equal(r.status, 1);+ assert.match(+ r.stderr,+ /follows TypeScript 7\.1\.0 and the project pins 7\.0\.2/,+ );+ assert.deepEqual(fx.bunCalls(), [["--help"], TS_PROBE]);+ assert.deepEqual(fx.tscCalls(), []);+ },+);++test("an unknown UNSLOTH_TYPECHECK value exits 2", () => {+ const fx = fixture();+ const r = run(fx, [], { UNSLOTH_TYPECHECK: "nonsense" });+ assert.equal(r.status, 2);+ assert.match(r.stderr, /unknown UNSLOTH_TYPECHECK=nonsense/);+ assert.deepEqual(fx.tscCalls(), []);+});++test(+ "Windows: an npm bun.cmd shim is never executed",+ { skip: process.platform !== "win32" },+ () => {+ const fx = fixture();+ const marker = join(fx.root, "shim-ran");+ writeFileSync(join(fx.root, "help.txt"), NEW_HELP);+ writeFileSync(+ join(fx.root, "bin", "bun.cmd"),+ `@echo off\r\necho ran> "${marker}"\r\ntype "${join(fx.root, "help.txt")}"\r\n`,+ );+ const r = run(fx, ["--tests"]);+ assert.equal(r.status, 0, r.stderr);+ assert.match(r.stderr, /typecheck: tsc/);+ assert.equal(existsSync(marker), false);+ assert.deepEqual(fx.tscCalls(), [TSC_ARGS, TSC_TEST_ARGS]);+ },+);diff --git a/studio/frontend/tests/uncaptioned-image-empty-text-block.test.ts b/studio/frontend/tests/uncaptioned-image-empty-text-block.test.tsindex dbd023491c9..152c4e48134 100644--- a/studio/frontend/tests/uncaptioned-image-empty-text-block.test.ts+++ b/studio/frontend/tests/uncaptioned-image-empty-text-block.test.ts@@ -4,7 +4,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";diff --git a/studio/frontend/tests/web-fetch-parked-url.test.ts b/studio/frontend/tests/web-fetch-parked-url.test.tsindex e7fe0f483e1..b66a9fc3405 100644--- a/studio/frontend/tests/web-fetch-parked-url.test.ts+++ b/studio/frontend/tests/web-fetch-parked-url.test.ts@@ -7,7 +7,7 @@import assert from "node:assert/strict";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";import { readSrc } from "./helpers/kit.ts";import { openingTag } from "./helpers/tsx-ast.ts";diff --git a/studio/frontend/tests/windows-path-portability.test.ts b/studio/frontend/tests/windows-path-portability.test.tsindex 7f7161c1544..be594a952dd 100644--- a/studio/frontend/tests/windows-path-portability.test.ts+++ b/studio/frontend/tests/windows-path-portability.test.ts@@ -24,7 +24,7 @@ import assert from "node:assert/strict";import { readFileSync, readdirSync } from "node:fs";import test from "node:test";-import ts from "typescript";+import ts from "@typescript/typescript6";const TESTS_DIR = new URL("./", import.meta.url);diff --git a/studio/frontend/tsconfig.app.json b/studio/frontend/tsconfig.app.jsonindex 84ce1298d06..9276e6fcaee 100644--- a/studio/frontend/tsconfig.app.json+++ b/studio/frontend/tsconfig.app.json@@ -1,5 +1,6 @@{"compilerOptions": {+ "incremental": true,"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo","target": "ES2022","useDefineForClassFields": true,@@ -23,7 +24,6 @@"erasableSyntaxOnly": true,"noFallthroughCasesInSwitch": true,"noUncheckedSideEffectImports": true,- "baseUrl": ".","paths": {"@/*": ["./src/*"]}diff --git a/studio/frontend/tsconfig.json b/studio/frontend/tsconfig.jsonindex fec8c8e5c21..c36d52afa7c 100644--- a/studio/frontend/tsconfig.json+++ b/studio/frontend/tsconfig.json@@ -5,7 +5,6 @@{ "path": "./tsconfig.node.json" }],"compilerOptions": {- "baseUrl": ".","paths": {"@/*": ["./src/*"]}diff --git a/studio/frontend/tsconfig.node.json b/studio/frontend/tsconfig.node.jsonindex 8a67f62f4ce..675c25f7852 100644--- a/studio/frontend/tsconfig.node.json+++ b/studio/frontend/tsconfig.node.json@@ -1,5 +1,6 @@{"compilerOptions": {+ "incremental": true,"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo","target": "ES2023","lib": ["ES2023"],diff --git a/studio/frontend/tsconfig.test.json b/studio/frontend/tsconfig.test.jsonindex 2e6b0e6c23e..7797f29bf7c 100644--- a/studio/frontend/tsconfig.test.json+++ b/studio/frontend/tsconfig.test.json@@ -1,5 +1,7 @@{"compilerOptions": {+ "incremental": true,+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.test.tsbuildinfo","target": "ES2022","lib": ["ES2022", "DOM", "DOM.Iterable"],"module": "ESNext",@@ -21,7 +23,6 @@"erasableSyntaxOnly": true,"noFallthroughCasesInSwitch": true,"noUncheckedSideEffectImports": true,- "baseUrl": ".","paths": {"@/*": ["./src/*"]}