AI-native design editor. Open-source Figma alternative.
feat(settings): unify preferences and integration editors
Danila Poyarkovea4b8e4b97be
diff --git a/AGENTS.md b/AGENTS.mdindex b449c448b..43653097d 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -24,7 +24,7 @@ The root Tauri/Vite app lives in `src/`; app services and state belong under `sr### Settings UI ownership-Settings components own layout, translated copy, confirmation visibility, and emits. Reactive settings workflows live under the owning app domain's `settings/` folder (for example `src/app/ai/models/settings/profile-editor/{use,selection,connection}.ts`), not a global composables bucket. Use `use.ts` for orchestration and focused sibling modules for substantial sub-workflows. Keep persistence and external operations in domain services, and pure option projections as ordinary functions. Return operation outcomes rather than importing dialogs, routers, or toast UI into workflow composables. Keep newly entered secrets short-lived, never expose saved secrets, and guard async results against changed targets. Small presentation-only computed bindings can remain in components.+Settings components own layout, translated copy, confirmation visibility, and emits. Reactive settings workflows live under the owning app domain's `settings/` folder (for example `src/app/ai/models/settings/profile-editor/{use,selection,connection}.ts`), not a global composables bucket. Use `use.ts` for orchestration and focused sibling modules for substantial sub-workflows. Keep persistence and external operations in domain services, and pure option projections as ordinary functions. Return operation outcomes rather than importing dialogs, routers, or toast UI into workflow composables. Keep newly entered secrets short-lived, never expose saved secrets, and guard async results against changed targets. Small presentation-only computed bindings can remain in components. New explicit settings forms use headless VeeValidate v5 with native Valibot schemas and existing controlled UI components; keep form state in the owning settings domain. Saved secrets and replacement-secret drafts stay outside form snapshots and devtools, and persistence/concurrency remain in domain workflows rather than form callbacks.### Public package exportsdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex fdca38421..67aa9f452 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,7 +9,7 @@### Added-- Expose design inspection and undoable layer-property and variable edits to browser agents through experimental WebMCP in supporting browsers.+- Expose design inspection and undoable layer-property and variable edits to browser agents through experimental WebMCP in supporting browsers, with explicit Off, Inspect, and Edit access controls in Settings.- Bind Design JSX spacing, sizing, corners, and typography directly to numeric document variables.- Define component properties and assign instance values in Design JSX using stable property IDs.- Save AI conversations and attachment previews locally, switch between chats, rename or delete them, and browse saved transcripts across documents. Choose whether reasoning stays collapsed, expands while thinking, or stays expanded, with animated disclosure controls that respect reduced motion.@@ -44,7 +44,7 @@- Keep applied and available Effect styles concise, and collapse equal independent corner fields when all four use the same variable.- Keep pixel-grid rounding invisible while showing alignment guides only for real geometry, objects, and canvas/layout guides.- Copy selections with embedded images into Figma while preserving typed geometry, text sizing, images, components, variables, modes, and shared styles for lossless in-app paste.-- Choose whether interface animations follow the system motion preference or stay off, with live updates and a persistent override.+- Choose the app theme and whether animations follow the system or stay off under Appearance in General Settings, with live updates and persistent preferences.- Put unbound fill and stroke style pickers in section headers, preserve applied and missing style rows, and remove the redundant Dimensions heading for text layers.- Open variable pickers below their trigger when space permits, flipping above near the viewport edge.- Keep AI chat preferences with the model overview and edit models in a fixed-size Settings pane with explicit Save and Cancel actions.@@ -55,7 +55,8 @@- Upgrade CanvasKit to 0.41 and use immutable renderer paths through `PathBuilder`.- Upgrade direct model chat providers and transports to AI SDK 7 while retaining the local ACP execution path.- Localize file, clipboard, collaboration, chat, vectorization, storage, recovery, and component-library notifications in every supported language.-- Move MCP connections into their own Settings destination instead of presenting them as part of model configuration.+- Separate local MCP server controls, browser WebMCP access, and remote connections in Settings, with inline searchable tool permissions.+- Show translated field errors and hints in Settings forms, focus the first invalid field on submission, and explain missing requirements instead of silently disabling Save or Test.- Pan horizontally with Shift+wheel while preserving native horizontal trackpad movement.### Fixeddiff --git a/bun.lock b/bun.lockindex 13f430519..bb87d090e 100644--- a/bun.lock+++ b/bun.lock@@ -76,6 +76,7 @@"tinykeys": "^3.1.0","trystero": "^0.22.0","valibot": "^1.4.2",+ "vee-validate": "5.0.0-beta.0","vue": "^3.5.41","vue-router": "^5.2.0","vue-stream-markdown": "2.0.0-beta.5",@@ -1567,6 +1568,8 @@"@standard-schema/spec": ["@standard-schema/[email protected]", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],+ "@standard-schema/utils": ["@standard-schema/[email protected]", "", {}, "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g=="],+"@storybook/addon-a11y": ["@storybook/[email protected]", "", { "dependencies": { "@storybook/global": "^5.0.0", "axe-core": "^4.2.0" }, "peerDependencies": { "storybook": "^10.5.9" } }, "sha512-MvXkoJIVRcZrqhWi+wynYAmFkvTWm5aHdJfYohhgPeEJVDRF91zejtOsN7zPRE/lQvBDY+IiomKxeRN3UhWNVw=="],"@storybook/addon-docs": ["@storybook/[email protected]", "", { "dependencies": { "@mdx-js/react": "^3.0.0", "@storybook/csf-plugin": "10.5.9", "@storybook/icons": "^2.0.2", "@storybook/react-dom-shim": "10.5.9", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "ts-dedent": "^2.0.0" }, "peerDependencies": { "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "storybook": "^10.5.9" }, "optionalPeers": ["@types/react"] }, "sha512-8sFsMkZYrrdqCLdV+hnwTwDF7RaBsBPRwl4wfc8ve9Q/7Yhi5REe/Xjvd8x1yn6fBPPw9tnID9dx6Agdnr81fw=="],@@ -2265,6 +2268,8 @@"cookie-signature": ["[email protected]", "", {}, "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg=="],+ "copy-anything": ["[email protected]", "", {}, "sha512-ufbM3smX/Jbnpk5wcQjzd1MgBpzmqfNETUAyZNrGwU9foRlyHoGzMMBBCRzEhQLBjZfFDE1W2ufPXX2vdWkV8Q=="],+"copy-to-clipboard": ["[email protected]", "", {}, "sha512-gklSft7IuhriZKHKpuoA1fpJSLPNgvUMWMo5BlnzAJm0zNKnznoSv23IjtNqclx8eKi6ZcdvFFzYEER/+U1LoQ=="],"core-js": ["[email protected]", "", {}, "sha512-BRWgOLKkFeCgRudR6zrs8p9XJZcE14grzKMMssoYrk6krtuEZ7MTKPIY5RzOnqsEKIR9kst7wNzphttraT+Yqw=="],@@ -3819,6 +3824,8 @@"spdx-license-ids": ["[email protected]", "", {}, "sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw=="],+ "speakingurl": ["[email protected]", "", {}, "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ=="],+"specificity": ["[email protected]", "", { "bin": { "specificity": "./bin/specificity" } }, "sha512-1klA3Gi5PD1Wv9Q0wUoOQN1IWAuPu0D1U03ThXTr0cJ20+/iq2tHSDnK7Kk/0LXJ1ztUB2/1Os0wKmfyNgUQfg=="],"split2": ["[email protected]", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="],@@ -3883,6 +3890,8 @@"sucrase": ["[email protected]", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.2", "commander": "^4.0.0", "lines-and-columns": "^1.1.6", "mz": "^2.7.0", "pirates": "^4.0.1", "tinyglobby": "^0.2.11", "ts-interface-checker": "^0.1.9" }, "bin": { "sucrase": "bin/sucrase", "sucrase-node": "bin/sucrase-node" } }, "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw=="],+ "superjson": ["[email protected]", "", { "dependencies": { "copy-anything": "^4" } }, "sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA=="],+"supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],"supports-hyperlinks": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0", "supports-color": "^7.0.0" } }, "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig=="],@@ -4003,7 +4012,7 @@"type-detect": ["[email protected]", "", {}, "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw=="],- "type-fest": ["[email protected]", "", { "dependencies": { "tagged-tag": "^1.0.0" } }, "sha512-YGYEVz3Fm5iy/AybuA0oyNFq7H4CgQNfRp/qfe8nurE1kuCeNm3/vfm9X4Mtl+qLyaKJUh5xrFZwogr41SMjYA=="],+ "type-fest": ["[email protected]", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="],"type-is": ["[email protected]", "", { "dependencies": { "content-type": "^2.0.0", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA=="],@@ -4119,6 +4128,8 @@"vary": ["[email protected]", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="],+ "vee-validate": ["[email protected]", "", { "dependencies": { "@standard-schema/spec": "^1.0.0", "@standard-schema/utils": "^0.3.0", "@vue/devtools-api": "^7.5.2", "type-fest": "^4.8.3" }, "peerDependencies": { "vue": "^3.4.26" } }, "sha512-uGIRnODDMM0A8Weu8AJcZFFJceUpgbSX6G4UYZgWhBc90VcXDK+v7yO16G+sj+6vU1eML11M2BH4HxwoPE62rw=="],+"verkit": ["[email protected]", "", {}, "sha512-zj/ob3UsvJGN0whEAKFp53REA5X66hvffVqoCtVQAakJKnKlH+/PcOfMoFwIG/o4rElqLv/ycAFlx8ZlXUorCg=="],"vfile": ["[email protected]", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile-message": "^4.0.0" } }, "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q=="],@@ -4407,6 +4418,8 @@"@shikijs/vitepress-twoslash/magic-string": ["[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vCfXkt3lIJha02CjPT1igeysyHVfCsEpIeD20O+X9aJ2hML3/kKx8E9Iv1FB+aMSAlDOEAtpRWzuooQCrYwdUg=="],+ "@storybook/vue3/type-fest": ["[email protected]", "", { "dependencies": { "tagged-tag": "^1.0.0" } }, "sha512-YGYEVz3Fm5iy/AybuA0oyNFq7H4CgQNfRp/qfe8nurE1kuCeNm3/vfm9X4Mtl+qLyaKJUh5xrFZwogr41SMjYA=="],+"@storybook/vue3-vite/typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],"@tailwindcss/node/lightningcss": ["[email protected]", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.32.0", "lightningcss-darwin-arm64": "1.32.0", "lightningcss-darwin-x64": "1.32.0", "lightningcss-freebsd-x64": "1.32.0", "lightningcss-linux-arm-gnueabihf": "1.32.0", "lightningcss-linux-arm64-gnu": "1.32.0", "lightningcss-linux-arm64-musl": "1.32.0", "lightningcss-linux-x64-gnu": "1.32.0", "lightningcss-linux-x64-musl": "1.32.0", "lightningcss-win32-arm64-msvc": "1.32.0", "lightningcss-win32-x64-msvc": "1.32.0" } }, "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ=="],@@ -4525,8 +4538,6 @@"create-wdio/commander": ["[email protected]", "", {}, "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw=="],- "create-wdio/type-fest": ["[email protected]", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="],-"degenerator/ast-types": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.1" } }, "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w=="],"detective-typescript/@typescript-eslint/typescript-estree": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/project-service": "8.67.0", "@typescript-eslint/tsconfig-utils": "8.67.0", "@typescript-eslint/types": "8.67.0", "@typescript-eslint/visitor-keys": "8.67.0", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-EKQBCE9yNlRJYm7jdTW5AhDacDUmSwQb0FAJAmK2EKYrNXIsa2vxcSZx6PvJ/dEdI6lS+Y9W+EXckLj0iPFGcw=="],@@ -4667,12 +4678,8 @@"read-pkg/parse-json": ["[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.21.4", "error-ex": "^1.3.2", "json-parse-even-better-errors": "^3.0.0", "lines-and-columns": "^2.0.3", "type-fest": "^3.8.0" } }, "sha512-SgOTCX/EZXtZxBE5eJ97P4yGM5n37BwRU+YMsH4vNzFqJV/oWFXXCmwFlgWUM4PrakybVOueJJ6pwHqSVhTFDw=="],- "read-pkg/type-fest": ["[email protected]", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="],-"read-pkg-up/find-up": ["[email protected]", "", { "dependencies": { "locate-path": "^7.1.0", "path-exists": "^5.0.0" } }, "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw=="],- "read-pkg-up/type-fest": ["[email protected]", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="],-"readdir-glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw=="],"recursive-readdir/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="],@@ -4693,8 +4700,6 @@"seek-bzip/commander": ["[email protected]", "", {}, "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA=="],- "serialize-error/type-fest": ["[email protected]", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="],-"stack-utils/escape-string-regexp": ["[email protected]", "", {}, "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w=="],"steiger/@feature-sliced/steiger-plugin": ["@feature-sliced/[email protected]", "", { "dependencies": { "@feature-sliced/filesystem": "^3.1.0", "fastest-levenshtein": "^1.0.16", "lodash-es": "^4.17.21", "pluralize": "^8.0.0", "tsconfck": "^3.1.6", "web-tree-sitter": "^0.26.8" } }, "sha512-TO7DbHYcldgyasVK5iwoou+J0rJonDgH18B+IBQqXedeB2/MURpkbUw9PFPV84pysG5C3uvIDhk+lLMW2MgQ4Q=="],@@ -4735,6 +4740,8 @@"unplugin-vue-components/chokidar": ["[email protected]", "", { "dependencies": { "readdirp": "^5.0.0" } }, "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw=="],+ "vee-validate/@vue/devtools-api": ["@vue/[email protected]", "", { "dependencies": { "@vue/devtools-kit": "^7.7.10" } }, "sha512-KxtEpUOOpFz/qOGRrAwA36QF7DqIA+FXgCYit9mk9wjbaZt0sXOFz81ElOZtKA4HbWHUdwNjZHBFsFFyp5BZiA=="],+"vite/rolldown": ["[email protected]", "", { "dependencies": { "@oxc-project/types": "=0.139.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm64": "1.1.5", "@rolldown/binding-darwin-arm64": "1.1.5", "@rolldown/binding-darwin-x64": "1.1.5", "@rolldown/binding-freebsd-x64": "1.1.5", "@rolldown/binding-linux-arm-gnueabihf": "1.1.5", "@rolldown/binding-linux-arm64-gnu": "1.1.5", "@rolldown/binding-linux-arm64-musl": "1.1.5", "@rolldown/binding-linux-ppc64-gnu": "1.1.5", "@rolldown/binding-linux-s390x-gnu": "1.1.5", "@rolldown/binding-linux-x64-gnu": "1.1.5", "@rolldown/binding-linux-x64-musl": "1.1.5", "@rolldown/binding-openharmony-arm64": "1.1.5", "@rolldown/binding-wasm32-wasi": "1.1.5", "@rolldown/binding-win32-arm64-msvc": "1.1.5", "@rolldown/binding-win32-x64-msvc": "1.1.5" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-t9z29cJjXf/vxQ8dyhCSpt6H6aSwHTk8cT5I3iy6SMXuFpk5mB6PL6XfC8PCwrPTx93udwKUm9HRteAlTGBLiA=="],"vitepress/vite": ["[email protected]", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.5", "postcss": "^8.5.25", "rolldown": "~1.2.1", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.4.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-EU/eS7BH3XROHh2YnBefjM6DBKA6ZeMZEYQbj7NLWg5wHYlhB8B/Mayd5XsgWq+NFYccDOTemRpdETWR6Ka/lw=="],@@ -5197,6 +5204,8 @@"unplugin-vue-components/chokidar/readdirp": ["[email protected]", "", {}, "sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA=="],+ "vee-validate/@vue/devtools-api/@vue/devtools-kit": ["@vue/[email protected]", "", { "dependencies": { "@vue/devtools-shared": "^7.7.10", "birpc": "^2.3.0", "hookable": "^5.5.3", "mitt": "^3.0.1", "perfect-debounce": "^1.0.0", "speakingurl": "^14.0.1", "superjson": "^2.2.2" } }, "sha512-3WNi2Kq4tbpVbmhml7RiphmAt0279oh3fKNeWMQIrltfX8Q91b4i5PL8DtyNKdwmcsGrV4fg+erwWOmD05CLIw=="],+"vite/rolldown/@oxc-project/types": ["@oxc-project/[email protected]", "", {}, "sha512-r9gHphtCs+1M7J0pw6Sn/hh/Wpa/iQrOOkrNAlVLF/gHq+/CJmHIWKKUUhdWjcD6CIa8idarspCsASiXCXvFUw=="],"vite/rolldown/@rolldown/binding-android-arm64": ["@rolldown/[email protected]", "", { "os": "android", "cpu": "arm64" }, "sha512-lZg8fqIv2v7FF237bwMgzGZEJvGL79/s5knJ/i6FmsGF4XXlzccZ4jb+TrFIxtSSxFtIpdsgrPZeMk1I9AFcyQ=="],@@ -5369,6 +5378,12 @@"storybook/oxc-parser/@oxc-parser/binding-wasm32-wasi/@emnapi/runtime": ["@emnapi/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-3U4+MIWHImeyu1wnmVygh5WlgfYDtyf0k8AbLhMFxOipihf6nrWC4syIm/SwEeec0mNSafiiNnMJwbza/Is6Lw=="],+ "vee-validate/@vue/devtools-api/@vue/devtools-kit/@vue/devtools-shared": ["@vue/[email protected]", "", { "dependencies": { "rfdc": "^1.4.1" } }, "sha512-wOPslzB8vTvpxwdaOcR2qAbwmuSP0L+rhpoC6Cf56V3Jip+HWb7PQQXOUPgBNQARpXsbQX/+mvi8kKucmBGRwQ=="],++ "vee-validate/@vue/devtools-api/@vue/devtools-kit/hookable": ["[email protected]", "", {}, "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ=="],++ "vee-validate/@vue/devtools-api/@vue/devtools-kit/perfect-debounce": ["[email protected]", "", {}, "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA=="],+"workbox-build/glob/jackspeak/@isaacs/cliui": ["@isaacs/[email protected]", "", {}, "sha512-AokJm4tuBHillT+FpMtxQ60n8ObyXBatq7jD2/JA9dxbDDokKQm8KMht5ibGzLVU9IJDIKK4TPKgMHEYMn3lMg=="],"@waku/enr/@libp2p/peer-id/@libp2p/crypto/@libp2p/interface/@multiformats/multiaddr": ["@multiformats/[email protected]", "", { "dependencies": { "@chainsafe/is-ip": "^2.0.1", "multiformats": "^14.0.0", "uint8-varint": "^3.0.0", "uint8arrays": "^6.1.1" } }, "sha512-mEqqJ4r3a/uuFMTpRkU316wGNIDQNhuVWpm+ebKTQeYsfv9jXbPONWM6VVnj3KGUrwfsX7GZOyp4TFqEA2SPCw=="],diff --git a/package.json b/package.jsonindex abac2d10b..f8ec5dcfa 100644--- a/package.json+++ b/package.json@@ -147,6 +147,7 @@"tinykeys": "^3.1.0","trystero": "^0.22.0","valibot": "^1.4.2",+ "vee-validate": "5.0.0-beta.0","vue": "^3.5.41","vue-router": "^5.2.0","vue-stream-markdown": "2.0.0-beta.5",diff --git a/packages/docs/programmable/mcp-server.md b/packages/docs/programmable/mcp-server.mdindex 84555ab07..718ca8161 100644--- a/packages/docs/programmable/mcp-server.md+++ b/packages/docs/programmable/mcp-server.md@@ -11,9 +11,13 @@ Two transports: **stdio** for MCP clients, and **Streamable HTTP** for browser eTool definitions own native Valibot input schemas, execution/mutation metadata, capabilities, and explicit browser exposure. AI and MCP consume the same schema through Standard Schema; WebMCP derives its JSON Schema from that input. Numeric strings are accepted consistently across adapters, while non-finite values are rejected. Programmatic integrations use MCP SDK v2; custom tools replace the former `params`/`ParamDef` contract with `input` and execution metadata.-## Browser-native WebMCP (experimental)+## Browser-native WebMCP (experimental) {#webmcp}-In browsers exposing `document.modelContext`, OpenPencil registers a reviewed set of tools directly in the workspace. Browser agents can inspect nodes, JSX, variables, components, and design patterns, and edit existing layer properties and variable values without installing or connecting an MCP server.+WebMCP is **off by default**. Open **Settings → MCP & automation → WebMCP** and choose **Inspect** for read-only access or **Edit** to also allow scoped, undoable changes. **Off** unregisters all browser tools; changing modes revokes the previous registrations immediately. This preference is independent of local MCP authentication, tool switches, and outbound connections.++For local testing, use a Chrome version exposing `document.modelContext`, enable `chrome://flags/#enable-webmcp-testing`, and relaunch the browser. Open a document, enable access in Settings, and connect a WebMCP-capable browser agent or the [Model Context Tool Inspector](https://developer.chrome.com/docs/ai/webmcp). Settings shows browser support and registration status. See the [Chrome WebMCP guide](https://developer.chrome.com/docs/ai/webmcp) for current availability.++In supported browsers, OpenPencil registers the selected reviewed set of tools directly in the workspace. Browser agents can inspect nodes, JSX, variables, components, and design patterns, and edit existing layer properties and variable values without installing or connecting an MCP server.Tools target the document and page active when the call starts. Switching tabs does not redirect an in-flight call. Closing the workspace unregisters the tools. Tool inputs are validated and large inspection results require a narrower query. Oversized editing results are omitted with a committed-edit notice rather than reporting a successful edit as failed.diff --git a/packages/vue/src/i18n/locales/de/automation.json b/packages/vue/src/i18n/locales/de/automation.jsonindex 4eaaa5bf1..eb6b964b5 100644--- a/packages/vue/src/i18n/locales/de/automation.json+++ b/packages/vue/src/i18n/locales/de/automation.json@@ -23,7 +23,7 @@"authentication": "Authentifizierung erforderlich","authenticationDescription": "Den lokalen MCP-Endpunkt mit einem Bearer-Token schützen. Nur auf vertrauenswürdigen Geräten deaktivieren. Server neu starten, um Änderungen anzuwenden.","rootDirectory": "MCP-Stammverzeichnis",- "rootDirectoryDefault": "Benutzerverzeichnis (Standard)",+ "rootDirectoryDefault": "Standardverzeichnis des Servers","chooseRootDirectory": "Ordner auswählen","useDefaultRoot": "Standard verwenden","rootDirectoryDescription": "Dateiwerkzeuge sind auf diesen Ordner beschränkt. MCP-Server neu starten, um Änderungen anzuwenden.",@@ -42,5 +42,20 @@"statusStarting": "Wird gestartet","statusRunning": "Läuft","statusStopped": "Gestoppt",- "statusError": "Fehler"+ "statusError": "Fehler",+ "localServer": "Lokaler Server",+ "webmcpDescription": "Browser-Agenten können dieses Dokument direkt verwenden, ohne lokalen MCP-Server oder Bearer-Token. Die Einstellungen des lokalen Servers gelten hier nicht.",+ "browserAccess": "Zugriff für Browser-Agenten",+ "accessOff": "Aus",+ "accessInspect": "Prüfen",+ "accessEdit": "Bearbeiten",+ "accessOffDescription": "Browser-Agenten werden keine Tools bereitgestellt.",+ "accessInspectDescription": "Agenten können das Dokument prüfen, aber nicht ändern.",+ "accessEditDescription": "Agenten können auch vorhandene Eigenschaften, Texte und Variablenwerte bearbeiten. Änderungen sind rückgängig machbar; das Erstellen oder Löschen von Inhalten, Skripte und Dateizugriffe sind ausgeschlossen.",+ "webmcpUnsupported": "Dieser Browser stellt WebMCP nicht bereit. Verwende eine unterstützte Chrome-Version, aktiviere WebMCP-Tests und starte den Browser neu.",+ "webmcpSetup": "WebMCP-Einrichtungsanleitung",+ "noMatchingTools": "Keine Tools entsprechen deiner Suche.",+ "connectionNameHint": "Verwende einen eindeutigen Namen mit höchstens 80 Zeichen. Der Name open-pencil ist reserviert.",+ "connectionNameInvalid": "Wähle einen eindeutigen Namen mit höchstens 80 Zeichen, der nicht open-pencil lautet.",+ "serverURLHint": "Verwende HTTPS. HTTP ist nur für localhost oder eine Loopback-Adresse erlaubt. Die URL darf keine Zugangsdaten enthalten."}diff --git a/packages/vue/src/i18n/locales/de/settings.json b/packages/vue/src/i18n/locales/de/settings.jsonindex 659ef1e5e..e3e917f90 100644--- a/packages/vue/src/i18n/locales/de/settings.json+++ b/packages/vue/src/i18n/locales/de/settings.json@@ -1,4 +1,5 @@{+ "appearance": "Darstellung","snapToGeometry": "An Geometrie ausrichten","snapToGeometryDescription": "Gezogene Vektorpunkte an anderen Punkten im Pfad ausrichten.","snapToObjects": "An Objekten ausrichten",@@ -22,5 +23,25 @@"storage": "Cloud-Speicher","animations": "Animationen","animationsSystem": "Systemeinstellung",- "animationsOff": "Aus"+ "animationsOff": "Aus",+ "discardChanges": "Änderungen verwerfen?",+ "discardChangesDescription": "Deine ungespeicherten Änderungen gehen verloren.",+ "keepEditing": "Weiter bearbeiten",+ "discard": "Verwerfen",+ "edit": "Bearbeiten",+ "configured": "Konfiguriert",+ "notConfigured": "Nicht konfiguriert",+ "saveChangesDescription": "Änderungen werden beim Speichern übernommen.",+ "partialSaveWarning": "Einige Änderungen sind möglicherweise bereits gespeichert. Prüfe die Einstellungen und versuche es erneut.",+ "requiredField": "Dieses Feld ist erforderlich.",+ "invalidURL": "Gib eine gültige HTTP- oder HTTPS-URL ohne eingebettete Zugangsdaten ein.",+ "saveFailed": "Die Änderungen konnten nicht gespeichert werden. Prüfe die Einstellungen und versuche es erneut.",+ "connectionFailed": "Verbindung fehlgeschlagen. Prüfe Endpunkt und Zugangsdaten und versuche es erneut.",+ "savedCredentialHint": "Leer lassen, um die gespeicherten Zugangsdaten beizubehalten. Mit Löschen entfernen.",+ "optionalCredentialHint": "Optional. Füge einen Schlüssel hinzu, um diesen Dienst zu aktivieren.",+ "configureStorageHint": "Konfiguriere die Verbindung, bevor du den Arbeitsbereich öffnest.",+ "modelNameHint": "Ein Name, den du in der Modellauswahl wiedererkennst.",+ "modelIDHint": "Verwende die genaue Modell-ID deines Anbieters.",+ "baseURLHint": "Gib den API-Endpunkt einschließlich des erforderlichen Pfads ein.",+ "designToolsRequired": "Das Design-Modell muss Werkzeuge unterstützen. Wähle ein kompatibles Modell oder aktiviere die Werkzeugunterstützung in den erweiterten Einstellungen."}diff --git a/packages/vue/src/i18n/locales/es/automation.json b/packages/vue/src/i18n/locales/es/automation.jsonindex 8a8269903..a61a6836e 100644--- a/packages/vue/src/i18n/locales/es/automation.json+++ b/packages/vue/src/i18n/locales/es/automation.json@@ -23,7 +23,7 @@"authentication": "Requerir autenticación","authenticationDescription": "Protege el endpoint MCP local con un token Bearer. Desactívalo solo en un equipo de confianza. Reinicia el servidor para aplicar los cambios.","rootDirectory": "Directorio raíz MCP",- "rootDirectoryDefault": "Directorio personal del usuario (predeterminado)",+ "rootDirectoryDefault": "Carpeta predeterminada del servidor","chooseRootDirectory": "Elegir carpeta","useDefaultRoot": "Usar predeterminado","rootDirectoryDescription": "Las herramientas de archivos están limitadas a esta carpeta. Reinicia el servidor MCP para aplicar los cambios.",@@ -42,5 +42,20 @@"statusStarting": "Iniciando","statusRunning": "En ejecución","statusStopped": "Detenido",- "statusError": "Error"+ "statusError": "Error",+ "localServer": "Servidor local",+ "webmcpDescription": "Permite a los agentes del navegador usar este documento directamente, sin servidor MCP local ni token de portador. La configuración del servidor local no se aplica aquí.",+ "browserAccess": "Acceso de agentes del navegador",+ "accessOff": "Desactivado",+ "accessInspect": "Inspeccionar",+ "accessEdit": "Editar",+ "accessOffDescription": "No se exponen herramientas a los agentes del navegador.",+ "accessInspectDescription": "Los agentes pueden inspeccionar el documento, pero no modificarlo.",+ "accessEditDescription": "Los agentes también pueden editar propiedades, texto y valores de variables existentes. Los cambios se pueden deshacer; se excluyen la creación o eliminación de contenido, los scripts y el acceso a archivos.",+ "webmcpUnsupported": "Este navegador no ofrece WebMCP. Usa una versión compatible de Chrome, activa las pruebas de WebMCP y reinicia el navegador.",+ "webmcpSetup": "Guía de configuración de WebMCP",+ "noMatchingTools": "Ninguna herramienta coincide con tu búsqueda.",+ "connectionNameHint": "Usa un nombre único de hasta 80 caracteres. El nombre open-pencil está reservado.",+ "connectionNameInvalid": "Elige un nombre único de hasta 80 caracteres que no sea open-pencil.",+ "serverURLHint": "Usa HTTPS. HTTP solo se permite para localhost o una dirección de bucle local. No incluyas credenciales en la URL."}diff --git a/packages/vue/src/i18n/locales/es/settings.json b/packages/vue/src/i18n/locales/es/settings.jsonindex 89f763986..3ff3d5272 100644--- a/packages/vue/src/i18n/locales/es/settings.json+++ b/packages/vue/src/i18n/locales/es/settings.json@@ -1,4 +1,5 @@{+ "appearance": "Apariencia","snapToGeometry": "Ajustar a la geometría","snapToGeometryDescription": "Alinea los puntos vectoriales arrastrados con otros puntos del trazado.","snapToObjects": "Ajustar a objetos",@@ -22,5 +23,25 @@"storage": "Almacenamiento en la nube","animations": "Animaciones","animationsSystem": "Seguir al sistema",- "animationsOff": "Desactivadas"+ "animationsOff": "Desactivadas",+ "discardChanges": "¿Descartar los cambios?",+ "discardChangesDescription": "Se perderán los cambios sin guardar.",+ "keepEditing": "Seguir editando",+ "discard": "Descartar",+ "edit": "Editar",+ "configured": "Configurado",+ "notConfigured": "Sin configurar",+ "saveChangesDescription": "Los cambios se aplican al guardar.",+ "partialSaveWarning": "Es posible que algunos cambios ya se hayan guardado. Revisa la configuración e inténtalo de nuevo.",+ "requiredField": "Este campo es obligatorio.",+ "invalidURL": "Introduce una URL HTTP o HTTPS válida sin credenciales incorporadas.",+ "saveFailed": "No se pudieron guardar los cambios. Revisa los ajustes e inténtalo de nuevo.",+ "connectionFailed": "No se pudo conectar. Revisa el endpoint y las credenciales e inténtalo de nuevo.",+ "savedCredentialHint": "Déjalo vacío para conservar la credencial guardada. Usa Borrar para eliminarla.",+ "optionalCredentialHint": "Opcional. Añade una clave para activar este servicio.",+ "configureStorageHint": "Configura la conexión antes de abrir el espacio de trabajo.",+ "modelNameHint": "Un nombre que puedas reconocer en el selector de modelos.",+ "modelIDHint": "Usa el identificador exacto del modelo que proporciona tu proveedor.",+ "baseURLHint": "Introduce el endpoint de la API, incluida cualquier ruta necesaria.",+ "designToolsRequired": "El modelo de diseño debe admitir herramientas. Elige un modelo compatible o activa las herramientas en los ajustes avanzados."}diff --git a/packages/vue/src/i18n/locales/fr/automation.json b/packages/vue/src/i18n/locales/fr/automation.jsonindex a8d076a67..70bb86dd0 100644--- a/packages/vue/src/i18n/locales/fr/automation.json+++ b/packages/vue/src/i18n/locales/fr/automation.json@@ -23,7 +23,7 @@"authentication": "Exiger une authentification","authenticationDescription": "Protégez le point de terminaison MCP local avec un jeton Bearer. Désactivez-le uniquement sur une machine de confiance. Redémarrez le serveur pour appliquer les modifications.","rootDirectory": "Répertoire racine MCP",- "rootDirectoryDefault": "Répertoire personnel (par défaut)",+ "rootDirectoryDefault": "Dossier par défaut du serveur","chooseRootDirectory": "Choisir un dossier","useDefaultRoot": "Utiliser la valeur par défaut","rootDirectoryDescription": "Les outils de fichiers sont limités à ce dossier. Redémarrez le serveur MCP pour appliquer les modifications.",@@ -42,5 +42,20 @@"statusStarting": "Démarrage","statusRunning": "En cours","statusStopped": "Arrêté",- "statusError": "Erreur"+ "statusError": "Erreur",+ "localServer": "Serveur local",+ "webmcpDescription": "Permettez aux agents du navigateur d’utiliser directement ce document, sans serveur MCP local ni jeton Bearer. Les paramètres du serveur local ne s’appliquent pas ici.",+ "browserAccess": "Accès des agents du navigateur",+ "accessOff": "Désactivé",+ "accessInspect": "Inspecter",+ "accessEdit": "Modifier",+ "accessOffDescription": "Aucun outil n’est exposé aux agents du navigateur.",+ "accessInspectDescription": "Les agents peuvent inspecter le document, mais pas le modifier.",+ "accessEditDescription": "Les agents peuvent aussi modifier les propriétés, le texte et les valeurs de variables existants. Les modifications sont annulables ; la création ou la suppression de contenu, les scripts et l’accès aux fichiers sont exclus.",+ "webmcpUnsupported": "Ce navigateur ne propose pas WebMCP. Utilisez une version compatible de Chrome, activez les tests WebMCP, puis relancez le navigateur.",+ "webmcpSetup": "Guide de configuration de WebMCP",+ "noMatchingTools": "Aucun outil ne correspond à votre recherche.",+ "connectionNameHint": "Utilisez un nom unique de 80 caractères maximum. Le nom open-pencil est réservé.",+ "connectionNameInvalid": "Choisissez un nom unique de 80 caractères maximum, différent de open-pencil.",+ "serverURLHint": "Utilisez HTTPS. HTTP n’est autorisé que pour localhost ou une adresse de bouclage. N’incluez pas d’identifiants dans l’URL."}diff --git a/packages/vue/src/i18n/locales/fr/settings.json b/packages/vue/src/i18n/locales/fr/settings.jsonindex 4bda03649..3ce5cdce4 100644--- a/packages/vue/src/i18n/locales/fr/settings.json+++ b/packages/vue/src/i18n/locales/fr/settings.json@@ -1,4 +1,5 @@{+ "appearance": "Apparence","snapToGeometry": "Aligner sur la géométrie","snapToGeometryDescription": "Aligne les points vectoriels déplacés sur les autres points du tracé.","snapToObjects": "Aligner sur les objets",@@ -22,5 +23,25 @@"storage": "Stockage cloud","animations": "Animations","animationsSystem": "Suivre le système",- "animationsOff": "Désactivées"+ "animationsOff": "Désactivées",+ "discardChanges": "Abandonner les modifications ?",+ "discardChangesDescription": "Vos modifications non enregistrées seront perdues.",+ "keepEditing": "Continuer à modifier",+ "discard": "Abandonner",+ "edit": "Modifier",+ "configured": "Configuré",+ "notConfigured": "Non configuré",+ "saveChangesDescription": "Les modifications s’appliquent à l’enregistrement.",+ "partialSaveWarning": "Certaines modifications sont peut-être déjà enregistrées. Vérifiez les paramètres et réessayez.",+ "requiredField": "Ce champ est obligatoire.",+ "invalidURL": "Saisissez une URL HTTP ou HTTPS valide sans identifiants intégrés.",+ "saveFailed": "Impossible d’enregistrer ces modifications. Vérifiez les paramètres et réessayez.",+ "connectionFailed": "Connexion impossible. Vérifiez le point d’accès et les identifiants, puis réessayez.",+ "savedCredentialHint": "Laissez vide pour conserver l’identifiant enregistré. Utilisez Effacer pour le supprimer.",+ "optionalCredentialHint": "Facultatif. Ajoutez une clé pour activer ce service.",+ "configureStorageHint": "Configurez la connexion avant d’ouvrir l’espace de travail.",+ "modelNameHint": "Un nom que vous reconnaîtrez dans le sélecteur de modèles.",+ "modelIDHint": "Utilisez l’identifiant exact du modèle fourni par votre fournisseur.",+ "baseURLHint": "Saisissez le point d’accès de l’API, y compris le chemin requis.",+ "designToolsRequired": "Le modèle de conception doit prendre en charge les outils. Choisissez un modèle compatible ou activez les outils dans les paramètres avancés."}diff --git a/packages/vue/src/i18n/locales/it/automation.json b/packages/vue/src/i18n/locales/it/automation.jsonindex 1f4fc8c69..afa4b37d0 100644--- a/packages/vue/src/i18n/locales/it/automation.json+++ b/packages/vue/src/i18n/locales/it/automation.json@@ -23,7 +23,7 @@"authentication": "Richiedi autenticazione","authenticationDescription": "Proteggi l’endpoint MCP locale con un token Bearer. Disabilita l’autenticazione solo su un computer attendibile. Riavvia il server per applicare le modifiche.","rootDirectory": "Directory radice MCP",- "rootDirectoryDefault": "Directory home dell’utente (predefinita)",+ "rootDirectoryDefault": "Cartella predefinita del server","chooseRootDirectory": "Scegli una cartella","useDefaultRoot": "Usa la directory predefinita","rootDirectoryDescription": "Gli strumenti per i file sono limitati a questa cartella. Riavvia il server MCP per applicare le modifiche.",@@ -42,5 +42,20 @@"statusStarting": "Avvio","statusRunning": "In esecuzione","statusStopped": "Arrestato",- "statusError": "Errore"+ "statusError": "Errore",+ "localServer": "Server locale",+ "webmcpDescription": "Consenti agli agenti del browser di usare direttamente questo documento, senza un server MCP locale o un token Bearer. Le impostazioni del server locale non si applicano qui.",+ "browserAccess": "Accesso degli agenti del browser",+ "accessOff": "Disattivato",+ "accessInspect": "Ispeziona",+ "accessEdit": "Modifica",+ "accessOffDescription": "Nessuno strumento viene esposto agli agenti del browser.",+ "accessInspectDescription": "Gli agenti possono ispezionare il documento, ma non modificarlo.",+ "accessEditDescription": "Gli agenti possono anche modificare proprietà, testo e valori delle variabili esistenti. Le modifiche sono annullabili; la creazione o eliminazione di contenuti, gli script e l’accesso ai file sono esclusi.",+ "webmcpUnsupported": "Questo browser non espone WebMCP. Usa una versione compatibile di Chrome, abilita i test WebMCP e riavvia il browser.",+ "webmcpSetup": "Guida alla configurazione di WebMCP",+ "noMatchingTools": "Nessuno strumento corrisponde alla ricerca.",+ "connectionNameHint": "Usa un nome univoco di massimo 80 caratteri. Il nome open-pencil è riservato.",+ "connectionNameInvalid": "Scegli un nome univoco di massimo 80 caratteri, diverso da open-pencil.",+ "serverURLHint": "Usa HTTPS. HTTP è consentito solo per localhost o un indirizzo di loopback. Non includere credenziali nell’URL."}diff --git a/packages/vue/src/i18n/locales/it/settings.json b/packages/vue/src/i18n/locales/it/settings.jsonindex 5934c7fcd..b93047ca3 100644--- a/packages/vue/src/i18n/locales/it/settings.json+++ b/packages/vue/src/i18n/locales/it/settings.json@@ -1,4 +1,5 @@{+ "appearance": "Aspetto","snapToGeometry": "Aggancia alla geometria","snapToGeometryDescription": "Allinea i punti vettoriali trascinati agli altri punti del tracciato.","snapToObjects": "Aggancia agli oggetti",@@ -22,5 +23,25 @@"storage": "Archiviazione cloud","animations": "Animazioni","animationsSystem": "Segui il sistema",- "animationsOff": "Disattivate"+ "animationsOff": "Disattivate",+ "discardChanges": "Scartare le modifiche?",+ "discardChangesDescription": "Le modifiche non salvate andranno perse.",+ "keepEditing": "Continua a modificare",+ "discard": "Scarta",+ "edit": "Modifica",+ "configured": "Configurato",+ "notConfigured": "Non configurato",+ "saveChangesDescription": "Le modifiche vengono applicate al salvataggio.",+ "partialSaveWarning": "Alcune modifiche potrebbero essere già salvate. Controlla le impostazioni e riprova.",+ "requiredField": "Questo campo è obbligatorio.",+ "invalidURL": "Inserisci un URL HTTP o HTTPS valido senza credenziali incorporate.",+ "saveFailed": "Impossibile salvare le modifiche. Controlla le impostazioni e riprova.",+ "connectionFailed": "Connessione non riuscita. Controlla l’endpoint e le credenziali, poi riprova.",+ "savedCredentialHint": "Lascia vuoto per mantenere la credenziale salvata. Usa Cancella per rimuoverla.",+ "optionalCredentialHint": "Facoltativo. Aggiungi una chiave per attivare questo servizio.",+ "configureStorageHint": "Configura la connessione prima di aprire l’area di lavoro.",+ "modelNameHint": "Un nome riconoscibile nel selettore dei modelli.",+ "modelIDHint": "Usa l’identificatore esatto del modello fornito dal provider.",+ "baseURLHint": "Inserisci l’endpoint dell’API, incluso l’eventuale percorso richiesto.",+ "designToolsRequired": "Il modello di progettazione deve supportare gli strumenti. Scegli un modello compatibile o attiva gli strumenti nelle impostazioni avanzate."}diff --git a/packages/vue/src/i18n/locales/ja/automation.json b/packages/vue/src/i18n/locales/ja/automation.jsonindex 30052b5e0..df8271f2e 100644--- a/packages/vue/src/i18n/locales/ja/automation.json+++ b/packages/vue/src/i18n/locales/ja/automation.json@@ -23,7 +23,7 @@"authentication": "認証を要求","authenticationDescription": "ローカル MCP エンドポイントを Bearer トークンで保護します。信頼できる端末でのみ無効にしてください。変更を反映するにはサーバーを再起動します。","rootDirectory": "MCP ルートディレクトリ",- "rootDirectoryDefault": "ユーザーのホームディレクトリ(既定)",+ "rootDirectoryDefault": "サーバーの既定ディレクトリ","chooseRootDirectory": "フォルダーを選択","useDefaultRoot": "既定を使用","rootDirectoryDescription": "ファイルツールはこのフォルダー内に制限されます。変更を反映するには MCP サーバーを再起動します。",@@ -42,5 +42,20 @@"statusStarting": "起動中","statusRunning": "実行中","statusStopped": "停止",- "statusError": "エラー"+ "statusError": "エラー",+ "localServer": "ローカルサーバー",+ "webmcpDescription": "ローカルMCPサーバーやBearerトークンを使わずに、ブラウザーエージェントがこのドキュメントを直接操作できるようにします。ローカルサーバーの設定はここには適用されません。",+ "browserAccess": "ブラウザーエージェントのアクセス",+ "accessOff": "オフ",+ "accessInspect": "参照",+ "accessEdit": "編集",+ "accessOffDescription": "ブラウザーエージェントにツールを公開しません。",+ "accessInspectDescription": "エージェントはドキュメントを参照できますが、変更はできません。",+ "accessEditDescription": "エージェントは既存のプロパティ、テキスト、変数の値も編集できます。編集は元に戻せます。コンテンツの作成や削除、スクリプト、ファイルへのアクセスは許可されません。",+ "webmcpUnsupported": "このブラウザーはWebMCPを公開していません。対応するChromeバージョンでWebMCPテストを有効にして、ブラウザーを再起動してください。",+ "webmcpSetup": "WebMCP設定ガイド",+ "noMatchingTools": "検索に一致するツールはありません。",+ "connectionNameHint": "80 文字以内の重複しない名前を使用してください。open-pencil は予約済みです。",+ "connectionNameInvalid": "open-pencil 以外の、80 文字以内で重複しない名前を選んでください。",+ "serverURLHint": "HTTPS を使用してください。HTTP は localhost またはループバックアドレスでのみ使用できます。URL に認証情報を含めないでください。"}diff --git a/packages/vue/src/i18n/locales/ja/settings.json b/packages/vue/src/i18n/locales/ja/settings.jsonindex 43c14c599..3b2d98a07 100644--- a/packages/vue/src/i18n/locales/ja/settings.json+++ b/packages/vue/src/i18n/locales/ja/settings.json@@ -1,4 +1,5 @@{+ "appearance": "外観","snapToGeometry": "ジオメトリにスナップ","snapToGeometryDescription": "ドラッグしたベクターポイントをパス内の他のポイントに揃えます。","snapToObjects": "オブジェクトにスナップ",@@ -22,5 +23,25 @@"storage": "クラウドストレージ","animations": "アニメーション","animationsSystem": "システム設定に従う",- "animationsOff": "オフ"+ "animationsOff": "オフ",+ "discardChanges": "変更を破棄しますか?",+ "discardChangesDescription": "保存されていない変更は失われます。",+ "keepEditing": "編集を続ける",+ "discard": "破棄",+ "edit": "編集",+ "configured": "設定済み",+ "notConfigured": "未設定",+ "saveChangesDescription": "保存すると変更が適用されます。",+ "partialSaveWarning": "一部の変更はすでに保存されている可能性があります。設定を確認して、もう一度お試しください。",+ "requiredField": "この項目は必須です。",+ "invalidURL": "認証情報を含まない有効な HTTP または HTTPS URL を入力してください。",+ "saveFailed": "変更を保存できませんでした。設定を確認して、もう一度お試しください。",+ "connectionFailed": "接続できませんでした。接続先と認証情報を確認して、もう一度お試しください。",+ "savedCredentialHint": "空欄にすると保存済みの認証情報を保持します。削除するにはクリアを使ってください。",+ "optionalCredentialHint": "任意です。このサービスを有効にするにはキーを追加してください。",+ "configureStorageHint": "ワークスペースを開く前に接続を設定してください。",+ "modelNameHint": "モデル選択画面で見分けやすい名前を付けてください。",+ "modelIDHint": "プロバイダーが指定する正確なモデル ID を使用してください。",+ "baseURLHint": "必要なパスを含めて API エンドポイントを入力してください。",+ "designToolsRequired": "デザイン用モデルはツールに対応している必要があります。対応モデルを選ぶか、詳細設定でツール対応を有効にしてください。"}diff --git a/packages/vue/src/i18n/locales/pl/automation.json b/packages/vue/src/i18n/locales/pl/automation.jsonindex 351215bd5..5dc059306 100644--- a/packages/vue/src/i18n/locales/pl/automation.json+++ b/packages/vue/src/i18n/locales/pl/automation.json@@ -23,7 +23,7 @@"authentication": "Wymagaj uwierzytelnienia","authenticationDescription": "Chroń lokalny punkt MCP tokenem Bearer. Wyłączaj tylko na zaufanym urządzeniu. Uruchom serwer ponownie, aby zastosować zmiany.","rootDirectory": "Katalog główny MCP",- "rootDirectoryDefault": "Katalog domowy użytkownika (domyślny)",+ "rootDirectoryDefault": "Domyślny katalog serwera","chooseRootDirectory": "Wybierz folder","useDefaultRoot": "Użyj domyślnego","rootDirectoryDescription": "Narzędzia plikowe są ograniczone do tego folderu. Uruchom serwer MCP ponownie, aby zastosować zmiany.",@@ -42,5 +42,20 @@"statusStarting": "Uruchamianie","statusRunning": "Działa","statusStopped": "Zatrzymany",- "statusError": "Błąd"+ "statusError": "Błąd",+ "localServer": "Serwer lokalny",+ "webmcpDescription": "Pozwól agentom przeglądarki korzystać z tego dokumentu bezpośrednio, bez lokalnego serwera MCP ani tokena Bearer. Ustawienia serwera lokalnego nie mają tu zastosowania.",+ "browserAccess": "Dostęp agentów przeglądarki",+ "accessOff": "Wyłączony",+ "accessInspect": "Inspekcja",+ "accessEdit": "Edycja",+ "accessOffDescription": "Żadne narzędzia nie są udostępniane agentom przeglądarki.",+ "accessInspectDescription": "Agenci mogą przeglądać dokument, ale nie mogą go zmieniać.",+ "accessEditDescription": "Agenci mogą także edytować istniejące właściwości, tekst i wartości zmiennych. Zmiany można cofnąć; tworzenie lub usuwanie treści, skrypty i dostęp do plików są wykluczone.",+ "webmcpUnsupported": "Ta przeglądarka nie udostępnia WebMCP. Użyj obsługiwanej wersji Chrome, włącz testowanie WebMCP i uruchom ponownie przeglądarkę.",+ "webmcpSetup": "Instrukcja konfiguracji WebMCP",+ "noMatchingTools": "Brak narzędzi pasujących do wyszukiwania.",+ "connectionNameHint": "Użyj unikalnej nazwy o długości do 80 znaków. Nazwa open-pencil jest zarezerwowana.",+ "connectionNameInvalid": "Wybierz unikalną nazwę o długości do 80 znaków, inną niż open-pencil.",+ "serverURLHint": "Użyj HTTPS. HTTP jest dozwolone tylko dla localhost lub adresu pętli zwrotnej. Nie umieszczaj danych uwierzytelniających w adresie URL."}diff --git a/packages/vue/src/i18n/locales/pl/settings.json b/packages/vue/src/i18n/locales/pl/settings.jsonindex d057a18ef..8bfe476d4 100644--- a/packages/vue/src/i18n/locales/pl/settings.json+++ b/packages/vue/src/i18n/locales/pl/settings.json@@ -1,4 +1,5 @@{+ "appearance": "Wygląd","snapToGeometry": "Przyciągaj do geometrii","snapToGeometryDescription": "Wyrównuj przeciągane punkty wektorowe do innych punktów ścieżki.","snapToObjects": "Przyciągaj do obiektów",@@ -22,5 +23,25 @@"storage": "Przechowywanie w chmurze","animations": "Animacje","animationsSystem": "Zgodnie z systemem",- "animationsOff": "Wyłączone"+ "animationsOff": "Wyłączone",+ "discardChanges": "Odrzucić zmiany?",+ "discardChangesDescription": "Niezapisane zmiany zostaną utracone.",+ "keepEditing": "Kontynuuj edycję",+ "discard": "Odrzuć",+ "edit": "Edytuj",+ "configured": "Skonfigurowano",+ "notConfigured": "Nie skonfigurowano",+ "saveChangesDescription": "Zmiany zostaną zastosowane po zapisaniu.",+ "partialSaveWarning": "Niektóre zmiany mogły już zostać zapisane. Sprawdź ustawienia i spróbuj ponownie.",+ "requiredField": "To pole jest wymagane.",+ "invalidURL": "Wpisz poprawny adres HTTP lub HTTPS bez osadzonych danych uwierzytelniających.",+ "saveFailed": "Nie udało się zapisać zmian. Sprawdź ustawienia i spróbuj ponownie.",+ "connectionFailed": "Nie udało się połączyć. Sprawdź adres i dane uwierzytelniające, a następnie spróbuj ponownie.",+ "savedCredentialHint": "Pozostaw puste, aby zachować zapisane dane uwierzytelniające. Użyj Wyczyść, aby je usunąć.",+ "optionalCredentialHint": "Opcjonalne. Dodaj klucz, aby włączyć tę usługę.",+ "configureStorageHint": "Skonfiguruj połączenie przed otwarciem obszaru roboczego.",+ "modelNameHint": "Nazwa, którą rozpoznasz na liście modeli.",+ "modelIDHint": "Użyj dokładnego identyfikatora modelu podanego przez dostawcę.",+ "baseURLHint": "Wpisz adres API wraz z wymaganą ścieżką.",+ "designToolsRequired": "Model projektowy musi obsługiwać narzędzia. Wybierz zgodny model lub włącz obsługę narzędzi w ustawieniach zaawansowanych."}diff --git a/packages/vue/src/i18n/locales/ru/automation.json b/packages/vue/src/i18n/locales/ru/automation.jsonindex d129ece78..4748f9cf7 100644--- a/packages/vue/src/i18n/locales/ru/automation.json+++ b/packages/vue/src/i18n/locales/ru/automation.json@@ -23,7 +23,7 @@"authentication": "Требовать аутентификацию","authenticationDescription": "Защитите локальную конечную точку MCP с помощью Bearer-токена. Отключайте только на доверенном устройстве. Перезапустите сервер, чтобы применить изменения.","rootDirectory": "Корневой каталог MCP",- "rootDirectoryDefault": "Домашний каталог пользователя (по умолчанию)",+ "rootDirectoryDefault": "Каталог сервера по умолчанию","chooseRootDirectory": "Выбрать папку","useDefaultRoot": "Использовать по умолчанию","rootDirectoryDescription": "Файловые инструменты ограничены этой папкой. Перезапустите MCP-сервер, чтобы применить изменения.",@@ -42,5 +42,20 @@"statusStarting": "Запускается","statusRunning": "Работает","statusStopped": "Остановлен",- "statusError": "Ошибка"+ "statusError": "Ошибка",+ "localServer": "Локальный сервер",+ "webmcpDescription": "Разрешите браузерным агентам работать с документом напрямую, без локального MCP-сервера и Bearer-токена. Настройки локального сервера здесь не действуют.",+ "browserAccess": "Доступ браузерных агентов",+ "accessOff": "Выключен",+ "accessInspect": "Просмотр",+ "accessEdit": "Редактирование",+ "accessOffDescription": "Браузерным агентам не доступны инструменты.",+ "accessInspectDescription": "Агенты могут просматривать документ, но не изменять его.",+ "accessEditDescription": "Агенты также могут изменять существующие свойства, текст и значения переменных. Правки можно отменить; создание и удаление содержимого, скрипты и доступ к файлам недоступны.",+ "webmcpUnsupported": "Этот браузер не предоставляет WebMCP. Используйте поддерживаемую версию Chrome, включите тестирование WebMCP и перезапустите браузер.",+ "webmcpSetup": "Настройка WebMCP",+ "noMatchingTools": "По вашему запросу инструменты не найдены.",+ "connectionNameHint": "Укажите уникальное название длиной до 80 символов. Название open-pencil зарезервировано.",+ "connectionNameInvalid": "Выберите уникальное название длиной до 80 символов, отличное от open-pencil.",+ "serverURLHint": "Используйте HTTPS. HTTP разрешён только для localhost или адреса обратной петли. Не включайте учётные данные в URL."}diff --git a/packages/vue/src/i18n/locales/ru/settings.json b/packages/vue/src/i18n/locales/ru/settings.jsonindex 1d3b425a8..5aee3ca06 100644--- a/packages/vue/src/i18n/locales/ru/settings.json+++ b/packages/vue/src/i18n/locales/ru/settings.json@@ -1,4 +1,5 @@{+ "appearance": "Внешний вид","snapToGeometry": "Привязка к геометрии","snapToGeometryDescription": "Выравнивать перетаскиваемые векторные точки по другим точкам контура.","snapToObjects": "Привязка к объектам",@@ -22,5 +23,25 @@"storage": "Облачное хранилище","animations": "Анимации","animationsSystem": "Как в системе",- "animationsOff": "Выключены"+ "animationsOff": "Выключены",+ "discardChanges": "Отменить изменения?",+ "discardChangesDescription": "Несохранённые изменения будут потеряны.",+ "keepEditing": "Продолжить редактирование",+ "discard": "Отменить изменения",+ "edit": "Изменить",+ "configured": "Настроено",+ "notConfigured": "Не настроено",+ "saveChangesDescription": "Изменения применяются при сохранении.",+ "partialSaveWarning": "Некоторые изменения могли уже сохраниться. Проверьте настройки и попробуйте снова.",+ "requiredField": "Это поле обязательно.",+ "invalidURL": "Введите корректный HTTP- или HTTPS-адрес без встроенных учётных данных.",+ "saveFailed": "Не удалось сохранить изменения. Проверьте настройки и попробуйте ещё раз.",+ "connectionFailed": "Не удалось подключиться. Проверьте адрес и учётные данные и попробуйте ещё раз.",+ "savedCredentialHint": "Оставьте поле пустым, чтобы сохранить текущие учётные данные. Для удаления нажмите «Очистить».",+ "optionalCredentialHint": "Необязательно. Добавьте ключ, чтобы включить этот сервис.",+ "configureStorageHint": "Настройте подключение перед открытием рабочего пространства.",+ "modelNameHint": "Название, по которому вы узнаете модель в списке.",+ "modelIDHint": "Используйте точный идентификатор модели, указанный провайдером.",+ "baseURLHint": "Введите адрес API, включая необходимый путь.",+ "designToolsRequired": "Модель для дизайна должна поддерживать инструменты. Выберите подходящую модель или включите поддержку инструментов в расширенных настройках."}diff --git a/packages/vue/src/i18n/locales/zh-cn/automation.json b/packages/vue/src/i18n/locales/zh-cn/automation.jsonindex 7326af894..c3100ddda 100644--- a/packages/vue/src/i18n/locales/zh-cn/automation.json+++ b/packages/vue/src/i18n/locales/zh-cn/automation.json@@ -23,7 +23,7 @@"authentication": "要求身份验证","authenticationDescription": "使用 Bearer 令牌保护本地 MCP 端点。仅在可信设备上禁用。重启服务器以应用更改。","rootDirectory": "MCP 根目录",- "rootDirectoryDefault": "用户主目录(默认)",+ "rootDirectoryDefault": "服务器默认目录","chooseRootDirectory": "选择文件夹","useDefaultRoot": "使用默认值","rootDirectoryDescription": "文件工具仅限于此文件夹。重启 MCP 服务器以应用更改。",@@ -42,5 +42,20 @@"statusStarting": "正在启动","statusRunning": "运行中","statusStopped": "已停止",- "statusError": "错误"+ "statusError": "错误",+ "localServer": "本地服务器",+ "webmcpDescription": "允许浏览器代理直接使用此文档,无需本地 MCP 服务器或 Bearer 令牌。本地服务器设置不适用于此处。",+ "browserAccess": "浏览器代理访问权限",+ "accessOff": "关闭",+ "accessInspect": "查看",+ "accessEdit": "编辑",+ "accessOffDescription": "不向浏览器代理开放任何工具。",+ "accessInspectDescription": "代理可以查看文档,但不能修改。",+ "accessEditDescription": "代理还可以编辑现有属性、文本和变量值。编辑可以撤销;不允许创建或删除内容、运行脚本或访问文件。",+ "webmcpUnsupported": "此浏览器未提供 WebMCP。请使用受支持的 Chrome 版本,启用 WebMCP 测试,然后重新启动浏览器。",+ "webmcpSetup": "WebMCP 设置指南",+ "noMatchingTools": "没有与搜索匹配的工具。",+ "connectionNameHint": "使用不超过 80 个字符的唯一名称。open-pencil 为保留名称。",+ "connectionNameInvalid": "请选择不超过 80 个字符且不是 open-pencil 的唯一名称。",+ "serverURLHint": "请使用 HTTPS。仅 localhost 或回环地址允许使用 HTTP。请勿在 URL 中包含凭据。"}diff --git a/packages/vue/src/i18n/locales/zh-cn/settings.json b/packages/vue/src/i18n/locales/zh-cn/settings.jsonindex 81677d57e..4b2fc148e 100644--- a/packages/vue/src/i18n/locales/zh-cn/settings.json+++ b/packages/vue/src/i18n/locales/zh-cn/settings.json@@ -1,4 +1,5 @@{+ "appearance": "外观","snapToGeometry": "吸附到几何图形","snapToGeometryDescription": "将拖动的矢量点与路径中的其他点对齐。","snapToObjects": "吸附到对象",@@ -22,5 +23,25 @@"storage": "云存储","animations": "动画","animationsSystem": "跟随系统",- "animationsOff": "关闭"+ "animationsOff": "关闭",+ "discardChanges": "放弃更改?",+ "discardChangesDescription": "未保存的更改将丢失。",+ "keepEditing": "继续编辑",+ "discard": "放弃",+ "edit": "编辑",+ "configured": "已配置",+ "notConfigured": "未配置",+ "saveChangesDescription": "保存后更改才会生效。",+ "partialSaveWarning": "部分更改可能已保存。请检查设置后重试。",+ "requiredField": "此字段为必填项。",+ "invalidURL": "请输入有效的 HTTP 或 HTTPS 地址,且不要包含凭据。",+ "saveFailed": "无法保存更改。请检查设置后重试。",+ "connectionFailed": "无法连接。请检查端点和凭据后重试。",+ "savedCredentialHint": "留空可保留已保存的凭据。点击清除可将其删除。",+ "optionalCredentialHint": "可选。添加密钥以启用此服务。",+ "configureStorageHint": "请先配置连接,再打开工作区。",+ "modelNameHint": "设置一个便于在模型选择器中识别的名称。",+ "modelIDHint": "请使用提供商给出的准确模型标识。",+ "baseURLHint": "请输入 API 端点,包括所需的路径。",+ "designToolsRequired": "设计模型必须支持工具。请选择兼容的模型,或在高级设置中启用工具支持。"}diff --git a/packages/vue/src/i18n/messages/automation.ts b/packages/vue/src/i18n/messages/automation.tsindex 6e1c1e068..307a5db3b 100644--- a/packages/vue/src/i18n/messages/automation.ts+++ b/packages/vue/src/i18n/messages/automation.ts@@ -3,6 +3,21 @@ import { params } from '@nanostores/i18n'import { i18n } from '#vue/i18n/create'export const automationMessageDefaults = {+ localServer: 'Local server',+ webmcpDescription:+ 'Let browser agents use this document directly, without a local MCP server or bearer token. Local server settings do not apply here.',+ browserAccess: 'Browser agent access',+ accessOff: 'Off',+ accessInspect: 'Inspect',+ accessEdit: 'Edit',+ accessOffDescription: 'No tools are exposed to browser agents.',+ accessInspectDescription: 'Agents can inspect the document but cannot change it.',+ accessEditDescription:+ 'Agents can also edit existing properties, text, and variable values. Edits are undoable; creating or deleting content, scripts, and file access are excluded.',+ webmcpUnsupported:+ 'This browser does not expose WebMCP. Use a supported Chrome version and enable WebMCP testing, then relaunch the browser.',+ webmcpSetup: 'WebMCP setup guide',+ noMatchingTools: 'No tools match your search.',connections: 'MCP connections',connectionsDescription: 'Give ACP agents access to trusted remote tools and services.',addConnection: 'Add connection',@@ -10,6 +25,10 @@ export const automationMessageDefaults = {editConnection: 'Edit MCP connection',connectionEditorDescription: 'Configure a Streamable HTTP server and optional authentication.',connectionName: 'Connection name',+ connectionNameHint: 'Use a unique name, up to 80 characters. The name open-pencil is reserved.',+ connectionNameInvalid: 'Choose a unique name of at most 80 characters, other than open-pencil.',+ serverURLHint:+ 'Use HTTPS. HTTP is allowed only for localhost or a loopback address. Do not include credentials in the URL.',serverURL: 'MCP server URL',enableConnection: 'Enable for ACP agents',bearerAuthentication: 'Use bearer authentication',@@ -28,7 +47,7 @@ export const automationMessageDefaults = {authenticationDescription:'Protect the localhost MCP endpoint with a bearer token. Disable only on a trusted machine. Restart the server to apply changes.',rootDirectory: 'MCP root directory',- rootDirectoryDefault: 'User home directory (default)',+ rootDirectoryDefault: 'Server default directory',chooseRootDirectory: 'Choose folder',useDefaultRoot: 'Use default',rootDirectoryDescription:diff --git a/packages/vue/src/i18n/messages/settings.ts b/packages/vue/src/i18n/messages/settings.tsindex 9400f88ef..df77827b3 100644--- a/packages/vue/src/i18n/messages/settings.ts+++ b/packages/vue/src/i18n/messages/settings.ts@@ -1,6 +1,7 @@import { i18n } from '#vue/i18n/create'export const settingsMessageDefaults = {+ appearance: 'Appearance',animations: 'Animations',animationsSystem: 'Follow system',animationsOff: 'Off',@@ -24,6 +25,27 @@ export const settingsMessageDefaults = {diagnostics: 'Diagnostics',media: 'Media',automation: 'MCP & automation',+ edit: 'Edit',+ configured: 'Configured',+ notConfigured: 'Not configured',+ saveChangesDescription: 'Changes apply when you save.',+ requiredField: 'This field is required.',+ invalidURL: 'Enter a valid HTTP or HTTPS URL without embedded credentials.',+ saveFailed: 'Could not save these changes. Check the settings and try again.',+ connectionFailed: 'Could not connect. Check the endpoint and credentials, then try again.',+ savedCredentialHint: 'Leave blank to keep the saved credential. Use Clear to remove it.',+ optionalCredentialHint: 'Optional. Add a key to enable this service.',+ configureStorageHint: 'Configure the connection before opening the workspace.',+ modelNameHint: 'A name you can recognize in the model picker.',+ designToolsRequired:+ 'The Design model must support tools. Choose a compatible model or enable tool support in advanced settings.',+ modelIDHint: 'Use the exact model ID supplied by your provider.',+ baseURLHint: 'Enter the API endpoint, including any required path.',+ partialSaveWarning: 'Some changes may already be saved. Review the settings and try again.',+ discardChanges: 'Discard changes?',+ discardChangesDescription: 'Your unsaved changes will be lost.',+ keepEditing: 'Keep editing',+ discard: 'Discard',storage: 'Cloud storage',mobilePanelNavigation: 'Mobile panel navigation',notifications: 'Notifications'diff --git a/skills/open-pencil/SKILL.md b/skills/open-pencil/SKILL.mdindex 2340243da..402ee6196 100644--- a/skills/open-pencil/SKILL.md+++ b/skills/open-pencil/SKILL.md@@ -207,9 +207,9 @@ The CLI defaults the filesystem root to the home directory on Windows and the cu### Browser-native WebMCP (experimental)-Supporting browsers expose inspection and undoable existing-layer/property and variable edits directly from the OpenPencil workspace through `document.modelContext`, without an MCP server connection. Discover this browser surface separately: it excludes structural creation/deletion, arbitrary JS/JSX execution, external assets, filesystem operations, and credentials.+WebMCP is off by default. In **Settings → MCP & automation → WebMCP**, choose **Inspect** for read-only tools or **Edit** for scoped changes. These controls are independent of local MCP settings. Supporting browsers expose inspection and undoable existing-layer/property and variable edits directly from the OpenPencil workspace through `document.modelContext`, without an MCP server connection. Discover this browser surface separately: it excludes structural creation/deletion, arbitrary JS/JSX execution, external assets, filesystem operations, and credentials.-Calls capture the active document/page. Cancellation prevents an edit from starting but does not reverse an already committed edit; use editor undo instead. Atomic edits require at most 10,000 nodes and variables combined, including when these same tools run through app AI/MCP. See the [WebMCP guide](https://openpencil.dev/programmable/mcp-server#browser-native-webmcp-experimental) for scope and browser requirements.+Calls capture the active document/page. Cancellation prevents an edit from starting but does not reverse an already committed edit; use editor undo instead. Atomic edits require at most 10,000 nodes and variables combined, including when these same tools run through app AI/MCP. See the [WebMCP guide](https://openpencil.dev/programmable/mcp-server#webmcp) for scope and browser requirements.## Tool discoverydiff --git a/src/app.css b/src/app.cssindex f28f4540f..405d9182f 100644--- a/src/app.css+++ b/src/app.css@@ -60,7 +60,7 @@--color-hover: #353535;--color-accent: #3b82f6;--color-surface: #f0f0f0;- --color-muted: #888888;+ --color-muted: #a6a6a6;--color-input: #1e1e1e;--color-component: #9747ff;--color-warning-bg: rgb(245 158 11 / 0.1);diff --git a/src/app/ai/models/settings/profile-editor/connection.ts b/src/app/ai/models/settings/profile-editor/connection.tsindex 787e305f3..84def3e88 100644--- a/src/app/ai/models/settings/profile-editor/connection.ts+++ b/src/app/ai/models/settings/profile-editor/connection.ts@@ -1,17 +1,14 @@+import { tryOnScopeDispose } from '@vueuse/core'import { computed, ref, type Ref } from 'vue'-import type { AIProviderDef } from '@open-pencil/core/constants'-import {testProviderConnection,type ProviderConnectionTestFailureReason} from '@/app/ai/chat/connection-test'-import { refreshAIProviderStatus } from '@/app/ai/chat/storage'import {findModelConnectionForDraft,modelConnectionCredentialStatus,resolveModelConnectionAPIKey,- setModelConnectionAPIKey,type AIModelProfileDraft} from '@/app/ai/models'import type { CredentialStatus } from '@/app/settings/credentials/types'@@ -19,81 +16,86 @@ import type { CredentialStatus } from '@/app/settings/credentials/types'interface ConnectionOptions {draft: AIModelProfileDraftkeyInput: Ref<string>- providerDef: Readonly<Ref<AIProviderDef>>- isACP: Readonly<Ref<boolean>>- isHarness: Readonly<Ref<boolean>>- customModelSelected: Ref<boolean>}-export function useProfileConnection({- draft,- keyInput,- providerDef,- isACP,- isHarness,- customModelSelected-}: ConnectionOptions) {+export function useProfileConnection({ draft, keyInput }: ConnectionOptions) {const keyStatus = ref<CredentialStatus>('missing')const connectionTestStatus = ref<'idle' | 'testing' | 'success' | 'error'>('idle')const connectionTestReason = ref<ProviderConnectionTestFailureReason | null>(null)- const hasExistingKey = computed(() => keyStatus.value === 'configured')- const canTest = computed(() => {- if (isACP.value || isHarness.value) return false- if (!keyInput.value.trim() && !hasExistingKey.value) return false- if (providerDef.value.supportsCustomBaseURL && !draft.customBaseURL.trim()) return false- return customModelSelected.value- ? Boolean(draft.customModelID.trim())- : Boolean(draft.modelID.trim())+ const keyCleared = ref(false)+ const hasExistingKey = computed(() => !keyCleared.value && keyStatus.value === 'configured')++ let version = 0+ let disposed = false+ tryOnScopeDispose(() => {+ disposed = true+ version++})+ function current(request: number) {+ return !disposed && request === version+ }function resetConnectionTest(): void {+ version++connectionTestStatus.value = 'idle'connectionTestReason.value = null}async function refreshKeyStatus(): Promise<void> {+ const request = versionconst connection = findModelConnectionForDraft(draft)- keyStatus.value = connection ? await modelConnectionCredentialStatus(connection.id) : 'missing'+ try {+ const status = connection ? await modelConnectionCredentialStatus(connection.id) : 'missing'+ if (current(request)) keyStatus.value = status+ } catch {+ if (current(request)) keyStatus.value = 'unavailable'+ }}- async function clearKey(): Promise<void> {- const connection = findModelConnectionForDraft(draft)- if (!connection) return-- await setModelConnectionAPIKey(connection.id, '')- await refreshAIProviderStatus()+ function clearKey(): void {+ keyCleared.value = truekeyInput.value = ''- await refreshKeyStatus()+ resetConnectionTest()}async function testConnection(): Promise<void> {+ const request = ++version+ const target = { ...draft }+ const replacement = keyInput.value.trim()connectionTestStatus.value = 'testing'connectionTestReason.value = null- const connection = findModelConnectionForDraft(draft)- const existingKey = connection ? await resolveModelConnectionAPIKey(connection.id) : null- const result = await testProviderConnection({- providerID: draft.providerID,- apiKey: keyInput.value.trim() || existingKey || '',- modelID: draft.modelID,- customModelID: draft.customModelID,- customBaseURL: draft.customBaseURL,- customAPIType: draft.customAPIType- })- if (result.ok) {- connectionTestStatus.value = 'success'- return+ try {+ const connection = findModelConnectionForDraft(target)+ const existingKey =+ !replacement && !keyCleared.value && connection+ ? await resolveModelConnectionAPIKey(connection.id)+ : null+ if (!current(request)) return+ const result = await testProviderConnection({+ providerID: target.providerID,+ apiKey: replacement || existingKey || '',+ modelID: target.modelID,+ customModelID: target.customModelID,+ customBaseURL: target.customBaseURL,+ customAPIType: target.customAPIType+ })+ if (!current(request)) return+ connectionTestStatus.value = result.ok ? 'success' : 'error'+ connectionTestReason.value = result.ok ? null : result.reason+ } catch {+ if (!current(request)) return+ connectionTestStatus.value = 'error'+ connectionTestReason.value = 'unknown'}- connectionTestStatus.value = 'error'- connectionTestReason.value = result.reason}return {+ keyCleared,keyStatus,connectionTestStatus,connectionTestReason,hasExistingKey,- canTest,resetConnectionTest,refreshKeyStatus,clearKey,diff --git a/src/app/ai/models/settings/profile-editor/feedback.ts b/src/app/ai/models/settings/profile-editor/feedback.tsnew file mode 100644index 000000000..300ad598b--- /dev/null+++ b/src/app/ai/models/settings/profile-editor/feedback.ts@@ -0,0 +1,50 @@+import { computed, ref, type Ref } from 'vue'++import { aiModelSettings } from '@/app/ai/models'+import { useSettingsValidation } from '@/app/settings/validation/use'++import { modelProfileSchema, type ModelProfileValidationMessages } from './schema'+import type { useModelProfileEditor } from './use'++export function useModelProfileFeedback(+ profile: ReturnType<typeof useModelProfileEditor>,+ keyInput: Readonly<Ref<string>>,+ messages: Readonly<Ref<ModelProfileValidationMessages>>+) {+ const testing = ref(false)+ const providerKind = computed(() => {+ if (profile.isACP.value) return 'acp'+ return profile.isHarness.value ? 'harness' : 'api'+ })+ const values = computed(() => ({+ name: profile.draft.name,+ modelID: profile.draft.modelID,+ customModelID: profile.draft.customModelID,+ baseURL: profile.draft.customBaseURL,+ credential: Boolean(keyInput.value.trim() || profile.hasExistingKey.value),+ tools: (profile.knownModel.value+ ? profile.knownCapabilities.value+ : profile.draft.capabilities+ ).includes('tools')+ }))+ const schema = computed(() =>+ modelProfileSchema(+ {+ customModel: profile.customModelSelected.value,+ intent: testing.value ? 'test' : 'save',+ providerKind: providerKind.value,+ supportsCustomBaseURL: Boolean(profile.providerDef.value.supportsCustomBaseURL),+ design: profile.draft.profileId === aiModelSettings.value.assignments.design+ },+ messages.value+ )+ )+ const validation = useSettingsValidation(values, schema)+ return {+ ...validation,+ async validate(intent: 'save' | 'test') {+ testing.value = intent === 'test'+ return validation.validate()+ }+ }+}diff --git a/src/app/ai/models/settings/profile-editor/schema.ts b/src/app/ai/models/settings/profile-editor/schema.tsnew file mode 100644index 000000000..2a0257a5e--- /dev/null+++ b/src/app/ai/models/settings/profile-editor/schema.ts@@ -0,0 +1,57 @@+import * as v from 'valibot'++import {+ requiredSetting,+ requiredSettingsURL,+ type SettingsValidationMessages+} from '@/app/settings/validation/schema'++export interface ModelProfileValidationContext {+ customModel: boolean+ providerKind: 'api' | 'acp' | 'harness'+ supportsCustomBaseURL: boolean+ design: boolean+ intent: 'save' | 'test'+}++export interface ModelProfileValidationMessages extends SettingsValidationMessages {+ designToolsRequired: string+}++export function modelProfileSchema(+ context: ModelProfileValidationContext,+ messages: ModelProfileValidationMessages+) {+ const modelField = context.customModel ? 'customModelID' : 'modelID'+ const requiresModel = context.providerKind !== 'acp'+ const requiresAPI = context.providerKind === 'api'+ return v.pipe(+ v.object({+ name: context.intent === 'save' ? requiredSetting(messages.requiredField) : v.string(),+ modelID:+ requiresModel && !context.customModel+ ? requiredSetting(messages.requiredField)+ : v.string(),+ customModelID:+ requiresModel && context.customModel ? requiredSetting(messages.requiredField) : v.string(),+ baseURL:+ requiresAPI && context.supportsCustomBaseURL ? requiredSettingsURL(messages) : v.string(),+ credential:+ requiresAPI && context.intent === 'test'+ ? v.pipe(+ v.boolean(),+ v.check((value: boolean) => value, messages.requiredField)+ )+ : v.boolean(),+ tools: v.boolean()+ }),+ v.forward(+ v.partialCheck(+ [['tools']],+ ({ tools }) => context.intent !== 'save' || !context.design || tools,+ messages.designToolsRequired+ ),+ [modelField]+ )+ )+}diff --git a/src/app/ai/models/settings/profile-editor/use.ts b/src/app/ai/models/settings/profile-editor/use.tsindex 4558d48ab..ab441a541 100644--- a/src/app/ai/models/settings/profile-editor/use.ts+++ b/src/app/ai/models/settings/profile-editor/use.ts@@ -1,4 +1,6 @@-import { computed, reactive, ref, watch } from 'vue'+import { tryOnScopeDispose } from '@vueuse/core'+import { isEqual } from 'es-toolkit'+import { computed, reactive, ref, toRaw, watch } from 'vue'import type { Ref } from 'vue'import type { AIProviderID } from '@open-pencil/core/constants'@@ -32,7 +34,6 @@ export function useModelProfileEditor({ profileId, keyInput, labels: ai }: ProfiproviderDef,isACP,isHarness,- customModelSelected,supportsReasoningEffort,providerDisplayName,modelOptions,@@ -47,30 +48,32 @@ export function useModelProfileEditor({ profileId, keyInput, labels: ai }: Profi} = selectionconst saveError = ref<string | null>(null)+ const busy = ref(false)+ const initialDraft = structuredClone(toRaw(draft))+ tryOnScopeDispose(() => {+ keyInput.value = ''+ })const {connectionTestStatus,connectionTestReason,hasExistingKey,- canTest,resetConnectionTest,refreshKeyStatus,- clearKey,+ keyCleared,+ clearKey: stageKeyRemoval,testConnection- } = useProfileConnection({ draft, keyInput, providerDef, isACP, isHarness, customModelSelected })+ } = useProfileConnection({ draft, keyInput })- const canDelete = computed(() => Boolean(profileId) && aiModelSettings.value.models.length > 1)- const canSave = computed(- () =>- Boolean(draft.name.trim()) &&- (isACP.value ||- (customModelSelected.value- ? Boolean(draft.customModelID.trim())- : Boolean(draft.modelID.trim())))+ const dirty = computed(+ () => !isEqual(draft, initialDraft) || keyInput.value.length > 0 || keyCleared.value)+ const canDelete = computed(() => Boolean(profileId) && aiModelSettings.value.models.length > 1)+function updateProvider(id: AIProviderID) {selection.updateProvider(id)+ keyCleared.value = falsekeyInput.value = ''resetConnectionTest()void refreshKeyStatus()@@ -81,14 +84,22 @@ export function useModelProfileEditor({ profileId, keyInput, labels: ai }: ProfiresetConnectionTest()}+ function clearKey() {+ if (busy.value) return+ saveError.value = null+ stageKeyRemoval()+ }+async function save(): Promise<boolean> {+ if (busy.value) return false+ busy.value = truesaveError.value = nulltry {applyKnownModelMetadata()if (!draft.name.trim()) draft.name = modelDisplayName.value || providerDisplayName.valueconst profile = saveModelProfileDraft(draft)- if (keyInput.value.trim()) {+ if (keyInput.value.trim() || keyCleared.value) {await setModelConnectionAPIKey(profile.connectionId, keyInput.value)await refreshAIProviderStatus()keyInput.value = ''@@ -97,20 +108,29 @@ export function useModelProfileEditor({ profileId, keyInput, labels: ai }: Profi} catch (reason) {saveError.value = reason instanceof Error ? reason.message : String(reason)return false+ } finally {+ busy.value = false}}async function remove(): Promise<boolean> {- if (!profileId) return false-- const profile = modelProfile(profileId)- if (profile && modelConnectionUsageCount(profile.connectionId) === 1) {- await setModelConnectionAPIKey(profile.connectionId, '')+ if (!profileId || busy.value) return false+ busy.value = true+ saveError.value = null+ try {+ const profile = modelProfile(profileId)+ if (profile && modelConnectionUsageCount(profile.connectionId) === 1) {+ await setModelConnectionAPIKey(profile.connectionId, '')+ }+ removeModelProfile(profileId)+ await refreshAIProviderStatus()+ return true+ } catch (reason) {+ saveError.value = reason instanceof Error ? reason.message : String(reason)+ return false+ } finally {+ busy.value = false}- removeModelProfile(profileId)- await refreshAIProviderStatus()-- return true}watch(@@ -122,6 +142,8 @@ export function useModelProfileEditor({ profileId, keyInput, labels: ai }: Profireturn {draft,+ dirty,+ busy,providerDef,isACP,isHarness,@@ -129,6 +151,7 @@ export function useModelProfileEditor({ profileId, keyInput, labels: ai }: ProfiproviderDisplayName,modelOptions,selectedModelValue,+ customModelSelected: selection.customModelSelected,knownModel,knownCapabilities,outputTokenRecommendation,@@ -137,8 +160,6 @@ export function useModelProfileEditor({ profileId, keyInput, labels: ai }: ProficanDelete,toolsEnabled,visionEnabled,- canSave,- canTest,connectionTestStatus,connectionTestReason,saveError,diff --git a/src/app/automation/mcp/preferences.ts b/src/app/automation/mcp/preferences.tsindex bf5a0a889..d6c4e48fc 100644--- a/src/app/automation/mcp/preferences.ts+++ b/src/app/automation/mcp/preferences.ts@@ -1,7 +1,7 @@import { useLocalStorage } from '@vueuse/core'import { ref } from 'vue'-import type { ToolDescriptor, ToolEffect } from '@open-pencil/mcp/tools'+import type { ToolDescriptor } from '@open-pencil/mcp/tools'const DISABLED_TOOLS_STORAGE_KEY = 'open-pencil:mcp:disabled-tools'const ROOT_DIRECTORY_STORAGE_KEY = 'open-pencil:mcp:root-directory'@@ -16,20 +16,3 @@ export const mcpAuthenticationEnabled = useLocalStorage(AUTHENTICATION_ENABLED_Sexport function setMCPToolDescriptors(tools: ToolDescriptor[]): void {configurableMCPTools.value = tools.filter((tool) => tool.availability !== 'eval')}--export function setMCPToolEnabled(name: string, enabled: boolean): void {- const disabled = new Set(disabledMCPTools.value)- if (enabled) disabled.delete(name)- else disabled.add(name)- disabledMCPTools.value = [...disabled]-}--export function setMCPToolCategoryEnabled(effect: ToolEffect, enabled: boolean): void {- const disabled = new Set(disabledMCPTools.value)- for (const tool of configurableMCPTools.value) {- if (tool.effect !== effect) continue- if (enabled) disabled.delete(tool.name)- else disabled.add(tool.name)- }- disabledMCPTools.value = [...disabled]-}diff --git a/src/app/automation/mcp/runtime.ts b/src/app/automation/mcp/runtime.tsindex 3fc3178a3..a37470ae7 100644--- a/src/app/automation/mcp/runtime.ts+++ b/src/app/automation/mcp/runtime.ts@@ -1,7 +1,5 @@import { reactive } from 'vue'-import { AUTOMATION_HTTP_PORT } from '@open-pencil/core/constants'-import { connectAutomation } from '@/app/automation/bridge/server'import type { EditorStore } from '@/app/editor/active-store'import { isTauri } from '@/app/tauri/env'@@ -11,6 +9,7 @@ import {type AutomationHealth,type AutomationServerHandle,readAutomationHealth,+ getMCPServerURL,spawnMCPIfNeeded} from './spawn'@@ -18,7 +17,7 @@ export type MCPRuntimeStatus = 'idle' | 'starting' | 'running' | 'stopped' | 'erexport interface MCPRuntimeState {status: MCPRuntimeStatus- port: number+ endpoint: stringversion: string | nullerror: string | nullchecking: boolean@@ -42,7 +41,7 @@ function toError(error: unknown): Error {export function createMCPRuntimeService(dependencies: MCPRuntimeDependencies) {const state = reactive<MCPRuntimeState>({status: 'idle',- port: AUTOMATION_HTTP_PORT,+ endpoint: getMCPServerURL(),version: null,error: null,checking: false,diff --git a/src/app/automation/mcp/settings/tool-access.ts b/src/app/automation/mcp/settings/tool-access.tsnew file mode 100644index 000000000..1f3208b7d--- /dev/null+++ b/src/app/automation/mcp/settings/tool-access.ts@@ -0,0 +1,63 @@+import { computed, ref, type Ref } from 'vue'++import type { ToolDescriptor, ToolEffect } from '@open-pencil/mcp/tools'++/** Tool access is derived from the catalog and one controlled disabled-name model. */+export function useMCPToolAccess(tools: Readonly<Ref<ToolDescriptor[]>>, disabled: Ref<string[]>) {+ const search = ref('')+ const disabledNames = computed(() => new Set(disabled.value))+ const enabledCount = computed(() => tools.value.filter(isEnabled).length)+ const visibleTools = computed(() => {+ const query = search.value.trim().toLowerCase()+ return tools.value.filter(+ (tool) =>+ tool.name.toLowerCase().includes(query) || tool.description.toLowerCase().includes(query)+ )+ })++ function isEnabled(tool: ToolDescriptor) {+ return !disabledNames.value.has(tool.name)+ }++ function setEnabled(names: string[], enabled: boolean) {+ const next = new Set(disabled.value)+ for (const name of names) {+ if (enabled) next.delete(name)+ else next.add(name)+ }+ disabled.value = [...next]+ }++ function category(effect: ToolEffect) {+ const members = computed(() => tools.value.filter((tool) => tool.effect === effect))+ const count = computed(() => members.value.filter(isEnabled).length)+ return {+ enabled: computed({+ get: () => count.value > 0,+ set: (enabled: boolean) =>+ setEnabled(+ members.value.map((tool) => tool.name),+ enabled+ )+ }),+ state: computed(() =>+ count.value > 0 && count.value < members.value.length ? 'mixed' : 'idle'+ )+ }+ }++ const { enabled: inspectionEnabled, state: inspectionState } = category('read')+ const { enabled: modificationEnabled, state: modificationState } = category('write')++ return {+ search,+ visibleTools,+ enabledCount,+ inspectionEnabled,+ inspectionState,+ modificationEnabled,+ modificationState,+ isEnabled,+ setToolEnabled: (name: string, enabled: boolean) => setEnabled([name], enabled)+ }+}diff --git a/src/app/automation/mcp/settings/use.ts b/src/app/automation/mcp/settings/use.tsindex 7327de6f1..e2fd76f24 100644--- a/src/app/automation/mcp/settings/use.ts+++ b/src/app/automation/mcp/settings/use.ts@@ -1,45 +1,10 @@-import { computed, onMounted, ref } from 'vue'+import { onMounted } from 'vue'-import type { ToolEffect } from '@open-pencil/mcp/tools'--import {- configurableMCPTools,- disabledMCPTools,- mcpRootDirectory-} from '@/app/automation/mcp/preferences'+import { mcpRootDirectory } from '@/app/automation/mcp/preferences'import { refreshMCPRuntime, restartMCPRuntime } from '@/app/automation/mcp/runtime'import { isTauri } from '@/app/tauri/env'export function useMCPSettings() {- const toolSearch = ref('')-- const disabledToolNames = computed(() => new Set(disabledMCPTools.value))-- function categoryStatus(effect: ToolEffect) {- const tools = configurableMCPTools.value.filter((tool) => tool.effect === effect)- const enabled = tools.filter((tool) => !disabledToolNames.value.has(tool.name)).length-- return {- enabled: enabled > 0,- state: enabled > 0 && enabled < tools.length ? ('mixed' as const) : ('idle' as const)- }- }-- const inspectionToolsStatus = computed(() => categoryStatus('read'))- const modificationToolsStatus = computed(() => categoryStatus('write'))- const enabledToolCount = computed(- () =>- configurableMCPTools.value.filter((tool) => !disabledToolNames.value.has(tool.name)).length- )- const visibleTools = computed(() => {- const query = toolSearch.value.trim().toLowerCase()- if (!query) return configurableMCPTools.value- return configurableMCPTools.value.filter(- (tool) =>- tool.name.toLowerCase().includes(query) || tool.description.toLowerCase().includes(query)- )- })-onMounted(() => {void refreshMCPRuntime()})@@ -56,23 +21,5 @@ export function useMCPSettings() {if (typeof directory === 'string') mcpRootDirectory.value = directory}- function isToolEnabled(name: string): boolean {- return !disabledToolNames.value.has(name)- }-- function enableAllTools(): void {- disabledMCPTools.value = []- }-- return {- toolSearch,- inspectionToolsStatus,- modificationToolsStatus,- enabledToolCount,- visibleTools,- restart,- chooseRootDirectory,- isToolEnabled,- enableAllTools- }+ return { restart, chooseRootDirectory }}diff --git a/src/app/automation/mcp/spawn.ts b/src/app/automation/mcp/spawn.tsindex 388303d02..009b2fadc 100644--- a/src/app/automation/mcp/spawn.ts+++ b/src/app/automation/mcp/spawn.ts@@ -34,6 +34,10 @@ export interface AutomationServerHandle {const DEV_AUTOMATION_HTTP_URL = import.meta.env.DEV? __OPENPENCIL_LOCAL_AUTOMATION_HTTP_URL__: `http://127.0.0.1:${AUTOMATION_HTTP_PORT}`+export function getMCPServerURL(): string {+ return `${DEV_AUTOMATION_HTTP_URL}/mcp`+}+const DEV_AUTOMATION_AUTH_TOKEN =import.meta.env.DEV && typeof __OPENPENCIL_LOCAL_AUTOMATION_TOKEN__ === 'string'? __OPENPENCIL_LOCAL_AUTOMATION_TOKEN__diff --git a/src/app/automation/webmcp/policy.ts b/src/app/automation/webmcp/policy.tsnew file mode 100644index 000000000..a216370f0--- /dev/null+++ b/src/app/automation/webmcp/policy.ts@@ -0,0 +1,17 @@+import * as v from 'valibot'++import { ALL_TOOLS } from '@open-pencil/core/tools'++export const webmcpModeSchema = v.picklist(['off', 'inspect', 'edit'])+export type WebMCPMode = v.InferOutput<typeof webmcpModeSchema>++export function resolveWebMCPMode(value: unknown): WebMCPMode {+ const result = v.safeParse(webmcpModeSchema, value)+ return result.success ? result.output : 'off'+}++export function getWebMCPTools(mode: WebMCPMode) {+ return ALL_TOOLS.filter(+ (tool) => tool.exposure.webmcp && mode !== 'off' && (mode === 'edit' || !tool.mutates)+ )+}diff --git a/src/app/automation/webmcp/preferences.ts b/src/app/automation/webmcp/preferences.tsnew file mode 100644index 000000000..d0d23f046--- /dev/null+++ b/src/app/automation/webmcp/preferences.ts@@ -0,0 +1,13 @@+import { useLocalStorage } from '@vueuse/core'+import { computed } from 'vue'++import { resolveWebMCPMode, type WebMCPMode } from './policy'++const storedMode = useLocalStorage('open-pencil:webmcp:mode', 'off')++export const webmcpMode = computed<WebMCPMode>({+ get: () => resolveWebMCPMode(storedMode.value),+ set: (mode) => {+ storedMode.value = resolveWebMCPMode(mode)+ }+})diff --git a/src/app/automation/webmcp/registration.ts b/src/app/automation/webmcp/registration.tsindex 96ab53483..946dd4d25 100644--- a/src/app/automation/webmcp/registration.ts+++ b/src/app/automation/webmcp/registration.ts@@ -3,7 +3,9 @@ import { toJsonSchema as toJSONSchema } from '@valibot/to-json-schema'import * as v from 'valibot'import type { WebMCP } from 'webmcp-types'-import { ALL_TOOLS, type ToolDef } from '@open-pencil/core/tools'+import type { ToolDef } from '@open-pencil/core/tools'++import { getWebMCPTools, type WebMCPMode } from './policy'const MAX_RESULT_BYTES = 256 * 1024@@ -19,15 +21,15 @@ export interface WebMCPRegistration {/** Capture the document before invoking any asynchronous work. */export function registerWebMCPTools(context: Pick<WebMCP.ModelContext, 'registerTool'> | undefined,- getTarget: () => WebMCPExecutionTarget+ getTarget: () => WebMCPExecutionTarget,+ mode: WebMCPMode): WebMCPRegistration {const lifetime = new AbortController()const dispose = () => lifetime.abort()const ready = (async () => {if (!context) returntry {- for (const def of ALL_TOOLS) {- if (!def.exposure.webmcp) continue+ for (const def of getWebMCPTools(mode)) {lifetime.signal.throwIfAborted()const schema = def.inputawait context.registerTool(@@ -38,7 +40,9 @@ export function registerWebMCPTools(annotations: { readOnlyHint: !def.mutates, untrustedContentHint: true },execute: async (input, options?: WebMCP.ToolExecuteCallbackOptions) => {// Early document.modelContext implementations omit execution options.- const signal = options?.signal ?? new AbortController().signal+ const signal = options?.signal+ ? AbortSignal.any([lifetime.signal, options.signal])+ : lifetime.signallifetime.signal.throwIfAborted()signal.throwIfAborted()const args = v.parse(schema, input)diff --git a/src/app/automation/webmcp/runtime.ts b/src/app/automation/webmcp/runtime.tsindex 4a2416d9e..5fdacb081 100644--- a/src/app/automation/webmcp/runtime.ts+++ b/src/app/automation/webmcp/runtime.ts@@ -5,13 +5,18 @@ import { executeAtomicEditorTool } from '@/app/automation/execution/editor'import type { EditorStore } from '@/app/editor/active-store'import { getTabById } from '@/app/tabs'-import { registerWebMCPTools } from './registration'+import { webmcpMode } from './preferences'+import { createWebMCPRuntimeService } from './service'++const service = createWebMCPRuntimeService()+export const webmcpRuntime = service.state/** Browser-native tools reuse the same editor targeting and handlers as remote MCP. */export function startWebMCP(getStore: () => EditorStore): () => void {const handleTool = createAutomationToolHandler(makeFigmaFromStore)- const registration = registerWebMCPTools(+ return service.start(typeof document === 'undefined' ? undefined : document.modelContext,+ webmcpMode,() => {const target = resolveAutomationTarget(getStore(), undefined)if (getTabById(target.documentId)?.kind !== 'document') {@@ -41,6 +46,4 @@ export function startWebMCP(getStore: () => EditorStore): () => void {}})- void registration.ready.catch((error: unknown) => console.warn('[WebMCP]', error))- return registration.dispose}diff --git a/src/app/automation/webmcp/service.ts b/src/app/automation/webmcp/service.tsnew file mode 100644index 000000000..502307a33--- /dev/null+++ b/src/app/automation/webmcp/service.ts@@ -0,0 +1,82 @@+import { reactive, watch, type Ref, type WatchStopHandle } from 'vue'+import type { WebMCP } from 'webmcp-types'++import { getWebMCPTools, type WebMCPMode } from './policy'+import {+ registerWebMCPTools,+ type WebMCPExecutionTarget,+ type WebMCPRegistration+} from './registration'++export interface WebMCPRuntimeState {+ status: 'unsupported' | 'off' | 'starting' | 'ready' | 'error'+ toolCount: number+ error: string | null+}++/** Own browser registration lifetimes independently of the settings presentation. */+export function createWebMCPRuntimeService() {+ const state = reactive<WebMCPRuntimeState>({+ status: 'off',+ toolCount: 0,+ error: null+ })+ let stopWatch: WatchStopHandle | undefined+ let registration: WebMCPRegistration | undefined+ let version = 0+ let pending = Promise.resolve()++ function stop() {+ version+++ stopWatch?.()+ stopWatch = undefined+ registration?.dispose()+ registration = undefined+ state.status = 'off'+ state.toolCount = 0+ state.error = null+ }++ function start(+ context: Pick<WebMCP.ModelContext, 'registerTool'> | undefined,+ mode: Readonly<Ref<WebMCPMode>>,+ getTarget: () => WebMCPExecutionTarget+ ) {+ stop()+ stopWatch = watch(+ mode,+ (value) => {+ const request = ++version+ registration?.dispose()+ registration = undefined+ state.toolCount = 0+ state.error = null+ state.status = value === 'off' ? 'off' : 'starting'+ if (!context) state.status = 'unsupported'+ if (!context || value === 'off') return++ // Wait for any pending registerTool call to observe its aborted lifetime.+ async function configure() {+ if (request !== version) return+ const next = registerWebMCPTools(context, getTarget, value)+ registration = next+ try {+ await next.ready+ if (request !== version) return+ state.toolCount = getWebMCPTools(value).length+ state.status = 'ready'+ } catch (error) {+ if (request !== version) return+ state.status = 'error'+ state.error = error instanceof Error ? error.message : String(error)+ }+ }+ pending = pending.then(configure)+ },+ { immediate: true, flush: 'sync' }+ )+ return stop+ }++ return { state, start, stop }+}diff --git a/src/app/editor/vectorize/settings/use.ts b/src/app/editor/vectorize/settings/use.tsindex bed57515c..279fb9c09 100644--- a/src/app/editor/vectorize/settings/use.ts+++ b/src/app/editor/vectorize/settings/use.ts@@ -5,13 +5,18 @@ import {setVectorizeCredential,vectorizeCredentialStatus,vectorizeProviderID,- VECTORIZE_PROVIDER_DEFINITIONS+ VECTORIZE_PROVIDER_DEFINITIONS,+ type VectorizeProviderID} from '@/app/editor/vectorize'import type { CredentialStatus } from '@/app/settings/credentials/types'const vectorizeServices = { status: vectorizeCredentialStatus, set: setVectorizeCredential }-export function useVectorizeSettings(keyDraft: Ref<string>, services = vectorizeServices) {+export function useVectorizeSettings(+ keyDraft: Ref<string>,+ selectedProvider: Readonly<Ref<VectorizeProviderID>> = vectorizeProviderID,+ services = vectorizeServices+) {const keyStatus = ref<CredentialStatus>('missing')const error = ref('')@@ -21,10 +26,11 @@ export function useVectorizeSettings(keyDraft: Ref<string>, services = vectorizetryOnScopeDispose(() => {disposed = trueversion+++ keyDraft.value = ''})const provider = computed(() =>- VECTORIZE_PROVIDER_DEFINITIONS.find((definition) => definition.id === vectorizeProviderID.value)+ VECTORIZE_PROVIDER_DEFINITIONS.find((definition) => definition.id === selectedProvider.value))const providerOptions = VECTORIZE_PROVIDER_DEFINITIONS.map((definition) => ({value: definition.id,@@ -33,38 +39,45 @@ export function useVectorizeSettings(keyDraft: Ref<string>, services = vectorizeasync function refreshStatus(): Promise<void> {const request = ++version- const id = vectorizeProviderID.value+ const id = selectedProvider.valuetry {const status = await services.status(id)- if (!disposed && version === request) keyStatus.value = status+ if (!isDisposed() && version === request) keyStatus.value = status} catch (cause) {- if (!disposed && version === request)+ if (!isDisposed() && version === request)error.value = cause instanceof Error ? cause.message : String(cause)}}- async function updateCredential(clear: boolean): Promise<void> {+ function isDisposed() {+ return disposed+ }++ async function updateCredential(clear: boolean): Promise<boolean> {const value = keyDraft.value- if (!clear && !value.trim()) return+ if (isDisposed()) return false+ if (!clear && !value.trim()) return trueconst request = ++version- const id = vectorizeProviderID.value+ const id = selectedProvider.valueerror.value = ''try {await services.set(id, clear ? '' : value)- if (disposed || version !== request) return+ if (isDisposed() || version !== request) return falseif (keyDraft.value === value) keyDraft.value = ''await refreshStatus()+ return !isDisposed()} catch (cause) {- if (!disposed && version === request)+ if (!isDisposed() && version === request)error.value = cause instanceof Error ? cause.message : String(cause)+ return false}}watch(- vectorizeProviderID,+ selectedProvider,() => {keyDraft.value = ''keyStatus.value = 'missing'diff --git a/src/app/integrations/mcp/settings/form.ts b/src/app/integrations/mcp/settings/form.tsnew file mode 100644index 000000000..a7df2a7ab--- /dev/null+++ b/src/app/integrations/mcp/settings/form.ts@@ -0,0 +1,105 @@+import { omit } from 'es-toolkit'+import * as v from 'valibot'+import { useForm } from 'vee-validate'+import { computed, reactive, ref, watch, type Ref } from 'vue'++import {+ createMCPConnectionDraft,+ validateMCPConnectionURL,+ mcpConnectionSettings,+ MCP_CONNECTION_NAME_MAX_LENGTH+} from '@/app/integrations/mcp'+import { requiredSetting, type SettingsValidationMessages } from '@/app/settings/validation/schema'++import type { MCPConnectionDraft } from '../types'++interface ConnectionFormMessages {+ connectionNameInvalid: string+ serverURLHint: string+ bearerTokenRequired: string+}+export type MCPConnectionFieldErrors = Partial<Record<'name' | 'url' | 'credential', string>>++/** Only credential availability enters form state, never entered or saved secrets. */+export function useMCPConnectionForm(+ messages: Readonly<Ref<SettingsValidationMessages>>,+ automation: Readonly<Ref<ConnectionFormMessages>>+) {+ const id = ref<MCPConnectionDraft['id']>(null)+ const schema = computed(() =>+ v.pipe(+ v.object({+ name: v.pipe(+ requiredSetting(messages.value.requiredField),+ v.check(+ (name) =>+ name.length <= MCP_CONNECTION_NAME_MAX_LENGTH &&+ name.toLowerCase() !== 'open-pencil' &&+ !mcpConnectionSettings.value.connections.some(+ (connection) =>+ connection.id !== id.value && connection.name.toLowerCase() === name.toLowerCase()+ ),+ automation.value.connectionNameInvalid+ )+ ),+ url: v.pipe(+ requiredSetting(messages.value.requiredField),+ v.check((value) => {+ try {+ validateMCPConnectionURL(value)+ return true+ } catch {+ return false+ }+ }, automation.value.serverURLHint)+ ),+ enabled: v.boolean(),+ authenticationType: v.picklist(['none', 'bearer']),+ credential: v.boolean()+ }),+ v.forward(+ v.partialCheck(+ [['enabled'], ['authenticationType'], ['credential']],+ (value) => !value.enabled || value.authenticationType !== 'bearer' || value.credential,+ automation.value.bearerTokenRequired+ ),+ ['credential']+ )+ )+ )+ const form = useForm({+ initialValues: { ...omit(createMCPConnectionDraft(), ['id']), credential: false },+ validationSchema: schema+ })+ const config = (state: { errors: string[] }) => ({+ validateOnModelUpdate: state.errors.length > 0,+ validateOnChange: false,+ validateOnInput: false+ })+ const [name] = form.defineField('name', config)+ const [url] = form.defineField('url', config)+ const [enabled] = form.defineField('enabled', config)+ const [authenticationType] = form.defineField('authenticationType', config)+ form.defineField('credential', config)+ watch([enabled, authenticationType], () => {+ if (form.errors.value.credential) void form.validateField('credential')+ })+ const fields = reactive({ id, name, url, enabled, authenticationType })+ const draft = computed<MCPConnectionDraft>({+ get: () => fields,+ set: (values) => {+ id.value = values.id+ form.resetForm({ values: { ...omit(values, ['id']), credential: false } })+ }+ })++ return {+ draft,+ dirty: computed(() => form.meta.value.dirty),+ errors: form.errors,+ blur: (field: 'name' | 'url' | 'credential') => form.validateField(field),+ setCredentialReady: (ready: boolean) => form.resetField('credential', { value: ready }),+ handleSubmit: form.handleSubmit,+ isSubmitting: form.isSubmitting+ }+}diff --git a/src/app/integrations/mcp/settings/use.ts b/src/app/integrations/mcp/settings/use.tsindex 1edc47def..e9bd64603 100644--- a/src/app/integrations/mcp/settings/use.ts+++ b/src/app/integrations/mcp/settings/use.ts@@ -23,13 +23,16 @@ const connectionServices = {}export function useMCPConnectionSettings(+ draft: Ref<MCPConnectionDraft>,tokenDraft: Ref<string>,automation: Readonly<Ref<{ bearerTokenRequired: string }>>,services = connectionServices) {- const draft = ref<MCPConnectionDraft>(createMCPConnectionDraft())const tokenStatus = ref<CredentialStatus>('missing')+ const credentialCleared = ref(false)const error = ref('')+ const pending = ref(0)+ const busy = computed(() => pending.value > 0)let version = 0let disposed = false@@ -37,6 +40,7 @@ export function useMCPConnectionSettings(tryOnScopeDispose(() => {disposed = trueversion+++ tokenDraft.value = ''})const savedConnection = computed(() =>@@ -50,6 +54,7 @@ export function useMCPConnectionSettings(function startAdd(): void {version++draft.value = createMCPConnectionDraft()+ credentialCleared.value = falsetokenDraft.value = ''tokenStatus.value = 'missing'error.value = ''@@ -60,7 +65,9 @@ export function useMCPConnectionSettings(if (!connection) return falseconst request = ++version+ pending.value++draft.value = createMCPConnectionDraft(connection)+ credentialCleared.value = falsetokenDraft.value = ''tokenStatus.value = 'missing'error.value = ''@@ -76,15 +83,19 @@ export function useMCPConnectionSettings(error.value = cause instanceof Error ? cause.message : String(cause)return true+ } finally {+ pending.value--}}async function save(): Promise<boolean> {const request = ++version+ pending.value++const id: MCPConnectionID = draft.value.id ?? `mcp-${crypto.randomUUID()}`draft.value.id = idconst target = { ...draft.value, id }const token = tokenDraft.value+ const clearToken = credentialCleared.valueerror.value = ''try {@@ -99,8 +110,9 @@ export function useMCPConnectionSettings(await enqueueMCPConnectionMutation(id, async () => {const connection = services.save({ ...target, enabled: false })- if (target.authenticationType === 'none') await services.setCredential(connection.id, '')- else if (token.trim()) await services.setCredential(connection.id, token)+ if (target.authenticationType === 'none' || (clearToken && !token.trim())) {+ await services.setCredential(connection.id, '')+ } else if (token.trim()) await services.setCredential(connection.id, token)else if (target.enabled && (await services.status(connection.id)) !== 'configured') {throw new Error(automation.value.bearerTokenRequired)}@@ -114,33 +126,18 @@ export function useMCPConnectionSettings(} catch (cause) {if (current(request)) error.value = cause instanceof Error ? cause.message : String(cause)return false+ } finally {+ pending.value--}}- async function clearCredential(): Promise<void> {- const id = draft.value.id- if (!id) return-- const request = ++version- const token = tokenDraft.value+ function clearCredential(): void {+ if (busy.value) return+ credentialCleared.value = true+ draft.value.enabled = false+ tokenDraft.value = ''+ tokenStatus.value = 'missing'error.value = ''-- try {- await enqueueMCPConnectionMutation(id, async () => {- const connection = mcpConnectionSettings.value.connections.find((item) => item.id === id)- if (!connection) throw new Error('Connection no longer exists')-- services.save({ ...createMCPConnectionDraft(connection), enabled: false })- await services.setCredential(id, '')- })- if (!current(request)) return-- draft.value.enabled = false- if (tokenDraft.value === token) tokenDraft.value = ''- tokenStatus.value = 'missing'- } catch (cause) {- if (current(request)) error.value = cause instanceof Error ? cause.message : String(cause)- }}async function remove(): Promise<boolean> {@@ -148,6 +145,7 @@ export function useMCPConnectionSettings(if (!id) return falseconst request = ++version+ pending.value++error.value = ''try {@@ -156,6 +154,8 @@ export function useMCPConnectionSettings(} catch (cause) {if (current(request)) error.value = cause instanceof Error ? cause.message : String(cause)return false+ } finally {+ pending.value--}}@@ -168,7 +168,10 @@ export function useMCPConnectionSettings(return {draft,+ busy,+ cancel: startAdd,tokenStatus,+ credentialCleared,error,savedConnection,startAdd,diff --git a/src/app/integrations/mcp/store.ts b/src/app/integrations/mcp/store.tsindex f1464c557..08f98a217 100644--- a/src/app/integrations/mcp/store.ts+++ b/src/app/integrations/mcp/store.ts@@ -13,7 +13,7 @@ import type {MCPConnectionSettings} from './types'-const MAX_NAME_LENGTH = 80+export const MCP_CONNECTION_NAME_MAX_LENGTH = 80const MAX_URL_LENGTH = 2048const MCP_CONNECTION_ID_PATTERN = /^mcp-[a-z0-9._-]{1,60}$/@@ -57,7 +57,7 @@ function parseConnection(value: unknown): MCPConnection | null {const connectionId = id as MCPConnectionIDreturn {id: connectionId,- name: name.slice(0, MAX_NAME_LENGTH),+ name: name.slice(0, MCP_CONNECTION_NAME_MAX_LENGTH),enabled: value.enabled === true,transport: { type: 'streamable-http', url },authentication: parseAuthentication(value.authentication, connectionId)@@ -129,7 +129,7 @@ export function createMCPConnectionDraft(connection?: MCPConnection): MCPConnectexport function saveMCPConnectionDraft(draft: MCPConnectionDraft): MCPConnection {const name = draft.name.trim()if (!name) throw new Error('Connection name is required')- if (name.length > MAX_NAME_LENGTH) throw new Error('Connection name is too long')+ if (name.length > MCP_CONNECTION_NAME_MAX_LENGTH) throw new Error('Connection name is too long')if (name.toLowerCase() === 'open-pencil') throw new Error('The open-pencil name is reserved')const duplicateName = mcpConnectionSettings.value.connections.some((connection) =>diff --git a/src/app/integrations/storage/settings/draft.ts b/src/app/integrations/storage/settings/draft.tsnew file mode 100644index 000000000..ee4b7ef26--- /dev/null+++ b/src/app/integrations/storage/settings/draft.ts@@ -0,0 +1,35 @@+import { appCredentialServices } from '@/app/settings/credentials/app'++import { storageProviderRegistry } from '../providers'+import type { StorageProviderID } from '../types'++/** Test a snapshot without changing saved preferences or exposing saved secrets to the form. */+export function testStorageDraft(+ providerID: StorageProviderID,+ preferences: Record<string, string>,+ credentials: Record<string, string>,+ cleared: string[]+) {+ const provider = storageProviderRegistry.get(providerID)+ const fields = new Set(provider.credentialFields.map((field) => field.id))+ const adapter = storageProviderRegistry.createAdapter(providerID, {+ preferences,+ credentials: {+ resolve(reference) {+ if (+ reference.integrationId !== providerID ||+ reference.profileId !== 'default' ||+ !fields.has(reference.field)+ ) {+ throw new Error('Unexpected storage credential reference')+ }+ if (cleared.includes(reference.field)) return Promise.resolve(null)+ const replacement = credentials[reference.field]?.trim()+ return replacement+ ? Promise.resolve(replacement)+ : appCredentialServices.resolver.resolve(reference)+ }+ }+ })+ return adapter.testConnection()+}diff --git a/src/app/integrations/storage/settings/feedback.ts b/src/app/integrations/storage/settings/feedback.tsnew file mode 100644index 000000000..a25f0eb9c--- /dev/null+++ b/src/app/integrations/storage/settings/feedback.ts@@ -0,0 +1,77 @@+import * as v from 'valibot'+import { computed, ref, type Ref } from 'vue'++import {+ requiredSetting,+ requiredSettingsURL,+ validSettingsURL,+ type SettingsValidationMessages+} from '@/app/settings/validation/schema'+import { useSettingsValidation } from '@/app/settings/validation/use'++import type { StoragePreferenceField } from '../types'+import type { useStorageSettings } from './use'++function preferenceSchema(field: StoragePreferenceField, messages: SettingsValidationMessages) {+ if (field.kind !== 'url')+ return field.required ? requiredSetting(messages.requiredField) : v.string()+ if (field.required) return requiredSettingsURL(messages)+ return v.pipe(+ v.string(),+ v.check((value) => !value.trim() || validSettingsURL(value), messages.invalidURL)+ )+}++export function useStorageSettingsFeedback(+ connection: ReturnType<typeof useStorageSettings>,+ credentials: Readonly<Ref<Record<string, string>>>,+ messages: Readonly<Ref<SettingsValidationMessages>>+) {+ const testing = ref(false)+ const values = computed(() => ({+ ...Object.fromEntries(+ connection.provider.value.preferenceFields.map((field) => [+ field.id,+ connection.preferenceDrafts.value[field.id] ?? ''+ ])+ ),+ ...Object.fromEntries(+ connection.provider.value.credentialFields.map((field) => [+ `credential:${field.id}`,+ Boolean(+ credentials.value[field.id]?.trim() ||+ connection.credentialStatuses.value[field.id] === 'configured'+ )+ ])+ )+ }))+ const schema = computed(() =>+ v.object({+ ...Object.fromEntries(+ connection.provider.value.preferenceFields.map((field) => [+ field.id,+ preferenceSchema(field, messages.value)+ ])+ ),+ ...Object.fromEntries(+ connection.provider.value.credentialFields.map((field) => [+ `credential:${field.id}`,+ testing.value && field.required+ ? v.pipe(+ v.boolean(),+ v.check((value: boolean) => value, messages.value.requiredField)+ )+ : v.boolean()+ ])+ )+ })+ )+ const validation = useSettingsValidation(values, schema)+ return {+ ...validation,+ async validate(intent: 'save' | 'test') {+ testing.value = intent === 'test'+ return validation.validate()+ }+ }+}diff --git a/src/app/integrations/storage/settings/use.ts b/src/app/integrations/storage/settings/use.tsindex 787b26019..b4ca3508b 100644--- a/src/app/integrations/storage/settings/use.ts+++ b/src/app/integrations/storage/settings/use.ts@@ -1,12 +1,11 @@-import { tryOnScopeDispose } from '@vueuse/core'-import { computed, onMounted, ref, watch, type Ref } from 'vue'+import { tryOnMounted, tryOnScopeDispose } from '@vueuse/core'+import { isEqual } from 'es-toolkit'+import { computed, ref, watch, type Ref } from 'vue'import {- createActiveStorageAdapter,activeStorageProviderID,readStoragePreferences,storageCredentialStatuses,- storagePreferencesComplete,storageProviderRegistry,writeStoragePreference} from '@/app/integrations/storage'@@ -15,115 +14,180 @@ import { credentialRef } from '@/app/settings/credentials/reference'import type { CredentialStatus } from '@/app/settings/credentials/types'import { resumeStorageSync } from '@/app/storage/sync'-export function useStorageSettings(credentialDrafts: Ref<Record<string, string>>) {- const provider = computed(() => storageProviderRegistry.get(activeStorageProviderID.value))+import { testStorageDraft } from './draft'++const storageSettingsServices = {+ readPreferences: readStoragePreferences,+ writePreference: writeStoragePreference,+ statuses: storageCredentialStatuses,+ manager: appCredentialServices.manager,+ test: testStorageDraft,+ resume: resumeStorageSync+}+export function useStorageSettings(+ credentialDrafts: Ref<Record<string, string>>,+ services = storageSettingsServices+) {+ const provider = computed(() => storageProviderRegistry.get(activeStorageProviderID.value))const preferenceDrafts = ref<Record<string, string>>({- ...readStoragePreferences(provider.value.id)+ ...services.readPreferences(provider.value.id)})- const credentialStatuses = ref<Record<string, CredentialStatus>>({})- const busy = ref(false)-+ const initialPreferences = ref({ ...preferenceDrafts.value })+ const savedStatuses = ref<Record<string, CredentialStatus>>({})+ const cleared = ref<string[]>([])+ const operation = ref<'save' | 'test' | null>(null)+ const busy = computed(() => operation.value !== null)+ const error = ref('')+ const dirty = computed(+ () =>+ !isEqual(preferenceDrafts.value, initialPreferences.value) ||+ cleared.value.length > 0 ||+ Object.values(credentialDrafts.value).some((value) => value.length > 0)+ )+ const credentialStatuses = computed(() => ({+ ...savedStatuses.value,+ ...Object.fromEntries(cleared.value.map((field) => [field, 'missing' as const]))+ }))const configured = computed(() =>- storagePreferencesComplete(provider.value.id) &&+ provider.value.preferenceFields.every(+ (field) =>+ !field.required || Boolean(services.readPreferences(provider.value.id)[field.id]?.trim())+ ) &&provider.value.credentialFields.every(- (field) => !field.required || credentialStatuses.value[field.id] === 'configured'+ (field) => !field.required || savedStatuses.value[field.id] === 'configured'))-let statusRequest = 0+ let version = 0let disposed = falsetryOnScopeDispose(() => {disposed = true+ version++statusRequest+++ credentialDrafts.value = {}})- async function refreshStatuses(): Promise<void> {+ function current(request: number) {+ return !disposed && request === version+ }++ async function refreshStatuses() {const request = ++statusRequestconst target = provider.valuetry {- const statuses = await storageCredentialStatuses(target.id)- if (!disposed && statusRequest === request && provider.value.id === target.id)- credentialStatuses.value = statuses+ const statuses = await services.statuses(target.id)+ if (!disposed && request === statusRequest && provider.value.id === target.id)+ savedStatuses.value = statuses} catch {- if (!disposed && statusRequest === request && provider.value.id === target.id) {- credentialStatuses.value = Object.fromEntries(+ if (!disposed && request === statusRequest && provider.value.id === target.id) {+ savedStatuses.value = Object.fromEntries(target.credentialFields.map((field) => [field.id, 'unavailable' as const]))}}}- function savePreferences(): void {- for (const field of provider.value.preferenceFields) {- writeStoragePreference(provider.value.id, field.id, preferenceDrafts.value[field.id] ?? '')- }- void resumeStorageSync()- }-- async function saveCredential(field: string): Promise<void> {- const target = credentialDrafts.value- const value = target[field]?.trim()- if (!value) return-- await appCredentialServices.manager.set(credentialRef(provider.value.id, field), value)- if (credentialDrafts.value === target && target[field]?.trim() === value) target[field] = ''- await refreshStatuses()- await resumeStorageSync()- }-- async function clearCredential(field: string): Promise<void> {- const target = credentialDrafts.value- await appCredentialServices.manager.clear(credentialRef(provider.value.id, field))- if (credentialDrafts.value === target) target[field] = ''- await refreshStatuses()- }-- watch(activeStorageProviderID, (providerID) => {- credentialStatuses.value = {}- preferenceDrafts.value = { ...readStoragePreferences(providerID) }+ function reset() {+ version+++ preferenceDrafts.value = { ...services.readPreferences(provider.value.id) }+ initialPreferences.value = { ...preferenceDrafts.value }credentialDrafts.value = {}+ cleared.value = []+ error.value = ''void refreshStatuses()- })+ }- onMounted(() => void refreshStatuses())+ function clearCredential(field: string) {+ if (busy.value || !provider.value.credentialFields.some((item) => item.id === field)) return+ credentialDrafts.value = { ...credentialDrafts.value, [field]: '' }+ cleared.value = [...new Set([...cleared.value, field])]+ }- async function testConnection() {- busy.value = true+ async function save(): Promise<boolean> {+ if (busy.value || disposed) return false+ operation.value = 'save'+ error.value = ''+ const request = ++versionconst target = provider.value-+ const preferences = { ...preferenceDrafts.value }+ const credentials = { ...credentialDrafts.value }+ const removals = new Set(cleared.value)try {- savePreferences()+ // Persistence spans preferences and the native credential store; it is not atomic.+ for (const field of target.preferenceFields)+ services.writePreference(target.id, field.id, preferences[field.id] ?? '')for (const field of target.credentialFields) {- if (provider.value.id !== target.id) return null-- await saveCredential(field.id)+ if (!current(request)) return false+ const reference = credentialRef(target.id, field.id)+ const replacement = credentials[field.id]?.trim()+ if (replacement) await services.manager.set(reference, replacement)+ else if (removals.has(field.id)) await services.manager.clear(reference)}- await resumeStorageSync()- if (provider.value.id !== target.id) return null-- const result = await createActiveStorageAdapter(target.id).testConnection()- return provider.value.id === target.id ? result : null- } catch (error) {- if (provider.value.id !== target.id) return null+ if (!current(request)) return false+ reset()+ void services+ .resume()+ .catch(() =>+ console.warn('[Storage] Could not resume synchronization after saving settings')+ )+ return true+ } catch (cause) {+ if (current(request)) {+ error.value = cause instanceof Error ? cause.message : String(cause)+ await refreshStatuses()+ }+ return false+ } finally {+ operation.value = null+ }+ }- return { ok: false as const, message: error instanceof Error ? error.message : String(error) }+ async function testConnection() {+ if (busy.value || disposed) return null+ operation.value = 'test'+ const request = version+ const target = provider.value.id+ const credentials = { ...credentialDrafts.value }+ const removals = cleared.value.filter((field) => !credentials[field]?.trim())+ try {+ const result = await services.test(+ target,+ { ...preferenceDrafts.value },+ credentials,+ removals+ )+ return current(request) ? result : null+ } catch (cause) {+ return current(request)+ ? { ok: false as const, message: cause instanceof Error ? cause.message : String(cause) }+ : null} finally {- busy.value = false+ operation.value = null}}+ watch(activeStorageProviderID, () => {+ savedStatuses.value = {}+ reset()+ })+ tryOnMounted(() => void refreshStatuses())+return {- testConnection,provider,preferenceDrafts,credentialStatuses,+ operation,busy,configured,- savePreferences,- saveCredential,- clearCredential+ dirty,+ error,+ begin: reset,+ cancel: reset,+ save,+ clearCredential,+ testConnection}}diff --git a/src/app/settings/dialog.ts b/src/app/settings/dialog.tsindex fff511b18..80f9d81dd 100644--- a/src/app/settings/dialog.ts+++ b/src/app/settings/dialog.ts@@ -12,7 +12,22 @@ export type SettingsSection =export const settingsDialogOpen = ref(false)export const settingsDialogSection = ref<SettingsSection>('general')+type SettingsNavigationRequest = (action: () => void) => void+let requestNavigation: SettingsNavigationRequest | null = null++export function registerSettingsNavigation(request: SettingsNavigationRequest) {+ requestNavigation = request+ return () => {+ if (requestNavigation === request) requestNavigation = null+ }+}+export function openSettingsDialog(section?: SettingsSection): void {- if (section) settingsDialogSection.value = section- settingsDialogOpen.value = true+ if (settingsDialogOpen.value && (!section || section === settingsDialogSection.value)) return+ const open = () => {+ if (section) settingsDialogSection.value = section+ settingsDialogOpen.value = true+ }+ if (settingsDialogOpen.value && requestNavigation) requestNavigation(open)+ else open()}diff --git a/src/app/settings/media/use.ts b/src/app/settings/media/use.tsnew file mode 100644index 000000000..0ec6e0cc3--- /dev/null+++ b/src/app/settings/media/use.ts@@ -0,0 +1,87 @@+import { tryOnScopeDispose } from '@vueuse/core'+import { computed, ref, watch } from 'vue'++import { vectorizeProviderID } from '@/app/editor/vectorize'+import { useVectorizeSettings } from '@/app/editor/vectorize/settings/use'+import {+ pexelsKeyStatus,+ setPexelsKey,+ unsplashKeyStatus,+ setUnsplashKey+} from '@/app/settings/credentials/media'++export type MediaSettingsService = 'pexels' | 'unsplash' | 'vectorize'++const stockServices = {+ pexels: { status: pexelsKeyStatus, set: setPexelsKey },+ unsplash: { status: unsplashKeyStatus, set: setUnsplashKey }+}++export function useMediaSettingsEditor(service: MediaSettingsService, services = stockServices) {+ const key = ref('')+ const providerID = ref(vectorizeProviderID.value)+ const initialProvider = providerID.value+ const removeKey = ref(false)+ const busy = ref(false)+ const saveError = ref('')+ const vector = service === 'vectorize' ? useVectorizeSettings(key, providerID) : null+ let disposed = false+ tryOnScopeDispose(() => {+ disposed = true+ key.value = ''+ })+ watch(+ providerID,+ () => {+ removeKey.value = false+ },+ { flush: 'sync' }+ )++ const keyStatus = computed(() => {+ if (removeKey.value) return 'missing'+ return service === 'vectorize'+ ? (vector?.keyStatus.value ?? 'missing')+ : services[service].status.value+ })+ const error = computed(() => saveError.value || vector?.error.value || '')+ const dirty = computed(+ () => key.value.length > 0 || removeKey.value || providerID.value !== initialProvider+ )++ function clearCredential() {+ if (busy.value) return+ key.value = ''+ removeKey.value = true+ }++ function isDisposed() {+ return disposed+ }++ async function save(): Promise<boolean> {+ if (busy.value || isDisposed()) return false+ busy.value = true+ saveError.value = ''+ try {+ if (vector) {+ const saved =+ removeKey.value && !key.value.trim()+ ? await vector.clearCredential()+ : await vector.saveCredential()+ if (!saved || isDisposed()) return false+ vectorizeProviderID.value = providerID.value+ } else if (service !== 'vectorize' && (key.value.trim() || removeKey.value)) {+ await services[service].set(key.value.trim())+ }+ return !isDisposed()+ } catch (cause) {+ if (!isDisposed()) saveError.value = cause instanceof Error ? cause.message : String(cause)+ return false+ } finally {+ busy.value = false+ }+ }++ return { key, providerID, vector, keyStatus, error, dirty, busy, clearCredential, save }+}diff --git a/src/app/settings/navigation/use.ts b/src/app/settings/navigation/use.tsnew file mode 100644index 000000000..30e3c18a0--- /dev/null+++ b/src/app/settings/navigation/use.ts@@ -0,0 +1,67 @@+import { computed, inject, provide, shallowRef, watch, type InjectionKey, type Ref } from 'vue'++interface SettingsFormGuard {+ dirty: Readonly<Ref<boolean>>+ busy: Readonly<Ref<boolean>>+ cancel: () => void+}++/** One navigation policy for every editor in the Settings window. */+export function createSettingsNavigation() {+ const active = shallowRef<SettingsFormGuard | null>(null)+ const pending = shallowRef<{ form: SettingsFormGuard; action: () => void } | null>(null)++ function leave(form: SettingsFormGuard | null, action: () => void) {+ active.value = null+ form?.cancel()+ action()+ }++ return {+ editing: computed(() => active.value !== null),+ confirming: computed(() => pending.value !== null),+ register(form: SettingsFormGuard) {+ active.value = form+ return () => {+ if (active.value === form) active.value = null+ if (pending.value?.form === form) pending.value = null+ }+ },+ request(action: () => void) {+ const form = active.value+ if (form?.busy.value) return+ if (form?.dirty.value) pending.value = { form, action }+ else leave(form, action)+ },+ keepEditing() {+ pending.value = null+ },+ discard() {+ const request = pending.value+ if (!request || request.form !== active.value || request.form.busy.value) return+ pending.value = null+ leave(request.form, request.action)+ }+ }+}++const navigationKey: InjectionKey<ReturnType<typeof createSettingsNavigation>> =+ Symbol('settings-navigation')++export function provideSettingsNavigation() {+ const navigation = createSettingsNavigation()+ provide(navigationKey, navigation)+ return navigation+}++export function useSettingsFormGuard(form: SettingsFormGuard, when?: Readonly<Ref<boolean>>) {+ const navigation = inject(navigationKey, null)+ if (!navigation) return+ watch(+ () => when?.value ?? true,+ (enabled, _previous, onCleanup) => {+ if (enabled) onCleanup(navigation.register(form))+ },+ { immediate: true, flush: 'sync' }+ )+}diff --git a/src/app/settings/validation/schema.ts b/src/app/settings/validation/schema.tsnew file mode 100644index 000000000..03e13c0b9--- /dev/null+++ b/src/app/settings/validation/schema.ts@@ -0,0 +1,26 @@+import * as v from 'valibot'++export interface SettingsValidationMessages {+ requiredField: string+ invalidURL: string+}++export function requiredSetting(message: string) {+ return v.pipe(v.string(), v.trim(), v.nonEmpty(message))+}++export function validSettingsURL(value: string): boolean {+ try {+ const url = new URL(value)+ return (url.protocol === 'http:' || url.protocol === 'https:') && !url.username && !url.password+ } catch {+ return false+ }+}++export function requiredSettingsURL(messages: SettingsValidationMessages) {+ return v.pipe(+ requiredSetting(messages.requiredField),+ v.check(validSettingsURL, messages.invalidURL)+ )+}diff --git a/src/app/settings/validation/use.ts b/src/app/settings/validation/use.tsnew file mode 100644index 000000000..883b0dd03--- /dev/null+++ b/src/app/settings/validation/use.ts@@ -0,0 +1,46 @@+import type { GenericSchema } from 'valibot'+import { useForm } from 'vee-validate'+import { watch, type Ref } from 'vue'++/** Validate a non-secret projection without moving persistence into the form layer. */+export function useSettingsValidation(+ values: Readonly<Ref<Record<string, string | boolean>>>,+ schema: Readonly<Ref<GenericSchema>>+) {+ const form = useForm<Record<string, string | boolean>>({+ initialValues: { ...values.value },+ validationSchema: schema+ })+ const registered = new Set<string>()+ function registerFields() {+ for (const field of Object.keys(values.value)) {+ if (registered.has(field)) continue+ registered.add(field)+ form.defineField(field, (state) => ({+ validateOnModelUpdate: state.errors.length > 0,+ validateOnChange: false,+ validateOnInput: false+ }))+ }+ }+ registerFields()+ watch(+ values,+ (next, previous) => {+ registerFields()+ form.setValues({ ...next }, false)+ // Cross-field rules may attach their issue to a different field than the one changed.+ if (Object.keys(next).some((field) => next[field] !== previous[field])) {+ for (const field of Object.keys(form.errors.value)) void form.validateField(field)+ }+ },+ { deep: true, flush: 'sync' }+ )++ return {+ errors: form.errors,+ blur: (field: string) => form.validateField(field),+ validate: async () => (await form.validate()).valid,+ reset: () => form.resetForm({ values: { ...values.value } }, { force: true })+ }+}diff --git a/src/components/settings/SettingsDialog.vue b/src/components/settings/SettingsDialog.vueindex b5c98ccc4..81dd68571 100644--- a/src/components/settings/SettingsDialog.vue+++ b/src/components/settings/SettingsDialog.vue@@ -1,27 +1,34 @@<script setup lang="ts">-import { DialogClose } from 'reka-ui'-import { ref } from 'vue'+import { tryOnScopeDispose } from '@vueuse/core'+import { AlertDialogCancel, DialogClose } from 'reka-ui'+import { computed } from 'vue'import { useI18n, useViewportKind } from '@open-pencil/vue'-import { settingsDialogOpen, settingsDialogSection } from '@/app/settings/dialog'+import {+ settingsDialogOpen,+ registerSettingsNavigation,+ settingsDialogSection,+ type SettingsSection+} from '@/app/settings/dialog'+import { provideSettingsNavigation } from '@/app/settings/navigation/use'import ChatSettingsSection from '@/components/settings/chat/ChatSettingsSection.vue'import DiagnosticsSettingsPanel from '@/components/settings/diagnostics/DiagnosticsSettingsPanel.vue'import GeneralSettingsPanel from '@/components/settings/general/GeneralSettingsPanel.vue'-import MCPConnectionsSection from '@/components/settings/mcp/MCPConnectionsSection.vue'-import MCPSettingsPanel from '@/components/settings/mcp/MCPSettingsPanel.vue'+import SettingsPage from '@/components/settings/layout/SettingsPage.vue'+import MCPWorkspacePanel from '@/components/settings/mcp/MCPWorkspacePanel.vue'+import MediaSettingsPanel from '@/components/settings/media/MediaSettingsPanel.vue'import ModelsPanel from '@/components/settings/models/ModelsPanel.vue'-import StockPhotoKeysSection from '@/components/settings/provider/StockPhotoKeysSection.vue'import StorageSettingsPanel from '@/components/settings/storage/StorageSettingsPanel.vue'import UsageSettingsPanel from '@/components/settings/usage/UsageSettingsPanel.vue'-import VectorizeSettingsSection from '@/components/settings/vectorize/VectorizeSettingsSection.vue'import AppButton from '@/components/ui/button/AppButton.vue'import {- AppDialogBody,+ AppAlertDialogRoot,AppDialogFooter,AppDialogHeader,AppDialogRoot} from '@/components/ui/dialog'+import AppSelect from '@/components/ui/select/AppSelect.vue'import AppTabsContent from '@/components/ui/tabs/AppTabsContent.vue'import AppTabsList from '@/components/ui/tabs/AppTabsList.vue'import AppTabsRoot from '@/components/ui/tabs/AppTabsRoot.vue'@@ -29,22 +36,43 @@ import AppTabsTrigger from '@/components/ui/tabs/AppTabsTrigger.vue'const { isMobile } = useViewportKind()const { settings, common } = useI18n()-const editingModel = ref(false)+const navigation = provideSettingsNavigation()+tryOnScopeDispose(registerSettingsNavigation(navigation.request))+const { editing, confirming } = navigation+const sections = computed(+ () =>+ [+ { value: 'general', label: settings.value.general },+ { value: 'ai', label: settings.value.aiAndAgents },+ { value: 'usage', label: settings.value.usage },+ { value: 'diagnostics', label: settings.value.diagnostics },+ { value: 'mcp', label: settings.value.automation },+ { value: 'media', label: settings.value.media },+ { value: 'storage', label: settings.value.storage }+ ] satisfies { value: SettingsSection; label: string }[]+)function onSectionChange(section: string | number): void {- if (editingModel.value) return- settingsDialogSection.value = section as typeof settingsDialogSection.value+ const match = sections.value.find((item) => item.value === section)+ if (!match || match.value === settingsDialogSection.value) return+ navigation.request(() => {+ settingsDialogSection.value = match.value+ })}function onOpenChange(open: boolean): void {- if (!open && editingModel.value) return- settingsDialogOpen.value = open+ if (open) settingsDialogOpen.value = true+ else+ navigation.request(() => {+ settingsDialogOpen.value = false+ })}</script><template><AppDialogRoot:open="settingsDialogOpen"- size="lg"- height="tall"+ size="xl"+ :ui="{ content: 'w-[min(52.5rem,96vw)]' }"+ height="full"data-test-id="app-settings-dialog"@update:open="onOpenChange">@@ -52,7 +80,6 @@ function onOpenChange(open: boolean): void {:heading="settings.title":description="settings.description":close-label="common.close"- :show-close="!editingModel"/><AppTabsRoot@@ -60,7 +87,16 @@ function onOpenChange(open: boolean): void {@update:model-value="onSectionChange":orientation="isMobile ? 'horizontal' : 'vertical'">- <AppTabsList :label="settings.title" :inert="editingModel || undefined">+ <div v-if="isMobile" class="shrink-0 border-b border-border p-3">+ <AppSelect+ :model-value="settingsDialogSection"+ :options="sections"+ :label="settings.title"+ :ui="{ trigger: 'w-full' }"+ @update:model-value="onSectionChange"+ />+ </div>+ <AppTabsList v-show="!isMobile" :label="settings.title"><AppTabsTrigger value="general" data-test-id="settings-section-general"><template #leading><icon-lucide-settings class="size-3.5" /></template>{{ settings.general }}@@ -92,46 +128,33 @@ function onOpenChange(open: boolean): void {</AppTabsList><AppTabsContent value="general" as-child>- <AppDialogBody><GeneralSettingsPanel /></AppDialogBody>+ <SettingsPage><GeneralSettingsPanel /></SettingsPage></AppTabsContent><AppTabsContent value="ai" as-child>- <AppDialogBody>- <section class="flex h-full flex-col" data-test-id="settings-ai-panel">- <ModelsPanel v-model:editing="editingModel">- <ChatSettingsSection />- </ModelsPanel>- </section>- </AppDialogBody>+ <section class="flex min-h-0 min-w-0 flex-1 flex-col" data-test-id="settings-ai-panel">+ <ModelsPanel>+ <ChatSettingsSection />+ </ModelsPanel>+ </section></AppTabsContent><AppTabsContent value="usage" as-child>- <AppDialogBody><UsageSettingsPanel /></AppDialogBody>+ <SettingsPage><UsageSettingsPanel /></SettingsPage></AppTabsContent><AppTabsContent value="diagnostics" as-child>- <AppDialogBody><DiagnosticsSettingsPanel /></AppDialogBody>+ <SettingsPage><DiagnosticsSettingsPanel /></SettingsPage></AppTabsContent><AppTabsContent value="mcp" as-child>- <AppDialogBody>- <section class="flex flex-col" data-test-id="settings-mcp-panel">- <MCPSettingsPanel />- <MCPConnectionsSection />- </section>- </AppDialogBody>+ <MCPWorkspacePanel /></AppTabsContent><AppTabsContent value="media" as-child>- <AppDialogBody>- <section class="flex flex-col gap-2.5" data-test-id="settings-media-panel">- <h3 class="text-xs font-semibold text-surface">{{ settings.media }}</h3>- <StockPhotoKeysSection />- <VectorizeSettingsSection />- </section>- </AppDialogBody>+ <MediaSettingsPanel /></AppTabsContent><AppTabsContent value="storage" as-child>- <AppDialogBody><StorageSettingsPanel /></AppDialogBody>+ <StorageSettingsPanel /></AppTabsContent></AppTabsRoot>- <AppDialogFooter v-if="!editingModel || settingsDialogSection !== 'ai'">+ <AppDialogFooter v-if="!editing"><DialogClose as-child><AppButton color="primary" variant="solid" data-test-id="app-settings-done">{{ common.done }}@@ -139,4 +162,19 @@ function onOpenChange(open: boolean): void {</DialogClose></AppDialogFooter></AppDialogRoot>+ <AppAlertDialogRoot :open="confirming" @update:open="!$event && navigation.keepEditing()">+ <AppDialogHeader+ :heading="settings.discardChanges"+ :description="settings.discardChangesDescription"+ :show-close="false"+ />+ <AppDialogFooter>+ <AlertDialogCancel as-child+ ><AppButton>{{ settings.keepEditing }}</AppButton></AlertDialogCancel+ >+ <AppButton color="error" variant="solid" @click="navigation.discard">{{+ settings.discard+ }}</AppButton>+ </AppDialogFooter>+ </AppAlertDialogRoot></template>diff --git a/src/components/settings/chat/ChatSettingsSection.vue b/src/components/settings/chat/ChatSettingsSection.vueindex b9a93c081..c8ddb1228 100644--- a/src/components/settings/chat/ChatSettingsSection.vue+++ b/src/components/settings/chat/ChatSettingsSection.vue@@ -4,6 +4,8 @@ import { computed } from 'vue'import { useI18n } from '@open-pencil/vue'import { reasoningDisplay } from '@/app/ai/chat/preferences'+import SettingsGroup from '@/components/settings/layout/SettingsGroup.vue'+import SettingsRow from '@/components/settings/layout/SettingsRow.vue'import SettingsSectionHeader from '@/components/settings/layout/SettingsSectionHeader.vue'import AppSelect from '@/components/ui/select/AppSelect.vue'@@ -16,11 +18,17 @@ const options = computed(() => [</script><template>- <section class="mt-5 flex flex-col gap-3 border-t border-border pt-4">+ <section class="flex flex-col gap-4"><SettingsSectionHeader>{{ ai.chatSettings }}</SettingsSectionHeader>- <div class="grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-center gap-3">- <span class="text-[11px] text-surface">{{ ai.reasoningDisplay }}</span>- <AppSelect v-model="reasoningDisplay" :label="ai.reasoningDisplay" :options="options" />- </div>+ <SettingsGroup>+ <SettingsRow :label="ai.reasoningDisplay" class="max-sm:flex-col max-sm:items-stretch">+ <AppSelect+ v-model="reasoningDisplay"+ :label="ai.reasoningDisplay"+ :options="options"+ class="w-full sm:w-52"+ />+ </SettingsRow>+ </SettingsGroup></section></template>diff --git a/src/components/settings/diagnostics/DiagnosticsSettingsPanel.vue b/src/components/settings/diagnostics/DiagnosticsSettingsPanel.vueindex 6e87cc16a..098b01d77 100644--- a/src/components/settings/diagnostics/DiagnosticsSettingsPanel.vue+++ b/src/components/settings/diagnostics/DiagnosticsSettingsPanel.vue@@ -111,7 +111,7 @@ async function exportDiagnostics() {</div><divv-if="recentEvents.length"- class="flex max-h-64 flex-col overflow-y-auto divide-y divide-border rounded border border-border"+ class="flex flex-col divide-y divide-border rounded border border-border"><divv-for="event in recentEvents"diff --git a/src/components/settings/general/GeneralSettingsPanel.vue b/src/components/settings/general/GeneralSettingsPanel.vueindex 87351ea65..8dd2a54b8 100644--- a/src/components/settings/general/GeneralSettingsPanel.vue+++ b/src/components/settings/general/GeneralSettingsPanel.vue@@ -7,6 +7,7 @@ import { recoveryEnabled, setRecoveryEnabled } from '@/app/document/recovery/preimport { setSnappingPreference } from '@/app/settings/preferences/apply'import { appPreferences } from '@/app/settings/preferences/store'import { animationPreference } from '@/app/shell/motion'+import { useAppTheme } from '@/app/shell/theme'import CredentialSettingsSection from '@/components/settings/credentials/CredentialSettingsSection.vue'import RenderingSettingsSection from '@/components/settings/general/RenderingSettingsSection.vue'import SettingsGroup from '@/components/settings/layout/SettingsGroup.vue'@@ -16,6 +17,8 @@ import AppSwitch from '@/components/ui/toggle/AppSwitch.vue'const { availableLocales, locale, localeLabels, menu, recovery, setLocale, settings } = useI18n()+const { theme } = useAppTheme()+const language = computed<Locale>({get: () => locale.value,set: setLocale@@ -67,20 +70,36 @@ const snapToPixelGrid = computed({</label></div>- <SettingsGroup>- <label class="flex items-center justify-between gap-4 px-3 py-2.5">- <span class="text-xs text-surface">{{ settings.animations }}</span>- <AppSelect- v-model="animationPreference"- :label="settings.animations"- :options="[- { value: 'system', label: settings.animationsSystem },- { value: 'off', label: settings.animationsOff }- ]"- class="w-44"- />- </label>- </SettingsGroup>+ <section class="flex flex-col gap-4" :aria-label="settings.appearance">+ <SettingsSectionHeader>{{ settings.appearance }}</SettingsSectionHeader>+ <SettingsGroup>+ <label class="flex items-center justify-between gap-4 px-3 py-2.5">+ <span class="text-xs text-surface">{{ menu.theme }}</span>+ <AppSelect+ v-model="theme"+ :label="menu.theme"+ :options="[+ { value: 'auto', label: menu.themeAuto },+ { value: 'light', label: menu.themeLight },+ { value: 'dark', label: menu.themeDark }+ ]"+ class="w-44"+ />+ </label>+ <label class="flex items-center justify-between gap-4 px-3 py-2.5">+ <span class="text-xs text-surface">{{ settings.animations }}</span>+ <AppSelect+ v-model="animationPreference"+ :label="settings.animations"+ :options="[+ { value: 'system', label: settings.animationsSystem },+ { value: 'off', label: settings.animationsOff }+ ]"+ class="w-44"+ />+ </label>+ </SettingsGroup>+ </section><SettingsSectionHeader>{{ recovery.settingsTitle }}diff --git a/src/components/settings/layout/SettingsDisclosure.vue b/src/components/settings/layout/SettingsDisclosure.vuenew file mode 100644index 000000000..86fa05d3d--- /dev/null+++ b/src/components/settings/layout/SettingsDisclosure.vue@@ -0,0 +1,23 @@+<script setup lang="ts">+import { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger } from 'reka-ui'++import { settingsDisclosureMotion } from '@/theme/settings/disclosure'++const open = defineModel<boolean>('open', { default: false })+</script>++<template>+ <CollapsibleRoot v-model:open="open">+ <CollapsibleTrigger+ class="group flex w-full items-center gap-2 py-3 text-left text-xs text-surface"+ >+ <icon-lucide-chevron-right+ class="size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none"+ />+ <slot name="label" />+ </CollapsibleTrigger>+ <CollapsibleContent :class="settingsDisclosureMotion">+ <div class="pb-3"><slot /></div>+ </CollapsibleContent>+ </CollapsibleRoot>+</template>diff --git a/src/components/settings/layout/SettingsPage.vue b/src/components/settings/layout/SettingsPage.vuenew file mode 100644index 000000000..a8b4f2134--- /dev/null+++ b/src/components/settings/layout/SettingsPage.vue@@ -0,0 +1,14 @@+<script setup lang="ts">+import { AppDialogBody, AppDialogFooter } from '@/components/ui/dialog'+</script>++<template>+ <div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden" data-slot="settings-page">+ <AppDialogBody :ui="{ body: 'p-5 sm:p-6' }">+ <slot />+ </AppDialogBody>+ <AppDialogFooter v-if="$slots.footer">+ <slot name="footer" />+ </AppDialogFooter>+ </div>+</template>diff --git a/src/components/settings/layout/SettingsRow.vue b/src/components/settings/layout/SettingsRow.vuenew file mode 100644index 000000000..d50fefd70--- /dev/null+++ b/src/components/settings/layout/SettingsRow.vue@@ -0,0 +1,14 @@+<script setup lang="ts">+const { label, description } = defineProps<{ label: string; description?: string }>()+</script>++<template>+ <div class="flex items-center justify-between gap-4 px-3 py-2.5" data-slot="settings-row">+ <div class="min-w-0">+ <p class="text-xs font-medium text-surface">{{ label }}</p>+ <p v-if="description" class="mt-1 text-xs leading-relaxed text-muted">{{ description }}</p>+ <slot name="description" />+ </div>+ <div class="shrink-0"><slot /></div>+ </div>+</template>diff --git a/src/components/settings/layout/focus.ts b/src/components/settings/layout/focus.tsnew file mode 100644index 000000000..d133b2d90--- /dev/null+++ b/src/components/settings/layout/focus.ts@@ -0,0 +1,7 @@+import { nextTick } from 'vue'++/** Move focus only after validation has rendered its field feedback. */+export async function focusInvalidField(container: HTMLElement | null | undefined) {+ await nextTick()+ container?.querySelector<HTMLElement>('[aria-invalid="true"]')?.focus()+}diff --git a/src/components/settings/mcp/MCPConnectionEditor.stories.ts b/src/components/settings/mcp/MCPConnectionEditor.stories.tsnew file mode 100644index 000000000..041a92083--- /dev/null+++ b/src/components/settings/mcp/MCPConnectionEditor.stories.ts@@ -0,0 +1,47 @@+import type { Meta, StoryObj } from '@storybook/vue3-vite'+import { ref } from 'vue'++import type { MCPConnectionDraft } from '@/app/integrations/mcp'+import type { CredentialStatus } from '@/app/settings/credentials/types'++import MCPConnectionEditor from './MCPConnectionEditor.vue'++type Args = {+ draft: MCPConnectionDraft+ tokenStatus: CredentialStatus+ busy: boolean+ error: string+}+const emptyDraft: MCPConnectionDraft = {+ id: null,+ name: '',+ url: '',+ enabled: false,+ authenticationType: 'none'+}+const savedDraft: MCPConnectionDraft = {+ id: 'mcp-story',+ name: 'Design library',+ url: 'https://example.com/mcp',+ enabled: true,+ authenticationType: 'bearer'+}+const meta = {+ title: 'Settings/MCP/Connection editor',+ args: { draft: emptyDraft, tokenStatus: 'missing', busy: false, error: '' },+ render: (args) => ({+ components: { MCPConnectionEditor },+ setup: () => ({ args, draft: ref({ ...args.draft }), token: ref('') }),+ template:+ '<div class="max-w-lg bg-panel p-4"><MCPConnectionEditor v-model:draft="draft" v-model:token="token" :token-status="args.tokenStatus" :busy="args.busy" :error="args.error" /></div>'+ })+} satisfies Meta<Args>+export default meta+type Story = StoryObj<typeof meta>+export const Create: Story = {}+export const Edit: Story = { args: { draft: savedDraft, tokenStatus: 'configured' } }+export const MissingCredential: Story = { args: { draft: savedDraft } }+export const Saving: Story = { args: { draft: savedDraft, tokenStatus: 'configured', busy: true } }+export const CredentialFailure: Story = {+ args: { draft: savedDraft, error: 'The credential store is locked. Unlock it and try again.' }+}diff --git a/src/components/settings/mcp/MCPConnectionEditor.vue b/src/components/settings/mcp/MCPConnectionEditor.vuenew file mode 100644index 000000000..8cb8036db--- /dev/null+++ b/src/components/settings/mcp/MCPConnectionEditor.vue@@ -0,0 +1,160 @@+<script setup lang="ts">+import { useTemplateRef } from 'vue'++import {+ useAutomationMessages,+ useCommonMessages,+ useCredentialMessages,+ useSettingsMessages+} from '@open-pencil/vue'++import type { MCPConnectionDraft } from '@/app/integrations/mcp'+import type { MCPConnectionFieldErrors } from '@/app/integrations/mcp/settings/form'+import type { CredentialStatus } from '@/app/settings/credentials/types'+import { focusInvalidField } from '@/components/settings/layout/focus'+import SettingsGroup from '@/components/settings/layout/SettingsGroup.vue'+import SettingsPage from '@/components/settings/layout/SettingsPage.vue'+import SettingsRow from '@/components/settings/layout/SettingsRow.vue'+import SettingsSectionHeader from '@/components/settings/layout/SettingsSectionHeader.vue'+import ProviderSettingsField from '@/components/settings/provider/ProviderSettingsField.vue'+import ProviderSettingsKeyField from '@/components/settings/provider/ProviderSettingsKeyField.vue'+import AppButton from '@/components/ui/button/AppButton.vue'+import AppInput from '@/components/ui/input/AppInput.vue'+import AppSwitch from '@/components/ui/toggle/AppSwitch.vue'++const draft = defineModel<MCPConnectionDraft>('draft', { required: true })+const token = defineModel<string>('token', { required: true })+const {+ tokenStatus,+ busy,+ error,+ fieldErrors = {}+} = defineProps<{+ tokenStatus: CredentialStatus+ busy: boolean+ error: string+ fieldErrors?: MCPConnectionFieldErrors+}>()+defineEmits<{+ cancel: []+ save: []+ remove: []+ clear: []+ blurField: [field: 'name' | 'url' | 'credential']+}>()+const automation = useAutomationMessages()+const common = useCommonMessages()+const credentials = useCredentialMessages()+const settings = useSettingsMessages()+const formElement = useTemplateRef<HTMLFormElement>('formElement')+defineExpose({ focusInvalid: () => focusInvalidField(formElement.value) })+</script>++<template>+ <form+ ref="formElement"+ class="flex min-h-0 min-w-0 flex-1 flex-col"+ :aria-busy="busy"+ novalidate+ @submit.prevent="$emit('save')"+ >+ <SettingsPage>+ <div class="flex flex-col gap-4">+ <SettingsSectionHeader>+ {{ draft.id ? automation.editConnection : automation.addServerConnection }}+ <template #description>{{ automation.connectionEditorDescription }}</template>+ </SettingsSectionHeader>+ <fieldset :disabled="busy" class="flex min-w-0 flex-col gap-3">+ <ProviderSettingsField+ v-slot="{ control }"+ :label="automation.connectionName"+ :hint="automation.connectionNameHint"+ :error="fieldErrors.name"+ @blur="$emit('blurField', 'name')"+ >+ <AppInput+ v-bind="control"+ v-model="draft.name"+ tone="panel"+ :aria-label="automation.connectionName"+ autocomplete="off"+ />+ </ProviderSettingsField>+ <ProviderSettingsField+ v-slot="{ control }"+ :label="automation.serverURL"+ :hint="automation.serverURLHint"+ :error="fieldErrors.url"+ @blur="$emit('blurField', 'url')"+ >+ <AppInput+ v-bind="control"+ v-model="draft.url"+ type="url"+ tone="panel"+ :aria-label="automation.serverURL"+ placeholder="https://example.com/mcp"+ autocomplete="off"+ autocapitalize="off"+ :spellcheck="false"+ />+ </ProviderSettingsField>+ <SettingsGroup>+ <SettingsRow :label="automation.enableConnection">+ <AppSwitch+ v-model="draft.enabled"+ :label="automation.enableConnection"+ :disabled="busy"+ />+ </SettingsRow>+ <SettingsRow :label="automation.bearerAuthentication">+ <AppSwitch+ :model-value="draft.authenticationType === 'bearer'"+ :label="automation.bearerAuthentication"+ :disabled="busy"+ @update:model-value="draft.authenticationType = $event ? 'bearer' : 'none'"+ />+ </SettingsRow>+ </SettingsGroup>+ <ProviderSettingsKeyField+ v-if="draft.authenticationType === 'bearer'"+ v-model="token"+ :label="automation.bearerToken"+ input-id="mcp-bearer-token"+ :saved="tokenStatus === 'configured'"+ kind="api"+ :placeholder="+ tokenStatus === 'configured'+ ? credentials.savedReplace+ : automation.bearerTokenPlaceholder+ "+ :hint="+ tokenStatus === 'configured'+ ? settings.savedCredentialHint+ : automation.bearerTokenRequired+ "+ :error="fieldErrors.credential"+ @clear="$emit('clear')"+ @blur="$emit('blurField', 'credential')"+ />+ </fieldset>+ <p v-if="error" class="text-xs text-error" role="alert">{{ settings.saveFailed }}</p>+ </div>+ <template #footer>+ <AppButton+ v-if="draft.id"+ class="mr-auto"+ color="error"+ variant="link"+ :disabled="busy"+ @click="$emit('remove')"+ >{{ automation.deleteConnection }}</AppButton+ >+ <AppButton :disabled="busy" @click="$emit('cancel')">{{ common.cancel }}</AppButton>+ <AppButton type="submit" color="primary" variant="solid" :loading="busy">{{+ common.save+ }}</AppButton>+ </template>+ </SettingsPage>+ </form>+</template>diff --git a/src/components/settings/mcp/MCPConnectionsSection.vue b/src/components/settings/mcp/MCPConnectionsSection.vueindex aef0be18b..9c2275201 100644--- a/src/components/settings/mcp/MCPConnectionsSection.vue+++ b/src/components/settings/mcp/MCPConnectionsSection.vue@@ -1,24 +1,44 @@<script setup lang="ts">-import { ref } from 'vue'+import { AlertDialogAction, AlertDialogCancel } from 'reka-ui'+import { computed, ref, useTemplateRef, watch } from 'vue'-import { useI18n } from '@open-pencil/vue'+import { useAutomationMessages, useCommonMessages, useSettingsMessages } from '@open-pencil/vue'import { mcpConnectionSettings } from '@/app/integrations/mcp'+import { useMCPConnectionForm } from '@/app/integrations/mcp/settings/form'import { useMCPConnectionSettings } from '@/app/integrations/mcp/settings/use'-import ProviderSettingsKeyField from '@/components/settings/provider/ProviderSettingsKeyField.vue'+import { useSettingsFormGuard } from '@/app/settings/navigation/use'+import SettingsPage from '@/components/settings/layout/SettingsPage.vue'+import SettingsSectionHeader from '@/components/settings/layout/SettingsSectionHeader.vue'import AppButton from '@/components/ui/button/AppButton.vue'-import { AppConfirmationDialog } from '@/components/ui/dialog'-import AppInput from '@/components/ui/input/AppInput.vue'+import { AppAlertDialogRoot, AppDialogFooter, AppDialogHeader } from '@/components/ui/dialog'+import AppPlaceholder from '@/components/ui/feedback/AppPlaceholder.vue'import AppActionRow from '@/components/ui/list/AppActionRow.vue'-import AppSwitch from '@/components/ui/toggle/AppSwitch.vue'-const { automation, common, credentials } = useI18n()+import MCPConnectionEditor from './MCPConnectionEditor.vue'++const automation = useAutomationMessages()+const common = useCommonMessages()const editing = ref(false)const tokenDraft = ref('')const deleteOpen = ref(false)-const connection = useMCPConnectionSettings(tokenDraft, automation)-const { draft, tokenStatus, error, clearCredential } = connection+const settings = useSettingsMessages()+const editorElement = useTemplateRef('editorElement')+const form = useMCPConnectionForm(settings, automation)+const { draft, errors: fieldErrors } = form+const connection = useMCPConnectionSettings(draft, tokenDraft, automation)+const { tokenStatus, error, clearCredential } = connection+watch(+ () => Boolean(tokenDraft.value.trim() || tokenStatus.value === 'configured'),+ form.setCredentialReady,+ { immediate: true, flush: 'sync' }+)+const dirty = computed(+ () => form.dirty.value || tokenDraft.value.length > 0 || connection.credentialCleared.value+)+const busy = computed(() => connection.busy.value || form.isSubmitting.value)+useSettingsFormGuard({ dirty, busy, cancel }, editing)function startAdd() {connection.startAdd()editing.value = true@@ -26,129 +46,87 @@ function startAdd() {async function startEdit(id: string) {if (await connection.startEdit(id)) editing.value = true}+function cancel() {+ connection.cancel()+ editing.value = false+}+const submit = form.handleSubmit(async () => {+ if (await connection.save()) cancel()+})async function save() {- if (await connection.save()) editing.value = false+ if (busy.value) return+ await submit()+ await editorElement.value?.focusInvalid()}async function remove() {- if (await connection.remove()) editing.value = false+ if (await connection.remove()) cancel()deleteOpen.value = false}</script><template>- <section class="mt-5 border-t border-border pt-4" data-mcp-connections>- <div v-if="editing" class="flex flex-col gap-3">- <div class="flex items-center justify-between">- <div>- <h3 class="text-xs font-semibold text-surface">- {{ draft.id ? automation.editConnection : automation.addServerConnection }}- </h3>- <p class="text-[10px] text-muted">{{ automation.connectionEditorDescription }}</p>- </div>- <AppButton size="xs" @click="editing = false">- {{ common.back }}- </AppButton>- </div>-- <label class="flex flex-col gap-1 text-[10px] text-muted">- {{ automation.connectionName }}- <AppInput- v-model="draft.name"- tone="panel"- size="sm"- :aria-label="automation.connectionName"- />- </label>- <label class="flex flex-col gap-1 text-[10px] text-muted">- {{ automation.serverURL }}- <AppInput- v-model="draft.url"- tone="panel"- size="sm"- :aria-label="automation.serverURL"- placeholder="https://example.com/mcp"- />- </label>- <AppSwitch v-model="draft.enabled" :label="automation.enableConnection" />- <AppSwitch- :model-value="draft.authenticationType === 'bearer'"- :label="automation.bearerAuthentication"- @update:model-value="draft.authenticationType = $event ? 'bearer' : 'none'"- />- <ProviderSettingsKeyField- v-if="draft.authenticationType === 'bearer'"- v-model="tokenDraft"- :label="automation.bearerToken"- input-id="mcp-bearer-token"- :saved="tokenStatus === 'configured'"- kind="api"- :placeholder="- tokenStatus === 'configured'- ? credentials.savedReplace- : automation.bearerTokenPlaceholder- "- @clear="clearCredential"- />-- <p v-if="error" class="text-[10px] text-danger" role="alert">{{ error }}</p>- <div class="flex items-center justify-between">- <AppButton- v-if="draft.id"- size="xs"- color="error"- variant="link"- @click="deleteOpen = true"- >- {{ automation.deleteConnection }}- </AppButton>- <span v-else />- <AppButton color="primary" variant="solid" @click="save">- {{ common.save }}- </AppButton>- </div>- </div>-- <div v-else>- <div class="mb-2 flex items-center justify-between">- <div>- <h3 class="text-xs font-semibold text-surface">{{ automation.connections }}</h3>- <p class="text-[10px] text-muted">{{ automation.connectionsDescription }}</p>- </div>- <AppButton size="xs" variant="soft" @click="startAdd">- <template #leading><icon-lucide-plus class="size-3" /></template>+ <MCPConnectionEditor+ v-if="editing"+ ref="editorElement"+ v-model:draft="draft"+ v-model:token="tokenDraft"+ :token-status="tokenStatus"+ :error="error"+ :field-errors="fieldErrors"+ :busy="busy"+ @cancel="cancel"+ @save="save"+ @blur-field="form.blur"+ @remove="deleteOpen = true"+ @clear="clearCredential"+ />+ <SettingsPage v-else>+ <div class="flex flex-col gap-6">+ <slot />+ <section class="flex flex-col gap-4" :aria-busy="busy" data-mcp-connections>+ <SettingsSectionHeader>+ {{ automation.connections }}+ <template #description>{{ automation.connectionsDescription }}</template>+ </SettingsSectionHeader>+ <AppButton class="self-start" variant="outline" :loading="busy" @click="startAdd">+ <template #leading><icon-lucide-plus class="size-3.5" /></template>{{ automation.addConnection }}</AppButton>- </div>- <div v-if="mcpConnectionSettings.connections.length" class="flex flex-col gap-1.5">- <AppActionRow- v-for="connection in mcpConnectionSettings.connections"- :key="connection.id"- @click="startEdit(connection.id)"- >- <template #leading><icon-lucide-plug class="size-3.5" /></template>- {{ connection.name }}- <template #description>{{ connection.transport.url }}</template>- <template #trailing>- <span class="text-[9px]">{{- connection.enabled ? common.enabled : common.disabled- }}</span>- <icon-lucide-chevron-right class="size-3.5" />- </template>- </AppActionRow>- </div>- <p v-else class="rounded border border-dashed border-border p-3 text-[10px] text-muted">- {{ automation.noConnections }}- </p>+ <div v-if="mcpConnectionSettings.connections.length" class="flex flex-col gap-1.5">+ <AppActionRow+ v-for="item in mcpConnectionSettings.connections"+ :key="item.id"+ :disabled="busy"+ @click="startEdit(item.id)"+ >+ <template #leading><icon-lucide-plug class="size-3.5" /></template>+ {{ item.name }}+ <template #description>{{ item.transport.url }}</template>+ <template #trailing>+ <span class="text-xs">{{ item.enabled ? common.enabled : common.disabled }}</span>+ <icon-lucide-chevron-right class="size-3.5" />+ </template>+ </AppActionRow>+ </div>+ <AppPlaceholder v-else :label="automation.noConnections" />+ </section></div>- </section>-- <AppConfirmationDialog- v-model:open="deleteOpen"- :heading="automation.deleteConnection"- :description="automation.deleteConnectionDescription"- :cancel-label="common.cancel"- :confirm-label="automation.deleteConnection"- tone="danger"- @confirm="remove"- />+ </SettingsPage>+ <AppAlertDialogRoot v-model:open="deleteOpen">+ <AppDialogHeader+ :heading="automation.deleteConnection"+ :description="automation.deleteConnectionDescription"+ :show-close="false"+ />+ <AppDialogFooter>+ <AlertDialogCancel as-child>+ <AppButton>{{ common.cancel }}</AppButton>+ </AlertDialogCancel>+ <AlertDialogAction as-child>+ <AppButton color="error" variant="solid" :loading="busy" @click="remove">+ {{ automation.deleteConnection }}+ </AppButton>+ </AlertDialogAction>+ </AppDialogFooter>+ </AppAlertDialogRoot></template>diff --git a/src/components/settings/mcp/MCPSettingsPanel.vue b/src/components/settings/mcp/MCPSettingsPanel.vueindex 691ae5012..e3420709b 100644--- a/src/components/settings/mcp/MCPSettingsPanel.vue+++ b/src/components/settings/mcp/MCPSettingsPanel.vue@@ -1,241 +1,129 @@<script setup lang="ts">+import { useClipboard } from '@vueuse/core'import { computed } from 'vue'-import { useI18n } from '@open-pencil/vue'+import { useAutomationMessages, useCommonMessages } from '@open-pencil/vue'import {configurableMCPTools,disabledMCPTools,mcpAuthenticationEnabled,- mcpRootDirectory,- setMCPToolCategoryEnabled,- setMCPToolEnabled+ mcpRootDirectory} from '@/app/automation/mcp/preferences'import { mcpRuntime } from '@/app/automation/mcp/runtime'import { useMCPSettings } from '@/app/automation/mcp/settings/use'import { isTauri } from '@/app/tauri/env'+import SettingsDisclosure from '@/components/settings/layout/SettingsDisclosure.vue'+import SettingsGroup from '@/components/settings/layout/SettingsGroup.vue'+import SettingsRow from '@/components/settings/layout/SettingsRow.vue'+import SettingsSectionHeader from '@/components/settings/layout/SettingsSectionHeader.vue'import AppButton from '@/components/ui/button/AppButton.vue'-import AppInput from '@/components/ui/input/AppInput.vue'import AppSwitch from '@/components/ui/toggle/AppSwitch.vue'-const { settings, automation, common } = useI18n()-const statusMessage = computed(() => {- switch (mcpRuntime.status) {- case 'idle':- return automation.value.statusIdle- case 'starting':- return automation.value.statusStarting- case 'running':- return automation.value.statusRunning- case 'stopped':- return automation.value.statusStopped- case 'error':- return automation.value.statusError- default:- return automation.value.statusIdle- }-})+import MCPToolAccessPanel from './MCPToolAccessPanel.vue'-const {- toolSearch,- inspectionToolsStatus,- modificationToolsStatus,- enabledToolCount,- visibleTools,- restart,- chooseRootDirectory,- isToolEnabled,- enableAllTools-} = useMCPSettings()+const automation = useAutomationMessages()+const common = useCommonMessages()+const { copy, copied } = useClipboard()+const statusMessage = computed(+ () =>+ ({+ idle: automation.value.statusIdle,+ starting: automation.value.statusStarting,+ running: automation.value.statusRunning,+ stopped: automation.value.statusStopped,+ error: automation.value.statusError+ })[mcpRuntime.status]+)+const { restart, chooseRootDirectory } = useMCPSettings()</script><template>- <section class="flex flex-col gap-4" data-test-id="settings-mcp-automation-panel">- <div>- <h3 class="text-xs font-semibold text-surface">{{ settings.automation }}</h3>- <p class="mt-1 text-[11px] text-muted">{{ automation.description }}</p>- </div>-- <div class="rounded border border-border bg-panel p-3 text-[11px]">- <dl class="grid grid-cols-[7rem_1fr] gap-x-3 gap-y-2">- <dt class="text-muted">{{ automation.status }}</dt>- <dd class="flex items-center gap-2 text-surface">- <span- class="size-2 rounded-full"- :class="- mcpRuntime.status === 'running'- ? 'bg-green-500'- : mcpRuntime.status === 'error'- ? 'bg-red-500'- : 'bg-muted'- "- />- {{ statusMessage }}- </dd>- <dt class="text-muted">{{ automation.port }}</dt>- <dd class="font-mono text-surface">{{ mcpRuntime.port }}</dd>- <dt class="text-muted">{{ automation.address }}</dt>- <dd class="select-all font-mono text-surface">127.0.0.1</dd>- <template v-if="mcpRuntime.version">- <dt class="text-muted">{{ automation.version }}</dt>- <dd class="font-mono text-surface">{{ mcpRuntime.version }}</dd>- </template>- </dl>-- <div class="mt-3 border-t border-border pt-3">- <div class="flex items-center justify-between gap-3">- <div>- <p class="text-[10px] font-medium text-surface">{{ automation.authentication }}</p>- <p class="mt-0.5 text-[10px] leading-relaxed text-muted">- {{ automation.authenticationDescription }}- </p>+ <section class="flex flex-col gap-3" data-test-id="settings-mcp-automation-panel">+ <div class="flex flex-col gap-3">+ <SettingsSectionHeader>+ {{ automation.localServer }}+ <template #description>{{ automation.description }}</template>+ </SettingsSectionHeader>+ <SettingsGroup>+ <SettingsRow :label="automation.status"+ ><span class="text-xs text-surface" role="status">{{ statusMessage }}</span></SettingsRow+ >+ <div class="px-3 py-2.5">+ <p class="mb-1 text-xs font-medium text-surface">{{ automation.address }}</p>+ <div class="flex items-center justify-between gap-2">+ <code class="min-w-0 select-all break-all text-xs text-surface">{{+ mcpRuntime.endpoint+ }}</code>+ <AppButton size="xs" variant="link" @click="copy(mcpRuntime.endpoint)">{{+ copied ? common.copied : common.copy+ }}</AppButton></div>+ </div>+ <SettingsRow v-if="mcpRuntime.version" :label="automation.version"+ ><code class="text-xs text-surface">{{ mcpRuntime.version }}</code></SettingsRow+ >+ <SettingsRow+ :label="automation.authentication"+ :description="automation.authenticationDescription"+ ><AppSwitchv-model="mcpAuthenticationEnabled":label="automation.authentication"data-test-id="settings-mcp-authentication"/>- </div>- </div>-- <div class="mt-3 border-t border-border pt-3">- <div class="flex items-center justify-between gap-3">- <div class="min-w-0">- <p class="text-[10px] font-medium text-surface">{{ automation.rootDirectory }}</p>- <p class="mt-0.5 truncate font-mono text-[10px] text-muted">- {{ mcpRootDirectory || automation.rootDirectoryDefault }}- </p>- </div>- <div class="flex shrink-0 gap-1.5">+ </SettingsRow>+ <div class="flex flex-col gap-2 px-3 py-2.5">+ <p class="text-xs font-medium text-surface">{{ automation.rootDirectory }}</p>+ <p class="break-all font-mono text-xs text-surface">+ {{ mcpRootDirectory || automation.rootDirectoryDefault }}+ </p>+ <p class="text-xs leading-relaxed text-muted">+ {{ automation.rootDirectoryDescription }}+ </p>+ <div v-if="mcpRootDirectory || isTauri()" class="flex flex-wrap gap-2"><AppButtonv-if="mcpRootDirectory"size="xs"variant="outline"@click="mcpRootDirectory = ''"+ >{{ automation.useDefaultRoot }}</AppButton>- {{ automation.useDefaultRoot }}- </AppButton><AppButtonv-if="isTauri()"size="xs"variant="outline"data-test-id="settings-mcp-root-directory"@click="chooseRootDirectory"+ >{{ automation.chooseRootDirectory }}</AppButton>- {{ automation.chooseRootDirectory }}- </AppButton></div></div>- <p class="mt-1.5 text-[10px] leading-relaxed text-muted">- {{ automation.rootDirectoryDescription }}- </p>- </div>- </div>-- <p- v-if="mcpRuntime.error"- class="rounded border border-red-500/30 bg-red-500/10 p-3 text-[11px] text-red-400"- >- {{ mcpRuntime.error }}- </p>-- <div class="overflow-hidden rounded border border-border bg-panel">- <div class="flex items-start justify-between gap-4 border-b border-border p-3">- <div>- <h4 class="text-[11px] font-medium text-surface">{{ automation.tools }}</h4>- <p class="mt-0.5 text-[10px] text-muted">- {{- automation.toolsEnabled({- enabled: enabledToolCount,- total: configurableMCPTools.length- })- }}- </p>- </div>- <AppButton- v-if="disabledMCPTools.length"- size="xs"- color="primary"- variant="link"- @click="enableAllTools"- >- {{ automation.enableAllTools }}- </AppButton>- </div>-- <div class="border-b border-border p-2">- <AppInput- v-model="toolSearch"- type="search"- size="sm"- :placeholder="common.search"- :aria-label="automation.searchTools"- data-test-id="settings-mcp-tool-search"- />- </div>-- <div class="grid grid-cols-2 gap-2 border-b border-border p-2.5">- <div class="flex items-center justify-between gap-2 rounded bg-input px-2.5 py-2">- <span class="text-[10px] text-surface">{{ automation.readOnlyTools }}</span>- <AppSwitch- :model-value="inspectionToolsStatus.enabled"- :state="inspectionToolsStatus.state"- :label="automation.readOnlyTools"- data-test-id="settings-mcp-inspection-tools"- @update:model-value="setMCPToolCategoryEnabled('read', $event)"- />- </div>- <div class="flex items-center justify-between gap-2 rounded bg-input px-2.5 py-2">- <span class="text-[10px] text-surface">{{ automation.sideEffectTools }}</span>- <AppSwitch- :model-value="modificationToolsStatus.enabled"- :state="modificationToolsStatus.state"- :label="automation.sideEffectTools"- data-test-id="settings-mcp-modification-tools"- @update:model-value="setMCPToolCategoryEnabled('write', $event)"- />- </div>- </div>-- <ul class="max-h-72 divide-y divide-border overflow-y-auto">- <li v-for="tool in visibleTools" :key="tool.name" class="flex items-start gap-3 p-2.5">- <div class="min-w-0 flex-1">- <code class="text-[10px] font-medium text-surface">{{ tool.name }}</code>- <p class="mt-0.5 text-[10px] leading-relaxed text-muted">{{ tool.description }}</p>- </div>- <AppSwitch- :model-value="isToolEnabled(tool.name)"- :label="tool.name"- :data-test-id="`settings-mcp-tool-${tool.name}`"- @update:model-value="setMCPToolEnabled(tool.name, $event)"- />- </li>- </ul>-- <p class="border-t border-border px-3 py-2 text-[10px] text-muted">- {{- mcpRuntime.externallyManaged- ? automation.externalRestartNotice- : automation.toolsRestartNotice- }}- </p>+ </SettingsGroup>+ <p v-if="mcpRuntime.error" class="text-xs text-error" role="alert">{{ mcpRuntime.error }}</p></div>-+ <SettingsDisclosure>+ <template #label>{{ automation.tools }}</template>+ <MCPToolAccessPanel v-model:disabled-tools="disabledMCPTools" :tools="configurableMCPTools">+ <template #footer>+ {{+ mcpRuntime.externallyManaged+ ? automation.externalRestartNotice+ : automation.toolsRestartNotice+ }}+ </template>+ </MCPToolAccessPanel>+ </SettingsDisclosure><div><AppButtoncolor="primary"variant="solid"- :disabled="mcpRuntime.status === 'starting' || mcpRuntime.externallyManaged"+ :disabled="mcpRuntime.externallyManaged"+ :loading="mcpRuntime.status === 'starting' || mcpRuntime.checking"data-test-id="settings-mcp-restart"@click="restart">- {{- mcpRuntime.status === 'starting' || mcpRuntime.checking- ? automation.starting- : mcpRuntime.externallyManaged- ? automation.externallyManaged- : automation.restart- }}+ {{ mcpRuntime.externallyManaged ? automation.externallyManaged : automation.restart }}</AppButton></div></section>diff --git a/src/components/settings/mcp/MCPToolAccessPanel.stories.ts b/src/components/settings/mcp/MCPToolAccessPanel.stories.tsnew file mode 100644index 000000000..9a3887e1f--- /dev/null+++ b/src/components/settings/mcp/MCPToolAccessPanel.stories.ts@@ -0,0 +1,57 @@+import type { Meta, StoryObj } from '@storybook/vue3-vite'+import { expect, userEvent, within } from 'storybook/test'+import { ref } from 'vue'++import type { ToolDescriptor } from '@open-pencil/mcp/tools'+import { useAutomationMessages } from '@open-pencil/vue'++import MCPToolAccessPanel from './MCPToolAccessPanel.vue'++const tools: ToolDescriptor[] = Array.from({ length: 80 }, (_, index) => ({+ name: `inspect_component_${index + 1}`,+ description:+ 'Inspect a component and its properties in the active document. Narrow the selection to inspect fewer layers.',+ effect: 'read',+ availability: 'default',+ capabilities: ['document:read'],+ enabled: true+}))+const meta = {+ title: 'Settings/MCP/Tool access',+ args: { tools, disabledTools: [], externallyManaged: false },+ render: (args) => ({+ components: { MCPToolAccessPanel },+ setup: () => ({+ args,+ disabled: ref([...args.disabledTools]),+ automation: useAutomationMessages()+ }),+ template: `+ <div class="flex h-96 max-w-lg bg-panel">+ <MCPToolAccessPanel :tools="args.tools" v-model:disabled-tools="disabled">+ <template #footer>{{ args.externallyManaged ? automation.externalRestartNotice : automation.toolsRestartNotice }}</template>+ </MCPToolAccessPanel>+ </div>`+ })+} satisfies Meta<{ tools: ToolDescriptor[]; disabledTools: string[]; externallyManaged: boolean }>+export default meta+type Story = StoryObj<typeof meta>+export const LongCatalog: Story = {}+export const MixedAccess: Story = { args: { disabledTools: ['inspect_component_1'] } }+export const EmptySearch: Story = {+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement)+ await userEvent.type(canvas.getByRole('searchbox'), 'no-matching-tool')+ await expect(canvas.getByText('No tools match your search.')).toBeVisible()+ }+}+export const ExternallyManaged: Story = { args: { externallyManaged: true } }+export const ToggleAccess: Story = {+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement)+ await userEvent.click(canvas.getByRole('switch', { name: 'inspect_component_1' }))+ await expect(canvas.getByText('79 of 80 enabled')).toBeVisible()+ await userEvent.click(canvas.getByRole('button', { name: 'Enable all' }))+ await expect(canvas.getByText('80 of 80 enabled')).toBeVisible()+ }+}diff --git a/src/components/settings/mcp/MCPToolAccessPanel.vue b/src/components/settings/mcp/MCPToolAccessPanel.vuenew file mode 100644index 000000000..83ab6bac2--- /dev/null+++ b/src/components/settings/mcp/MCPToolAccessPanel.vue@@ -0,0 +1,96 @@+<script setup lang="ts">+import { toRef } from 'vue'++import type { ToolDescriptor } from '@open-pencil/mcp/tools'+import { useAutomationMessages, useCommonMessages } from '@open-pencil/vue'++import { useMCPToolAccess } from '@/app/automation/mcp/settings/tool-access'+import SettingsRow from '@/components/settings/layout/SettingsRow.vue'+import AppButton from '@/components/ui/button/AppButton.vue'+import AppPlaceholder from '@/components/ui/feedback/AppPlaceholder.vue'+import AppInput from '@/components/ui/input/AppInput.vue'+import AppSwitch from '@/components/ui/toggle/AppSwitch.vue'++const { tools } = defineProps<{ tools: ToolDescriptor[] }>()+const disabledTools = defineModel<string[]>('disabledTools', { required: true })+const {+ search,+ visibleTools,+ enabledCount,+ inspectionEnabled,+ inspectionState,+ modificationEnabled,+ modificationState,+ isEnabled,+ setToolEnabled+} = useMCPToolAccess(+ toRef(() => tools),+ disabledTools+)+const automation = useAutomationMessages()+const common = useCommonMessages()+</script>++<template>+ <div class="flex flex-col" data-slot="mcp-tool-access">+ <div class="flex shrink-0 items-center justify-between gap-3 border-b border-border p-3">+ <div class="min-w-0 flex-1">+ <h3 class="text-xs font-semibold text-surface">{{ automation.tools }}</h3>+ <p class="mt-1 text-xs text-muted">+ {{ automation.toolsEnabled({ enabled: enabledCount, total: tools.length }) }}+ </p>+ </div>+ <AppButton v-if="disabledTools.length" size="xs" variant="link" @click="disabledTools = []">{{+ automation.enableAllTools+ }}</AppButton>+ </div>+ <div class="sticky top-0 z-10 border-b border-border bg-panel p-3">+ <AppInput+ v-model="search"+ type="search"+ :placeholder="common.search"+ :aria-label="automation.searchTools"+ data-test-id="settings-mcp-tool-search"+ />+ </div>+ <div class="divide-y divide-border border-b border-border">+ <SettingsRow :label="automation.readOnlyTools">+ <AppSwitch+ v-model="inspectionEnabled"+ :state="inspectionState"+ :label="automation.readOnlyTools"+ data-test-id="settings-mcp-inspection-tools"+ />+ </SettingsRow>+ <SettingsRow :label="automation.sideEffectTools">+ <AppSwitch+ v-model="modificationEnabled"+ :state="modificationState"+ :label="automation.sideEffectTools"+ data-test-id="settings-mcp-modification-tools"+ />+ </SettingsRow>+ </div>+ <AppPlaceholder v-if="!visibleTools.length" :label="automation.noMatchingTools" fill />+ <ul v-else class="divide-y divide-border">+ <li v-for="tool in visibleTools" :key="tool.name" class="flex items-start gap-3 p-3">+ <div class="min-w-0 flex-1">+ <code class="break-all text-xs font-medium text-surface">{{ tool.name }}</code>+ <p class="mt-1 text-xs leading-relaxed text-muted">{{ tool.description }}</p>+ </div>+ <AppSwitch+ :model-value="isEnabled(tool)"+ :label="tool.name"+ :data-test-id="`settings-mcp-tool-${tool.name}`"+ @update:model-value="setToolEnabled(tool.name, $event)"+ />+ </li>+ </ul>+ <p+ v-if="$slots.footer"+ class="shrink-0 border-t border-border p-3 text-xs leading-relaxed text-muted"+ >+ <slot name="footer" />+ </p>+ </div>+</template>diff --git a/src/components/settings/mcp/MCPWorkspacePanel.vue b/src/components/settings/mcp/MCPWorkspacePanel.vuenew file mode 100644index 000000000..5d0ac86ee--- /dev/null+++ b/src/components/settings/mcp/MCPWorkspacePanel.vue@@ -0,0 +1,23 @@+<script setup lang="ts">+import { useSettingsMessages } from '@open-pencil/vue'++import { webmcpMode } from '@/app/automation/webmcp/preferences'+import { webmcpRuntime } from '@/app/automation/webmcp/runtime'+import SettingsSectionHeader from '@/components/settings/layout/SettingsSectionHeader.vue'++import MCPConnectionsSection from './MCPConnectionsSection.vue'+import MCPSettingsPanel from './MCPSettingsPanel.vue'+import WebMCPSettingsPanel from './WebMCPSettingsPanel.vue'++const settings = useSettingsMessages()+</script>++<template>+ <div class="flex min-h-0 min-w-0 flex-1 flex-col" data-test-id="settings-mcp-panel">+ <MCPConnectionsSection>+ <SettingsSectionHeader>{{ settings.automation }}</SettingsSectionHeader>+ <MCPSettingsPanel />+ <WebMCPSettingsPanel v-model="webmcpMode" :state="webmcpRuntime" />+ </MCPConnectionsSection>+ </div>+</template>diff --git a/src/components/settings/mcp/WebMCPSettingsPanel.stories.ts b/src/components/settings/mcp/WebMCPSettingsPanel.stories.tsnew file mode 100644index 000000000..b3a4294c2--- /dev/null+++ b/src/components/settings/mcp/WebMCPSettingsPanel.stories.ts@@ -0,0 +1,46 @@+import type { Meta, StoryObj } from '@storybook/vue3-vite'+import { ref } from 'vue'++import { getWebMCPTools, type WebMCPMode } from '@/app/automation/webmcp/policy'+import type { WebMCPRuntimeState } from '@/app/automation/webmcp/service'++import WebMCPSettingsPanel from './WebMCPSettingsPanel.vue'++type Args = { modelValue: WebMCPMode; state: WebMCPRuntimeState }+const meta = {+ title: 'Settings/MCP/WebMCP',+ args: { modelValue: 'off', state: { status: 'off', toolCount: 0, error: null } },+ render: (args) => ({+ components: { WebMCPSettingsPanel },+ setup: () => ({ args, mode: ref(args.modelValue) }),+ template:+ '<div class="max-w-lg bg-panel p-4"><WebMCPSettingsPanel v-model="mode" :state="args.state" /></div>'+ })+} satisfies Meta<Args>+export default meta+type Story = StoryObj<typeof meta>+export const Off: Story = {}+export const Inspect: Story = {+ args: {+ modelValue: 'inspect',+ state: { status: 'ready', toolCount: getWebMCPTools('inspect').length, error: null }+ }+}+export const Edit: Story = {+ args: {+ modelValue: 'edit',+ state: { status: 'ready', toolCount: getWebMCPTools('edit').length, error: null }+ }+}+export const Unsupported: Story = {+ args: { state: { status: 'unsupported', toolCount: 0, error: null } }+}+export const Starting: Story = {+ args: { modelValue: 'inspect', state: { status: 'starting', toolCount: 0, error: null } }+}+export const Rejected: Story = {+ args: {+ modelValue: 'inspect',+ state: { status: 'error', toolCount: 0, error: 'The browser denied tool registration.' }+ }+}diff --git a/src/components/settings/mcp/WebMCPSettingsPanel.vue b/src/components/settings/mcp/WebMCPSettingsPanel.vuenew file mode 100644index 000000000..e07d42ced--- /dev/null+++ b/src/components/settings/mcp/WebMCPSettingsPanel.vue@@ -0,0 +1,65 @@+<script setup lang="ts">+import { computed } from 'vue'++import { useAutomationMessages } from '@open-pencil/vue'++import type { WebMCPMode } from '@/app/automation/webmcp/policy'+import type { WebMCPRuntimeState } from '@/app/automation/webmcp/service'+import SettingsGroup from '@/components/settings/layout/SettingsGroup.vue'+import SettingsRow from '@/components/settings/layout/SettingsRow.vue'+import SettingsSectionHeader from '@/components/settings/layout/SettingsSectionHeader.vue'+import AppSelect from '@/components/ui/select/AppSelect.vue'++const mode = defineModel<WebMCPMode>({ required: true })+const { state } = defineProps<{ state: WebMCPRuntimeState }>()+const automation = useAutomationMessages()+const options = computed(() => [+ { value: 'off' as const, label: automation.value.accessOff },+ { value: 'inspect' as const, label: automation.value.accessInspect },+ { value: 'edit' as const, label: automation.value.accessEdit }+])+const descriptions = computed(() => ({+ off: automation.value.accessOffDescription,+ inspect: automation.value.accessInspectDescription,+ edit: automation.value.accessEditDescription+}))+const status = computed(+ () =>+ ({+ off: automation.value.statusStopped,+ starting: automation.value.statusStarting,+ ready: automation.value.statusRunning,+ unsupported: automation.value.webmcpUnsupported,+ error: automation.value.statusError+ })[state.status]+)+</script>++<template>+ <section class="flex flex-col gap-4" data-slot="webmcp-settings">+ <SettingsSectionHeader>+ WebMCP+ <template #description>{{ automation.webmcpDescription }}</template>+ </SettingsSectionHeader>+ <SettingsGroup>+ <SettingsRow :label="automation.browserAccess">+ <AppSelect v-model="mode" :options="options" :label="automation.browserAccess" />+ </SettingsRow>+ <p class="px-3 py-2.5 text-xs leading-relaxed text-muted">{{ descriptions[mode] }}</p>+ </SettingsGroup>+ <div class="text-xs leading-relaxed text-surface" role="status">+ <p>{{ status }}</p>+ <p v-if="state.status === 'ready'" class="mt-1 text-muted">+ {{ automation.tools }}: {{ state.toolCount }}+ </p>+ </div>+ <p v-if="state.error" role="alert" class="text-xs text-error">{{ state.error }}</p>+ <a+ href="https://openpencil.dev/programmable/mcp-server#webmcp"+ target="_blank"+ rel="noopener noreferrer"+ class="self-start text-xs text-surface underline underline-offset-4"+ >{{ automation.webmcpSetup }}</a+ >+ </section>+</template>diff --git a/src/components/settings/media/MediaCredentialEditor.vue b/src/components/settings/media/MediaCredentialEditor.vuenew file mode 100644index 000000000..3521db994--- /dev/null+++ b/src/components/settings/media/MediaCredentialEditor.vue@@ -0,0 +1,107 @@+<script setup lang="ts">+import { computed, useTemplateRef } from 'vue'++import {+ useCommonMessages,+ useCredentialMessages,+ useMediaMessages,+ useSettingsMessages+} from '@open-pencil/vue'++import { useMediaSettingsEditor, type MediaSettingsService } from '@/app/settings/media/use'+import { useSettingsFormGuard } from '@/app/settings/navigation/use'+import { focusInvalidField } from '@/components/settings/layout/focus'+import SettingsPage from '@/components/settings/layout/SettingsPage.vue'+import SettingsSectionHeader from '@/components/settings/layout/SettingsSectionHeader.vue'+import ProviderSettingsKeyField from '@/components/settings/provider/ProviderSettingsKeyField.vue'+import AppButton from '@/components/ui/button/AppButton.vue'+import AppSelect from '@/components/ui/select/AppSelect.vue'++const { service } = defineProps<{ service: MediaSettingsService }>()+const emit = defineEmits<{ done: [] }>()+const editor = useMediaSettingsEditor(service)+const formElement = useTemplateRef<HTMLFormElement>('formElement')+const { key, providerID, keyStatus, error, dirty, busy, clearCredential } = editor+useSettingsFormGuard({ dirty, busy, cancel: () => emit('done') })+const common = useCommonMessages()+const credentials = useCredentialMessages()+const media = useMediaMessages()+const settings = useSettingsMessages()+const provider = computed(() => editor.vector?.provider.value)+const providerOptions = editor.vector?.providerOptions ?? []+const title = computed(() => {+ if (service === 'vectorize') return media.value.vectorization+ return service === 'pexels' ? 'Pexels' : 'Unsplash'+})+const keyLabel = computed(() => {+ if (service === 'pexels') return media.value.pexelsAPIKey+ if (service === 'unsplash') return media.value.unsplashAccessKey+ return title.value+})+const keyURL = computed(() => {+ if (service === 'pexels') return 'https://www.pexels.com/api/'+ if (service === 'unsplash') return 'https://unsplash.com/oauth/applications'+ return provider.value?.keyURL+})+const placeholder = computed(() => {+ if (keyStatus.value === 'configured') return credentials.value.savedReplace+ if (service === 'pexels') return media.value.stockPhotoToolOptional+ if (service === 'unsplash') return media.value.pexelsAlternativeOptional+ return provider.value?.keyPlaceholder ?? ''+})+async function save() {+ if (await editor.save()) emit('done')+ else await focusInvalidField(formElement.value)+}+</script>++<template>+ <form+ ref="formElement"+ class="flex min-h-0 min-w-0 flex-1 flex-col"+ :aria-busy="busy"+ @submit.prevent="save"+ >+ <SettingsPage>+ <div class="flex flex-col gap-4">+ <SettingsSectionHeader>+ {{ title }}+ <template #description>{{ settings.saveChangesDescription }}</template>+ </SettingsSectionHeader>+ <fieldset :disabled="busy" class="flex min-w-0 flex-col gap-4">+ <label v-if="service === 'vectorize'" class="flex flex-col gap-1.5 text-xs text-surface">+ {{ media.vectorizeProvider }}+ <AppSelect+ v-model="providerID"+ :options="providerOptions"+ :label="media.vectorizeProvider"+ :disabled="busy"+ />+ </label>+ <ProviderSettingsKeyField+ v-model="key"+ :label="keyLabel"+ :saved="keyStatus === 'configured'"+ :hint="+ keyStatus === 'configured'+ ? settings.savedCredentialHint+ : settings.optionalCredentialHint+ "+ :error="error ? settings.saveFailed : undefined"+ kind="api"+ :placeholder="placeholder"+ :key-u-r-l="keyURL"+ :key-u-r-l-label="credentials.getAPIKey"+ @clear="clearCredential"+ />+ </fieldset>+ </div>+ <template #footer>+ <AppButton :disabled="busy" @click="emit('done')">{{ common.cancel }}</AppButton>+ <AppButton type="submit" color="primary" variant="solid" :loading="busy">{{+ common.save+ }}</AppButton>+ </template>+ </SettingsPage>+ </form>+</template>diff --git a/src/components/settings/media/MediaSettingsPanel.vue b/src/components/settings/media/MediaSettingsPanel.vuenew file mode 100644index 000000000..75856f371--- /dev/null+++ b/src/components/settings/media/MediaSettingsPanel.vue@@ -0,0 +1,64 @@+<script setup lang="ts">+import { computed, ref } from 'vue'++import { useMediaMessages, useSettingsMessages } from '@open-pencil/vue'++import { vectorizeProviderID, VECTORIZE_PROVIDER_DEFINITIONS } from '@/app/editor/vectorize'+import { pexelsKeyStatus, unsplashKeyStatus } from '@/app/settings/credentials/media'+import type { MediaSettingsService } from '@/app/settings/media/use'+import SettingsPage from '@/components/settings/layout/SettingsPage.vue'+import SettingsSectionHeader from '@/components/settings/layout/SettingsSectionHeader.vue'+import AppActionRow from '@/components/ui/list/AppActionRow.vue'++import MediaCredentialEditor from './MediaCredentialEditor.vue'++const editing = ref<MediaSettingsService | null>(null)+const settings = useSettingsMessages()+const media = useMediaMessages()+const stockServices = computed(() => [+ { id: 'pexels' as const, name: 'Pexels', status: pexelsKeyStatus.value },+ { id: 'unsplash' as const, name: 'Unsplash', status: unsplashKeyStatus.value }+])+const vectorProvider = computed(() =>+ VECTORIZE_PROVIDER_DEFINITIONS.find((item) => item.id === vectorizeProviderID.value)+)+</script>++<template>+ <div class="flex min-h-0 min-w-0 flex-1 flex-col" data-test-id="settings-media-panel">+ <MediaCredentialEditor+ v-if="editing"+ :key="editing"+ :service="editing"+ @done="editing = null"+ />+ <SettingsPage v-else>+ <section class="flex flex-col gap-4">+ <SettingsSectionHeader>{{ settings.media }}</SettingsSectionHeader>+ <AppActionRow+ v-for="service in stockServices"+ :key="service.id"+ @click="editing = service.id"+ >+ {{ service.name }}+ <template #description>{{+ service.status === 'configured' ? settings.configured : settings.notConfigured+ }}</template>+ <template #trailing+ >{{ settings.edit }}<icon-lucide-chevron-right class="size-3.5"+ /></template>+ </AppActionRow>+ <SettingsSectionHeader>+ {{ media.vectorization }}+ <template #description>{{ media.vectorizationDescription }}</template>+ </SettingsSectionHeader>+ <AppActionRow data-vectorize-settings @click="editing = 'vectorize'">+ {{ vectorProvider?.name }}+ <template #trailing+ >{{ settings.edit }}<icon-lucide-chevron-right class="size-3.5"+ /></template>+ </AppActionRow>+ </section>+ </SettingsPage>+ </div>+</template>diff --git a/src/components/settings/models/ModelsPanel.vue b/src/components/settings/models/ModelsPanel.vueindex 5b79fb72f..8bd64390f 100644--- a/src/components/settings/models/ModelsPanel.vue+++ b/src/components/settings/models/ModelsPanel.vue@@ -5,6 +5,8 @@ import { nextTick, ref, onUnmounted } from 'vue'import { useI18n } from '@open-pencil/vue'import { useModelSettings } from '@/app/ai/models/settings/use'+import SettingsPage from '@/components/settings/layout/SettingsPage.vue'+import SettingsSectionHeader from '@/components/settings/layout/SettingsSectionHeader.vue'import ProfileEditor from '@/components/settings/models/ProfileEditor.vue'import RoleAssignments from '@/components/settings/models/RoleAssignments.vue'import AppButton from '@/components/ui/button/AppButton.vue'@@ -82,88 +84,93 @@ const { profiles, statusByConnection, refreshStatuses } = useModelSettings()</div></Transition>- <div- v-show="!editing && !editorLeaving"- class="scrollbar-thin min-h-0 flex-1 overflow-y-auto pr-1"- >- <section>- <div class="mb-2 flex items-center justify-between">- <div>- <h3 class="text-xs font-semibold text-surface">{{ ai.modelsTitle }}</h3>- <p class="text-[10px] text-muted">{{ ai.modelsDescription }}</p>+ <SettingsPage v-show="!editing && !editorLeaving">+ <div class="flex flex-col gap-6">+ <section class="flex flex-col gap-4">+ <div class="flex items-start justify-between gap-4">+ <SettingsSectionHeader>+ {{ ai.modelsTitle }}+ <template #description>{{ ai.modelsDescription }}</template>+ </SettingsSectionHeader>+ <AppButton+ color="primary"+ variant="solid"+ data-test-id="settings-add-model"+ @click="addModel"+ >+ <template #leading><icon-lucide-plus class="size-3" /></template>+ {{ ai.addModel }}+ </AppButton></div>- <AppButton- color="primary"- variant="solid"- data-test-id="settings-add-model"- @click="addModel"- >- <template #leading><icon-lucide-plus class="size-3" /></template>- {{ ai.addModel }}- </AppButton>- </div>- <div class="flex flex-col gap-1.5" data-test-id="settings-model-list">- <AppActionRow- v-for="profile in profiles"- :key="profile.id"- :data-model-id="profile.id"- @click="editModel(profile.id)"- >- <template #leading>- <span class="flex size-8 items-center justify-center rounded bg-panel"- ><icon-lucide-bot class="size-4"- /></span>- </template>- {{ profile.name }}- <template #description>- {{ profile.providerName- }}<span v-if="profile.modelName"> · {{ profile.modelName }}</span>- </template>- <template #trailing>- <span- class="mr-1 flex items-center gap-1 text-[9px] text-muted"- :data-state="- statusByConnection[profile.connectionId] === 'configured'- ? 'configured'- : 'missing'- "- >+ <div class="flex flex-col gap-1.5" data-test-id="settings-model-list">+ <AppActionRow+ v-for="profile in profiles"+ :key="profile.id"+ :data-model-id="profile.id"+ :ui="{+ root: 'py-3 max-sm:flex-wrap',+ label: 'text-xs',+ description: 'text-[11px] leading-relaxed',+ trailing: 'max-sm:w-full max-sm:justify-end'+ }"+ @click="editModel(profile.id)"+ >+ <template #leading>+ <span class="flex size-8 items-center justify-center rounded bg-panel"+ ><icon-lucide-bot class="size-4"+ /></span>+ </template>+ {{ profile.name }}+ <template #description>+ {{ profile.providerName+ }}<span v-if="profile.modelName"> · {{ profile.modelName }}</span>+ </template>+ <template #trailing><span- class="size-1.5 rounded-full bg-muted data-[state=configured]:bg-[var(--color-success)]"+ class="mr-1 flex items-center gap-1 text-[11px] text-muted":data-state="statusByConnection[profile.connectionId] === 'configured'? 'configured': 'missing'"- />- {{ statusLabel(profile.connectionId, profile.providerID) }}- </span>- <span- v-for="capability in profile.capabilities"- :key="capability"- class="rounded bg-panel px-1.5 py-0.5 text-[9px] text-muted"- >- {{- capability === 'tools'- ? ai.modelCapabilityToolsShort- : ai.modelCapabilityVisionShort- }}- </span>- <icon-lucide-chevron-right class="size-3.5 shrink-0 text-muted" />- </template>- </AppActionRow>- </div>- </section>+ >+ <span+ class="size-1.5 rounded-full bg-muted data-[state=configured]:bg-[var(--color-success)]"+ :data-state="+ statusByConnection[profile.connectionId] === 'configured'+ ? 'configured'+ : 'missing'+ "+ />+ {{ statusLabel(profile.connectionId, profile.providerID) }}+ </span>+ <span+ v-for="capability in profile.capabilities"+ :key="capability"+ class="rounded bg-panel px-1.5 py-0.5 text-[11px] text-muted"+ >+ {{+ capability === 'tools'+ ? ai.modelCapabilityToolsShort+ : ai.modelCapabilityVisionShort+ }}+ </span>+ <icon-lucide-chevron-right class="size-3.5 shrink-0 text-muted" />+ </template>+ </AppActionRow>+ </div>+ </section>- <section class="mt-5 border-t border-border pt-4">- <div class="mb-3">- <h3 class="text-xs font-semibold text-surface">{{ ai.modelAssignments }}</h3>- <p class="text-[10px] text-muted">{{ ai.modelAssignmentsDescription }}</p>- </div>- <RoleAssignments />- </section>- <slot />- </div>+ <section class="flex flex-col gap-4">+ <SettingsSectionHeader>+ {{ ai.modelAssignments }}+ <template #description>{{ ai.modelAssignmentsDescription }}</template>+ </SettingsSectionHeader>+ <RoleAssignments />+ </section>+ <slot />+ </div>+ </SettingsPage></div></template>diff --git a/src/components/settings/models/ProfileEditor.vue b/src/components/settings/models/ProfileEditor.vueindex 611b570ed..e53d9ec5a 100644--- a/src/components/settings/models/ProfileEditor.vue+++ b/src/components/settings/models/ProfileEditor.vue@@ -1,12 +1,16 @@<script setup lang="ts">import { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger } from 'reka-ui'-import { ref } from 'vue'+import { computed, ref, useTemplateRef } from 'vue'import type { AIProviderID } from '@open-pencil/core/constants'import { useI18n } from '@open-pencil/vue'+import { useModelProfileFeedback } from '@/app/ai/models/settings/profile-editor/feedback'import { useModelProfileEditor } from '@/app/ai/models/settings/profile-editor/use'+import { useSettingsFormGuard } from '@/app/settings/navigation/use'import ProviderConnectionTestButton from '@/components/chat/ProviderConnectionTestButton.vue'+import { focusInvalidField } from '@/components/settings/layout/focus'+import SettingsPage from '@/components/settings/layout/SettingsPage.vue'import ProviderSelect from '@/components/settings/provider-select/ProviderSelect.vue'import ProviderSettingsField from '@/components/settings/provider/ProviderSettingsField.vue'import ProviderSettingsInput from '@/components/settings/provider/ProviderSettingsInput.vue'@@ -17,14 +21,18 @@ import AppInput from '@/components/ui/input/AppInput.vue'import AppCombobox from '@/components/ui/select/AppCombobox.vue'import AppSelect from '@/components/ui/select/AppSelect.vue'import AppSwitch from '@/components/ui/toggle/AppSwitch.vue'+import { settingsDisclosureMotion } from '@/theme/settings/disclosure'const { profileId } = defineProps<{ profileId?: string }>()const emit = defineEmits<{ done: []; deleted: [] }>()-const { ai, common, credentials } = useI18n()+const { ai, common, credentials, settings } = useI18n()+const formElement = useTemplateRef<HTMLFormElement>('formElement')const keyInput = ref('')const deleteOpen = ref(false)const profile = useModelProfileEditor({ profileId, keyInput, labels: ai })const {draft,+ dirty,+ busy: saving,providerDef,isACP,isHarness,@@ -39,14 +47,16 @@ const {canDelete,toolsEnabled,visionEnabled,- canSave,- canTest,connectionTestStatus,connectionTestReason,saveError,clearKey,- testConnection+ testConnection: runConnectionTest} = profile+const feedback = useModelProfileFeedback(profile, keyInput, settings)+const { errors: fieldErrors } = feedback+const busy = computed(() => saving.value || connectionTestStatus.value === 'testing')+useSettingsFormGuard({ dirty, busy, cancel: () => emit('done') })const CUSTOM_MODEL_VALUE = '__custom__'const advancedOpen = ref(Boolean(draft.customModelID.trim()))function updateProvider(id: AIProviderID) {@@ -58,8 +68,21 @@ function updateModel(id: string) {if (id === CUSTOM_MODEL_VALUE) advancedOpen.value = true}async function save() {+ if (busy.value) return+ if (!(await feedback.validate('save'))) {+ await focusInvalidField(formElement.value)+ return+ }if (await profile.save()) emit('done')}+async function testConnection() {+ if (busy.value) return+ if (!(await feedback.validate('test'))) {+ await focusInvalidField(formElement.value)+ return+ }+ await runConnectionTest()+}async function remove() {if (await profile.remove()) {deleteOpen.value = false@@ -69,219 +92,265 @@ async function remove() {</script><template>- <div class="flex min-h-0 flex-1 flex-col" data-test-id="settings-model-editor">- <div class="flex shrink-0 items-center gap-2 border-b border-border pb-3">- <div>- <h3 class="text-xs font-semibold text-surface">- {{ profileId ? ai.editModel : ai.addModel }}- </h3>- <p class="text-[10px] text-muted">{{ ai.modelEditorDescription }}</p>- </div>- </div>-- <div class="scrollbar-thin flex min-h-0 flex-1 flex-col gap-2.5 overflow-y-auto py-3 pr-1">- <ProviderSettingsField :label="ai.modelName">- <AppInput- v-model="draft.name"- :aria-label="ai.modelName"- :placeholder="modelDisplayName"- size="sm"- />- </ProviderSettingsField>-- <ProviderSettingsField :label="ai.provider">- <ProviderSelect- :model-value="draft.providerID"- :aria-label="ai.provider"- data-test-id="settings-model-provider"- :ui="{- trigger:- 'w-full justify-between rounded border border-border bg-input px-2.5 py-1.5 text-xs text-surface',- item: 'rounded px-2 py-1.5 text-[11px]'- }"- @update:model-value="updateProvider"- />- </ProviderSettingsField>-- <template v-if="!isACP">- <div class="flex items-center gap-2 pt-1">- <p class="text-[10px] font-medium uppercase tracking-wide text-muted">- {{ ai.modelConfiguration }}- </p>- <div class="h-px flex-1 bg-border" />+ <form+ ref="formElement"+ class="flex min-h-0 min-w-0 flex-1 flex-col"+ novalidate+ :aria-busy="busy"+ @submit.prevent="save"+ >+ <SettingsPage data-test-id="settings-model-editor">+ <div class="flex shrink-0 items-center gap-2 border-b border-border pb-3">+ <div>+ <h3 class="text-xs font-semibold text-surface">+ {{ profileId ? ai.editModel : ai.addModel }}+ </h3>+ <p class="text-[10px] text-muted">{{ ai.modelEditorDescription }}</p></div>+ </div>- <ProviderSettingsField v-if="modelOptions.length" :label="ai.modelID">- <AppCombobox- :model-value="selectedModelValue"- :options="modelOptions"- :label="ai.modelID"- :placeholder="ai.selectModel"- :search-placeholder="ai.searchModels"- :empty-label="common.noResults"- @update:model-value="updateModel(String($event))"- />- </ProviderSettingsField>-+ <fieldset :disabled="busy" class="flex min-w-0 flex-col gap-3 py-4"><ProviderSettingsField- v-if="providerDef.supportsCustomModel && selectedModelValue === CUSTOM_MODEL_VALUE"- :label="ai.customModelID"+ v-slot="{ control }"+ :label="ai.modelName"+ :hint="settings.modelNameHint"+ :error="fieldErrors.name"+ @blur="feedback.blur('name')">- <ProviderSettingsInput- v-model="draft.customModelID"- :aria-label="ai.customModelID"- data-test-id="provider-settings-custom-model"- placeholder="e.g. llama-3.3-70b"+ <AppInput+ v-bind="control"+ v-model="draft.name"+ :aria-label="ai.modelName"+ :placeholder="modelDisplayName"+ size="sm"/></ProviderSettingsField>- <div class="flex items-center gap-2 pt-1">- <p class="text-[10px] font-medium uppercase tracking-wide text-muted">- {{ ai.connectionSettings }}- </p>- <div class="h-px flex-1 bg-border" />- </div>-- <ProviderSettingsField v-if="providerDef.supportsCustomBaseURL" :label="ai.baseURL">- <ProviderSettingsInput- v-model="draft.customBaseURL"- :aria-label="ai.baseURL"- placeholder="http://localhost:11434/v1"+ <ProviderSettingsField :label="ai.provider">+ <ProviderSelect+ :model-value="draft.providerID"+ :aria-label="ai.provider"+ data-test-id="settings-model-provider"+ :ui="{+ trigger:+ 'w-full justify-between rounded border border-border bg-input px-2.5 py-1.5 text-xs text-surface',+ item: 'rounded px-2 py-1.5 text-[11px]'+ }"+ @update:model-value="updateProvider"/></ProviderSettingsField>- <ProviderSettingsField v-if="draft.providerID === 'openai-compatible'" :label="ai.apiType">- <AppSelect- v-model="draft.customAPIType"- :label="ai.apiType"- :options="[- { value: 'completions', label: ai.completions },- { value: 'responses', label: ai.responses }- ]"- />- </ProviderSettingsField>+ <template v-if="!isACP">+ <div class="flex items-center gap-2 pt-1">+ <p class="text-[10px] font-medium uppercase tracking-wide text-muted">+ {{ ai.modelConfiguration }}+ </p>+ <div class="h-px flex-1 bg-border" />+ </div>- <ProviderSettingsKeyField- v-model="keyInput"- :label="ai.apiKey"- :saved="hasExistingKey"- kind="api"- :placeholder="hasExistingKey ? credentials.savedReplace : providerDef.keyPlaceholder"- :key-u-r-l="providerDef.keyURL"- :key-u-r-l-label="credentials.getAPIKey"- @clear="clearKey"- />+ <ProviderSettingsField+ v-if="modelOptions.length"+ v-slot="{ control }"+ :label="ai.modelID"+ :error="fieldErrors.modelID"+ @blur="feedback.blur('modelID')"+ >+ <AppCombobox+ v-bind="control"+ :model-value="selectedModelValue"+ :options="modelOptions"+ :label="ai.modelID"+ :placeholder="ai.selectModel"+ :search-placeholder="ai.searchModels"+ :empty-label="common.noResults"+ @update:model-value="updateModel(String($event))"+ />+ </ProviderSettingsField>- <ProviderConnectionTestButton- :status="connectionTestStatus"- :reason="connectionTestReason"- :disabled="!canTest"- @test="testConnection"- />- </template>+ <ProviderSettingsField+ v-if="providerDef.supportsCustomModel && selectedModelValue === CUSTOM_MODEL_VALUE"+ v-slot="{ control }"+ :label="ai.customModelID"+ :hint="settings.modelIDHint"+ :error="fieldErrors.customModelID"+ @blur="feedback.blur('customModelID')"+ >+ <ProviderSettingsInput+ v-bind="control"+ v-model="draft.customModelID"+ :aria-label="ai.customModelID"+ data-test-id="provider-settings-custom-model"+ placeholder="e.g. llama-3.3-70b"+ />+ </ProviderSettingsField>- <CollapsibleRoot- v-if="!isACP"- v-model:open="advancedOpen"- class="rounded border border-border"- >- <CollapsibleTrigger- class="flex w-full items-center gap-2 px-2.5 py-2 text-left text-[11px] text-muted hover:text-surface"- >- <icon-lucide-chevron-right- class="size-3 transition-transform [[data-state=open]>&]:rotate-90"+ <div class="flex items-center gap-2 pt-1">+ <p class="text-[10px] font-medium uppercase tracking-wide text-muted">+ {{ ai.connectionSettings }}+ </p>+ <div class="h-px flex-1 bg-border" />+ </div>++ <ProviderSettingsField+ v-if="providerDef.supportsCustomBaseURL"+ v-slot="{ control }"+ :label="ai.baseURL"+ :hint="settings.baseURLHint"+ :error="fieldErrors.baseURL"+ @blur="feedback.blur('baseURL')"+ >+ <ProviderSettingsInput+ v-bind="control"+ v-model="draft.customBaseURL"+ :aria-label="ai.baseURL"+ placeholder="http://localhost:11434/v1"+ />+ </ProviderSettingsField>++ <ProviderSettingsField+ v-if="draft.providerID === 'openai-compatible'"+ :label="ai.apiType"+ >+ <AppSelect+ v-model="draft.customAPIType"+ :label="ai.apiType"+ :options="[+ { value: 'completions', label: ai.completions },+ { value: 'responses', label: ai.responses }+ ]"+ />+ </ProviderSettingsField>++ <ProviderSettingsKeyField+ v-model="keyInput"+ :label="ai.apiKey"+ :saved="hasExistingKey"+ :hint="hasExistingKey ? settings.savedCredentialHint : settings.optionalCredentialHint"+ :error="fieldErrors.credential"+ @blur="feedback.blur('credential')"+ kind="api"+ :placeholder="hasExistingKey ? credentials.savedReplace : providerDef.keyPlaceholder"+ :key-u-r-l="providerDef.keyURL"+ :key-u-r-l-label="credentials.getAPIKey"+ @clear="clearKey"/>- {{ ai.advancedModelSettings }}- </CollapsibleTrigger>- <CollapsibleContent class="border-t border-border p-2.5">- <div class="flex flex-col gap-3">- <div>- <p class="text-[11px] font-medium text-surface">{{ ai.modelCapabilities }}</p>- <p class="mt-0.5 text-[10px] text-muted">- {{ knownModel ? ai.modelCapabilitiesDetected : ai.modelCapabilitiesManual }}- </p>- </div>- <div class="flex flex-col gap-2">- <div class="flex items-center justify-between gap-3">- <span class="text-[11px] text-muted">{{ ai.modelCapabilityTools }}</span>- <span v-if="knownModel" class="text-[10px] text-surface">- {{ knownCapabilities.includes('tools') ? common.supported : common.unsupported }}- </span>- <AppSwitch v-else v-model="toolsEnabled" :label="ai.modelCapabilityTools" />+ <ProviderConnectionTestButton+ v-if="!isHarness"+ :status="connectionTestStatus"+ :reason="connectionTestReason"+ :disabled="busy"+ @test="testConnection"+ />+ </template>++ <CollapsibleRoot+ v-if="!isACP"+ v-model:open="advancedOpen"+ class="rounded border border-border"+ >+ <CollapsibleTrigger+ class="flex w-full items-center gap-2 px-2.5 py-2 text-left text-[11px] text-muted hover:text-surface"+ >+ <icon-lucide-chevron-right+ class="size-3 transition-transform [[data-state=open]>&]:rotate-90"+ />+ {{ ai.advancedModelSettings }}+ </CollapsibleTrigger>+ <CollapsibleContent :class="settingsDisclosureMotion">+ <div class="flex flex-col gap-3 border-t border-border p-2.5">+ <div>+ <p class="text-[11px] font-medium text-surface">{{ ai.modelCapabilities }}</p>+ <p class="mt-0.5 text-[10px] text-muted">+ {{ knownModel ? ai.modelCapabilitiesDetected : ai.modelCapabilitiesManual }}+ </p></div>- <div class="flex items-center justify-between gap-3">- <span class="text-[11px] text-muted">{{ ai.modelCapabilityVision }}</span>- <span v-if="knownModel" class="text-[10px] text-surface">- {{ knownCapabilities.includes('vision') ? common.supported : common.unsupported }}- </span>- <AppSwitch v-else v-model="visionEnabled" :label="ai.modelCapabilityVision" />++ <div class="flex flex-col gap-2">+ <div class="flex items-center justify-between gap-3">+ <span class="text-[11px] text-muted">{{ ai.modelCapabilityTools }}</span>+ <span v-if="knownModel" class="text-[10px] text-surface">+ {{+ knownCapabilities.includes('tools') ? common.supported : common.unsupported+ }}+ </span>+ <AppSwitch v-else v-model="toolsEnabled" :label="ai.modelCapabilityTools" />+ </div>+ <div class="flex items-center justify-between gap-3">+ <span class="text-[11px] text-muted">{{ ai.modelCapabilityVision }}</span>+ <span v-if="knownModel" class="text-[10px] text-surface">+ {{+ knownCapabilities.includes('vision') ? common.supported : common.unsupported+ }}+ </span>+ <AppSwitch v-else v-model="visionEnabled" :label="ai.modelCapabilityVision" />+ </div></div>- </div>- <ProviderSettingsField v-if="isHarness" :label="ai.harnessThinkingLevel">- <AppSelect- v-model="draft.harnessThinkingLevel"- :label="ai.harnessThinkingLevel"- :options="[- { value: 'off', label: ai.harnessThinkingOff },- { value: 'minimal', label: ai.harnessThinkingMinimal },- { value: 'low', label: ai.harnessThinkingLow },- { value: 'medium', label: ai.harnessThinkingMedium },- { value: 'high', label: ai.harnessThinkingHigh },- { value: 'xhigh', label: ai.harnessThinkingExtraHigh }- ]"- />- </ProviderSettingsField>+ <ProviderSettingsField v-if="isHarness" :label="ai.harnessThinkingLevel">+ <AppSelect+ v-model="draft.harnessThinkingLevel"+ :label="ai.harnessThinkingLevel"+ :options="[+ { value: 'off', label: ai.harnessThinkingOff },+ { value: 'minimal', label: ai.harnessThinkingMinimal },+ { value: 'low', label: ai.harnessThinkingLow },+ { value: 'medium', label: ai.harnessThinkingMedium },+ { value: 'high', label: ai.harnessThinkingHigh },+ { value: 'xhigh', label: ai.harnessThinkingExtraHigh }+ ]"+ />+ </ProviderSettingsField>- <ProviderSettingsField v-if="isHarness" :label="ai.harnessToolPermissions">- <AppSelect- v-model="draft.harnessPermissionMode"- :label="ai.harnessToolPermissions"- :options="[- { value: 'allow-reads', label: ai.harnessPermissionReads },- { value: 'allow-edits', label: ai.harnessPermissionEdits },- { value: 'allow-all', label: ai.harnessPermissionAll }- ]"- />- </ProviderSettingsField>+ <ProviderSettingsField v-if="isHarness" :label="ai.harnessToolPermissions">+ <AppSelect+ v-model="draft.harnessPermissionMode"+ :label="ai.harnessToolPermissions"+ :options="[+ { value: 'allow-reads', label: ai.harnessPermissionReads },+ { value: 'allow-edits', label: ai.harnessPermissionEdits },+ { value: 'allow-all', label: ai.harnessPermissionAll }+ ]"+ />+ </ProviderSettingsField>- <ProviderSettingsField v-if="supportsReasoningEffort" :label="ai.reasoningEffort">- <ProviderSettingsInput- v-model="draft.reasoningEffort"- :aria-label="ai.reasoningEffort"- :placeholder="ai.reasoningEffortPlaceholder"- />- <p class="mt-1 text-[10px] text-muted">{{ ai.reasoningEffortDescription }}</p>- </ProviderSettingsField>+ <ProviderSettingsField v-if="supportsReasoningEffort" :label="ai.reasoningEffort">+ <ProviderSettingsInput+ v-model="draft.reasoningEffort"+ :aria-label="ai.reasoningEffort"+ :placeholder="ai.reasoningEffortPlaceholder"+ />+ <p class="mt-1 text-[10px] text-muted">{{ ai.reasoningEffortDescription }}</p>+ </ProviderSettingsField>- <div class="border-t border-border pt-2.5">- <p class="text-[11px] font-medium text-surface">{{ ai.outputLimit }}</p>- <p class="mt-0.5 text-[10px] text-muted">- {{ ai.outputLimitAutomatic }} ·- {{ outputTokenRecommendation.toLocaleString() }}- {{ common.tokens }}- </p>+ <div class="border-t border-border pt-2.5">+ <p class="text-[11px] font-medium text-surface">{{ ai.outputLimit }}</p>+ <p class="mt-0.5 text-[10px] text-muted">+ {{ ai.outputLimitAutomatic }} ·+ {{ outputTokenRecommendation.toLocaleString() }}+ {{ common.tokens }}+ </p>+ </div></div>- </div>- </CollapsibleContent>- </CollapsibleRoot>+ </CollapsibleContent>+ </CollapsibleRoot>- <p v-if="saveError" class="text-[10px] text-danger" role="alert">{{ saveError }}</p>- </div>+ <p v-if="saveError" class="text-xs text-error" role="alert">{{ settings.saveFailed }}</p>+ </fieldset>- <div class="flex shrink-0 items-center gap-2 border-t border-border pt-3">- <AppButton v-if="canDelete" color="error" @click="deleteOpen = true">- {{ ai.deleteModel }}- </AppButton>- <AppButton class="ml-auto" @click="emit('done')">- {{ common.cancel }}- </AppButton>- <AppButton color="primary" variant="solid" :disabled="!canSave" @click="save">- {{ ai.saveModel }}- </AppButton>- </div>- </div>+ <template #footer>+ <AppButton v-if="canDelete" color="error" :disabled="busy" @click="deleteOpen = true">+ {{ ai.deleteModel }}+ </AppButton>+ <AppButton class="ml-auto" :disabled="busy" @click="emit('done')">+ {{ common.cancel }}+ </AppButton>+ <AppButton type="submit" color="primary" variant="solid" :loading="busy">+ {{ ai.saveModel }}+ </AppButton>+ </template>+ </SettingsPage>+ </form><AppConfirmationDialogv-model:open="deleteOpen"diff --git a/src/components/settings/models/RoleAssignments.vue b/src/components/settings/models/RoleAssignments.vueindex c4e5d76af..e55ca7ca4 100644--- a/src/components/settings/models/RoleAssignments.vue+++ b/src/components/settings/models/RoleAssignments.vue@@ -4,6 +4,8 @@ import { computed } from 'vue'import { useI18n } from '@open-pencil/vue'import { useModelRoleAssignments } from '@/app/ai/models/settings/assignments'+import SettingsGroup from '@/components/settings/layout/SettingsGroup.vue'+import SettingsRow from '@/components/settings/layout/SettingsRow.vue'import AppSelect from '@/components/ui/select/AppSelect.vue'const { ai } = useI18n()@@ -35,24 +37,23 @@ const { assignmentValue, optionsForRole, updateAssignment } = useModelRoleAssign</script><template>- <div class="flex flex-col gap-2">- <div+ <SettingsGroup>+ <SettingsRowv-for="definition in roleDefinitions":key="definition.role"- class="grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-3"+ class="max-sm:flex-col max-sm:items-stretch"+ :label="definition.label"+ :description="definition.description":data-model-role="definition.role">- <div class="min-w-0">- <p class="text-[11px] font-medium text-surface">{{ definition.label }}</p>- <p class="text-[10px] leading-tight text-muted">{{ definition.description }}</p>- </div><AppSelect+ class="w-full sm:w-52":model-value="assignmentValue(definition.role)":options="optionsForRole(definition.role)":label="definition.label":data-test-id="`settings-model-assignment-${definition.role}`"@update:model-value="updateAssignment(definition.role, String($event))"/>- </div>- </div>+ </SettingsRow>+ </SettingsGroup></template>diff --git a/src/components/settings/provider/ProviderSettingsField.vue b/src/components/settings/provider/ProviderSettingsField.vueindex 23d25b44d..2fdfff750 100644--- a/src/components/settings/provider/ProviderSettingsField.vue+++ b/src/components/settings/provider/ProviderSettingsField.vue@@ -1,23 +1,38 @@<script setup lang="ts">+import { computed, useId } from 'vue'+import AppButton from '@/components/ui/button/AppButton.vue'interface ProviderSettingsFieldProps {label: stringlabelFor?: stringclearLabel?: string+ hint?: string+ error?: string}defineOptions({ inheritAttrs: false })-const { label, labelFor, clearLabel } = defineProps<ProviderSettingsFieldProps>()+const { label, labelFor, clearLabel, hint, error } = defineProps<ProviderSettingsFieldProps>()+const generatedID = useId()+const inputID = computed(() => labelFor || generatedID)+const control = computed(() => ({+ id: inputID.value,+ 'aria-invalid': Boolean(error),+ 'aria-describedby':+ [error && `${inputID.value}-error`, hint && `${inputID.value}-hint`]+ .filter(Boolean)+ .join(' ') || undefined,+ state: error ? ('invalid' as const) : ('idle' as const)+}))-const emit = defineEmits<{ clear: [] }>()+const emit = defineEmits<{ clear: []; blur: [] }>()</script><template>- <div class="flex flex-col gap-1">+ <div class="flex flex-col gap-1" @focusout="emit('blur')"><div class="flex items-center justify-between">- <label :for="labelFor" class="text-[10px] text-muted">{{ label }}</label>+ <label :for="inputID" class="text-xs text-surface">{{ label }}</label><AppButtonv-if="clearLabel"color="neutral"@@ -29,7 +44,13 @@ const emit = defineEmits<{ clear: [] }>(){{ clearLabel }}</AppButton></div>- <slot />+ <slot :control="control" />+ <p v-if="error" :id="`${inputID}-error`" class="text-xs text-error" role="alert">+ {{ error }}+ </p>+ <p v-if="hint" :id="`${inputID}-hint`" class="text-[11px] leading-relaxed text-muted">+ {{ hint }}+ </p><slot name="hint" /></div></template>diff --git a/src/components/settings/provider/ProviderSettingsKeyField.vue b/src/components/settings/provider/ProviderSettingsKeyField.vueindex 0e6621604..8eabdae2b 100644--- a/src/components/settings/provider/ProviderSettingsKeyField.vue+++ b/src/components/settings/provider/ProviderSettingsKeyField.vue@@ -7,21 +7,25 @@ import ProviderSettingsField from '@/components/settings/provider/ProviderSettinimport ProviderSettingsInput from '@/components/settings/provider/ProviderSettingsInput.vue'import ProviderSettingsLink from '@/components/settings/provider/ProviderSettingsLink.vue'-const { label, modelValue, saved, kind, placeholder, keyURL, keyURLLabel, inputId } = defineProps<{- label: string- modelValue: string- saved: boolean- kind: 'api' | 'pexels' | 'unsplash'- placeholder: string- inputId?: string- keyURL?: string- keyURLLabel?: string-}>()+const { label, modelValue, saved, kind, placeholder, keyURL, keyURLLabel, inputId, hint, error } =+ defineProps<{+ label: string+ modelValue: string+ saved: boolean+ kind: 'api' | 'pexels' | 'unsplash'+ placeholder: string+ inputId?: string+ keyURL?: string+ keyURLLabel?: string+ hint?: string+ error?: string+ }>()const emit = defineEmits<{'update:modelValue': [value: string]change: []clear: []+ blur: []}>()const { common } = useI18n()@@ -42,20 +46,26 @@ const clearDataTestId = computed(() => {<template><ProviderSettingsField:label="label"+ :hint="hint"+ :error="error":label-for="inputId":clear-label="saved ? common.clear : undefined":data-test-id="clearDataTestId"@clear="emit('clear')"+ @blur="emit('blur')">- <ProviderSettingsInput- :model-value="modelValue"- :id="inputId"- type="password"- :data-test-id="inputDataTestId"- :placeholder="placeholder"- @update:model-value="emit('update:modelValue', String($event))"- @change="emit('change')"- />+ <template #default="{ control }">+ <ProviderSettingsInput+ v-bind="control"+ :model-value="modelValue"+ :aria-label="label"+ type="password"+ :data-test-id="inputDataTestId"+ :placeholder="placeholder"+ @update:model-value="emit('update:modelValue', String($event))"+ @change="emit('change')"+ />+ </template><template #hint><ProviderSettingsLink v-if="keyURL && keyURLLabel" :href="keyURL">{{ keyURLLabel }}diff --git a/src/components/settings/provider/StockPhotoKeysSection.vue b/src/components/settings/provider/StockPhotoKeysSection.vuedeleted file mode 100644index a3fdaf9d5..000000000--- a/src/components/settings/provider/StockPhotoKeysSection.vue+++ /dev/null@@ -1,71 +0,0 @@-<script setup lang="ts">-import { computed, ref } from 'vue'--import { useI18n } from '@open-pencil/vue'--import {- pexelsKeyStatus,- setPexelsKey,- unsplashKeyStatus,- setUnsplashKey-} from '@/app/settings/credentials/media'-import ProviderSettingsKeyField from '@/components/settings/provider/ProviderSettingsKeyField.vue'--const { media, credentials } = useI18n()-const pexelsKeyInput = ref('')-const unsplashKeyInput = ref('')-const hasExistingPexelsKey = computed(() => pexelsKeyStatus.value === 'configured')-const hasExistingUnsplashKey = computed(() => unsplashKeyStatus.value === 'configured')--async function savePexelsKey(): Promise<void> {- const value = pexelsKeyInput.value.trim()- if (!value) return- await setPexelsKey(value)- pexelsKeyInput.value = ''-}--async function saveUnsplashKey(): Promise<void> {- const value = unsplashKeyInput.value.trim()- if (!value) return- await setUnsplashKey(value)- unsplashKeyInput.value = ''-}--async function clearPexelsKey(): Promise<void> {- await setPexelsKey('')- pexelsKeyInput.value = ''-}--async function clearUnsplashKey(): Promise<void> {- await setUnsplashKey('')- unsplashKeyInput.value = ''-}-</script>--<template>- <ProviderSettingsKeyField- v-model="pexelsKeyInput"- :label="media.pexelsAPIKey"- :saved="hasExistingPexelsKey"- kind="pexels"- :placeholder="hasExistingPexelsKey ? credentials.savedReplace : media.stockPhotoToolOptional"- key-u-r-l="https://www.pexels.com/api/"- :key-u-r-l-label="media.getPexelsAPIKey"- @clear="clearPexelsKey"- @change="savePexelsKey"- />-- <ProviderSettingsKeyField- v-model="unsplashKeyInput"- :label="media.unsplashAccessKey"- :saved="hasExistingUnsplashKey"- kind="unsplash"- :placeholder="- hasExistingUnsplashKey ? credentials.savedReplace : media.pexelsAlternativeOptional- "- key-u-r-l="https://unsplash.com/oauth/applications"- :key-u-r-l-label="media.getUnsplashAccessKey"- @clear="clearUnsplashKey"- @change="saveUnsplashKey"- />-</template>diff --git a/src/components/settings/storage/StorageSettingsPanel.vue b/src/components/settings/storage/StorageSettingsPanel.vueindex c31a9a7fc..92a67678c 100644--- a/src/components/settings/storage/StorageSettingsPanel.vue+++ b/src/components/settings/storage/StorageSettingsPanel.vue@@ -1,143 +1,218 @@<script setup lang="ts">-import { ref } from 'vue'+import { computed, ref, useTemplateRef } from 'vue'import { useRouter } from 'vue-router'-import { useI18n } from '@open-pencil/vue'+import {+ useCommonMessages,+ useCredentialMessages,+ useSettingsMessages,+ useStorageMessages+} from '@open-pencil/vue'import { useNotificationMessages } from '@/app/i18n/notifications'+import { useStorageSettingsFeedback } from '@/app/integrations/storage/settings/feedback'import { useStorageSettings } from '@/app/integrations/storage/settings/use'import { settingsDialogOpen } from '@/app/settings/dialog'-import { toast } from '@/app/shell/ui'+import { useSettingsFormGuard } from '@/app/settings/navigation/use'+import { focusInvalidField } from '@/components/settings/layout/focus'+import SettingsPage from '@/components/settings/layout/SettingsPage.vue'+import SettingsSectionHeader from '@/components/settings/layout/SettingsSectionHeader.vue'+import ProviderSettingsField from '@/components/settings/provider/ProviderSettingsField.vue'import AppButton from '@/components/ui/button/AppButton.vue'import AppInput from '@/components/ui/input/AppInput.vue'+import AppActionRow from '@/components/ui/list/AppActionRow.vue'-const { storage, settings, credentials, common } = useI18n()+const storage = useStorageMessages()+const settings = useSettingsMessages()+const credentials = useCredentialMessages()+const common = useCommonMessages()const notifications = useNotificationMessages()const router = useRouter()+const editing = ref(false)const credentialDrafts = ref<Record<string, string>>({})+const connection = useStorageSettings(credentialDrafts)+const feedback = useStorageSettingsFeedback(connection, credentialDrafts, settings)+const { errors: fieldErrors } = feedback+const formElement = useTemplateRef<HTMLFormElement>('formElement')+const testResult = ref<'success' | 'error' | null>(null)+const testing = computed(() => connection.operation.value === 'test')+const {+ provider,+ preferenceDrafts,+ credentialStatuses,+ busy,+ configured,+ dirty,+ error,+ clearCredential+} = connection+useSettingsFormGuard({ dirty, busy, cancel }, editing)-function preferenceLabel(field: string): string {+function preferenceLabel(field: string) {if (field === 'endpoint') return storage.value.endpointif (field === 'bucket') return storage.value.bucketif (field === 'region') return storage.value.regionreturn field}--function credentialLabel(field: string): string {+function credentialLabel(field: string) {if (field === 'access-key-id') return storage.value.accessKeyIDif (field === 'secret-access-key') return storage.value.secretAccessKeyreturn field}--async function openWorkspace(): Promise<void> {+function edit() {+ connection.begin()+ feedback.reset()+ testResult.value = null+ editing.value = true+}+function cancel() {+ connection.cancel()+ editing.value = false+}+async function save() {+ if (busy.value) return+ if (!(await feedback.validate('save'))) {+ await focusInvalidField(formElement.value)+ return+ }+ if (await connection.save()) editing.value = false+}+async function openWorkspace() {settingsDialogOpen.value = falseawait router.push('/storage')}--async function testConnection(): Promise<void> {- const result = await testStorageConnection()- if (!result) return- if (result.ok) toast.info(notifications.value.storageConnected)- else toast.error(notifications.value.storageConnectionFailed({ error: result.message }))+async function testConnection() {+ if (busy.value) return+ testResult.value = null+ if (!(await feedback.validate('test'))) {+ await focusInvalidField(formElement.value)+ return+ }+ const result = await connection.testConnection()+ if (result) testResult.value = result.ok ? 'success' : 'error'}--const {- testConnection: testStorageConnection,- provider,- preferenceDrafts,- credentialStatuses,- busy,- configured,- savePreferences,- saveCredential,- clearCredential-} = useStorageSettings(credentialDrafts)</script><template>- <section class="flex flex-col gap-3" data-test-id="settings-storage-panel">- <div>- <h3 class="text-xs font-semibold text-surface">{{ settings.storage }}</h3>- <p class="mt-0.5 text-[10px] text-muted">{{ provider.description }}</p>- </div>-- <label- v-for="field in provider.preferenceFields"- :key="field.id"- class="flex flex-col gap-1 text-[10px] text-muted"- >- {{ preferenceLabel(field.id) }}- <AppInput- v-model="preferenceDrafts[field.id]"- :placeholder="field.placeholder"- size="sm"- tone="panel"- @change="savePreferences"- />- </label>-- <div- v-for="field in provider.credentialFields"- :key="field.id"- class="flex flex-col gap-1"- :data-credential="field.id"- >- <label :for="`storage-${field.id}`" class="text-[10px] text-muted">- {{ credentialLabel(field.id) }}- </label>- <div class="flex gap-2">- <AppInput- :id="`storage-${field.id}`"- v-model="credentialDrafts[field.id]"- type="password"- :aria-label="credentialLabel(field.id)"- :placeholder="- credentialStatuses[field.id] === 'configured'- ? credentials.savedReplace- : field.placeholder- "- size="sm"- tone="panel"- class="min-w-0 flex-1"- @enter="saveCredential(field.id)"- />+ <form+ ref="formElement"+ class="flex min-h-0 min-w-0 flex-1 flex-col"+ novalidate+ :aria-busy="busy"+ @submit.prevent="save"+ >+ <SettingsPage data-test-id="settings-storage-panel">+ <section v-if="!editing" class="flex flex-col gap-4">+ <SettingsSectionHeader>+ {{ settings.storage }}+ <template #description>{{ provider.description }}</template>+ </SettingsSectionHeader>+ <AppActionRow @click="edit">+ {{ provider.label }}+ <template #description>{{+ configured ? settings.configured : settings.notConfigured+ }}</template>+ <template #trailing+ >{{ settings.edit }}<icon-lucide-chevron-right class="size-3.5"+ /></template>+ </AppActionRow><AppButton- v-if="credentialDrafts[field.id]?.trim()"- size="xs"- variant="soft"- @click="saveCredential(field.id)"+ class="self-start"+ variant="outline"+ :disabled="!configured"+ data-test-id="settings-storage-open-workspace"+ @click="openWorkspace"+ >{{ storage.openWorkspace }}</AppButton>- {{ common.save }}- </AppButton>+ <p v-if="!configured" class="text-[11px] text-muted">{{ settings.configureStorageHint }}</p>+ </section>+ <section v-else class="flex flex-col gap-4">+ <SettingsSectionHeader>+ {{ settings.storage }}+ <template #description>{{ settings.saveChangesDescription }}</template>+ </SettingsSectionHeader>+ <fieldset :disabled="busy" class="flex min-w-0 flex-col gap-4">+ <ProviderSettingsField+ v-for="field in provider.preferenceFields"+ :key="field.id"+ v-slot="{ control }"+ :label="preferenceLabel(field.id)"+ :hint="field.kind === 'url' ? settings.baseURLHint : field.placeholder"+ :error="fieldErrors[field.id]"+ @blur="feedback.blur(field.id)"+ >+ <AppInput+ v-bind="control"+ :model-value="preferenceDrafts[field.id] ?? ''"+ @update:model-value="preferenceDrafts[field.id] = String($event)"+ :type="field.kind"+ :placeholder="field.placeholder"+ :aria-label="preferenceLabel(field.id)"+ tone="panel"+ />+ </ProviderSettingsField>+ <ProviderSettingsField+ v-for="field in provider.credentialFields"+ :key="field.id"+ v-slot="{ control }"+ :label="credentialLabel(field.id)"+ :label-for="`storage-${field.id}`"+ :hint="+ credentialStatuses[field.id] === 'configured'+ ? settings.savedCredentialHint+ : field.placeholder+ "+ :error="fieldErrors[`credential:${field.id}`]"+ :clear-label="credentialStatuses[field.id] === 'configured' ? common.clear : undefined"+ @clear="clearCredential(field.id)"+ @blur="feedback.blur(`credential:${field.id}`)"+ >+ <AppInput+ v-bind="control"+ :model-value="credentialDrafts[field.id] ?? ''"+ @update:model-value="credentialDrafts[field.id] = String($event)"+ type="password"+ :aria-label="credentialLabel(field.id)"+ :placeholder="+ credentialStatuses[field.id] === 'configured'+ ? credentials.savedReplace+ : field.placeholder+ "+ tone="panel"+ autocomplete="new-password"+ />+ </ProviderSettingsField>+ </fieldset><AppButton- v-else-if="credentialStatuses[field.id] === 'configured'"- size="xs"- @click="clearCredential(field.id)"+ class="self-start"+ variant="outline"+ :loading="testing"+ :disabled="busy"+ data-test-id="settings-storage-test"+ @click="testConnection"+ >{{ testing ? common.testingConnection : common.testConnection }}</AppButton>- {{ common.clear }}- </AppButton>- </div>- </div>-- <div class="mt-1 flex flex-wrap items-center gap-2">- <AppButton- color="primary"- variant="solid"- :disabled="busy"- data-test-id="settings-storage-test"- @click="testConnection"- >- {{ common.testConnection }}- </AppButton>-- <AppButton- variant="outline"- :disabled="!configured"- data-test-id="settings-storage-open-workspace"- @click="openWorkspace"- >- {{ storage.openWorkspace }}- </AppButton>- </div>- </section>+ <p v-if="testResult" role="status" class="text-xs text-surface">+ {{+ testResult === 'success' ? notifications.storageConnected : settings.connectionFailed+ }}+ </p>+ <div v-if="error" role="alert" class="text-xs text-error">+ <p>{{ settings.saveFailed }}</p>+ <p class="mt-1">{{ settings.partialSaveWarning }}</p>+ </div>+ </section>+ <template v-if="editing" #footer>+ <AppButton :disabled="busy" @click="cancel">{{ common.cancel }}</AppButton>+ <AppButton+ type="submit"+ color="primary"+ variant="solid"+ :loading="busy && !testing"+ :disabled="busy"+ >{{ common.save }}</AppButton+ >+ </template>+ </SettingsPage>+ </form></template>diff --git a/src/components/settings/vectorize/VectorizeSettingsSection.vue b/src/components/settings/vectorize/VectorizeSettingsSection.vuedeleted file mode 100644index 28cc5ab7e..000000000--- a/src/components/settings/vectorize/VectorizeSettingsSection.vue+++ /dev/null@@ -1,48 +0,0 @@-<script setup lang="ts">-import { ref } from 'vue'--import { useI18n } from '@open-pencil/vue'--import { vectorizeProviderID } from '@/app/editor/vectorize'-import { useVectorizeSettings } from '@/app/editor/vectorize/settings/use'-import ProviderSettingsKeyField from '@/components/settings/provider/ProviderSettingsKeyField.vue'-import AppSelect from '@/components/ui/select/AppSelect.vue'--const { media, ai, credentials } = useI18n()-const keyDraft = ref('')--const { keyStatus, error, provider, providerOptions, saveCredential, clearCredential } =- useVectorizeSettings(keyDraft)-</script>--<template>- <section class="flex flex-col gap-2.5 border-t border-border pt-3" data-vectorize-settings>- <div>- <h3 class="text-xs font-semibold text-surface">{{ media.vectorization }}</h3>- <p class="mt-0.5 text-[10px] text-muted">{{ media.vectorizationDescription }}</p>- </div>-- <label class="flex flex-col gap-1 text-[10px] text-muted">- {{ media.vectorizeProvider }}- <AppSelect- v-model="vectorizeProviderID"- :label="media.vectorizeProvider"- :options="providerOptions"- />- </label>-- <ProviderSettingsKeyField- v-if="provider"- v-model="keyDraft"- :label="ai.apiKey"- :saved="keyStatus === 'configured'"- kind="api"- :placeholder="keyStatus === 'configured' ? credentials.savedReplace : provider.keyPlaceholder"- :key-u-r-l="provider.keyURL"- :key-u-r-l-label="credentials.getAPIKey"- @change="saveCredential"- @clear="clearCredential"- />- <p v-if="error" role="alert" class="text-[10px] text-danger">{{ error }}</p>- </section>-</template>diff --git a/src/components/ui/input/AppInput.vue b/src/components/ui/input/AppInput.vueindex 3f1c99aff..8c33ba363 100644--- a/src/components/ui/input/AppInput.vue+++ b/src/components/ui/input/AppInput.vue@@ -11,7 +11,7 @@ interface AppInputProps {class?: HTMLAttributes['class']ui?: { root?: string; input?: string; leading?: string; trailing?: string }id?: string- type?: 'text' | 'password' | 'number' | 'search'+ type?: 'text' | 'password' | 'number' | 'search' | 'url'placeholder?: stringariaLabel?: stringreadonly?: booleandiff --git a/src/theme/panel/field.ts b/src/theme/panel/field.tsindex afc2ba8e9..fdf48559e 100644--- a/src/theme/panel/field.ts+++ b/src/theme/panel/field.ts@@ -5,7 +5,7 @@ export const panelFieldState = {idle: '',mixed: 'text-muted placeholder:text-muted',bound: 'text-component',- invalid: 'border-danger focus:border-danger focus-visible:border-danger'+ invalid: 'border-error focus:border-error focus-visible:border-error'} as constexport const panelIconButtonBase =diff --git a/src/theme/select/combobox.ts b/src/theme/select/combobox.tsindex ded299f13..27fb503e8 100644--- a/src/theme/select/combobox.ts+++ b/src/theme/select/combobox.ts@@ -2,7 +2,10 @@ import { panelFieldBase } from '../panel/field'const appComboboxTheme = {slots: {- trigger: [panelFieldBase, 'flex w-full min-w-0 items-center justify-between px-2'],+ trigger: [+ panelFieldBase,+ 'flex w-full min-w-0 items-center justify-between px-2 aria-invalid:border-error aria-invalid:focus:ring-error/25'+ ],value: 'min-w-0 flex-1 truncate text-left text-[11px] text-surface',chevron: 'ml-1 size-3 shrink-0 text-muted',content:diff --git a/src/theme/settings/disclosure.ts b/src/theme/settings/disclosure.tsnew file mode 100644index 000000000..ed01ac581--- /dev/null+++ b/src/theme/settings/disclosure.ts@@ -0,0 +1,2 @@+export const settingsDisclosureMotion =+ 'overflow-hidden data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up duration-180 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none'diff --git a/src/theme/tabs/tabs.ts b/src/theme/tabs/tabs.tsindex 1b6f03b94..f8c3f3c20 100644--- a/src/theme/tabs/tabs.ts+++ b/src/theme/tabs/tabs.ts@@ -5,7 +5,7 @@ export const tabs = tv({root: 'flex min-h-0 min-w-0 flex-1 flex-col data-[orientation=vertical]:flex-row',list: 'flex min-w-0 shrink-0 gap-1 overflow-x-auto p-2 data-[orientation=vertical]:w-40 data-[orientation=vertical]:flex-col data-[orientation=vertical]:border-r data-[orientation=vertical]:border-border',trigger:- 'flex shrink-0 items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-muted transition-colors hover:bg-hover hover:text-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-50 data-[state=active]:bg-hover data-[state=active]:text-surface',+ 'flex shrink-0 cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-muted transition-colors hover:bg-hover hover:text-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:cursor-default disabled:opacity-50 data-[state=active]:bg-hover data-[state=active]:text-surface',icon: 'flex size-3.5 shrink-0 items-center justify-center',label: 'min-w-0',trailing: 'ml-auto shrink-0',diff --git a/tests/e2e/app/webmcp.spec.ts b/tests/e2e/app/webmcp.spec.tsindex 05cbd6b33..939be11a3 100644--- a/tests/e2e/app/webmcp.spec.ts+++ b/tests/e2e/app/webmcp.spec.ts@@ -48,6 +48,14 @@ test('native WebMCP discovery, editing, validation and undo', async ({ page, brotry {await cdp.send('WebMCP.enable')+ expect(frames.size).toBe(0)+ await page.getByTestId('app-settings-trigger').click()+ await page.getByTestId('settings-section-mcp').click()+ const access = page.getByRole('combobox', { name: 'Browser agent access' })+ await expect(access).toHaveText('Off')+ await access.click()+ await page.getByRole('option', { name: 'Edit', exact: true }).click()+ await page.getByTestId('app-settings-done').click()await expect.poll(() => frames.has('update_node')).toBe(true)expect(frames.has('eval')).toBe(false)expect(frames.has('save_file')).toBe(false)diff --git a/tests/e2e/settings/credentials.spec.ts b/tests/e2e/settings/credentials.spec.tsindex 310cfd31e..faf95bf58 100644--- a/tests/e2e/settings/credentials.spec.ts+++ b/tests/e2e/settings/credentials.spec.ts@@ -6,32 +6,40 @@ test('storage settings keep secrets behind the credential manager', async ({ pagawait page.goto('/?test')const canvas = new CanvasHelper(page)await canvas.waitForInit()-await page.getByTestId('app-settings-trigger').click()await page.getByTestId('settings-section-storage').click()- await page.getByLabel('Endpoint').fill('https://s3.example.com')- await page.getByLabel('Bucket').fill('designs')+ const connection = page.getByRole('button', { name: /S3 storage/ })+ await connection.click()+ await page.getByLabel('Endpoint', { exact: true }).fill('https://s3.example.com')+ await page.getByLabel('Bucket', { exact: true }).fill('designs')await expect(page.getByRole('button', { name: 'Copy CORS JSON' })).toBeHidden()-- const secretField = page.locator('[data-credential="secret-access-key"]')- await secretField.locator('input').fill('storage-secret')- await secretField.getByRole('button', { name: 'Save' }).click()- await expect(secretField.locator('input')).toHaveValue('')- await expect(secretField.locator('input')).toHaveAttribute('placeholder', /Key saved/)-- await page.getByTestId('app-settings-done').click()- await page.getByTestId('app-settings-trigger').click()- await page.getByTestId('settings-section-storage').click()- await expect(secretField.locator('input')).toHaveValue('')- await secretField.getByRole('button', { name: 'Clear' }).click()+ const secret = page.getByLabel('Secret access key', { exact: true })+ await secret.fill('storage-secret')+ const save = page.getByRole('button', { name: 'Save', exact: true })+ await save.click()+ await connection.click()+ await expect(secret).toHaveValue('')+ await expect(secret).toHaveAttribute('placeholder', /Key saved/)+ expect(+ await page.evaluate(() => {+ // oxlint-disable-next-line open-pencil/no-direct-storage-access -- Inspect persisted bytes to detect plaintext credential leaks.+ return Object.values(localStorage).some((value) => value.includes('storage-secret'))+ })+ ).toBe(false)+ await page.getByRole('button', { name: 'Clear', exact: true }).click()+ await page.getByRole('button', { name: 'Cancel', exact: true }).click()+ await connection.click()+ await expect(secret).toHaveAttribute('placeholder', /Key saved/)+ await page.getByRole('button', { name: 'Clear', exact: true }).click()+ await save.click()await page.getByTestId('app-settings-done').click()-await page.reload()await canvas.waitForInit()await page.getByTestId('app-settings-trigger').click()await page.getByTestId('settings-section-storage').click()- await expect(page.getByLabel('Endpoint')).toHaveValue('https://s3.example.com')- await expect(secretField.locator('input')).not.toHaveAttribute('placeholder', /Key saved/)+ await connection.click()+ await expect(page.getByLabel('Endpoint', { exact: true })).toHaveValue('https://s3.example.com')+ await expect(secret).not.toHaveAttribute('placeholder', /Key saved/)})test('MCP connections keep bearer tokens out of ordinary settings', async ({ page }) => {@@ -41,12 +49,12 @@ test('MCP connections keep bearer tokens out of ordinary settings', async ({ pagawait page.getByTestId('app-settings-trigger').click()await page.getByTestId('settings-section-mcp').click()- const section = page.locator('[data-mcp-connections]')+ const section = page.getByTestId('app-settings-dialog')await section.getByRole('button', { name: 'Add connection' }).click()await section.getByLabel('Connection name').fill('GitHub')await section.getByLabel('MCP server URL').fill('http://example.com/mcp')await section.getByRole('button', { name: 'Save' }).click()- await expect(section.getByRole('alert')).toContainText('must use HTTPS')+ await expect(section.getByLabel('MCP server URL')).toHaveAttribute('aria-invalid', 'true')await section.getByLabel('MCP server URL').fill('https://example.com/mcp')await section.getByRole('switch', { name: 'Enable for ACP agents' }).click()@@ -67,6 +75,14 @@ test('MCP connections keep bearer tokens out of ordinary settings', async ({ pagawait expect(section).toContainText('Enabled')await section.getByRole('button', { name: /GitHub/ }).click()await expect(section.getByPlaceholder(/Key saved/)).toBeVisible()+ await section.getByRole('button', { name: 'Clear', exact: true }).click()+ await section.getByRole('button', { name: 'Cancel', exact: true }).click()+ await section.getByRole('button', { name: /GitHub/ }).click()+ await expect(section.getByPlaceholder(/Key saved/)).toBeVisible()+ await section.getByRole('button', { name: 'Clear', exact: true }).click()+ await section.getByRole('button', { name: 'Save', exact: true }).click()+ await section.getByRole('button', { name: /GitHub/ }).click()+ await expect(section.getByPlaceholder(/Key saved/)).toHaveCount(0)await section.getByRole('button', { name: 'Delete connection' }).click()const confirmation = page.getByRole('alertdialog')await expect(confirmation).toContainText('remove its saved bearer token')@@ -117,6 +133,7 @@ test('MCP automation settings filter and persist tool availability', async ({ paawait expect(authentication).toHaveAttribute('data-state', 'unchecked')await authentication.click()+ await page.getByRole('button', { name: 'Available tools', exact: true }).click()const search = page.getByTestId('settings-mcp-tool-search')await search.fill('create_shape')await expect(search).toHaveValue('create_shape')@@ -128,6 +145,7 @@ test('MCP automation settings filter and persist tool availability', async ({ paawait canvas.waitForInit()await page.getByTestId('app-settings-trigger').click()await page.getByTestId('settings-section-mcp').click()+ await page.getByRole('button', { name: 'Available tools', exact: true }).click()await expect(page.getByTestId('settings-mcp-tool-create_shape')).toHaveAttribute('data-state','unchecked'diff --git a/tests/e2e/settings/feedback.spec.ts b/tests/e2e/settings/feedback.spec.tsnew file mode 100644index 000000000..c79351ad9--- /dev/null+++ b/tests/e2e/settings/feedback.spec.ts@@ -0,0 +1,166 @@+import { expect, test, type Page } from '@playwright/test'++import { CanvasHelper } from '#tests/helpers/canvas'++async function openSettings(page: Page) {+ await page.goto('/?test')+ await new CanvasHelper(page).waitForInit()+ await page.keyboard.press(process.platform === 'darwin' ? 'Meta+,' : 'Control+,')+}++test('model Save and Test explain missing fields and focus the first error', async ({ page }) => {+ await page.emulateMedia({ colorScheme: 'dark' })+ await openSettings(page)+ await page.getByTestId('settings-section-ai').click()+ await page.getByTestId('settings-add-model').click()+ const editor = page.getByTestId('settings-model-editor')+ const name = editor.getByRole('textbox', { name: 'Name', exact: true })+ const save = page.getByRole('button', { name: 'Save model', exact: true })+ await expect(editor.locator('[aria-invalid="true"]')).toHaveCount(0)+ await name.fill('')+ await name.press('Tab')+ await expect(name).toHaveAttribute('aria-invalid', 'true')+ await expect(editor.locator('[aria-invalid="true"]')).toHaveCount(1)+ await expect(save).toBeEnabled()+ await save.click()+ await expect(name).toBeFocused()+ await expect(name).toHaveAttribute('aria-invalid', 'true')+ await expect(name).toHaveAccessibleDescription(/^This field is required\./)+ expect(+ await name.evaluate((control) => {+ const [errorID, hintID] = control.getAttribute('aria-describedby')?.split(' ') ?? []+ if (!errorID || !hintID) return false+ const error = document.getElementById(errorID)+ const hint = document.getElementById(hintID)+ return Boolean(+ error && hint && error.getBoundingClientRect().bottom <= hint.getBoundingClientRect().top+ )+ })+ ).toBe(true)+ await expect(name).toHaveCSS('border-top-color', 'rgb(248, 113, 113)')+ await expect(editor.getByRole('alert').first()).toHaveCSS('color', 'rgb(248, 113, 113)')+ await name.fill('My model')+ await expect(name).toHaveAttribute('aria-invalid', 'false')+ const testConnection = page.getByTestId('provider-test-connection')+ await expect(testConnection).toBeEnabled()+ await testConnection.click()+ await expect(editor.locator('[aria-invalid="true"]').first()).toBeFocused()+})++test('storage validates preferences and test credentials without saving', async ({ page }) => {+ await openSettings(page)+ await page.getByTestId('settings-section-storage').click()+ await expect(+ page.getByText('Configure the connection before opening the workspace.')+ ).toBeVisible()+ await page.getByRole('button', { name: /S3 storage/ }).click()+ const endpoint = page.getByRole('textbox', { name: 'Endpoint', exact: true })+ const bucket = page.getByRole('textbox', { name: 'Bucket', exact: true })+ await page.getByRole('button', { name: 'Save', exact: true }).click()+ await expect(endpoint).toBeFocused()+ await expect(endpoint).toHaveAttribute('aria-invalid', 'true')+ await endpoint.fill('https://example.com')+ await bucket.fill('designs')+ await expect(endpoint).toHaveAttribute('aria-invalid', 'false')+ await page.getByTestId('settings-storage-test').click()+ const key = page.getByRole('textbox', { name: 'Access key ID', exact: true })+ await expect(key).toBeFocused()+ await expect(key).toHaveAttribute('aria-invalid', 'true')+ await expect(key).toHaveAccessibleDescription('This field is required.')+ await page.getByRole('button', { name: 'Cancel', exact: true }).click()+ await expect(+ page.getByText('Configure the connection before opening the workspace.')+ ).toBeVisible()+})++async function failCredentialWrites(page: Page) {+ return page.evaluateHandle(async () => {+ const path = '/src/app/settings/credentials/app.ts'+ const { appCredentialServices } = await import(path)+ const original = appCredentialServices.manager.set+ appCredentialServices.manager.set = async () => {+ throw new Error('Test credential write failure')+ }+ return {+ restore() {+ appCredentialServices.manager.set = original+ }+ }+ })+}++test('media explains optional keys and preserves input after a failed save', async ({ page }) => {+ await openSettings(page)+ await page.getByTestId('settings-section-media').click()+ await page.getByRole('button', { name: /Pexels/ }).click()+ const key = page.getByRole('textbox', { name: /Pexels/ })+ await expect(key).toHaveAccessibleDescription('Optional. Add a key to enable this service.')+ await key.fill('test-only-replacement')+ const failure = await failCredentialWrites(page)+ try {+ await page.getByRole('button', { name: 'Save', exact: true }).click()+ await expect(key).toHaveValue('test-only-replacement')+ await expect(key).toBeFocused()+ await expect(key).toHaveAttribute('aria-invalid', 'true')+ await expect(key).toHaveAccessibleDescription(/Could not save these changes/)+ await expect(page.getByRole('button', { name: 'Save', exact: true })).toBeEnabled()+ } finally {+ await failure.evaluate((handle) => handle.restore())+ await failure.dispose()+ }+ await page.getByRole('button', { name: 'Save', exact: true }).click()+ await expect(page.getByRole('button', { name: /Pexels/ })).toBeVisible()+})++test('MCP requires a token only for enabled bearer connections and preserves failed saves', async ({+ page+}) => {+ await openSettings(page)+ await page.getByTestId('settings-section-mcp').click()+ await page.getByRole('button', { name: 'Add connection', exact: true }).click()+ await page.getByRole('textbox', { name: 'Connection name', exact: true }).fill('Test server')+ await page+ .getByRole('textbox', { name: 'MCP server URL', exact: true })+ .fill('https://example.com/mcp')+ await page.getByRole('switch', { name: 'Enable for ACP agents' }).click()+ await page.getByRole('switch', { name: 'Use bearer authentication' }).click()+ const key = page.getByRole('textbox', { name: 'Bearer token', exact: true })+ await page.getByRole('button', { name: 'Save', exact: true }).click()+ await expect(key).toBeFocused()+ await expect(key).toHaveAttribute('aria-invalid', 'true')+ await key.fill('test-only-replacement')+ await expect(key).toHaveAttribute('aria-invalid', 'false')+ const failure = await failCredentialWrites(page)+ try {+ await page.getByRole('button', { name: 'Save', exact: true }).click()+ await expect(+ page.getByText('Could not save these changes. Check the settings and try again.', {+ exact: true+ })+ ).toBeVisible()+ await expect(key).toHaveValue('test-only-replacement')+ await expect(page.getByRole('button', { name: 'Save', exact: true })).toBeEnabled()+ } finally {+ await failure.evaluate((handle) => handle.restore())+ await failure.dispose()+ }+})++test('MCP field feedback is translated after switching the locale', async ({ page }) => {+ await openSettings(page)+ await page.getByTestId('settings-language').click()+ await page.getByRole('option', { name: 'Русский', exact: true }).click()+ await page.getByTestId('settings-section-mcp').click()+ await page.getByRole('button', { name: 'Добавить подключение', exact: true }).click()+ await page.getByRole('button', { name: 'Сохранить', exact: true }).click()+ const name = page.getByRole('textbox', { name: 'Название подключения', exact: true })+ await expect(name).toBeFocused()+ await expect(name).toHaveAccessibleDescription(/Это поле обязательно\./)+ await name.fill('Мой сервер')+ await expect(name).toHaveAttribute('aria-invalid', 'false')+ const url = page.getByRole('textbox', { name: 'URL сервера MCP', exact: true })+ await url.fill('http://example.com/mcp')+ await url.press('Tab')+ await expect(url).toHaveAccessibleDescription(/Используйте HTTPS/)+ await expect(page.getByText('This field is required.', { exact: true })).toHaveCount(0)+})diff --git a/tests/e2e/settings/mcp.spec.ts b/tests/e2e/settings/mcp.spec.tsnew file mode 100644index 000000000..3efe516e2--- /dev/null+++ b/tests/e2e/settings/mcp.spec.ts@@ -0,0 +1,106 @@+import { expect, test, type Page } from '@playwright/test'++import { CanvasHelper } from '#tests/helpers/canvas'++async function selectMCPSection(page: Page, mobile: boolean) {+ if (mobile) {+ await page.getByRole('combobox', { name: 'Settings', exact: true }).click()+ await page.getByRole('option', { name: 'MCP & automation', exact: true }).click()+ } else {+ await page.getByTestId('settings-section-mcp').click()+ }+}++for (const viewport of [+ { width: 1280, height: 900 },+ { width: 390, height: 844 }+]) {+ test(`MCP settings separate access controls and discard cancelled drafts at ${viewport.width}px`, async ({+ page+ }) => {+ await page.setViewportSize(viewport)+ await page.goto('/?test')+ const canvas = new CanvasHelper(page)+ await canvas.waitForInit()+ await page.keyboard.press(process.platform === 'darwin' ? 'Meta+,' : 'Control+,')+ await selectMCPSection(page, viewport.width < 640)+ await expect(page.getByRole('heading', { name: 'Local server', exact: true })).toBeVisible()+ await page.getByRole('button', { name: 'Available tools', exact: true }).click()+ const search = page.getByRole('searchbox', { name: 'Search MCP tools' })+ await search.fill('no-such-mcp-tool')+ await expect(page.getByText('No tools match your search.', { exact: true })).toBeVisible()+ await page.getByRole('button', { name: 'Available tools', exact: true }).click()+ const access = page.getByRole('combobox', { name: 'Browser agent access' })+ await expect(access).toHaveText('Off')+ await access.click()+ await page.getByRole('option', { name: 'Inspect', exact: true }).click()+ await expect(+ page.getByText('Agents can inspect the document but cannot change it.', { exact: true })+ ).toBeVisible()+ await page.getByRole('button', { name: 'Add connection', exact: true }).click()+ await expect(page.getByText('Enable for ACP agents', { exact: true })).toBeVisible()+ await expect(page.getByText('Use bearer authentication', { exact: true })).toBeVisible()+ await page.getByRole('switch', { name: 'Use bearer authentication' }).click()+ await page.getByLabel('Bearer token', { exact: true }).fill('test-only-discarded-token')+ await page.getByRole('button', { name: 'Cancel', exact: true }).click()+ await page.getByRole('button', { name: 'Add connection', exact: true }).click()+ await page.getByRole('switch', { name: 'Use bearer authentication' }).click()+ await expect(page.getByLabel('Bearer token', { exact: true })).toHaveValue('')+ await page.getByRole('button', { name: 'Cancel', exact: true }).click()+ await page.getByTestId('app-settings-done').click()+ await page.reload()+ await canvas.waitForInit()+ await page.keyboard.press(process.platform === 'darwin' ? 'Meta+,' : 'Control+,')+ await selectMCPSection(page, viewport.width < 640)+ await expect(access).toHaveText('Inspect')+ })+}++test('MCP connection forms validate, retain invalid drafts and reset dirty state', async ({+ page+}) => {+ await page.goto('/?test')+ await new CanvasHelper(page).waitForInit()+ await page.keyboard.press(process.platform === 'darwin' ? 'Meta+,' : 'Control+,')+ await selectMCPSection(page, false)+ await page.getByRole('button', { name: 'Add connection', exact: true }).click()+ const name = page.getByRole('textbox', { name: 'Connection name', exact: true })+ const url = page.getByRole('textbox', { name: 'MCP server URL', exact: true })+ const save = page.getByRole('button', { name: 'Save', exact: true })+ await save.click()+ await expect(name).toHaveAttribute('aria-invalid', 'true')+ await expect(url).toHaveAttribute('aria-invalid', 'true')+ await expect(name).toHaveAccessibleDescription(/This field is required\./)+ await expect(name).toBeFocused()+ await name.fill('open-pencil')+ await url.fill('http://example.com/mcp')+ await save.click()+ await expect(url).toHaveAttribute('aria-invalid', 'true')+ await url.fill('https://example.com/mcp')+ await page.getByRole('switch', { name: 'Use bearer authentication' }).click()+ const token = page.getByLabel('Bearer token', { exact: true })+ await token.fill('test-only-unsaved-token')+ await save.click()+ await expect(name).toHaveAccessibleDescription(/Choose a unique name/)+ await expect(name).toHaveValue('open-pencil')+ await expect(token).toHaveValue('test-only-unsaved-token')+ await name.fill('Valid connection')+ await expect(name).toHaveAttribute('aria-invalid', 'false')+ await page.getByRole('button', { name: 'Cancel', exact: true }).click()+ await page.getByRole('button', { name: 'Add connection', exact: true }).click()+ await expect(name).toHaveValue('')+ await expect(name).toHaveAttribute('aria-invalid', 'false')+ await name.fill('Temporary')+ await page.getByTestId('settings-section-general').click()+ await expect(page.getByRole('alertdialog')).toBeVisible()+ await page.getByRole('button', { name: 'Keep editing', exact: true }).click()+ await name.fill('')+ await page.getByTestId('settings-section-general').click()+ await expect(page.getByRole('alertdialog')).toHaveCount(0)+ await selectMCPSection(page, false)+ await page.getByRole('button', { name: 'Add connection', exact: true }).click()+ await name.fill('Saved connection')+ await url.fill('https://example.com/mcp')+ await save.click()+ await expect(page.getByRole('button', { name: /Saved connection/ })).toBeVisible()+})diff --git a/tests/e2e/settings/mobile.spec.ts b/tests/e2e/settings/mobile.spec.tsindex 7c4eb096a..e9964b82a 100644--- a/tests/e2e/settings/mobile.spec.ts+++ b/tests/e2e/settings/mobile.spec.ts@@ -15,13 +15,13 @@ for (const theme of ['light', 'dark']) {await page.keyboard.press(process.platform === 'darwin' ? 'Meta+,' : 'Control+,')const dialog = page.getByTestId('app-settings-dialog')await expect(dialog).toBeVisible()- const general = dialog.getByRole('tab', { name: 'General', exact: true })- await general.focus()- await general.press('ArrowRight')- await expect(page.getByTestId('settings-section-ai')).toBeFocused()+ const section = dialog.getByRole('combobox', { name: 'Settings', exact: true })+ await section.click()+ await page.getByRole('option', { name: 'AI & agents', exact: true }).click()await expect(page.getByTestId('settings-ai-panel')).toBeVisible()await expect(dialog).toHaveScreenshot(`mobile-settings-models-${theme}.png`)- await page.getByTestId('settings-section-storage').click()+ await section.click()+ await page.getByRole('option', { name: 'Cloud storage', exact: true }).click()await expect(page.getByTestId('settings-storage-panel')).toBeVisible()await expect(dialog).toHaveScreenshot(`mobile-settings-storage-${theme}.png`)})diff --git a/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-models-dark-openpencil-darwin.png b/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-models-dark-openpencil-darwin.pngindex c09d6c4d3..c555780ed 100644Binary files a/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-models-dark-openpencil-darwin.png and b/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-models-dark-openpencil-darwin.png differdiff --git a/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-models-light-openpencil-darwin.png b/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-models-light-openpencil-darwin.pngindex b2c783b9b..75026310e 100644Binary files a/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-models-light-openpencil-darwin.png and b/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-models-light-openpencil-darwin.png differdiff --git a/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-storage-dark-openpencil-darwin.png b/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-storage-dark-openpencil-darwin.pngindex d65909e26..eeb33377d 100644Binary files a/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-storage-dark-openpencil-darwin.png and b/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-storage-dark-openpencil-darwin.png differdiff --git a/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-storage-light-openpencil-darwin.png b/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-storage-light-openpencil-darwin.pngindex 50d8025f9..f97fd4373 100644Binary files a/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-storage-light-openpencil-darwin.png and b/tests/e2e/settings/mobile.spec.ts-snapshots/mobile-settings-storage-light-openpencil-darwin.png differdiff --git a/tests/e2e/settings/model-editor.spec.ts b/tests/e2e/settings/model-editor.spec.tsindex 3b3c4b8c4..2cf3801e5 100644--- a/tests/e2e/settings/model-editor.spec.ts+++ b/tests/e2e/settings/model-editor.spec.ts@@ -22,7 +22,10 @@ test('model editing keeps the Settings shell stable and isolates the form', asynexpect(await dialog.boundingBox()).toEqual(before)// Accidental dismissal must not throw away an in-progress profile.+ await editor.getByRole('textbox', { name: 'Name', exact: true }).fill('Draft profile')await page.keyboard.press('Escape')+ await expect(page.getByRole('alertdialog')).toBeVisible()+ await page.getByRole('button', { name: 'Keep editing', exact: true }).click()await expect(editor).toBeVisible()await editor.getByRole('button', { name: 'Cancel', exact: true }).click()await expect(editor).toHaveCount(0)diff --git a/tests/e2e/settings/polish.spec.ts b/tests/e2e/settings/polish.spec.tsnew file mode 100644index 000000000..3041f99df--- /dev/null+++ b/tests/e2e/settings/polish.spec.ts@@ -0,0 +1,105 @@+import { expect, test, type Page } from '@playwright/test'++import { CanvasHelper } from '#tests/helpers/canvas'++async function openSettings(page: Page) {+ await page.goto('/?test')+ await new CanvasHelper(page).waitForInit()+ await page.keyboard.press(process.platform === 'darwin' ? 'Meta+,' : 'Control+,')+}++for (const reducedMotion of ['no-preference', 'reduce'] as const) {+ test(`Settings disclosures open, close and reopen with ${reducedMotion} motion`, async ({+ page+ }) => {+ await page.setViewportSize({ width: 1280, height: 900 })+ await page.emulateMedia({ reducedMotion })+ await openSettings(page)+ await expect(page.getByRole('dialog')).toHaveCSS('width', '840px')+ await page.getByTestId('settings-section-mcp').click()+ const trigger = page.getByRole('button', { name: 'Available tools', exact: true })+ const motion = await trigger.evaluate(async (button) => {+ if (!(button instanceof HTMLButtonElement)) throw new Error('Expected a disclosure button')+ button.click()+ await new Promise(requestAnimationFrame)+ const id = button.getAttribute('aria-controls')+ if (!id) throw new Error('Missing disclosure relationship')+ const content = document.getElementById(id)+ if (!content) throw new Error('Missing disclosure content')+ const opening = getComputedStyle(content).animationName+ await Promise.allSettled(content.getAnimations().map((animation) => animation.finished))+ const expanded = content.getBoundingClientRect().height+ button.click()+ await Promise.resolve()+ const closing = getComputedStyle(content).animationName+ button.click()+ await Promise.resolve()+ await Promise.allSettled(content.getAnimations().map((animation) => animation.finished))+ return { opening, closing, expanded }+ })+ expect(motion.opening).toBe(reducedMotion === 'reduce' ? 'none' : 'collapsible-down')+ expect(motion.closing).toBe(reducedMotion === 'reduce' ? 'none' : 'collapsible-up')+ expect(motion.expanded).toBeGreaterThan(0)+ await expect(trigger).toHaveAttribute('aria-expanded', 'true')+ await expect(page.getByRole('searchbox', { name: 'Search MCP tools' })).toBeVisible()+ await trigger.click()+ await expect(page.getByRole('searchbox', { name: 'Search MCP tools' })).toBeHidden()+ await expect(page.getByTestId('app-settings-done')).toBeVisible()+ })+}++test('external Settings requests respect a dirty editor', async ({ page }) => {+ await openSettings(page)+ await page.getByTestId('settings-section-ai').click()+ await page.getByTestId('settings-add-model').click()+ const name = page.getByRole('textbox', { name: 'Name', exact: true })+ await name.fill('Keep this draft')+ const requestSection = () =>+ page.evaluate(async () => {+ const path = '/src/app/settings/dialog.ts'+ const { openSettingsDialog } = await import(path)+ openSettingsDialog('media')+ })+ await requestSection()+ await expect(page.getByRole('alertdialog')).toBeVisible()+ await page.getByRole('button', { name: 'Keep editing', exact: true }).click()+ await expect(name).toHaveValue('Keep this draft')+ await requestSection()+ await page.getByRole('button', { name: 'Discard', exact: true }).click()+ await expect(page.getByRole('button', { name: /Pexels/ })).toBeVisible()+})++test('model credential Clear is staged until Save and Cancel preserves the saved key', async ({+ page+}) => {+ await openSettings(page)+ const credential = await page.evaluateHandle(async () => {+ const path = '/src/app/ai/models/index.ts'+ const models = await import(path)+ const draft = models.createModelProfileDraft()+ draft.name = 'Credential retention test'+ draft.providerID = 'openai'+ draft.customModelID = 'test-only-model'+ const profile = models.saveModelProfileDraft(draft)+ await models.setModelConnectionAPIKey(profile.connectionId, 'test-only-secret')+ return { status: () => models.modelConnectionCredentialStatus(profile.connectionId) }+ })+ try {+ await page.getByTestId('settings-section-ai').click()+ const row = page.getByRole('button', { name: /Credential retention test/ })+ await row.click()+ const clear = page.getByTestId('provider-settings-clear-key')+ await expect(clear).toBeVisible()+ await clear.click()+ expect(await credential.evaluate((saved) => saved.status())).toBe('configured')+ await page.getByRole('button', { name: 'Cancel', exact: true }).click()+ await row.click()+ await expect(clear).toBeVisible()+ await clear.click()+ await page.getByRole('button', { name: 'Save model', exact: true }).click()+ await expect(row).toBeVisible()+ expect(await credential.evaluate((saved) => saved.status())).toBe('missing')+ } finally {+ await credential.dispose()+ }+})diff --git a/tests/e2e/settings/tabs.spec.ts b/tests/e2e/settings/tabs.spec.tsindex 30558c01d..c2e4b922f 100644--- a/tests/e2e/settings/tabs.spec.ts+++ b/tests/e2e/settings/tabs.spec.ts@@ -10,6 +10,9 @@ test('settings tabs associate panels and support vertical keyboard navigation',await page.getByTestId('app-settings-trigger').click()const dialog = page.getByTestId('app-settings-dialog')const general = dialog.getByRole('tab', { name: 'General', exact: true })+ for (const tab of await dialog.getByRole('tab').all()) {+ await expect(tab).toHaveCSS('cursor', 'pointer')+ }await expect(general).toHaveAttribute('aria-selected', 'true')await expect(dialog).toHaveScreenshot('settings-tabs-general.png')await general.focus()diff --git a/tests/e2e/settings/tabs.spec.ts-snapshots/settings-tabs-general-openpencil-darwin.png b/tests/e2e/settings/tabs.spec.ts-snapshots/settings-tabs-general-openpencil-darwin.pngindex 0dc25a0ed..a3f877d4b 100644Binary files a/tests/e2e/settings/tabs.spec.ts-snapshots/settings-tabs-general-openpencil-darwin.png and b/tests/e2e/settings/tabs.spec.ts-snapshots/settings-tabs-general-openpencil-darwin.png differdiff --git a/tests/e2e/settings/theme.spec.ts b/tests/e2e/settings/theme.spec.tsnew file mode 100644index 000000000..256a97ddd--- /dev/null+++ b/tests/e2e/settings/theme.spec.ts@@ -0,0 +1,35 @@+import { expect, test } from '@playwright/test'++import { CanvasHelper } from '#tests/helpers/canvas'++test('Appearance groups theme and animation controls and uses the persisted app theme', async ({+ page+}) => {+ await page.emulateMedia({ colorScheme: 'dark' })+ await page.goto('/?test')+ const canvas = new CanvasHelper(page)+ await canvas.waitForInit()+ await page.getByTestId('app-settings-trigger').click()+ const appearance = page.getByRole('region', { name: 'Appearance', exact: true })+ await expect(appearance.getByRole('combobox', { name: 'Animations', exact: true })).toBeVisible()+ const theme = appearance.getByRole('combobox', { name: 'Theme', exact: true })+ await theme.click()+ await page.getByRole('option', { name: 'Light', exact: true }).click()+ await expect(page.locator('html')).toHaveAttribute('data-theme', 'light')+ await expect(page.locator('html')).toHaveAttribute('data-theme-setting', 'light')+ await page.reload()+ await canvas.waitForInit()+ await expect(page.locator('html')).toHaveAttribute('data-theme', 'light')+ await page.getByTestId('app-settings-trigger').click()+ await expect(theme).toHaveText('Light')+ await theme.click()+ await page.getByRole('option', { name: 'Dark', exact: true }).click()+ await expect(page.locator('html')).toHaveAttribute('data-theme', 'dark')+ await theme.click()+ await page.getByRole('option', { name: 'Auto', exact: true }).click()+ await expect(page.locator('html')).toHaveAttribute('data-theme-setting', 'auto')+ await page.emulateMedia({ colorScheme: 'light' })+ await expect(page.locator('html')).toHaveAttribute('data-theme', 'light')+ await page.emulateMedia({ colorScheme: 'dark' })+ await expect(page.locator('html')).toHaveAttribute('data-theme', 'dark')+})diff --git a/tests/engine/app/settings/mcp-tool-access.test.ts b/tests/engine/app/settings/mcp-tool-access.test.tsnew file mode 100644index 000000000..c703fbf47--- /dev/null+++ b/tests/engine/app/settings/mcp-tool-access.test.ts@@ -0,0 +1,71 @@+import { expect, test } from 'bun:test'++import { ref } from 'vue'++import type { ToolDescriptor } from '@open-pencil/mcp/tools'++import { useMCPToolAccess } from '@/app/automation/mcp/settings/tool-access'++function catalog() {+ return ref<ToolDescriptor[]>([+ {+ name: 'inspect_a',+ description: 'Inspect layers',+ effect: 'read',+ availability: 'default',+ capabilities: ['document:read'],+ enabled: true+ },+ {+ name: 'inspect_b',+ description: 'Inspect variables',+ effect: 'read',+ availability: 'default',+ capabilities: ['document:read'],+ enabled: true+ },+ {+ name: 'edit_a',+ description: 'Change a layer',+ effect: 'write',+ availability: 'default',+ capabilities: ['document:write'],+ enabled: true+ }+ ])+}++test('tool counts and mixed states follow the controlled model and catalog', () => {+ const tools = catalog()+ const disabled = ref(['inspect_a', 'unavailable_tool'])+ const access = useMCPToolAccess(tools, disabled)+ expect(access.enabledCount.value).toBe(2)+ expect(access.inspectionEnabled.value).toBe(true)+ expect(access.inspectionState.value).toBe('mixed')+ access.inspectionEnabled.value = false+ expect(disabled.value).toEqual(['inspect_a', 'unavailable_tool', 'inspect_b'])+ expect(access.enabledCount.value).toBe(1)+ expect(access.inspectionState.value).toBe('idle')+ access.inspectionEnabled.value = true+ expect(disabled.value).toEqual(['unavailable_tool'])+ access.setToolEnabled('edit_a', false)+ expect(access.modificationEnabled.value).toBe(false)+ disabled.value = []+ expect(access.enabledCount.value).toBe(3)+ tools.value = []+ expect(access.enabledCount.value).toBe(0)+ expect(access.inspectionEnabled.value).toBe(false)+})++test('search filters presentation without changing category membership or access', () => {+ const tools = catalog()+ const disabled = ref<string[]>([])+ const access = useMCPToolAccess(tools, disabled)+ access.search.value = ' VARIABLES '+ expect(access.visibleTools.value.map((tool) => tool.name)).toEqual(['inspect_b'])+ access.inspectionEnabled.value = false+ expect(disabled.value).toEqual(['inspect_a', 'inspect_b'])+ expect(access.enabledCount.value).toBe(1)+ access.search.value = 'no-match'+ expect(access.visibleTools.value).toEqual([])+})diff --git a/tests/engine/app/settings/mcp-workflow.test.ts b/tests/engine/app/settings/mcp-workflow.test.tsindex 612d164be..cfaf4644d 100644--- a/tests/engine/app/settings/mcp-workflow.test.ts+++ b/tests/engine/app/settings/mcp-workflow.test.ts@@ -2,7 +2,11 @@ import { beforeEach, afterEach, expect, test } from 'bun:test'import { effectScope, ref } from 'vue'-import { mcpConnectionSettings, type MCPConnection } from '@/app/integrations/mcp'+import {+ createMCPConnectionDraft,+ mcpConnectionSettings,+ type MCPConnection+} from '@/app/integrations/mcp'import { useMCPConnectionSettings } from '@/app/integrations/mcp/settings/use'const connection: MCPConnection = {@@ -22,7 +26,7 @@ afterEach(() => {mcpConnectionSettings.value.connections = previousConnections})-test('MCP credential clear disables its captured target without changing a new draft', async () => {+test('MCP save commits staged clearing without changing a new draft', async () => {const scope = effectScope()let finish: () => void = () => undefinedconst pending = new Promise<void>((resolve) => {@@ -32,25 +36,33 @@ test('MCP credential clear disables its captured target without changing a new dconst token = ref('')try {const state = scope.run(() =>- useMCPConnectionSettings(token, ref({ bearerTokenRequired: 'Required' }), {- status: async () => 'configured',- setCredential: async () => pending,- save: (draft) => {- saved.push(draft.enabled)- return connection- },- remove: async () => undefined- })+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ token,+ ref({ bearerTokenRequired: 'Required' }),+ {+ status: async () => 'configured',+ setCredential: async () => pending,+ save: (draft) => {+ saved.push(draft.enabled)+ return connection+ },+ remove: async () => undefined+ }+ ))if (!state) throw new Error('Missing scope')state.draft.value.id = connection.id- const clearing = state.clearCredential()+ state.clearCredential()+ expect(saved).toEqual([])+ const clearing = state.save()state.startAdd()state.draft.value.enabled = truetoken.value = 'new-key'finish()await clearing- expect(saved).toEqual([false])+ expect(saved).toEqual([false, false])+ expect(state.credentialCleared.value).toBe(false)expect(state.draft.value.enabled).toBe(true)expect(token.value).toBe('new-key')} finally {@@ -68,15 +80,20 @@ test('MCP edit ignores credential status after another draft opens', async () =>})try {const state = scope.run(() =>- useMCPConnectionSettings(ref(''), ref({ bearerTokenRequired: 'Required' }), {- status: async () => {- await pending- return 'configured'- },- setCredential: async () => undefined,- save: () => connection,- remove: async () => undefined- })+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ ref(''),+ ref({ bearerTokenRequired: 'Required' }),+ {+ status: async () => {+ await pending+ return 'configured'+ },+ setCredential: async () => undefined,+ save: () => connection,+ remove: async () => undefined+ }+ ))if (!state) throw new Error('Missing scope')const editing = state.startEdit(connection.id)@@ -90,27 +107,37 @@ test('MCP edit ignores credential status after another draft opens', async () =>}})-test('MCP save and clear failures preserve token input', async () => {+test('MCP failed writes preserve replacements and staged removals', async () => {const scope = effectScope()const token = ref('replacement')try {const state = scope.run(() =>- useMCPConnectionSettings(token, ref({ bearerTokenRequired: 'Required' }), {- status: async () => 'configured',- setCredential: async () => {- throw new Error('Offline')- },- save: () => connection,- remove: async () => undefined- })+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ token,+ ref({ bearerTokenRequired: 'Required' }),+ {+ status: async () => 'configured',+ setCredential: async () => {+ throw new Error('Offline')+ },+ save: () => connection,+ remove: async () => undefined+ }+ ))if (!state) throw new Error('Missing scope')state.draft.value.id = connection.idexpect(await state.save()).toBe(false)expect(state.error.value).toBe('Offline')- await state.clearCredential()- expect(state.error.value).toBe('Offline')expect(token.value).toBe('replacement')+ state.clearCredential()+ expect(state.error.value).toBe('')+ expect(token.value).toBe('')+ expect(state.credentialCleared.value).toBe(true)+ expect(await state.save()).toBe(false)+ expect(state.error.value).toBe('Offline')+ expect(state.credentialCleared.value).toBe(true)} finally {scope.stop()}@@ -121,17 +148,22 @@ test('failed bearer write never enables the saved connection', async () => {const saved: boolean[] = []try {const state = scope.run(() =>- useMCPConnectionSettings(ref('token'), ref({ bearerTokenRequired: 'Required' }), {- status: async () => 'configured',- setCredential: async () => {- throw new Error('Write failed')- },- save: (draft) => {- saved.push(draft.enabled)- return connection- },- remove: async () => undefined- })+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ ref('token'),+ ref({ bearerTokenRequired: 'Required' }),+ {+ status: async () => 'configured',+ setCredential: async () => {+ throw new Error('Write failed')+ },+ save: (draft) => {+ saved.push(draft.enabled)+ return connection+ },+ remove: async () => undefined+ }+ ))if (!state) throw new Error('Missing scope')state.draft.value.authenticationType = 'bearer'@@ -143,28 +175,37 @@ test('failed bearer write never enables the saved connection', async () => {}})-test('clear uses persisted fields rather than invalid unsaved input', async () => {+test('clear never persists unsaved fields and cancel discards removal', async () => {const scope = effectScope()const names: string[] = []try {const state = scope.run(() =>- useMCPConnectionSettings(ref(''), ref({ bearerTokenRequired: 'Required' }), {- status: async () => 'configured',- setCredential: async () => undefined,- save: (draft) => {- names.push(draft.name)- expect(draft.url).toBe(connection.transport.url)- return connection- },- remove: async () => undefined- })+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ ref(''),+ ref({ bearerTokenRequired: 'Required' }),+ {+ status: async () => 'configured',+ setCredential: async () => undefined,+ save: (draft) => {+ names.push(draft.name)+ expect(draft.url).toBe(connection.transport.url)+ return connection+ },+ remove: async () => undefined+ }+ ))if (!state) throw new Error('Missing scope')state.draft.value.id = connection.idstate.draft.value.name = ''state.draft.value.url = 'invalid'- await state.clearCredential()- expect(names).toEqual(['Test'])+ state.clearCredential()+ expect(names).toEqual([])+ expect(state.draft.value.url).toBe('invalid')+ expect(state.credentialCleared.value).toBe(true)+ state.cancel()+ expect(state.credentialCleared.value).toBe(false)} finally {scope.stop()}@@ -174,14 +215,19 @@ test('status lookup failure opens the editor with an error', async () => {const scope = effectScope()try {const state = scope.run(() =>- useMCPConnectionSettings(ref(''), ref({ bearerTokenRequired: 'Required' }), {- status: async () => {- throw new Error('Locked')- },- setCredential: async () => undefined,- save: () => connection,- remove: async () => undefined- })+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ ref(''),+ ref({ bearerTokenRequired: 'Required' }),+ {+ status: async () => {+ throw new Error('Locked')+ },+ setCredential: async () => undefined,+ save: () => connection,+ remove: async () => undefined+ }+ ))if (!state) throw new Error('Missing scope')expect(await state.startEdit(connection.id)).toBe(true)@@ -201,15 +247,20 @@ test('serializes overlapping credential replacements', async () => {const token = ref('first')try {const state = scope.run(() =>- useMCPConnectionSettings(token, ref({ bearerTokenRequired: 'Required' }), {- status: async () => 'configured',- setCredential: async (_id, value) => {- writes.push(value)- if (value === 'first') await blocked- },- save: () => connection,- remove: async () => undefined- })+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ token,+ ref({ bearerTokenRequired: 'Required' }),+ {+ status: async () => 'configured',+ setCredential: async (_id, value) => {+ writes.push(value)+ if (value === 'first') await blocked+ },+ save: () => connection,+ remove: async () => undefined+ }+ ))if (!state) throw new Error('Missing scope')state.draft.value.id = connection.id@@ -251,13 +302,28 @@ test('reopened editors serialize writes to the same connection while other conne}try {const first = firstScope.run(() =>- useMCPConnectionSettings(ref('first'), ref({ bearerTokenRequired: 'Required' }), services)+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ ref('first'),+ ref({ bearerTokenRequired: 'Required' }),+ services+ ))const second = secondScope.run(() =>- useMCPConnectionSettings(ref('second'), ref({ bearerTokenRequired: 'Required' }), services)+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ ref('second'),+ ref({ bearerTokenRequired: 'Required' }),+ services+ ))const other = secondScope.run(() =>- useMCPConnectionSettings(ref('other'), ref({ bearerTokenRequired: 'Required' }), services)+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ ref('other'),+ ref({ bearerTokenRequired: 'Required' }),+ services+ ))if (!first || !second || !other) throw new Error('Missing scope')for (const editor of [first, second, other]) {@@ -298,23 +364,73 @@ test('blank-token save rechecks status after a different editor clears the crede}try {const first = scope.run(() =>- useMCPConnectionSettings(ref(''), ref({ bearerTokenRequired: 'Required' }), services)+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ ref(''),+ ref({ bearerTokenRequired: 'Required' }),+ services+ ))const second = scope.run(() =>- useMCPConnectionSettings(ref(''), ref({ bearerTokenRequired: 'Required' }), services)+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ ref(''),+ ref({ bearerTokenRequired: 'Required' }),+ services+ ))if (!first || !second) throw new Error('Missing scope')await first.startEdit(connection.id)await second.startEdit(connection.id)second.draft.value.authenticationType = 'bearer'second.draft.value.enabled = true- const clearing = first.clearCredential()+ first.clearCredential()+ expect(configured).toBe(true)+ const clearing = first.save()const saving = second.save()await clearingexpect(await saving).toBe(false)expect(second.error.value).toBe('Required')- expect(enabled).toEqual([false, false])+ expect(enabled).toEqual([false, false, false])+ } finally {+ scope.stop()+ }+})++test('cancel clears secrets and ignores a pending credential lookup', async () => {+ const scope = effectScope()+ const token = ref('')+ const lookup = Promise.withResolvers<'configured'>()+ try {+ const state = scope.run(() =>+ useMCPConnectionSettings(+ ref(createMCPConnectionDraft()),+ token,+ ref({ bearerTokenRequired: 'Required' }),+ {+ status: () => lookup.promise,+ save: () => connection,+ setCredential: async () => undefined,+ remove: async () => undefined+ }+ )+ )+ if (!state) throw new Error('Missing scope')+ const editing = state.startEdit(connection.id)+ expect(state.busy.value).toBe(true)+ token.value = 'discard-me'+ state.cancel()+ expect(token.value).toBe('')+ expect(state.draft.value.id).toBeNull()+ lookup.resolve('configured')+ expect(await editing).toBe(false)+ expect(state.busy.value).toBe(false)+ expect(state.tokenStatus.value).toBe('missing')+ token.value = 'discard-on-close'+ scope.stop()+ expect(token.value).toBe('')} finally {+ lookup.resolve('configured')scope.stop()}})diff --git a/tests/engine/app/settings/model-schema.test.ts b/tests/engine/app/settings/model-schema.test.tsnew file mode 100644index 000000000..833a532c9--- /dev/null+++ b/tests/engine/app/settings/model-schema.test.ts@@ -0,0 +1,57 @@+import { expect, test } from 'bun:test'++import * as v from 'valibot'++import {+ modelProfileSchema,+ type ModelProfileValidationContext+} from '@/app/ai/models/settings/profile-editor/schema'++const messages = {+ requiredField: 'Required',+ invalidURL: 'Invalid URL',+ designToolsRequired: 'Tools required'+}+const context: ModelProfileValidationContext = {+ customModel: false,+ providerKind: 'api',+ supportsCustomBaseURL: false,+ design: true,+ intent: 'save'+}+const values = {+ name: 'Design',+ modelID: 'known-model',+ customModelID: '',+ baseURL: '',+ credential: false,+ tools: true+}++function errors(options: Partial<ModelProfileValidationContext>, input = values) {+ const result = v.safeParse(modelProfileSchema({ ...context, ...options }, messages), input)+ return result.success ? {} : v.flatten(result.issues).nested+}++test('model requirements attach to the active field without fallback to an inactive model ID', () => {+ expect(errors({}, { ...values, modelID: '' })).toEqual({ modelID: ['Required'] })+ expect(errors({ customModel: true })).toEqual({ customModelID: ['Required'] })+ expect(+ errors({ customModel: true }, { ...values, modelID: '', customModelID: 'custom' })+ ).toEqual({})+})++test('tool support errors are forwarded by the schema to the active model field', () => {+ expect(errors({}, { ...values, tools: false })).toEqual({ modelID: ['Tools required'] })+ expect(+ errors({ customModel: true }, { ...values, customModelID: 'custom', tools: false })+ ).toEqual({ customModelID: ['Tools required'] })+ expect(errors({ design: false }, { ...values, tools: false })).toEqual({})+})++test('independent field errors survive a failed tool-support rule', () => {+ expect(errors({}, { ...values, name: '', tools: false })).toEqual({+ name: ['Required'],+ modelID: ['Tools required']+ })+})diff --git a/tests/engine/app/settings/navigation.test.ts b/tests/engine/app/settings/navigation.test.tsnew file mode 100644index 000000000..595a6372f--- /dev/null+++ b/tests/engine/app/settings/navigation.test.ts@@ -0,0 +1,75 @@+import { expect, test } from 'bun:test'++import { ref } from 'vue'++import { createSettingsNavigation } from '@/app/settings/navigation/use'++test('pristine editors can leave; dirty editors ask before navigation', () => {+ const navigation = createSettingsNavigation()+ const dirty = ref(false)+ const busy = ref(false)+ let cancelled = 0+ let navigated = 0+ const form = {+ dirty,+ busy,+ cancel: () => {+ cancelled+++ }+ }+ navigation.register(form)+ navigation.request(() => {+ navigated+++ })+ expect([cancelled, navigated]).toEqual([1, 1])+ dirty.value = true+ navigation.register(form)+ navigation.request(() => {+ navigated+++ })+ expect(navigation.confirming.value).toBe(true)+ navigation.keepEditing()+ expect(navigation.editing.value).toBe(true)+ expect([cancelled, navigated]).toEqual([1, 1])+ navigation.request(() => {+ navigated+++ })+ navigation.discard()+ expect([cancelled, navigated]).toEqual([2, 2])+ expect(navigation.confirming.value).toBe(false)+ expect(navigation.editing.value).toBe(false)+})++test('busy and replaced editors cannot be discarded by stale requests', () => {+ const navigation = createSettingsNavigation()+ const busy = ref(true)+ let cancelled = false+ let navigated = false+ const unregister = navigation.register({+ dirty: ref(true),+ busy,+ cancel: () => {+ cancelled = true+ }+ })+ navigation.request(() => {+ navigated = true+ })+ expect(navigation.confirming.value).toBe(false)+ busy.value = false+ navigation.request(() => {+ navigated = true+ })+ unregister()+ navigation.register({+ dirty: ref(true),+ busy: ref(false),+ cancel: () => {+ cancelled = true+ }+ })+ navigation.discard()+ expect(cancelled).toBe(false)+ expect(navigated).toBe(false)+ expect(navigation.editing.value).toBe(true)+})diff --git a/tests/engine/app/settings/storage-workflow.test.ts b/tests/engine/app/settings/storage-workflow.test.tsnew file mode 100644index 000000000..0b1965a4e--- /dev/null+++ b/tests/engine/app/settings/storage-workflow.test.ts@@ -0,0 +1,111 @@+import { expect, test } from 'bun:test'++import { effectScope, ref } from 'vue'++import { useStorageSettings } from '@/app/integrations/storage/settings/use'+import type { CredentialManager } from '@/app/settings/credentials/types'++function fixture() {+ const preferences = ref<Record<string, string>>({+ endpoint: 'https://old.example.com',+ bucket: 'designs',+ region: 'auto'+ })+ const writes: string[] = []+ const tests: Record<string, string>[] = []+ const manager: CredentialManager = {+ backend: 'memory',+ availability: async () => 'available',+ status: async () => 'configured',+ set: async (reference) => {+ writes.push(`set:${reference.field}`)+ },+ clear: async (reference) => {+ writes.push(`clear:${reference.field}`)+ }+ }+ return {+ preferences,+ writes,+ tests,+ services: {+ readPreferences: () => ({ ...preferences.value }),+ writePreference: (_provider: string, field: string, value: string) => {+ preferences.value = { ...preferences.value, [field]: value }+ writes.push(`preference:${field}`)+ },+ statuses: async () => ({+ 'access-key-id': 'configured' as const,+ 'secret-access-key': 'configured' as const+ }),+ manager,+ test: async (_provider: string, values: Record<string, string>) => {+ tests.push(values)+ return { ok: true, message: 'Connected' }+ },+ resume: async () => undefined+ }+ }+}++test('testing storage drafts and cancelling never persist settings', async () => {+ const f = fixture()+ const scope = effectScope()+ const credentials = ref<Record<string, string>>({})+ try {+ const state = scope.run(() => useStorageSettings(credentials, f.services))+ if (!state) throw new Error('Missing scope')+ state.preferenceDrafts.value.endpoint = 'https://draft.example.com'+ credentials.value['secret-access-key'] = 'test-only-draft'+ expect(state.dirty.value).toBe(true)+ expect(await state.testConnection()).toEqual({ ok: true, message: 'Connected' })+ expect(f.tests[0]?.endpoint).toBe('https://draft.example.com')+ expect(f.writes).toEqual([])+ expect(f.preferences.value.endpoint).toBe('https://old.example.com')+ state.cancel()+ expect(state.dirty.value).toBe(false)+ expect(credentials.value).toEqual({})+ expect(state.preferenceDrafts.value.endpoint).toBe('https://old.example.com')+ } finally {+ scope.stop()+ }+})++test('credential clearing is staged until Save', async () => {+ const f = fixture()+ const scope = effectScope()+ try {+ const state = scope.run(() => useStorageSettings(ref({}), f.services))+ if (!state) throw new Error('Missing scope')+ state.clearCredential('secret-access-key')+ expect(f.writes).toEqual([])+ expect(state.dirty.value).toBe(true)+ expect(await state.save()).toBe(true)+ expect(f.writes).toContain('clear:secret-access-key')+ expect(state.dirty.value).toBe(false)+ } finally {+ scope.stop()+ }+})++test('failed storage saves retain replacement drafts and expose the failure', async () => {+ const f = fixture()+ f.services.manager.set = async () => {+ throw new Error('Credential store locked')+ }+ const scope = effectScope()+ const credentials = ref<Record<string, string>>({})+ try {+ const state = scope.run(() => useStorageSettings(credentials, f.services))+ if (!state) throw new Error('Missing scope')+ credentials.value['secret-access-key'] = 'test-only-replacement'+ expect(await state.save()).toBe(false)+ expect(state.error.value).toBe('Credential store locked')+ expect(state.busy.value).toBe(false)+ expect(credentials.value['secret-access-key']).toBe('test-only-replacement')+ scope.stop()+ expect(credentials.value).toEqual({})+ } finally {+ scope.stop()+ }+})diff --git a/tests/engine/app/settings/validation.test.ts b/tests/engine/app/settings/validation.test.tsnew file mode 100644index 000000000..d70656251--- /dev/null+++ b/tests/engine/app/settings/validation.test.ts@@ -0,0 +1,43 @@+import { expect, test } from 'bun:test'++import * as v from 'valibot'++import {+ requiredSetting,+ requiredSettingsURL,+ validSettingsURL+} from '@/app/settings/validation/schema'++test('settings URL validation accepts HTTP(S) endpoints but never embedded credentials', () => {+ for (const value of [+ 'https://example.com/v1',+ 'http://localhost:11434/v1',+ 'http://127.0.0.1:9000'+ ]) {+ expect(validSettingsURL(value)).toBe(true)+ }+ for (const value of [+ '',+ 'example.com',+ 'file:///tmp/config',+ // eslint-disable-next-line no-script-url -- Rejection fixture; this URL is never executed.+ 'javascript:alert(1)',+ 'https://user:[email protected]',+ 'https://[email protected]'+ ]) {+ expect(validSettingsURL(value)).toBe(false)+ }+})++test('required fields and URL failures use supplied translated messages', () => {+ const messages = { requiredField: 'Это поле обязательно.', invalidURL: 'Неверный адрес.' }+ const required = v.safeParse(requiredSetting(messages.requiredField), ' ')+ expect(required.success).toBe(false)+ if (!required.success) expect(required.issues[0]?.message).toBe(messages.requiredField)+ const invalid = v.safeParse(requiredSettingsURL(messages), 'ftp://example.com')+ expect(invalid.success).toBe(false)+ if (!invalid.success) expect(invalid.issues[0]?.message).toBe(messages.invalidURL)+ expect(v.parse(requiredSettingsURL(messages), ' https://example.com/v1 ')).toBe(+ 'https://example.com/v1'+ )+})diff --git a/tests/engine/app/settings/vectorize-workflow.test.ts b/tests/engine/app/settings/vectorize-workflow.test.tsindex ba5982de6..c837244cf 100644--- a/tests/engine/app/settings/vectorize-workflow.test.ts+++ b/tests/engine/app/settings/vectorize-workflow.test.ts@@ -21,7 +21,7 @@ test('vectorization save cannot clear a different provider draft', async () => {const key = ref('')try {const state = scope.run(() =>- useVectorizeSettings(key, {+ useVectorizeSettings(key, vectorizeProviderID, {status: async () => 'missing',set: async () => pending.promise})@@ -46,7 +46,7 @@ test('vectorization save and clear failures preserve the draft and expose errorsconst key = ref('')try {const state = scope.run(() =>- useVectorizeSettings(key, {+ useVectorizeSettings(key, vectorizeProviderID, {status: async () => 'configured',set: async () => {throw new Error('Credential store unavailable')diff --git a/tests/engine/mcp/webmcp-settings.test.ts b/tests/engine/mcp/webmcp-settings.test.tsnew file mode 100644index 000000000..79c8a6538--- /dev/null+++ b/tests/engine/mcp/webmcp-settings.test.ts@@ -0,0 +1,113 @@+import { describe, expect, test } from 'bun:test'++import { ref } from 'vue'+import type { WebMCP } from 'webmcp-types'++import { getWebMCPTools, resolveWebMCPMode, type WebMCPMode } from '@/app/automation/webmcp/policy'+import { createWebMCPRuntimeService } from '@/app/automation/webmcp/service'++function createHost() {+ const tools = new Map<string, WebMCP.ModelContextTool>()+ return {+ tools,+ async registerTool(+ tool: WebMCP.ModelContextTool,+ options?: WebMCP.ModelContextRegisterToolOptions+ ) {+ if (tools.has(tool.name)) throw new Error('Duplicate tool')+ tools.set(tool.name, tool)+ options?.signal?.addEventListener('abort', () => tools.delete(tool.name), { once: true })+ }+ }+}++async function ready(service: ReturnType<typeof createWebMCPRuntimeService>) {+ for (let attempt = 0; attempt < 1000 && service.state.status === 'starting'; attempt++) {+ await Promise.resolve()+ }+ expect(service.state.status).toBe('ready')+}++describe('WebMCP access preferences', () => {+ test('unrecognized stored access fails closed', () => {+ for (const value of [undefined, null, true, {}, 'all', 'EDIT']) {+ expect(resolveWebMCPMode(value)).toBe('off')+ }+ for (const mode of ['off', 'inspect', 'edit']) expect(resolveWebMCPMode(mode)).toBe(mode)+ expect(getWebMCPTools('off')).toEqual([])+ expect(getWebMCPTools('inspect').length).toBeGreaterThan(0)+ expect(getWebMCPTools('inspect').every((tool) => !tool.mutates)).toBe(true)+ expect(getWebMCPTools('edit').some((tool) => tool.mutates)).toBe(true)+ expect(getWebMCPTools('edit').every((tool) => tool.exposure.webmcp)).toBe(true)+ })++ test('reconfigures access and revokes retained callbacks immediately', async () => {+ const context = createHost()+ const service = createWebMCPRuntimeService()+ const mode = ref<WebMCPMode>('off')+ let executions = 0+ const stop = service.start(context, mode, () => ({ execute: async () => ++executions }))+ try {+ expect(service.state.status).toBe('off')+ expect(context.tools.size).toBe(0)+ mode.value = 'edit'+ await ready(service)+ const retained = context.tools.get('set_fill')+ if (!retained) throw new Error('Missing editing tool')+ mode.value = 'inspect'+ await expect(retained.execute({ id: 'node', color: '#ffffff' })).rejects.toThrow()+ expect(executions).toBe(0)+ await ready(service)+ expect(context.tools.size).toBe(getWebMCPTools('inspect').length)+ expect(service.state.toolCount).toBe(context.tools.size)+ expect(context.tools.has('set_fill')).toBe(false)+ mode.value = 'off'+ expect(context.tools.size).toBe(0)+ expect(service.state.status).toBe('off')+ } finally {+ stop()+ }+ })++ test('serializes interrupted registrations and stops watching on disposal', async () => {+ const context = createHost()+ const mode = ref<WebMCPMode>('edit')+ const service = createWebMCPRuntimeService()+ const stop = service.start(context, mode, () => ({ execute: async () => null }))+ await Promise.resolve()+ mode.value = 'inspect'+ mode.value = 'off'+ mode.value = 'edit'+ await ready(service)+ expect(context.tools.size).toBe(getWebMCPTools('edit').length)+ stop()+ mode.value = 'inspect'+ await Promise.resolve()+ expect(context.tools.size).toBe(0)+ expect(service.state.status).toBe('off')+ })++ test('reports unsupported browsers and registration errors', async () => {+ const service = createWebMCPRuntimeService()+ const mode = ref<WebMCPMode>('inspect')+ service.start(undefined, mode, () => ({ execute: async () => null }))+ expect(service.state.status).toBe('unsupported')+ service.start(+ {+ registerTool: async () => {+ throw new Error('Permission denied')+ }+ },+ mode,+ () => ({ execute: async () => null })+ )+ for (let attempt = 0; attempt < 100 && service.state.status === 'starting'; attempt++)+ await Promise.resolve()+ expect(service.state).toMatchObject({+ status: 'error',+ toolCount: 0,+ error: 'Permission denied'+ })+ service.stop()+ })+})diff --git a/tests/engine/mcp/webmcp.test.ts b/tests/engine/mcp/webmcp.test.tsindex e388e9eaf..54b660436 100644--- a/tests/engine/mcp/webmcp.test.ts+++ b/tests/engine/mcp/webmcp.test.ts@@ -28,16 +28,20 @@ const options = () => ({ signal: new AbortController().signal })describe('WebMCP registration', () => {test('unsupported browsers do nothing', async () => {- const registration = registerWebMCPTools(undefined, () => {- throw new Error('Must not resolve an editor')- })+ const registration = registerWebMCPTools(+ undefined,+ () => {+ throw new Error('Must not resolve an editor')+ },+ 'edit'+ )await registration.readyregistration.dispose()})test('registers only reviewed tools and unregisters on disposal', async () => {const context = host()- const registration = registerWebMCPTools(context, () => ({ execute: async () => ({}) }))+ const registration = registerWebMCPTools(context, () => ({ execute: async () => ({}) }), 'edit')await registration.readyexpect(context.tools.has('get_node')).toBe(true)for (const name of [@@ -64,16 +68,20 @@ describe('WebMCP registration', () => {const context = host()let active = 'first'let calls = 0- const registration = registerWebMCPTools(context, () => {- const captured = active- return {- execute: async () => {- calls++- await Promise.resolve()- return { document: captured }+ const registration = registerWebMCPTools(+ context,+ () => {+ const captured = active+ return {+ execute: async () => {+ calls+++ await Promise.resolve()+ return { document: captured }+ }}- }- })+ },+ 'edit'+ )await registration.readytry {const tool = requiredTool(context.tools, 'get_node')@@ -90,9 +98,13 @@ describe('WebMCP registration', () => {test('rejects cancelled calls and excessive results', async () => {const context = host()- const registration = registerWebMCPTools(context, () => ({- execute: async () => 'x'.repeat(300_000)- }))+ const registration = registerWebMCPTools(+ context,+ () => ({+ execute: async () => 'x'.repeat(300_000)+ }),+ 'edit'+ )await registration.readytry {const tool = requiredTool(context.tools, 'get_node')@@ -108,12 +120,16 @@ describe('WebMCP registration', () => {test('reports committed edits even when their result exceeds the size limit', async () => {const context = host()let content = ''- const registration = registerWebMCPTools(context, () => ({- execute: async (_def, args) => {- content = String(args.text)- return { id: args.id, text: content }- }- }))+ const registration = registerWebMCPTools(+ context,+ () => ({+ execute: async (_def, args) => {+ content = String(args.text)+ return { id: args.id, text: content }+ }+ }),+ 'edit'+ )await registration.readytry {const text = 'x'.repeat(300_000)@@ -143,7 +159,8 @@ describe('WebMCP registration', () => {await context.registerTool(tool, options)}},- () => ({ execute: async () => ({}) })+ () => ({ execute: async () => ({}) }),+ 'edit')await expect(registration.ready).rejects.toThrow('Registration denied')expect(context.tools.size).toBe(0)diff --git a/tools/i18n/mixed-script-baseline.txt b/tools/i18n/mixed-script-baseline.txtindex 4e2e76341..09c19c04d 100644--- a/tools/i18n/mixed-script-baseline.txt+++ b/tools/i18n/mixed-script-baseline.txt@@ -22,12 +22,18 @@ ja:ai.modelIDPlaceholderja:ai.modelRoleDesignDescriptionja:ai.providerja:ai.reasoningEffortPlaceholder+ja:automation.webmcpDescription+ja:automation.webmcpSetup+ja:automation.webmcpUnsupportedja:automation.addServerConnectionja:automation.authenticationDescriptionja:automation.bearerAuthenticationja:automation.bearerTokenja:automation.bearerTokenPlaceholderja:automation.bearerTokenRequired+ja:automation.connectionNameHint+ja:automation.connectionNameInvalid+ja:automation.serverURLHintja:automation.connectionEditorDescriptionja:automation.connectionsja:automation.connectionsDescription@@ -96,6 +102,9 @@ ja:recovery.dialogDescriptionja:rendering.reloadRequiredja:rendering.settingsDescriptionja:rendering.urlOverride+ja:settings.invalidURL+ja:settings.modelIDHint+ja:settings.baseURLHintja:settings.aiAndAgentsja:settings.automationja:settings.temporaryDisableSnappingHint@@ -132,12 +141,18 @@ zh-cn:ai.modelIDPlaceholderzh-cn:ai.modelRoleDesignDescriptionzh-cn:ai.providerzh-cn:ai.reasoningEffortPlaceholder+zh-cn:automation.webmcpDescription+zh-cn:automation.webmcpSetup+zh-cn:automation.webmcpUnsupportedzh-cn:automation.addServerConnectionzh-cn:automation.authenticationDescriptionzh-cn:automation.bearerAuthenticationzh-cn:automation.bearerTokenzh-cn:automation.bearerTokenPlaceholderzh-cn:automation.bearerTokenRequired+zh-cn:automation.connectionNameHint+zh-cn:automation.connectionNameInvalid+zh-cn:automation.serverURLHintzh-cn:automation.connectionEditorDescriptionzh-cn:automation.connectionszh-cn:automation.connectionsDescription@@ -204,6 +219,8 @@ zh-cn:recovery.dialogDescriptionzh-cn:rendering.reloadRequiredzh-cn:rendering.settingsDescriptionzh-cn:rendering.urlOverride+zh-cn:settings.invalidURL+zh-cn:settings.baseURLHintzh-cn:settings.aiAndAgentszh-cn:settings.automationzh-cn:settings.temporaryDisableSnappingHint