diff --git a/package.json b/package.json index a6d2e2f..f153d1d 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "@codemirror/basic-setup": "^0.20.0", "@codemirror/lang-markdown": "^6.3.2", "@codemirror/merge": "^6.10.0", + "@codemirror/language": "^6.11.2", "@electric-sql/pglite": "0.2.14", "@google/genai": "^1.2.0", "@google/generative-ai": "^0.21.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4029e7a..3bed62c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,6 +27,9 @@ importers: '@codemirror/lang-markdown': specifier: ^6.3.2 version: 6.3.3 + '@codemirror/language': + specifier: ^6.11.2 + version: 6.11.2 '@codemirror/merge': specifier: ^6.10.0 version: 6.10.2 @@ -699,8 +702,8 @@ packages: cpu: [ppc64] os: [aix] - '@esbuild/aix-ppc64@0.25.6': - resolution: {integrity: sha512-ShbM/3XxwuxjFiuVBHA+d3j5dyac0aEVVq1oluIDf71hUw0aRF59dV/efUsIwFnR6m8JNM2FjZOzmaZ8yG61kw==} + '@esbuild/aix-ppc64@0.25.7': + resolution: {integrity: sha512-uD0kKFHh6ETr8TqEtaAcV+dn/2qnYbH/+8wGEdY70Qf7l1l/jmBUbrmQqwiPKAQE6cOQ7dTj6Xr0HzQDGHyceQ==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] @@ -723,8 +726,8 @@ packages: cpu: [arm64] os: [android] - '@esbuild/android-arm64@0.25.6': - resolution: {integrity: sha512-hd5zdUarsK6strW+3Wxi5qWws+rJhCCbMiC9QZyzoxfk5uHRIE8T287giQxzVpEvCwuJ9Qjg6bEjcRJcgfLqoA==} + '@esbuild/android-arm64@0.25.7': + resolution: {integrity: sha512-p0ohDnwyIbAtztHTNUTzN5EGD/HJLs1bwysrOPgSdlIA6NDnReoVfoCyxG6W1d85jr2X80Uq5KHftyYgaK9LPQ==} engines: {node: '>=18'} cpu: [arm64] os: [android] @@ -747,8 +750,8 @@ packages: cpu: [arm] os: [android] - '@esbuild/android-arm@0.25.6': - resolution: {integrity: sha512-S8ToEOVfg++AU/bHwdksHNnyLyVM+eMVAOf6yRKFitnwnbwwPNqKr3srzFRe7nzV69RQKb5DgchIX5pt3L53xg==} + '@esbuild/android-arm@0.25.7': + resolution: {integrity: sha512-Jhuet0g1k9rAJHrXGIh7sFknFuT4sfytYZpZpuZl7YKDhnPByVAm5oy2LEBmMbuYf3ejWVYCc2seX81Mk+madA==} engines: {node: '>=18'} cpu: [arm] os: [android] @@ -771,8 +774,8 @@ packages: cpu: [x64] os: [android] - '@esbuild/android-x64@0.25.6': - resolution: {integrity: sha512-0Z7KpHSr3VBIO9A/1wcT3NTy7EB4oNC4upJ5ye3R7taCc2GUdeynSLArnon5G8scPwaU866d3H4BCrE5xLW25A==} + '@esbuild/android-x64@0.25.7': + resolution: {integrity: sha512-mMxIJFlSgVK23HSsII3ZX9T2xKrBCDGyk0qiZnIW10LLFFtZLkFD6imZHu7gUo2wkNZwS9Yj3mOtZD3ZPcjCcw==} engines: {node: '>=18'} cpu: [x64] os: [android] @@ -795,8 +798,8 @@ packages: cpu: [arm64] os: [darwin] - '@esbuild/darwin-arm64@0.25.6': - resolution: {integrity: sha512-FFCssz3XBavjxcFxKsGy2DYK5VSvJqa6y5HXljKzhRZ87LvEi13brPrf/wdyl/BbpbMKJNOr1Sd0jtW4Ge1pAA==} + '@esbuild/darwin-arm64@0.25.7': + resolution: {integrity: sha512-jyOFLGP2WwRwxM8F1VpP6gcdIJc8jq2CUrURbbTouJoRO7XCkU8GdnTDFIHdcifVBT45cJlOYsZ1kSlfbKjYUQ==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] @@ -819,8 +822,8 @@ packages: cpu: [x64] os: [darwin] - '@esbuild/darwin-x64@0.25.6': - resolution: {integrity: sha512-GfXs5kry/TkGM2vKqK2oyiLFygJRqKVhawu3+DOCk7OxLy/6jYkWXhlHwOoTb0WqGnWGAS7sooxbZowy+pK9Yg==} + '@esbuild/darwin-x64@0.25.7': + resolution: {integrity: sha512-m9bVWqZCwQ1BthruifvG64hG03zzz9gE2r/vYAhztBna1/+qXiHyP9WgnyZqHgGeXoimJPhAmxfbeU+nMng6ZA==} engines: {node: '>=18'} cpu: [x64] os: [darwin] @@ -843,8 +846,8 @@ packages: cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-arm64@0.25.6': - resolution: {integrity: sha512-aoLF2c3OvDn2XDTRvn8hN6DRzVVpDlj2B/F66clWd/FHLiHaG3aVZjxQX2DYphA5y/evbdGvC6Us13tvyt4pWg==} + '@esbuild/freebsd-arm64@0.25.7': + resolution: {integrity: sha512-Bss7P4r6uhr3kDzRjPNEnTm/oIBdTPRNQuwaEFWT/uvt6A1YzK/yn5kcx5ZxZ9swOga7LqeYlu7bDIpDoS01bA==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] @@ -867,8 +870,8 @@ packages: cpu: [x64] os: [freebsd] - '@esbuild/freebsd-x64@0.25.6': - resolution: {integrity: sha512-2SkqTjTSo2dYi/jzFbU9Plt1vk0+nNg8YC8rOXXea+iA3hfNJWebKYPs3xnOUf9+ZWhKAaxnQNUf2X9LOpeiMQ==} + '@esbuild/freebsd-x64@0.25.7': + resolution: {integrity: sha512-S3BFyjW81LXG7Vqmr37ddbThrm3A84yE7ey/ERBlK9dIiaWgrjRlre3pbG7txh1Uaxz8N7wGGQXmC9zV+LIpBQ==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] @@ -891,8 +894,8 @@ packages: cpu: [arm64] os: [linux] - '@esbuild/linux-arm64@0.25.6': - resolution: {integrity: sha512-b967hU0gqKd9Drsh/UuAm21Khpoh6mPBSgz8mKRq4P5mVK8bpA+hQzmm/ZwGVULSNBzKdZPQBRT3+WuVavcWsQ==} + '@esbuild/linux-arm64@0.25.7': + resolution: {integrity: sha512-HfQZQqrNOfS1Okn7PcsGUqHymL1cWGBslf78dGvtrj8q7cN3FkapFgNA4l/a5lXDwr7BqP2BSO6mz9UremNPbg==} engines: {node: '>=18'} cpu: [arm64] os: [linux] @@ -915,8 +918,8 @@ packages: cpu: [arm] os: [linux] - '@esbuild/linux-arm@0.25.6': - resolution: {integrity: sha512-SZHQlzvqv4Du5PrKE2faN0qlbsaW/3QQfUUc6yO2EjFcA83xnwm91UbEEVx4ApZ9Z5oG8Bxz4qPE+HFwtVcfyw==} + '@esbuild/linux-arm@0.25.7': + resolution: {integrity: sha512-JZMIci/1m5vfQuhKoFXogCKVYVfYQmoZJg8vSIMR4TUXbF+0aNlfXH3DGFEFMElT8hOTUF5hisdZhnrZO/bkDw==} engines: {node: '>=18'} cpu: [arm] os: [linux] @@ -939,8 +942,8 @@ packages: cpu: [ia32] os: [linux] - '@esbuild/linux-ia32@0.25.6': - resolution: {integrity: sha512-aHWdQ2AAltRkLPOsKdi3xv0mZ8fUGPdlKEjIEhxCPm5yKEThcUjHpWB1idN74lfXGnZ5SULQSgtr5Qos5B0bPw==} + '@esbuild/linux-ia32@0.25.7': + resolution: {integrity: sha512-9Jex4uVpdeofiDxnwHRgen+j6398JlX4/6SCbbEFEXN7oMO2p0ueLN+e+9DdsdPLUdqns607HmzEFnxwr7+5wQ==} engines: {node: '>=18'} cpu: [ia32] os: [linux] @@ -963,8 +966,8 @@ packages: cpu: [loong64] os: [linux] - '@esbuild/linux-loong64@0.25.6': - resolution: {integrity: sha512-VgKCsHdXRSQ7E1+QXGdRPlQ/e08bN6WMQb27/TMfV+vPjjTImuT9PmLXupRlC90S1JeNNW5lzkAEO/McKeJ2yg==} + '@esbuild/linux-loong64@0.25.7': + resolution: {integrity: sha512-TG1KJqjBlN9IHQjKVUYDB0/mUGgokfhhatlay8aZ/MSORMubEvj/J1CL8YGY4EBcln4z7rKFbsH+HeAv0d471w==} engines: {node: '>=18'} cpu: [loong64] os: [linux] @@ -987,8 +990,8 @@ packages: cpu: [mips64el] os: [linux] - '@esbuild/linux-mips64el@0.25.6': - resolution: {integrity: sha512-WViNlpivRKT9/py3kCmkHnn44GkGXVdXfdc4drNmRl15zVQ2+D2uFwdlGh6IuK5AAnGTo2qPB1Djppj+t78rzw==} + '@esbuild/linux-mips64el@0.25.7': + resolution: {integrity: sha512-Ty9Hj/lx7ikTnhOfaP7ipEm/ICcBv94i/6/WDg0OZ3BPBHhChsUbQancoWYSO0WNkEiSW5Do4febTTy4x1qYQQ==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] @@ -1011,8 +1014,8 @@ packages: cpu: [ppc64] os: [linux] - '@esbuild/linux-ppc64@0.25.6': - resolution: {integrity: sha512-wyYKZ9NTdmAMb5730I38lBqVu6cKl4ZfYXIs31Baf8aoOtB4xSGi3THmDYt4BTFHk7/EcVixkOV2uZfwU3Q2Jw==} + '@esbuild/linux-ppc64@0.25.7': + resolution: {integrity: sha512-MrOjirGQWGReJl3BNQ58BLhUBPpWABnKrnq8Q/vZWWwAB1wuLXOIxS2JQ1LT3+5T+3jfPh0tyf5CpbyQHqnWIQ==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] @@ -1035,8 +1038,8 @@ packages: cpu: [riscv64] os: [linux] - '@esbuild/linux-riscv64@0.25.6': - resolution: {integrity: sha512-KZh7bAGGcrinEj4qzilJ4hqTY3Dg2U82c8bv+e1xqNqZCrCyc+TL9AUEn5WGKDzm3CfC5RODE/qc96OcbIe33w==} + '@esbuild/linux-riscv64@0.25.7': + resolution: {integrity: sha512-9pr23/pqzyqIZEZmQXnFyqp3vpa+KBk5TotfkzGMqpw089PGm0AIowkUppHB9derQzqniGn3wVXgck19+oqiOw==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] @@ -1059,8 +1062,8 @@ packages: cpu: [s390x] os: [linux] - '@esbuild/linux-s390x@0.25.6': - resolution: {integrity: sha512-9N1LsTwAuE9oj6lHMyyAM+ucxGiVnEqUdp4v7IaMmrwb06ZTEVCIs3oPPplVsnjPfyjmxwHxHMF8b6vzUVAUGw==} + '@esbuild/linux-s390x@0.25.7': + resolution: {integrity: sha512-4dP11UVGh9O6Y47m8YvW8eoA3r8qL2toVZUbBKyGta8j6zdw1cn9F/Rt59/Mhv0OgY68pHIMjGXWOUaykCnx+w==} engines: {node: '>=18'} cpu: [s390x] os: [linux] @@ -1083,14 +1086,14 @@ packages: cpu: [x64] os: [linux] - '@esbuild/linux-x64@0.25.6': - resolution: {integrity: sha512-A6bJB41b4lKFWRKNrWoP2LHsjVzNiaurf7wyj/XtFNTsnPuxwEBWHLty+ZE0dWBKuSK1fvKgrKaNjBS7qbFKig==} + '@esbuild/linux-x64@0.25.7': + resolution: {integrity: sha512-ghJMAJTdw/0uhz7e7YnpdX1xVn7VqA0GrWrAO2qKMuqbvgHT2VZiBv1BQ//VcHsPir4wsL3P2oPggfKPzTKoCA==} engines: {node: '>=18'} cpu: [x64] os: [linux] - '@esbuild/netbsd-arm64@0.25.6': - resolution: {integrity: sha512-IjA+DcwoVpjEvyxZddDqBY+uJ2Snc6duLpjmkXm/v4xuS3H+3FkLZlDm9ZsAbF9rsfP3zeA0/ArNDORZgrxR/Q==} + '@esbuild/netbsd-arm64@0.25.7': + resolution: {integrity: sha512-bwXGEU4ua45+u5Ci/a55B85KWaDSRS8NPOHtxy2e3etDjbz23wlry37Ffzapz69JAGGc4089TBo+dGzydQmydg==} engines: {node: '>=18'} cpu: [arm64] os: [netbsd] @@ -1113,14 +1116,14 @@ packages: cpu: [x64] os: [netbsd] - '@esbuild/netbsd-x64@0.25.6': - resolution: {integrity: sha512-dUXuZr5WenIDlMHdMkvDc1FAu4xdWixTCRgP7RQLBOkkGgwuuzaGSYcOpW4jFxzpzL1ejb8yF620UxAqnBrR9g==} + '@esbuild/netbsd-x64@0.25.7': + resolution: {integrity: sha512-tUZRvLtgLE5OyN46sPSYlgmHoBS5bx2URSrgZdW1L1teWPYVmXh+QN/sKDqkzBo/IHGcKcHLKDhBeVVkO7teEA==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] - '@esbuild/openbsd-arm64@0.25.6': - resolution: {integrity: sha512-l8ZCvXP0tbTJ3iaqdNf3pjaOSd5ex/e6/omLIQCVBLmHTlfXW3zAxQ4fnDmPLOB1x9xrcSi/xtCWFwCZRIaEwg==} + '@esbuild/openbsd-arm64@0.25.7': + resolution: {integrity: sha512-bTJ50aoC+WDlDGBReWYiObpYvQfMjBNlKztqoNUL0iUkYtwLkBQQeEsTq/I1KyjsKA5tyov6VZaPb8UdD6ci6Q==} engines: {node: '>=18'} cpu: [arm64] os: [openbsd] @@ -1143,14 +1146,14 @@ packages: cpu: [x64] os: [openbsd] - '@esbuild/openbsd-x64@0.25.6': - resolution: {integrity: sha512-hKrmDa0aOFOr71KQ/19JC7az1P0GWtCN1t2ahYAf4O007DHZt/dW8ym5+CUdJhQ/qkZmI1HAF8KkJbEFtCL7gw==} + '@esbuild/openbsd-x64@0.25.7': + resolution: {integrity: sha512-TA9XfJrgzAipFUU895jd9j2SyDh9bbNkK2I0gHcvqb/o84UeQkBpi/XmYX3cO1q/9hZokdcDqQxIi6uLVrikxg==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] - '@esbuild/openharmony-arm64@0.25.6': - resolution: {integrity: sha512-+SqBcAWoB1fYKmpWoQP4pGtx+pUUC//RNYhFdbcSA16617cchuryuhOCRpPsjCblKukAckWsV+aQ3UKT/RMPcA==} + '@esbuild/openharmony-arm64@0.25.7': + resolution: {integrity: sha512-5VTtExUrWwHHEUZ/N+rPlHDwVFQ5aME7vRJES8+iQ0xC/bMYckfJ0l2n3yGIfRoXcK/wq4oXSItZAz5wslTKGw==} engines: {node: '>=18'} cpu: [arm64] os: [openharmony] @@ -1173,8 +1176,8 @@ packages: cpu: [x64] os: [sunos] - '@esbuild/sunos-x64@0.25.6': - resolution: {integrity: sha512-dyCGxv1/Br7MiSC42qinGL8KkG4kX0pEsdb0+TKhmJZgCUDBGmyo1/ArCjNGiOLiIAgdbWgmWgib4HoCi5t7kA==} + '@esbuild/sunos-x64@0.25.7': + resolution: {integrity: sha512-umkbn7KTxsexhv2vuuJmj9kggd4AEtL32KodkJgfhNOHMPtQ55RexsaSrMb+0+jp9XL4I4o2y91PZauVN4cH3A==} engines: {node: '>=18'} cpu: [x64] os: [sunos] @@ -1197,8 +1200,8 @@ packages: cpu: [arm64] os: [win32] - '@esbuild/win32-arm64@0.25.6': - resolution: {integrity: sha512-42QOgcZeZOvXfsCBJF5Afw73t4veOId//XD3i+/9gSkhSV6Gk3VPlWncctI+JcOyERv85FUo7RxuxGy+z8A43Q==} + '@esbuild/win32-arm64@0.25.7': + resolution: {integrity: sha512-j20JQGP/gz8QDgzl5No5Gr4F6hurAZvtkFxAKhiv2X49yi/ih8ECK4Y35YnjlMogSKJk931iNMcd35BtZ4ghfw==} engines: {node: '>=18'} cpu: [arm64] os: [win32] @@ -1221,8 +1224,8 @@ packages: cpu: [ia32] os: [win32] - '@esbuild/win32-ia32@0.25.6': - resolution: {integrity: sha512-4AWhgXmDuYN7rJI6ORB+uU9DHLq/erBbuMoAuB4VWJTu5KtCgcKYPynF0YI1VkBNuEfjNlLrFr9KZPJzrtLkrQ==} + '@esbuild/win32-ia32@0.25.7': + resolution: {integrity: sha512-4qZ6NUfoiiKZfLAXRsvFkA0hoWVM+1y2bSHXHkpdLAs/+r0LgwqYohmfZCi985c6JWHhiXP30mgZawn/XrqAkQ==} engines: {node: '>=18'} cpu: [ia32] os: [win32] @@ -1245,8 +1248,8 @@ packages: cpu: [x64] os: [win32] - '@esbuild/win32-x64@0.25.6': - resolution: {integrity: sha512-NgJPHHbEpLQgDH2MjQu90pzW/5vvXIZ7KOnPyNBm92A6WgZ/7b6fJyUBjoumLqeOQQGqY2QjQxRo97ah4Sj0cA==} + '@esbuild/win32-x64@0.25.7': + resolution: {integrity: sha512-FaPsAHTwm+1Gfvn37Eg3E5HIpfR3i6x1AIcla/MkqAIupD4BW3MrSeUqfoTzwwJhk3WE2/KqUn4/eenEJC76VA==} engines: {node: '>=18'} cpu: [x64] os: [win32] @@ -3781,8 +3784,8 @@ packages: engines: {node: '>=12'} hasBin: true - esbuild@0.25.6: - resolution: {integrity: sha512-GVuzuUwtdsghE3ocJ9Bs8PNoF13HNQ5TXbEi2AhvVb8xU1Iwt9Fos9FEamfoee+u/TOsn7GUWc04lz46n2bbTg==} + esbuild@0.25.7: + resolution: {integrity: sha512-daJB0q2dmTzo90L9NjRaohhRWrCzYxWNFTjEi72/h+p5DcY3yn4MacWfDakHmaBaDzDiuLJsCh0+6LK/iX+c+Q==} engines: {node: '>=18'} hasBin: true @@ -7257,7 +7260,7 @@ snapshots: '@esbuild/aix-ppc64@0.19.12': optional: true - '@esbuild/aix-ppc64@0.25.6': + '@esbuild/aix-ppc64@0.25.7': optional: true '@esbuild/android-arm64@0.17.3': @@ -7269,7 +7272,7 @@ snapshots: '@esbuild/android-arm64@0.19.12': optional: true - '@esbuild/android-arm64@0.25.6': + '@esbuild/android-arm64@0.25.7': optional: true '@esbuild/android-arm@0.17.3': @@ -7281,7 +7284,7 @@ snapshots: '@esbuild/android-arm@0.19.12': optional: true - '@esbuild/android-arm@0.25.6': + '@esbuild/android-arm@0.25.7': optional: true '@esbuild/android-x64@0.17.3': @@ -7293,7 +7296,7 @@ snapshots: '@esbuild/android-x64@0.19.12': optional: true - '@esbuild/android-x64@0.25.6': + '@esbuild/android-x64@0.25.7': optional: true '@esbuild/darwin-arm64@0.17.3': @@ -7305,7 +7308,7 @@ snapshots: '@esbuild/darwin-arm64@0.19.12': optional: true - '@esbuild/darwin-arm64@0.25.6': + '@esbuild/darwin-arm64@0.25.7': optional: true '@esbuild/darwin-x64@0.17.3': @@ -7317,7 +7320,7 @@ snapshots: '@esbuild/darwin-x64@0.19.12': optional: true - '@esbuild/darwin-x64@0.25.6': + '@esbuild/darwin-x64@0.25.7': optional: true '@esbuild/freebsd-arm64@0.17.3': @@ -7329,7 +7332,7 @@ snapshots: '@esbuild/freebsd-arm64@0.19.12': optional: true - '@esbuild/freebsd-arm64@0.25.6': + '@esbuild/freebsd-arm64@0.25.7': optional: true '@esbuild/freebsd-x64@0.17.3': @@ -7341,7 +7344,7 @@ snapshots: '@esbuild/freebsd-x64@0.19.12': optional: true - '@esbuild/freebsd-x64@0.25.6': + '@esbuild/freebsd-x64@0.25.7': optional: true '@esbuild/linux-arm64@0.17.3': @@ -7353,7 +7356,7 @@ snapshots: '@esbuild/linux-arm64@0.19.12': optional: true - '@esbuild/linux-arm64@0.25.6': + '@esbuild/linux-arm64@0.25.7': optional: true '@esbuild/linux-arm@0.17.3': @@ -7365,7 +7368,7 @@ snapshots: '@esbuild/linux-arm@0.19.12': optional: true - '@esbuild/linux-arm@0.25.6': + '@esbuild/linux-arm@0.25.7': optional: true '@esbuild/linux-ia32@0.17.3': @@ -7377,7 +7380,7 @@ snapshots: '@esbuild/linux-ia32@0.19.12': optional: true - '@esbuild/linux-ia32@0.25.6': + '@esbuild/linux-ia32@0.25.7': optional: true '@esbuild/linux-loong64@0.17.3': @@ -7389,7 +7392,7 @@ snapshots: '@esbuild/linux-loong64@0.19.12': optional: true - '@esbuild/linux-loong64@0.25.6': + '@esbuild/linux-loong64@0.25.7': optional: true '@esbuild/linux-mips64el@0.17.3': @@ -7401,7 +7404,7 @@ snapshots: '@esbuild/linux-mips64el@0.19.12': optional: true - '@esbuild/linux-mips64el@0.25.6': + '@esbuild/linux-mips64el@0.25.7': optional: true '@esbuild/linux-ppc64@0.17.3': @@ -7413,7 +7416,7 @@ snapshots: '@esbuild/linux-ppc64@0.19.12': optional: true - '@esbuild/linux-ppc64@0.25.6': + '@esbuild/linux-ppc64@0.25.7': optional: true '@esbuild/linux-riscv64@0.17.3': @@ -7425,7 +7428,7 @@ snapshots: '@esbuild/linux-riscv64@0.19.12': optional: true - '@esbuild/linux-riscv64@0.25.6': + '@esbuild/linux-riscv64@0.25.7': optional: true '@esbuild/linux-s390x@0.17.3': @@ -7437,7 +7440,7 @@ snapshots: '@esbuild/linux-s390x@0.19.12': optional: true - '@esbuild/linux-s390x@0.25.6': + '@esbuild/linux-s390x@0.25.7': optional: true '@esbuild/linux-x64@0.17.3': @@ -7449,10 +7452,10 @@ snapshots: '@esbuild/linux-x64@0.19.12': optional: true - '@esbuild/linux-x64@0.25.6': + '@esbuild/linux-x64@0.25.7': optional: true - '@esbuild/netbsd-arm64@0.25.6': + '@esbuild/netbsd-arm64@0.25.7': optional: true '@esbuild/netbsd-x64@0.17.3': @@ -7464,10 +7467,10 @@ snapshots: '@esbuild/netbsd-x64@0.19.12': optional: true - '@esbuild/netbsd-x64@0.25.6': + '@esbuild/netbsd-x64@0.25.7': optional: true - '@esbuild/openbsd-arm64@0.25.6': + '@esbuild/openbsd-arm64@0.25.7': optional: true '@esbuild/openbsd-x64@0.17.3': @@ -7479,10 +7482,10 @@ snapshots: '@esbuild/openbsd-x64@0.19.12': optional: true - '@esbuild/openbsd-x64@0.25.6': + '@esbuild/openbsd-x64@0.25.7': optional: true - '@esbuild/openharmony-arm64@0.25.6': + '@esbuild/openharmony-arm64@0.25.7': optional: true '@esbuild/sunos-x64@0.17.3': @@ -7494,7 +7497,7 @@ snapshots: '@esbuild/sunos-x64@0.19.12': optional: true - '@esbuild/sunos-x64@0.25.6': + '@esbuild/sunos-x64@0.25.7': optional: true '@esbuild/win32-arm64@0.17.3': @@ -7506,7 +7509,7 @@ snapshots: '@esbuild/win32-arm64@0.19.12': optional: true - '@esbuild/win32-arm64@0.25.6': + '@esbuild/win32-arm64@0.25.7': optional: true '@esbuild/win32-ia32@0.17.3': @@ -7518,7 +7521,7 @@ snapshots: '@esbuild/win32-ia32@0.19.12': optional: true - '@esbuild/win32-ia32@0.25.6': + '@esbuild/win32-ia32@0.25.7': optional: true '@esbuild/win32-x64@0.17.3': @@ -7530,7 +7533,7 @@ snapshots: '@esbuild/win32-x64@0.19.12': optional: true - '@esbuild/win32-x64@0.25.6': + '@esbuild/win32-x64@0.25.7': optional: true '@eslint-community/eslint-utils@4.7.0(eslint@8.57.1)': @@ -10425,7 +10428,7 @@ snapshots: esbuild-plugin-inline-worker@0.1.1: dependencies: - esbuild: 0.25.6 + esbuild: 0.25.7 find-cache-dir: 3.3.2 esbuild-register@3.6.0(esbuild@0.19.12): @@ -10511,34 +10514,34 @@ snapshots: '@esbuild/win32-ia32': 0.19.12 '@esbuild/win32-x64': 0.19.12 - esbuild@0.25.6: + esbuild@0.25.7: optionalDependencies: - '@esbuild/aix-ppc64': 0.25.6 - '@esbuild/android-arm': 0.25.6 - '@esbuild/android-arm64': 0.25.6 - '@esbuild/android-x64': 0.25.6 - '@esbuild/darwin-arm64': 0.25.6 - '@esbuild/darwin-x64': 0.25.6 - '@esbuild/freebsd-arm64': 0.25.6 - '@esbuild/freebsd-x64': 0.25.6 - '@esbuild/linux-arm': 0.25.6 - '@esbuild/linux-arm64': 0.25.6 - '@esbuild/linux-ia32': 0.25.6 - '@esbuild/linux-loong64': 0.25.6 - '@esbuild/linux-mips64el': 0.25.6 - '@esbuild/linux-ppc64': 0.25.6 - '@esbuild/linux-riscv64': 0.25.6 - '@esbuild/linux-s390x': 0.25.6 - '@esbuild/linux-x64': 0.25.6 - '@esbuild/netbsd-arm64': 0.25.6 - '@esbuild/netbsd-x64': 0.25.6 - '@esbuild/openbsd-arm64': 0.25.6 - '@esbuild/openbsd-x64': 0.25.6 - '@esbuild/openharmony-arm64': 0.25.6 - '@esbuild/sunos-x64': 0.25.6 - '@esbuild/win32-arm64': 0.25.6 - '@esbuild/win32-ia32': 0.25.6 - '@esbuild/win32-x64': 0.25.6 + '@esbuild/aix-ppc64': 0.25.7 + '@esbuild/android-arm': 0.25.7 + '@esbuild/android-arm64': 0.25.7 + '@esbuild/android-x64': 0.25.7 + '@esbuild/darwin-arm64': 0.25.7 + '@esbuild/darwin-x64': 0.25.7 + '@esbuild/freebsd-arm64': 0.25.7 + '@esbuild/freebsd-x64': 0.25.7 + '@esbuild/linux-arm': 0.25.7 + '@esbuild/linux-arm64': 0.25.7 + '@esbuild/linux-ia32': 0.25.7 + '@esbuild/linux-loong64': 0.25.7 + '@esbuild/linux-mips64el': 0.25.7 + '@esbuild/linux-ppc64': 0.25.7 + '@esbuild/linux-riscv64': 0.25.7 + '@esbuild/linux-s390x': 0.25.7 + '@esbuild/linux-x64': 0.25.7 + '@esbuild/netbsd-arm64': 0.25.7 + '@esbuild/netbsd-x64': 0.25.7 + '@esbuild/openbsd-arm64': 0.25.7 + '@esbuild/openbsd-x64': 0.25.7 + '@esbuild/openharmony-arm64': 0.25.7 + '@esbuild/sunos-x64': 0.25.7 + '@esbuild/win32-arm64': 0.25.7 + '@esbuild/win32-ia32': 0.25.7 + '@esbuild/win32-x64': 0.25.7 escalade@3.2.0: {} diff --git a/src/core/mcp/McpHub.ts b/src/core/mcp/McpHub.ts index b7e5833..872bb02 100644 --- a/src/core/mcp/McpHub.ts +++ b/src/core/mcp/McpHub.ts @@ -119,6 +119,21 @@ const McpSettingsSchema = z.object({ mcpServers: z.record(ServerConfigSchema), }) +// Add type definitions for better type safety +type ConfigObject = Record & { + command?: string + url?: string + type?: string + args?: string[] + env?: Record + headers?: Record + disabled?: boolean + timeout?: number + alwaysAllow?: string[] + watchPaths?: string[] + cwd?: string +} + // 内置服务器工具的 API 响应类型 interface BuiltInToolResponse { name: string @@ -199,11 +214,13 @@ export class McpHub { throw new Error("Server configuration must be an object."); } - // 使用类型保护而不是类型断言 + // Use type guard to ensure config is an object if (typeof config !== 'object' || config === null || Array.isArray(config)) { throw new Error("Server configuration must be an object."); } - const configObj = config; + + // Use proper type assertion with better typing + const configObj = config as ConfigObject; // Detect configuration issues before validation const hasStdioFields = configObj.command !== undefined @@ -214,7 +231,7 @@ export class McpHub { throw new Error(mixedFieldsErrorMessage) } - const mutableConfig = { ...configObj }; // Create a mutable copy + const mutableConfig: ConfigObject = { ...configObj }; // Create a mutable copy with proper type // Check if it's a stdio or SSE config and add type if missing if (!mutableConfig.type) { @@ -380,7 +397,7 @@ export class McpHub { try { const oldFolderContents = await this.app.vault.adapter.list(normalizePath(oldMcpFolderPath)) if (oldFolderContents.files.length === 0 && oldFolderContents.folders.length === 0) { - await this.app.vault.adapter.rmdir(normalizePath(oldMcpFolderPath)) + await this.app.vault.adapter.rmdir(normalizePath(oldMcpFolderPath), false) console.log("Removed empty old MCP configuration directory") } } catch (error) { @@ -416,12 +433,14 @@ export class McpHub { console.log('Attempting to open MCP settings file:', filePath); // 检查文件是否已经打开 - let existingLeaf = null; + let existingLeaf: any = null; this.app.workspace.iterateAllLeaves((leaf) => { if (leaf.view.getViewType() === JSON_VIEW_TYPE) { // 检查视图状态中的文件路径 const viewState = leaf.view.getState(); - if (viewState && (viewState as { filePath?: string }).filePath === filePath) { + if (viewState && typeof viewState === 'object' && 'filePath' in viewState && + viewState !== null && !Array.isArray(viewState) && + (viewState as { filePath: unknown }).filePath === filePath) { existingLeaf = leaf; return false; // 停止遍历 } @@ -488,8 +507,14 @@ export class McpHub { try { // 安全地处理未验证的配置 const serversToConnect = config.mcpServers; - if (serversToConnect && typeof serversToConnect === 'object' && !Array.isArray(serversToConnect)) { - await this.updateServerConnections(serversToConnect as Record); + if (serversToConnect && typeof serversToConnect === 'object' && + !Array.isArray(serversToConnect) && serversToConnect !== null) { + // Use type guard to ensure it's a proper record + const servers: Record = {}; + for (const [key, value] of Object.entries(serversToConnect)) { + servers[key] = value; + } + await this.updateServerConnections(servers); } else { await this.updateServerConnections({}); } @@ -1232,8 +1257,10 @@ export class McpHub { // Remove the server from the settings if (config.mcpServers[serverName]) { - // 使用 Reflect.deleteProperty 而不是 delete 操作符 - Reflect.deleteProperty(config.mcpServers as object, serverName) + // Use delete operator safely with type guard + if (config.mcpServers && typeof config.mcpServers === 'object' && !Array.isArray(config.mcpServers)) { + delete config.mcpServers[serverName]; + } // Write the entire config back const updatedConfig = { @@ -1243,7 +1270,13 @@ export class McpHub { await this.app.vault.adapter.write(configPath, JSON.stringify(updatedConfig, null, 2)) // Update server connections with the correct source - await this.updateServerConnections(config.mcpServers as Record, serverSource) + const servers: Record = {}; + if (config.mcpServers && typeof config.mcpServers === 'object' && !Array.isArray(config.mcpServers)) { + for (const [key, value] of Object.entries(config.mcpServers)) { + servers[key] = value; + } + } + await this.updateServerConnections(servers, serverSource) // vscode.window.showInformationMessage(t("common:info.mcp_server_deleted", { serverName })) } else { @@ -1324,7 +1357,14 @@ export class McpHub { await this.app.vault.adapter.write(configPath, JSON.stringify(updatedConfig, null, 2)) // Update server connections to connect to the new server - await this.updateServerConnections(currentConfig.mcpServers as Record, source) + const servers: Record = {}; + if (currentConfig.mcpServers && typeof currentConfig.mcpServers === 'object' && + !Array.isArray(currentConfig.mcpServers)) { + for (const [key, value] of Object.entries(currentConfig.mcpServers)) { + servers[key] = value; + } + } + await this.updateServerConnections(servers, source) console.log(`Successfully created and connected to MCP server: ${name}`) } catch (error) {