From ce6761449631d488a263bad82d3ef65aba78429c Mon Sep 17 00:00:00 2001
From: BitSempre <26889439+BitSempre@users.noreply.github.com>
Date: Wed, 2 Dec 2026 18:59:33 +0000
Subject: [PATCH] Add Mosaic Add-on Studio: development, validation, and review
environment for Mosaic Companion extensions
Adds the Mosaic Add-on Studio as an add-on under addons/mosaic-addon-studio/.
- Checks add-ons against the official add-on surface
(scripts/adjudicate/addon-surface.json, pinned at cf3f5f7 and vendored
with provenance and an integrity check) instead of a hand-copied
description of the app. The renderable icon set now matches the app's:
32 names, including Eth.
- Capability scanner: reads comments, strings, templates and regex literals
correctly, runs in linear time, and reports code it cannot read instead of
skipping it.
- One generator for starter projects and licence texts, shared by the
in-Mosaic host and the validator.
- Manifest rules: strict SemVer, buckets:publish requires a publishes list,
input and homepage validation.
- Host fixes (appVersion, validateProject contract, jail path normalisation)
with regression tests.
- Tests: 221 in this directory, all passing, none skipped. Tests that need
the Studio development repository stay in that repository (273 there, all
passing).
Signed-off-by: BitSempre <26889439+BitSempre@users.noreply.github.com>
---
addons/mosaic-addon-studio/LICENSE | 21 +
addons/mosaic-addon-studio/NOTICE | 19 +
addons/mosaic-addon-studio/index.html | 13 +
addons/mosaic-addon-studio/manifest.json | 36 +
addons/mosaic-addon-studio/package-lock.json | 2487 +++++++++++++++++
addons/mosaic-addon-studio/package.json | 27 +
addons/mosaic-addon-studio/public/favicon.svg | 1 +
addons/mosaic-addon-studio/public/icons.svg | 24 +
.../shared/addon-surface.json | 321 +++
.../shared/addon-surface.provenance.json | 24 +
.../shared/capability-rules.mjs | 1178 ++++++++
.../shared/license-texts.mjs | 56 +
.../shared/manifest-rules.mjs | 346 +++
.../shared/mosaic-schema.mjs | 555 ++++
.../shared/starter-project.mjs | 282 ++
addons/mosaic-addon-studio/src/App.css | 1758 ++++++++++++
addons/mosaic-addon-studio/src/App.jsx | 845 ++++++
.../mosaic-addon-studio/src/assets/hero.png | Bin 0 -> 13057 bytes
.../mosaic-addon-studio/src/assets/react.svg | 1 +
.../mosaic-addon-studio/src/assets/vite.svg | 1 +
addons/mosaic-addon-studio/src/host.js | 300 ++
addons/mosaic-addon-studio/src/index.css | 40 +
addons/mosaic-addon-studio/src/main.jsx | 10 +
.../test/addon-surface.test.mjs | 940 +++++++
.../test/host-fixes.test.mjs | 294 ++
.../test/mutation-coverage.test.mjs | 182 ++
.../test/review-fixes.test.mjs | 288 ++
.../test/round3-fixes.test.mjs | 302 ++
.../test/scanner-and-generator.test.mjs | 100 +
addons/mosaic-addon-studio/vite.config.js | 28 +
30 files changed, 10479 insertions(+)
create mode 100644 addons/mosaic-addon-studio/LICENSE
create mode 100644 addons/mosaic-addon-studio/NOTICE
create mode 100644 addons/mosaic-addon-studio/index.html
create mode 100644 addons/mosaic-addon-studio/manifest.json
create mode 100644 addons/mosaic-addon-studio/package-lock.json
create mode 100644 addons/mosaic-addon-studio/package.json
create mode 100644 addons/mosaic-addon-studio/public/favicon.svg
create mode 100644 addons/mosaic-addon-studio/public/icons.svg
create mode 100644 addons/mosaic-addon-studio/shared/addon-surface.json
create mode 100644 addons/mosaic-addon-studio/shared/addon-surface.provenance.json
create mode 100644 addons/mosaic-addon-studio/shared/capability-rules.mjs
create mode 100644 addons/mosaic-addon-studio/shared/license-texts.mjs
create mode 100644 addons/mosaic-addon-studio/shared/manifest-rules.mjs
create mode 100644 addons/mosaic-addon-studio/shared/mosaic-schema.mjs
create mode 100644 addons/mosaic-addon-studio/shared/starter-project.mjs
create mode 100644 addons/mosaic-addon-studio/src/App.css
create mode 100644 addons/mosaic-addon-studio/src/App.jsx
create mode 100644 addons/mosaic-addon-studio/src/assets/hero.png
create mode 100644 addons/mosaic-addon-studio/src/assets/react.svg
create mode 100644 addons/mosaic-addon-studio/src/assets/vite.svg
create mode 100644 addons/mosaic-addon-studio/src/host.js
create mode 100644 addons/mosaic-addon-studio/src/index.css
create mode 100644 addons/mosaic-addon-studio/src/main.jsx
create mode 100644 addons/mosaic-addon-studio/test/addon-surface.test.mjs
create mode 100644 addons/mosaic-addon-studio/test/host-fixes.test.mjs
create mode 100644 addons/mosaic-addon-studio/test/mutation-coverage.test.mjs
create mode 100644 addons/mosaic-addon-studio/test/review-fixes.test.mjs
create mode 100644 addons/mosaic-addon-studio/test/round3-fixes.test.mjs
create mode 100644 addons/mosaic-addon-studio/test/scanner-and-generator.test.mjs
create mode 100644 addons/mosaic-addon-studio/vite.config.js
diff --git a/addons/mosaic-addon-studio/LICENSE b/addons/mosaic-addon-studio/LICENSE
new file mode 100644
index 0000000..d776e6d
--- /dev/null
+++ b/addons/mosaic-addon-studio/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 The Mosaic Add-on Studio authors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/addons/mosaic-addon-studio/NOTICE b/addons/mosaic-addon-studio/NOTICE
new file mode 100644
index 0000000..d970d13
--- /dev/null
+++ b/addons/mosaic-addon-studio/NOTICE
@@ -0,0 +1,19 @@
+Mosaic Add-on Studio
+Copyright 2026 The Mosaic Add-on Studio authors
+
+Licensed under the MIT License. See the LICENSE file alongside this notice.
+
+This add-on bundles the following third-party software:
+
+- React (MIT License) — https://react.dev
+- React DOM (MIT License) — https://react.dev
+- Lucide React (ISC License) — https://lucide.dev
+- semver (ISC License) — https://github.com/npm/node-semver
+
+The Mosaic application facts this add-on checks add-ons against are vendored
+from the official Mosaic add-on surface specification:
+`scripts/adjudicate/addon-surface.json` in `hypercycle-development/mosaic-open-platform`,
+at commit cf3f5f7bf957dc2e0f160077579f7c30b557cee7 (SHA-256
+748c5d28e25c43f8e1d59c94e2d60c3b5d063ee2fb139b7b4a8e49ee5b3ac31e). They are
+used to check an add-on against what the application actually implements.
+The upstream provenance is recorded in `shared/addon-surface.provenance.json`.
diff --git a/addons/mosaic-addon-studio/index.html b/addons/mosaic-addon-studio/index.html
new file mode 100644
index 0000000..a29d704
--- /dev/null
+++ b/addons/mosaic-addon-studio/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ Mosaic Add-on Studio
+
+
+
+
+
+
diff --git a/addons/mosaic-addon-studio/manifest.json b/addons/mosaic-addon-studio/manifest.json
new file mode 100644
index 0000000..6bf9f5a
--- /dev/null
+++ b/addons/mosaic-addon-studio/manifest.json
@@ -0,0 +1,36 @@
+{
+ "manifestVersion": 1,
+ "id": "mosaic-addon-studio",
+ "version": "0.1.0",
+ "name": "Mosaic Add-on Studio",
+ "description": "Author, validate and review Mosaic Companion add-ons from inside the app.",
+ "author": "BitSempre",
+ "homepage": "https://github.com/BitSempre/mosaic-addons",
+ "minAppVersion": "0.1.13",
+
+ "ipcNamespace": "mosaic-addon-studio",
+ "mountPoint": "tab",
+
+ "tab": {
+ "label": "Studio",
+ "icon": "Code2",
+ "order": 90
+ },
+
+ "renderer": {
+ "entry": "renderer/index.html"
+ },
+
+ "permissions": [],
+
+ "updates": {
+ "checkMode": "manual"
+ },
+
+ "linkVisibilityToActivation": true,
+
+ "buckets": {
+ "publishes": [],
+ "reads": []
+ }
+}
diff --git a/addons/mosaic-addon-studio/package-lock.json b/addons/mosaic-addon-studio/package-lock.json
new file mode 100644
index 0000000..7950e8f
--- /dev/null
+++ b/addons/mosaic-addon-studio/package-lock.json
@@ -0,0 +1,2487 @@
+{
+ "name": "mosaic-addon-studio",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "mosaic-addon-studio",
+ "version": "0.1.0",
+ "dependencies": {
+ "lucide-react": "^1.59.0",
+ "react": "^19.2.8",
+ "react-dom": "^19.2.8",
+ "semver": "^7.8.5"
+ },
+ "devDependencies": {
+ "@eslint/js": "^10.0.1",
+ "@vitejs/plugin-react": "^6.1.1",
+ "eslint": "^10.10.0",
+ "eslint-plugin-react-hooks": "^7.1.1",
+ "eslint-plugin-react-refresh": "^0.5.6",
+ "globals": "^17.12.0",
+ "vite": "^8.3.0"
+ }
+ },
+ "node_modules/@babel/code-frame": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",
+ "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-validator-identifier": "^7.29.7",
+ "js-tokens": "^4.0.0",
+ "picocolors": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/compat-data": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz",
+ "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/core": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz",
+ "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.7",
+ "@babel/generator": "^7.29.7",
+ "@babel/helper-compilation-targets": "^7.29.7",
+ "@babel/helper-module-transforms": "^7.29.7",
+ "@babel/helpers": "^7.29.7",
+ "@babel/parser": "^7.29.7",
+ "@babel/template": "^7.29.7",
+ "@babel/traverse": "^7.29.7",
+ "@babel/types": "^7.29.7",
+ "@jridgewell/remapping": "^2.3.5",
+ "convert-source-map": "^2.0.0",
+ "debug": "^4.1.0",
+ "gensync": "^1.0.0-beta.2",
+ "json5": "^2.2.3",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/babel"
+ }
+ },
+ "node_modules/@babel/core/node_modules/semver": {
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/@babel/generator": {
+ "version": "7.29.12",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.12.tgz",
+ "integrity": "sha512-2W76mhjrpQFO1lK5e8IvGYB2D0YZ7S2R1Z2BjO2ZUYuW+amcpK/z60U6ZZmzskwoa7sJ6XohP/Wg8H5KxXI/IA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.29.12",
+ "@babel/types": "^7.29.11",
+ "@jridgewell/gen-mapping": "^0.3.12",
+ "@jridgewell/trace-mapping": "^0.3.28",
+ "jsesc": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-compilation-targets": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz",
+ "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/compat-data": "^7.29.7",
+ "@babel/helper-validator-option": "^7.29.7",
+ "browserslist": "^4.24.0",
+ "lru-cache": "^5.1.1",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-compilation-targets/node_modules/semver": {
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/@babel/helper-globals": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz",
+ "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-imports": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz",
+ "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/traverse": "^7.29.7",
+ "@babel/types": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-transforms": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz",
+ "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-module-imports": "^7.29.7",
+ "@babel/helper-validator-identifier": "^7.29.7",
+ "@babel/traverse": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/helper-string-parser": {
+ "version": "7.29.11",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.11.tgz",
+ "integrity": "sha512-snZbO7MEDOof+hvNa97EjEY7qD7h2kwvQr5AJC3ZhQudKW5dnej6k3kP9NQV88hJwaS8vDqRLFo9rivLEhle2g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-identifier": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz",
+ "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-option": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz",
+ "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helpers": {
+ "version": "7.29.10",
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.10.tgz",
+ "integrity": "sha512-EMCx3AGZ3WfAl6ht7AyQoPm2Lh+BGYEMdc4Q6Hf7uSCDOZFuLq44qNwL+iaim8VlyYhRAo4X43+weadK8ZB4Yg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/template": "^7.29.7",
+ "@babel/types": "^7.29.8"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/parser": {
+ "version": "7.29.12",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.12.tgz",
+ "integrity": "sha512-WJ7JBp/Q4+z/ImydtI7jS6NVco5++632ExBemSX+Ysb+G1lCwQ5BVo3SY+jGGOcZXI4ZccbZSUSJLNBW6eEpJg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.29.11"
+ },
+ "bin": {
+ "parser": "bin/babel-parser.js"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@babel/template": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz",
+ "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.7",
+ "@babel/parser": "^7.29.7",
+ "@babel/types": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/traverse": {
+ "version": "7.29.12",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.12.tgz",
+ "integrity": "sha512-MscXe/NAZcOkYEsRajHZFt3ynsb22PUi6CTrp5U7+RYycR9By84mn9mFN54YgfITiqK4hFx3Ju3tZSyzfpS5ew==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.7",
+ "@babel/generator": "^7.29.12",
+ "@babel/helper-globals": "^7.29.7",
+ "@babel/parser": "^7.29.12",
+ "@babel/template": "^7.29.7",
+ "@babel/types": "^7.29.11",
+ "debug": "^4.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/types": {
+ "version": "7.29.11",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.11.tgz",
+ "integrity": "sha512-WCsemW40Cpc6gouC1SrY6PBaZ+oLRlEVY9XBvZBI7il/HyUrb2nJ505wE1MHEFyDZNnrWDEuy4jL50WVHfTTSQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-string-parser": "^7.29.11",
+ "@babel/helper-validator-identifier": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@cacheable/memory": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz",
+ "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@cacheable/utils": "^2.5.0",
+ "@keyv/bigmap": "^1.3.1",
+ "hookified": "^1.15.1",
+ "keyv": "^5.6.0"
+ }
+ },
+ "node_modules/@cacheable/utils": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz",
+ "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hashery": "^1.5.1",
+ "keyv": "^5.6.0"
+ }
+ },
+ "node_modules/@eslint-community/eslint-utils": {
+ "version": "4.10.1",
+ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz",
+ "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eslint-visitor-keys": "^3.4.3"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"
+ }
+ },
+ "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
+ "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/@eslint-community/regexpp": {
+ "version": "4.12.2",
+ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz",
+ "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.0.0 || ^14.0.0 || >=16.0.0"
+ }
+ },
+ "node_modules/@eslint/config-array": {
+ "version": "0.23.5",
+ "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz",
+ "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@eslint/object-schema": "^3.0.5",
+ "debug": "^4.3.1",
+ "minimatch": "^10.2.4"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ }
+ },
+ "node_modules/@eslint/config-helpers": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz",
+ "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@eslint/core": "^1.2.1"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ }
+ },
+ "node_modules/@eslint/core": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz",
+ "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@types/json-schema": "^7.0.15"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ }
+ },
+ "node_modules/@eslint/js": {
+ "version": "10.0.1",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz",
+ "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ },
+ "funding": {
+ "url": "https://eslint.org/donate"
+ },
+ "peerDependencies": {
+ "eslint": "^10.0.0"
+ },
+ "peerDependenciesMeta": {
+ "eslint": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@eslint/object-schema": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz",
+ "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ }
+ },
+ "node_modules/@eslint/plugin-kit": {
+ "version": "0.7.3",
+ "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz",
+ "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@eslint/core": "^1.2.1",
+ "levn": "^0.4.1"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ }
+ },
+ "node_modules/@humanfs/core": {
+ "version": "0.19.2",
+ "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
+ "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@humanfs/types": "^0.15.0"
+ },
+ "engines": {
+ "node": ">=18.18.0"
+ }
+ },
+ "node_modules/@humanfs/node": {
+ "version": "0.16.8",
+ "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz",
+ "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@humanfs/core": "^0.19.2",
+ "@humanfs/types": "^0.15.0",
+ "@humanwhocodes/retry": "^0.4.0"
+ },
+ "engines": {
+ "node": ">=18.18.0"
+ }
+ },
+ "node_modules/@humanfs/types": {
+ "version": "0.15.0",
+ "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz",
+ "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.18.0"
+ }
+ },
+ "node_modules/@humanwhocodes/module-importer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
+ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.22"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
+ }
+ },
+ "node_modules/@humanwhocodes/retry": {
+ "version": "0.4.3",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz",
+ "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.18"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
+ }
+ },
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.13",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/remapping": {
+ "version": "2.3.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
+ "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz",
+ "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@keyv/bigmap": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz",
+ "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hashery": "^1.4.0",
+ "hookified": "^1.15.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "peerDependencies": {
+ "keyv": "^5.6.0"
+ }
+ },
+ "node_modules/@keyv/serialize": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz",
+ "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@oxc-project/types": {
+ "version": "0.156.0",
+ "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz",
+ "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/oxc-project"
+ }
+ },
+ "node_modules/@rolldown/binding-android-arm-eabi": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.16.tgz",
+ "integrity": "sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-android-arm64": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.16.tgz",
+ "integrity": "sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-darwin-arm64": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.16.tgz",
+ "integrity": "sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-darwin-x64": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.16.tgz",
+ "integrity": "sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-freebsd-x64": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.16.tgz",
+ "integrity": "sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm-gnueabihf": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.16.tgz",
+ "integrity": "sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm64-gnu": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.16.tgz",
+ "integrity": "sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm64-musl": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.16.tgz",
+ "integrity": "sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-ppc64-gnu": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.16.tgz",
+ "integrity": "sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-s390x-gnu": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.16.tgz",
+ "integrity": "sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-x64-gnu": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.16.tgz",
+ "integrity": "sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-x64-musl": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.16.tgz",
+ "integrity": "sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-openharmony-arm64": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.16.tgz",
+ "integrity": "sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-win32-arm64-msvc": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.16.tgz",
+ "integrity": "sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-win32-x64-msvc": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.16.tgz",
+ "integrity": "sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/pluginutils": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",
+ "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/esrecurse": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz",
+ "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz",
+ "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/json-schema": {
+ "version": "7.0.15",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@vitejs/plugin-react": {
+ "version": "6.1.2",
+ "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.1.2.tgz",
+ "integrity": "sha512-fhJNGUdscQa4HkI0xFxwonWyhnVReCPDbXI7FH7jmzpnVCrFQI7PRrhWecO263610vOrs9tr2Y4xcf8uAdFxbw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@rolldown/pluginutils": "^1.0.1"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "peerDependencies": {
+ "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0",
+ "babel-plugin-react-compiler": "^1.0.0",
+ "oxc-transform-react": "^0.152.0",
+ "vite": "^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@rolldown/plugin-babel": {
+ "optional": true
+ },
+ "babel-plugin-react-compiler": {
+ "optional": true
+ },
+ "oxc-transform-react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/acorn": {
+ "version": "8.19.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz",
+ "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/acorn-jsx": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
+ "node_modules/ajv": {
+ "version": "6.15.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
+ "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/balanced-match": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
+ "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "18 || 20 || >=22"
+ }
+ },
+ "node_modules/baseline-browser-mapping": {
+ "version": "2.11.34",
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.34.tgz",
+ "integrity": "sha512-Aqr8mA1kIvyJ3UY5YAY7ib8LSo1DmDMbMnVqGPtsKW1LxaFQFwn9Eb3yvq2fUKJsRvaXjnAV7R5osqETapzNiA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "baseline-browser-mapping": "dist/cli.cjs"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/brace-expansion": {
+ "version": "5.0.12",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",
+ "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^4.0.2"
+ },
+ "engines": {
+ "node": "20 || >=22"
+ }
+ },
+ "node_modules/browserslist": {
+ "version": "4.29.5",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.5.tgz",
+ "integrity": "sha512-khTmKu5NGYTotqcYo8Bew2k4RAE9PuXRSFRXG2lQBrCEQHyeQ/vX6gKMxfokwywBsLiXZMnHsmWMG1pnO8J7uQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "baseline-browser-mapping": "^2.11.33",
+ "caniuse-lite": "^1.0.30001819",
+ "electron-to-chromium": "^1.5.464",
+ "node-releases": "^2.0.60",
+ "update-browserslist-db": "^1.3.4"
+ },
+ "bin": {
+ "browserslist": "cli.js"
+ },
+ "engines": {
+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
+ }
+ },
+ "node_modules/cacheable": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz",
+ "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@cacheable/memory": "^2.2.0",
+ "@cacheable/utils": "^2.5.0",
+ "hookified": "^1.15.0",
+ "keyv": "^5.6.0",
+ "qified": "^0.10.1"
+ }
+ },
+ "node_modules/caniuse-lite": {
+ "version": "1.0.30001820",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001820.tgz",
+ "integrity": "sha512-gfWD6MxqVCqAOwmODfZf7DchWvlrA+SRdNX7ceLfg3xRqe5ssjjpF7EgslC/0tiLiNTajdaNN/q8c/5u/7Gz8w==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "CC-BY-4.0"
+ },
+ "node_modules/convert-source-map": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/cross-spawn": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/deep-is": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/detect-libc": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/electron-to-chromium": {
+ "version": "1.5.472",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.472.tgz",
+ "integrity": "sha512-s4+nfT29b0FKpVKoaIxl2pWsoNcn7A/nMPSrxayw4T3BsmPeV2lF9Y06BsAQeMGhCTQ4nYJ5XST7jkqe4ZEqFw==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/escalade": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/eslint": {
+ "version": "10.14.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.14.0.tgz",
+ "integrity": "sha512-T0pNsxkb9IKmtQjhpK3d7nWOpFv+YHuMbTJnSVMoQblF0onvXfErrtp4V1jHtsQPan7dKaGVD0q1WCXnzMF31A==",
+ "dev": true,
+ "license": "MIT",
+ "workspaces": [
+ "packages/*"
+ ],
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.8.0",
+ "@eslint-community/regexpp": "^4.12.2",
+ "@eslint/config-array": "^0.23.5",
+ "@eslint/config-helpers": "^0.7.0",
+ "@eslint/core": "^1.2.1",
+ "@eslint/plugin-kit": "^0.7.3",
+ "@humanfs/node": "^0.16.8",
+ "@humanwhocodes/module-importer": "^1.0.1",
+ "@humanwhocodes/retry": "^0.4.2",
+ "@types/estree": "^1.0.6",
+ "ajv": "^6.14.0",
+ "cross-spawn": "^7.0.6",
+ "debug": "^4.3.2",
+ "escape-string-regexp": "^4.0.0",
+ "eslint-scope": "^9.1.2",
+ "eslint-visitor-keys": "^5.0.1",
+ "espree": "^11.2.0",
+ "esquery": "^1.7.0",
+ "esutils": "^2.0.2",
+ "fast-deep-equal": "^3.1.3",
+ "file-entry-cache": "11.1.5 || >11.1.6 <12",
+ "find-up": "^5.0.0",
+ "glob-parent": "^6.0.2",
+ "ignore": "^5.2.0",
+ "imurmurhash": "^0.1.4",
+ "is-glob": "^4.0.0",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "minimatch": "^10.2.6",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.9.3"
+ },
+ "bin": {
+ "eslint": "bin/eslint.js"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ },
+ "funding": {
+ "url": "https://eslint.org/donate"
+ },
+ "peerDependencies": {
+ "jiti": "*"
+ },
+ "peerDependenciesMeta": {
+ "jiti": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/eslint-plugin-react-hooks": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.1.1.tgz",
+ "integrity": "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/core": "^7.24.4",
+ "@babel/parser": "^7.24.4",
+ "hermes-parser": "^0.25.1",
+ "zod": "^3.25.0 || ^4.0.0",
+ "zod-validation-error": "^3.5.0 || ^4.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0"
+ }
+ },
+ "node_modules/eslint-plugin-react-refresh": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.5.7.tgz",
+ "integrity": "sha512-XhJSzLljuYD4UjNuFGJu2v7aD3sqNVK12w5/DCUfrNfHWegZo2+TsavNx8MuxMwEquuFAzNbNfXKU0WoZ+YUIg==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "eslint": "^9 || ^10"
+ }
+ },
+ "node_modules/eslint-scope": {
+ "version": "9.1.2",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz",
+ "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "@types/esrecurse": "^4.3.1",
+ "@types/estree": "^1.0.8",
+ "esrecurse": "^4.3.0",
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/eslint-visitor-keys": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
+ "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/espree": {
+ "version": "11.2.0",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz",
+ "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "acorn": "^8.16.0",
+ "acorn-jsx": "^5.3.2",
+ "eslint-visitor-keys": "^5.0.1"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/esquery": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz",
+ "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "estraverse": "^5.1.0"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/file-entry-cache": {
+ "version": "11.1.5",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz",
+ "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flat-cache": "^6.1.23"
+ }
+ },
+ "node_modules/find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/flat-cache": {
+ "version": "6.1.23",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz",
+ "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cacheable": "^2.5.0",
+ "flatted": "^3.4.2",
+ "hookified": "^1.15.0"
+ }
+ },
+ "node_modules/flatted": {
+ "version": "3.4.4",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz",
+ "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/gensync": {
+ "version": "1.0.0-beta.2",
+ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
+ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/glob-parent": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^4.0.3"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
+ "node_modules/globals": {
+ "version": "17.14.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-17.14.0.tgz",
+ "integrity": "sha512-UtdkTVyAJePQv0J2M9Xe4L0ruNSDV314XiIJsADI2Zf40bcdAonE/D/OhAU8AT99oij9mhLByb+NvA3QWZYgCg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/hashery": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz",
+ "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hookified": "^1.15.0"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/hermes-estree": {
+ "version": "0.25.1",
+ "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz",
+ "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/hermes-parser": {
+ "version": "0.25.1",
+ "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz",
+ "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hermes-estree": "0.25.1"
+ }
+ },
+ "node_modules/hookified": {
+ "version": "1.15.1",
+ "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz",
+ "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/ignore": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
+ "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.8.19"
+ }
+ },
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/jsesc": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
+ "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "jsesc": "bin/jsesc"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/json5": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "json5": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/keyv": {
+ "version": "5.6.0",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz",
+ "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@keyv/serialize": "^1.1.1"
+ }
+ },
+ "node_modules/levn": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "prelude-ls": "^1.2.1",
+ "type-check": "~0.4.0"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/lightningcss": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",
+ "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",
+ "dev": true,
+ "license": "MPL-2.0",
+ "dependencies": {
+ "detect-libc": "^2.0.3"
+ },
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ },
+ "optionalDependencies": {
+ "lightningcss-android-arm64": "1.33.0",
+ "lightningcss-darwin-arm64": "1.33.0",
+ "lightningcss-darwin-x64": "1.33.0",
+ "lightningcss-freebsd-x64": "1.33.0",
+ "lightningcss-linux-arm-gnueabihf": "1.33.0",
+ "lightningcss-linux-arm64-gnu": "1.33.0",
+ "lightningcss-linux-arm64-musl": "1.33.0",
+ "lightningcss-linux-x64-gnu": "1.33.0",
+ "lightningcss-linux-x64-musl": "1.33.0",
+ "lightningcss-win32-arm64-msvc": "1.33.0",
+ "lightningcss-win32-x64-msvc": "1.33.0"
+ }
+ },
+ "node_modules/lightningcss-android-arm64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz",
+ "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-darwin-arm64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",
+ "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-darwin-x64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",
+ "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-freebsd-x64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",
+ "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm-gnueabihf": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",
+ "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm64-gnu": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",
+ "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm64-musl": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",
+ "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-x64-gnu": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",
+ "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-x64-musl": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",
+ "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-win32-arm64-msvc": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",
+ "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-win32-x64-msvc": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",
+ "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/locate-path": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-locate": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/lru-cache": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "yallist": "^3.0.2"
+ }
+ },
+ "node_modules/lucide-react": {
+ "version": "1.66.0",
+ "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.66.0.tgz",
+ "integrity": "sha512-8zjbi/Us+ETXqfBwmXF/FHrWGIqOdE6zT1yUdRJLQVoptomSkB0zdFWVIM667t9K8djWDaXdkBkqi2qVTuDNiw==",
+ "license": "ISC",
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/minimatch": {
+ "version": "10.2.6",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
+ "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "brace-expansion": "^5.0.8"
+ },
+ "engines": {
+ "node": "18 || 20 || >=22"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.20",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
+ "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/node-releases": {
+ "version": "2.0.63",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.63.tgz",
+ "integrity": "sha512-6li2QanLsAXpIH2R6j77MzRyvOyrvdTqlKtO4CgBdHGNvN99ZZfyxszHc5o5+IZBWD5u6Hzwg83JoGXmqZNG9Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/optionator": {
+ "version": "0.9.4",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
+ "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "deep-is": "^0.1.3",
+ "fast-levenshtein": "^2.0.6",
+ "levn": "^0.4.1",
+ "prelude-ls": "^1.2.1",
+ "type-check": "^0.4.0",
+ "word-wrap": "^1.2.5"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/p-limit": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "yocto-queue": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-locate": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-limit": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-key": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/picomatch": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
+ "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/postcss": {
+ "version": "8.5.32",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz",
+ "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.20",
+ "picocolors": "^1.1.1",
+ "source-map-js": "^1.2.2"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/prelude-ls": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
+ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/punycode": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/qified": {
+ "version": "0.10.1",
+ "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz",
+ "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hookified": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/qified/node_modules/hookified": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz",
+ "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/react": {
+ "version": "19.3.1",
+ "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz",
+ "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/react-dom": {
+ "version": "19.3.1",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz",
+ "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==",
+ "license": "MIT",
+ "dependencies": {
+ "scheduler": "^0.28.0"
+ },
+ "peerDependencies": {
+ "react": "^19.3.1"
+ }
+ },
+ "node_modules/rolldown": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.16.tgz",
+ "integrity": "sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@oxc-project/types": "=0.156.0",
+ "@rolldown/pluginutils": "^1.0.0"
+ },
+ "bin": {
+ "rolldown": "bin/cli.mjs"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "optionalDependencies": {
+ "@rolldown/binding-android-arm-eabi": "1.2.16",
+ "@rolldown/binding-android-arm64": "1.2.16",
+ "@rolldown/binding-darwin-arm64": "1.2.16",
+ "@rolldown/binding-darwin-x64": "1.2.16",
+ "@rolldown/binding-freebsd-x64": "1.2.16",
+ "@rolldown/binding-linux-arm-gnueabihf": "1.2.16",
+ "@rolldown/binding-linux-arm64-gnu": "1.2.16",
+ "@rolldown/binding-linux-arm64-musl": "1.2.16",
+ "@rolldown/binding-linux-ppc64-gnu": "1.2.16",
+ "@rolldown/binding-linux-s390x-gnu": "1.2.16",
+ "@rolldown/binding-linux-x64-gnu": "1.2.16",
+ "@rolldown/binding-linux-x64-musl": "1.2.16",
+ "@rolldown/binding-openharmony-arm64": "1.2.16",
+ "@rolldown/binding-win32-arm64-msvc": "1.2.16",
+ "@rolldown/binding-win32-x64-msvc": "1.2.16"
+ }
+ },
+ "node_modules/scheduler": {
+ "version": "0.28.0",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz",
+ "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==",
+ "license": "MIT"
+ },
+ "node_modules/semver": {
+ "version": "7.8.5",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
+ "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "shebang-regex": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/source-map-js": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
+ "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/tinyglobby": {
+ "version": "0.2.17",
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.4"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/SuperchupuDev"
+ }
+ },
+ "node_modules/type-check": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "prelude-ls": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/update-browserslist-db": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.4.tgz",
+ "integrity": "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "escalade": "^3.2.0",
+ "picocolors": "^1.1.1"
+ },
+ "bin": {
+ "update-browserslist-db": "cli.js"
+ },
+ "peerDependencies": {
+ "browserslist": ">= 4.21.0"
+ }
+ },
+ "node_modules/uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "node_modules/vite": {
+ "version": "8.3.5",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.5.tgz",
+ "integrity": "sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "lightningcss": "^1.33.0",
+ "picomatch": "^4.0.7",
+ "postcss": "^8.5.30",
+ "rolldown": "~1.2.14",
+ "tinyglobby": "^0.2.17"
+ },
+ "bin": {
+ "vite": "bin/vite.js"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/vitejs/vite?sponsor=1"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ },
+ "peerDependencies": {
+ "@types/node": "^20.19.0 || >=22.12.0",
+ "@vitejs/devtools": "^0.7.1 || ^0.8.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"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "@vitejs/devtools": {
+ "optional": true
+ },
+ "esbuild": {
+ "optional": true
+ },
+ "jiti": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "sass-embedded": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "terser": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "node-which": "bin/node-which"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/word-wrap": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
+ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/yallist": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/yocto-queue": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/zod": {
+ "version": "4.6.7",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
+ "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ },
+ "node_modules/zod-validation-error": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz",
+ "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.0 || ^4.0.0"
+ }
+ }
+ }
+}
diff --git a/addons/mosaic-addon-studio/package.json b/addons/mosaic-addon-studio/package.json
new file mode 100644
index 0000000..f0d3771
--- /dev/null
+++ b/addons/mosaic-addon-studio/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "mosaic-addon-studio",
+ "private": true,
+ "version": "0.1.0",
+ "type": "module",
+ "scripts": {
+ "build": "vite build",
+ "dev": "vite",
+ "lint": "eslint .",
+ "test": "node --test"
+ },
+ "dependencies": {
+ "lucide-react": "^1.59.0",
+ "react": "^19.2.8",
+ "react-dom": "^19.2.8",
+ "semver": "^7.8.5"
+ },
+ "devDependencies": {
+ "@eslint/js": "^10.0.1",
+ "@vitejs/plugin-react": "^6.1.1",
+ "eslint": "^10.10.0",
+ "eslint-plugin-react-hooks": "^7.1.1",
+ "eslint-plugin-react-refresh": "^0.5.6",
+ "globals": "^17.12.0",
+ "vite": "^8.3.0"
+ }
+}
diff --git a/addons/mosaic-addon-studio/public/favicon.svg b/addons/mosaic-addon-studio/public/favicon.svg
new file mode 100644
index 0000000..6893eb1
--- /dev/null
+++ b/addons/mosaic-addon-studio/public/favicon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/addons/mosaic-addon-studio/public/icons.svg b/addons/mosaic-addon-studio/public/icons.svg
new file mode 100644
index 0000000..e952219
--- /dev/null
+++ b/addons/mosaic-addon-studio/public/icons.svg
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/mosaic-addon-studio/shared/addon-surface.json b/addons/mosaic-addon-studio/shared/addon-surface.json
new file mode 100644
index 0000000..f0533d5
--- /dev/null
+++ b/addons/mosaic-addon-studio/shared/addon-surface.json
@@ -0,0 +1,321 @@
+{
+ "schema": 1,
+ "app": {
+ "name": "mosaic-companion",
+ "version": "0.1.13",
+ "commit": "7af40c8ba2ed283a67852a2d8378eec425d1f943",
+ "describe": "v0.1.13"
+ },
+ "sinceHorizon": "0.1.10",
+ "api": {
+ "namespaces": {
+ "system": {
+ "methods": {
+ "getAppInfo": {
+ "permission": null,
+ "since": "0.1.10"
+ },
+ "getManifest": {
+ "permission": null,
+ "since": "0.1.10"
+ },
+ "getTheme": {
+ "permission": null,
+ "since": "0.1.10"
+ }
+ }
+ },
+ "settings": {
+ "methods": {
+ "clear": {
+ "permission": null,
+ "since": "0.1.10"
+ },
+ "get": {
+ "permission": null,
+ "since": "0.1.10"
+ },
+ "replace": {
+ "permission": null,
+ "since": "0.1.10"
+ },
+ "set": {
+ "permission": null,
+ "since": "0.1.10"
+ }
+ }
+ },
+ "files": {
+ "methods": {
+ "delete": {
+ "permission": null,
+ "since": "0.1.10"
+ },
+ "list": {
+ "permission": null,
+ "since": "0.1.10"
+ },
+ "mkdir": {
+ "permission": null,
+ "since": "0.1.10"
+ },
+ "read": {
+ "permission": null,
+ "since": "0.1.10"
+ },
+ "readBinary": {
+ "permission": null,
+ "since": "0.1.10"
+ },
+ "write": {
+ "permission": null,
+ "since": "0.1.10"
+ }
+ }
+ },
+ "events": {
+ "methods": {
+ "on": {
+ "permission": null,
+ "since": "0.1.10"
+ }
+ }
+ },
+ "ui": {
+ "methods": {
+ "openExternal": {
+ "permission": "shell:open-external",
+ "since": "0.1.10"
+ },
+ "setTitle": {
+ "permission": null,
+ "since": "0.1.10"
+ }
+ }
+ },
+ "wallet": {
+ "methods": {
+ "getAddress": {
+ "permission": "wallet:read",
+ "since": "0.1.10"
+ },
+ "getBalance": {
+ "permission": "wallet:read",
+ "since": "0.1.10"
+ },
+ "getNetworkInfo": {
+ "permission": "wallet:read",
+ "since": "0.1.10"
+ }
+ }
+ },
+ "agents": {
+ "methods": {
+ "add": {
+ "permission": "agents:write",
+ "since": "0.1.10"
+ },
+ "get": {
+ "permission": "agents:read",
+ "since": "0.1.10"
+ },
+ "list": {
+ "permission": "agents:read",
+ "since": "0.1.10"
+ },
+ "update": {
+ "permission": "agents:write",
+ "since": "0.1.10"
+ }
+ }
+ },
+ "mcp": {
+ "methods": {
+ "callTool": {
+ "permission": "mcp:call",
+ "since": "0.1.10"
+ },
+ "listServers": {
+ "permission": "mcp:read",
+ "since": "0.1.10"
+ },
+ "listTools": {
+ "permission": "mcp:read",
+ "since": "0.1.10"
+ }
+ }
+ },
+ "nodes": {
+ "methods": {
+ "getSavedAims": {
+ "permission": "nodes:read",
+ "since": "0.1.10"
+ },
+ "list": {
+ "permission": "nodes:read",
+ "since": "0.1.10"
+ }
+ }
+ },
+ "buckets": {
+ "methods": {
+ "clear": {
+ "permission": "buckets:publish",
+ "since": "0.1.13"
+ },
+ "list": {
+ "permission": null,
+ "since": "0.1.13"
+ },
+ "read": {
+ "permission": null,
+ "since": "0.1.13"
+ },
+ "write": {
+ "permission": "buckets:publish",
+ "since": "0.1.13"
+ }
+ }
+ }
+ },
+ "members": {
+ "init": {
+ "since": "0.1.10"
+ },
+ "invoke": {
+ "since": "0.1.10"
+ },
+ "parseError": {
+ "since": "0.1.10"
+ }
+ },
+ "internal": {
+ "events.subscribe": {
+ "permission": null
+ },
+ "events.unsubscribe": {
+ "permission": null
+ }
+ }
+ },
+ "permissions": {
+ "grantable": {
+ "wallet:read": {
+ "since": "0.1.10"
+ },
+ "agents:read": {
+ "since": "0.1.10"
+ },
+ "agents:write": {
+ "since": "0.1.10"
+ },
+ "mcp:read": {
+ "since": "0.1.10"
+ },
+ "mcp:call": {
+ "since": "0.1.10"
+ },
+ "nodes:read": {
+ "since": "0.1.10"
+ },
+ "shell:open-external": {
+ "since": "0.1.10"
+ },
+ "buckets:publish": {
+ "since": "0.1.13"
+ }
+ },
+ "reserved": [
+ "wallet:sign",
+ "agents:delete",
+ "vault:read",
+ "vault:write",
+ "notifications"
+ ]
+ },
+ "reservedIpcNamespaces": [
+ "nodes",
+ "ai-agents",
+ "ai-agents-history",
+ "themes",
+ "gmail",
+ "web3",
+ "vault",
+ "media",
+ "window",
+ "dialog",
+ "sandbox",
+ "toolSandbox",
+ "chronicle",
+ "tools",
+ "mcp",
+ "chat",
+ "ide",
+ "aimnodes",
+ "payments-jit",
+ "addon",
+ "addon-api",
+ "addons",
+ "tab-prefs"
+ ],
+ "mainEntryAllowlist": [
+ "hyperinsight"
+ ],
+ "tabIcons": {
+ "names": [
+ "Activity",
+ "BarChart3",
+ "Bot",
+ "Box",
+ "Boxes",
+ "BrainCircuit",
+ "Clock",
+ "Code2",
+ "Cpu",
+ "Database",
+ "Eth",
+ "Globe",
+ "Hash",
+ "Home",
+ "Layers",
+ "LayoutGrid",
+ "Lock",
+ "MessageSquare",
+ "Network",
+ "Plug",
+ "Power",
+ "Rocket",
+ "Server",
+ "Settings",
+ "Shield",
+ "Sparkles",
+ "Star",
+ "Store",
+ "Telescope",
+ "Trophy",
+ "Wallet",
+ "Zap"
+ ],
+ "fallback": null
+ },
+ "manifest": {
+ "manifestVersion": 1,
+ "mountPoints": [
+ "tab"
+ ],
+ "idPattern": "^[a-z][a-z0-9-]{1,40}$",
+ "ipcNamespacePattern": "^[a-z][a-z0-9-]{1,40}$",
+ "maxNameLength": 40,
+ "maxDescriptionLength": 200,
+ "maxTabLabelLength": 24,
+ "defaultTabOrder": 100,
+ "bucketIdPattern": "^[a-z][a-z0-9-]{1,40}$",
+ "bucketKindPattern": "^[a-z][a-z0-9-]{1,40}$",
+ "maxBucketsPublished": 8,
+ "maxBucketKindsRead": 8,
+ "maxBucketLabelLength": 40,
+ "bucketHistoryValues": [
+ "all"
+ ]
+ }
+}
diff --git a/addons/mosaic-addon-studio/shared/addon-surface.provenance.json b/addons/mosaic-addon-studio/shared/addon-surface.provenance.json
new file mode 100644
index 0000000..ad93414
--- /dev/null
+++ b/addons/mosaic-addon-studio/shared/addon-surface.provenance.json
@@ -0,0 +1,24 @@
+{
+ "artifact": {
+ "repository": "hypercycle-development/mosaic-open-platform",
+ "path": "scripts/adjudicate/addon-surface.json",
+ "commit": "cf3f5f7bf957dc2e0f160077579f7c30b557cee7",
+ "ref": "main",
+ "blobSha": "f0533d5d97cf7b7158ad72ee6d5a192668100108",
+ "sha256": "748c5d28e25c43f8e1d59c94e2d60c3b5d063ee2fb139b7b4a8e49ee5b3ac31e",
+ "size": 6603,
+ "retrievedAt": "2026-11-28"
+ },
+ "application": {
+ "name": "mosaic-companion",
+ "version": "0.1.13",
+ "commit": "7af40c8ba2ed283a67852a2d8378eec425d1f943",
+ "describe": "v0.1.13"
+ },
+ "notes": [
+ "The artifact was retrieved from the upstream repository's main branch at the commit named above.",
+ "It was NOT taken from a mosaic-companion release asset: at the time of retrieval the v0.1.13 release carried no addon-surface.json asset. mosaic-companion's release workflow now attaches one to each release, so a later pin may cite a release asset instead.",
+ "The application version and commit above are the values the artifact itself declares in its 'app' block; they describe the Mosaic Companion revision the surface was generated from.",
+ "sha256 is computed over the exact bytes of the vendored file, which are byte-identical to the upstream blob."
+ ]
+}
\ No newline at end of file
diff --git a/addons/mosaic-addon-studio/shared/capability-rules.mjs b/addons/mosaic-addon-studio/shared/capability-rules.mjs
new file mode 100644
index 0000000..2551378
--- /dev/null
+++ b/addons/mosaic-addon-studio/shared/capability-rules.mjs
@@ -0,0 +1,1178 @@
+/**
+ * Mosaic capability checks — the browser-safe half.
+ *
+ * The manifest schema can tell an add-on whether its fields are shaped
+ * correctly. It cannot tell the add-on whether the icon it chose will ever
+ * render, whether the API method it calls exists, or whether the app version
+ * it asks for is new enough to have that method. Those are the failures the
+ * Mosaic catalogue's issue #19 measured across four review rounds: an
+ * add-on called a method that does not exist, and nothing failed until a
+ * person read the code.
+ *
+ * These checks read the official Mosaic add-on surface artifact published by
+ * Mosaic Companion, vendored at `shared/addon-surface.json` and loaded through
+ * `shared/mosaic-schema.mjs`. The rules are therefore derived from the
+ * application at a pinned version, not from a list someone typed and forgot
+ * to update.
+ *
+ * The source of an add-on arrives here as a list of `{ file, source }`
+ * entries rather than as a directory, because a renderer has no filesystem:
+ * inside Mosaic the files come from `addonAPI.files`, and in the local
+ * Studio they come from disk. The rules are identical either way.
+ */
+
+import semver from 'semver';
+
+import {
+ SURFACE_ERRORS,
+ SURFACE_IS_VALID,
+ ADDON_SURFACE,
+ exposedMethods,
+ internalMethods,
+ rootMembers,
+ namespaceNames,
+ namespaceMethods,
+ renderableIcons,
+ iconFallback,
+ permissionForCall as surfacePermissionForCall,
+ releaseFloor as surfaceReleaseFloor,
+ surfaceProvenance
+} from './mosaic-schema.mjs';
+
+// The renderer reaches the app only through `window.addonAPI`. The add-on's
+// own main-process context (`ctx`) carries `ipc`, `events`, `paths`,
+// `settings` and `log` — no `api` — so a `ctx.api.*` call is a call to
+// something that was never there.
+const API_OBJECT = 'addonAPI';
+
+// The wrong global. `window.mosaicAPI` does not exist; `window.addonAPI`
+// does. Naming it here means the error can say what to use instead.
+//
+// It is anchored to `window.` on purpose. The upstream adjudicator looks
+// for `window.API` and nothing else, because the question is
+// whether the add-on is reaching for a host global. A bare identifier is
+// not that: `const mosaicAPI = {}` is an add-on's own object, and refusing
+// it blocks a correct add-on over a name it chose. A false block costs
+// more than a missed flag.
+const WRONG_GLOBAL_PATTERN = /(? limitSink?.push({ kind, index });
+
+/** The longest `${ ... }` body that is read as code. */
+const MAX_INTERPOLATION = 1500;
+
+/** The longest regex literal that is recognised as one. */
+const MAX_REGEX = 1500;
+
+/** Template literals nested deeper than this are not looked into. */
+const MAX_NESTING = 64;
+
+const EXPRESSION_KEYWORDS = new Set([
+ 'return', 'typeof', 'case', 'in', 'of', 'new', 'delete', 'void',
+ 'instanceof', 'else', 'do', 'yield', 'await', 'throw'
+]);
+
+/**
+ * Is this character part of an identifier?
+ *
+ * @param {string} ch
+ * @returns {boolean}
+ */
+function isIdentifierChar(ch) {
+ return /[A-Za-z0-9_$]/.test(ch);
+}
+
+/**
+ * The identifier that ends at `end` (exclusive).
+ *
+ * @param {string} text
+ * @param {number} end
+ * @returns {string}
+ */
+function identifierEndingAt(text, end) {
+ let start = end;
+ while (start > 0 && isIdentifierChar(text[start - 1])) start -= 1;
+ return text.slice(start, end);
+}
+
+/**
+ * Where a regex literal starting at `start` ends, or -1 if it is not one.
+ *
+ * The literal ends at the first `/` that is neither escaped nor inside a
+ * character class. A newline before that means the `/` was not a literal at
+ * all — a regex cannot span lines — so the caller treats it as an operator.
+ *
+ * @param {string} text
+ * @param {number} start
+ * @returns {number}
+ */
+function regexLiteralEnd(text, start) {
+ let j = start + 1;
+ let inClass = false;
+
+ // shortcut: a regex longer than MAX_REGEX is read as an operator, so a run
+ // of `/[` costs a bounded scan each, not a scan to the end each.
+ const stop = Math.min(text.length, start + MAX_REGEX);
+
+ while (j < stop) {
+ const c = text[j];
+
+ if (c === '\\') {
+ j += 2;
+ continue;
+ }
+ if (c === '[') {
+ inClass = true;
+ j += 1;
+ continue;
+ }
+ if (c === ']') {
+ inClass = false;
+ j += 1;
+ continue;
+ }
+ if (c === '\n') return -1;
+ if (c === '/' && !inClass) return j + 1;
+
+ j += 1;
+ }
+
+ if (j >= stop && stop < text.length) hitLimit(`a regex literal longer than ${MAX_REGEX} characters`, start);
+ return -1;
+}
+
+/**
+ * Put source into the shape the call scanner can read.
+ *
+ * Three rewrites, and none of them changes what a call *does* — only how it
+ * is spelled:
+ *
+ * - Comments are blanked, so a file that mentions a path in prose does not
+ * read as a call.
+ * - TypeScript casts are dropped: `(window as any).addonAPI` and
+ * `(addonAPI as AddonAPI | undefined)?.buckets` are the same call as
+ * `window.addonAPI` and `addonAPI.buckets`. A scanner that cannot see
+ * through a cast reports a method that exists as missing.
+ * - Optional chaining is dropped: `addonAPI?.agents?.list` is one call, not
+ * two, and the `?` is not part of the method name.
+ *
+ * @param {string} source
+ * @returns {string}
+ */
+export function normalizeSource(source) {
+ // The rewrites below must not reach inside a string or a template
+ // literal. `const q = "addonAPI.agents.list()"` is documentation, not a
+ // call, and rewriting it produced a call the add-on never made — which
+ // then failed on a method that does not exist and blocked a correct
+ // add-on. The segments are therefore rewritten one by one: the string
+ // literals are left exactly as they are.
+ //
+ // The string bodies are then blanked, keeping their length and their line
+ // breaks, so the scanner cannot read a call out of a literal either.
+ const rewritten = mapOutsideStrings(blankComments(source), segment => {
+ let out = segment;
+
+ // `(expr as Type)` -> `(expr)`. The type may itself contain a union, so
+ // the body runs to the closing parenthesis.
+ // A rewrite keeps the line breaks it removes, so a later line keeps its number.
+ const breaks = text => text.replace(/[^\n]/g, '');
+ out = out.replace(/\(\s*([A-Za-z_$][\w$.]*)\s+as\s+[^()]*\)/g, (match, id) => `(${id})${breaks(match)}`);
+
+ // `?.` -> `.`, but only where a member follows: `a ? .5 : b` is a
+ // ternary and must survive untouched.
+ out = out.replace(/\?\.(?=[A-Za-z_$])/g, '.');
+
+ // A parenthesised API object: `(window).addonAPI` -> `window.addonAPI`.
+ out = out.replace(/\(\s*(window|addonAPI)\s*\)\s*\./g, (match, id) => `${id}.${breaks(match)}`);
+
+ return out;
+ });
+
+ // `window['addonAPI']` is `window.addonAPI`. Padded to the same length so
+ // offsets into the text stay offsets into the text.
+ return blankStringBodies(rewritten).replace(
+ /\b(window|globalThis|self)\s*\[\s*(['"`])(addonAPI|mosaicAPI)\2\s*\]/g,
+ (match, object, _quote, name) => `${object}.${name}`.padEnd(match.length)
+ );
+}
+
+/**
+ * Walk text from `i` until the context stack is empty or the text ends.
+ *
+ * The stack holds the quote of every open literal and `{` for every open
+ * `${` interpolation or brace inside one. It is a loop, not recursion, so a
+ * hostile input of nested `${` cannot overflow the call stack.
+ */
+function walkLiteral(text, i, stack, stop = text.length) {
+ while (i < stop && stack.length) {
+ const top = stack[stack.length - 1];
+ const c = text[i];
+
+ if (top === '{') {
+ if (c === '"' || c === "'" || c === '`' || c === '{') stack.push(c);
+ else if (c === '}') stack.pop();
+ i += 1;
+ } else if (c === '\\') {
+ i += 2;
+ } else if (c === top) {
+ stack.pop();
+ i += 1;
+ } else if (top === '`' && c === '$' && text[i + 1] === '{') {
+ stack.push('{');
+ i += 2;
+ } else {
+ i += 1;
+ }
+ }
+
+ return Math.min(i, stop);
+}
+
+/**
+ * Index just past the closing quote of the literal that opens at `start`.
+ * A template's `${ ... }` is skipped as a unit, so a quote inside it does not
+ * end the template.
+ */
+function literalEnd(text, start) {
+ return walkLiteral(text, start + 1, [text[start]]);
+}
+
+/**
+ * Index of the `}` that closes a template `${` whose body starts at `start`,
+ * or -1 when it never closes.
+ */
+function interpolationEnd(text, start) {
+ const stack = ['{'];
+ // shortcut: an interpolation longer than MAX_INTERPOLATION is read as plain
+ // text, so a hostile run of unclosed `${` costs a bounded scan each, not a
+ // scan to the end of the file each. Raise it if real code needs more.
+ const end = walkLiteral(text, start, stack, Math.min(text.length, start + MAX_INTERPOLATION));
+ if (stack.length && start + MAX_INTERPOLATION < text.length) {
+ hitLimit(`a template interpolation longer than ${MAX_INTERPOLATION} characters`, start);
+ }
+
+ return stack.length === 0 ? end - 1 : -1;
+}
+
+/**
+ * Blank the body of every string and template literal, keeping the length
+ * and the line breaks.
+ *
+ * A literal is not code, so a call written inside one is not a call. The
+ * body is replaced by spaces — a call spans the same number of characters
+ * either way, so an offset into the text stays an offset into the text.
+ *
+ * @param {string} text
+ * @returns {string}
+ */
+function blankStringBodies(text, depth = 0) {
+ let out = '';
+ let i = 0;
+
+ while (i < text.length) {
+ const ch = text[i];
+
+ if (ch !== '"' && ch !== "'" && ch !== '`') {
+ out += ch;
+ i += 1;
+ continue;
+ }
+
+ const quote = ch;
+ const start = i;
+
+ // The literal is built apart and appended once: slicing the whole output
+ // for every member literal made this quadratic in the file size.
+ let piece = ch;
+ i += 1;
+
+ while (i < text.length) {
+ if (text[i] === '\\') {
+ // A backslash at the very end has no character to escape: pad only
+ // what exists, or the output would be longer than the input.
+ piece += i + 1 < text.length ? ' ' : ' ';
+ i += 2;
+ continue;
+ }
+ if (text[i] === quote) {
+ piece += quote;
+ i += 1;
+ break;
+ }
+ // `${ ... }` inside a template is code, not text.
+ const end = quote === '`' && depth < MAX_NESTING && text.startsWith('${', i) ? interpolationEnd(text, i + 2) : -1;
+ if (end !== -1) {
+ piece += '${' + blankStringBodies(text.slice(i + 2, end), depth + 1) + '}';
+ i = end + 1;
+ continue;
+ }
+ piece += text[i] === '\n' ? '\n' : ' ';
+ i += 1;
+ }
+
+ // A literal used as a member name — `addonAPI["agents"]["list"]()` —
+ // is part of the call, not documentation. The one that follows a `.` or
+ // an opening bracket directly is kept; every other literal is blanked.
+ const before = text.slice(Math.max(0, start - 2), start);
+ // Only an identifier is a member name: `['addonAPI.agents.list()']` is a
+ // string in an array, not a call.
+ const isMemberName = /[.[]$/.test(before) && /^[A-Za-z_$][\w$]*$/.test(text.slice(start + 1, i - 1));
+
+ out += isMemberName ? text.slice(start, i) : piece;
+ }
+
+ return out;
+}
+
+/**
+ * Apply a rewrite to the parts of the text that are code.
+ *
+ * A string or template literal is passed through untouched; everything
+ * between them is handed to `rewrite`.
+ *
+ * @param {string} text
+ * @param {(segment: string) => string} rewrite
+ * @returns {string}
+ */
+function mapOutsideStrings(text, rewrite, depth = 0) {
+ let out = '';
+ let i = 0;
+
+ while (i < text.length) {
+ const ch = text[i];
+
+ if (ch === '"' || ch === "'" || ch === '`') {
+ const quote = ch;
+
+ out += ch;
+ i += 1;
+
+ while (i < text.length) {
+ if (text[i] === '\\') {
+ out += text[i] + (text[i + 1] ?? '');
+ i += 2;
+ continue;
+ }
+ const end = quote === '`' && depth < MAX_NESTING && text.startsWith('${', i) ? interpolationEnd(text, i + 2) : -1;
+ if (end !== -1) {
+ out += '${' + mapOutsideStrings(text.slice(i + 2, end), rewrite, depth + 1) + '}';
+ i = end + 1;
+ continue;
+ }
+ out += text[i];
+ if (text[i] === quote) {
+ i += 1;
+ break;
+ }
+ i += 1;
+ }
+
+ continue;
+ }
+
+ // Collect the code up to the next string.
+ let j = i;
+ while (j < text.length && text[j] !== '"' && text[j] !== "'" && text[j] !== '`') j += 1;
+
+ out += rewrite(text.slice(i, j));
+ i = j;
+ }
+
+ return out;
+}
+
+const GLOBAL_OBJECT = String.raw`(?:window|globalThis|self)`;
+const NAME = String.raw`[A-Za-z_$][\w$]*`;
+const GLOBAL_NAMES = new Set(['window', 'globalThis', 'self']);
+
+const QUOTED = '[\'"`]';
+
+/** A destructuring pattern longer than this is not read (hostile input). */
+const MAX_DESTRUCTURING_LENGTH = 4000;
+
+/** The bounds above, for tests and for the messages that name them. */
+export const SCANNER_LIMITS = Object.freeze({
+ interpolation: MAX_INTERPOLATION,
+ regex: MAX_REGEX,
+ destructuring: MAX_DESTRUCTURING_LENGTH
+});
+
+const MEMBER_ACCESS = String.raw`\s*(?:\.\s*(${NAME})|\[\s*${QUOTED}(${NAME})${QUOTED}\s*\])`;
+/** The start of a use of a name, with or without `window.` in front. */
+/**
+ * Not a member of another object: the name is not preceded by a `.` (with or without
+ * whitespace after it), except the `...` of a spread, which is not a member access.
+ */
+const NOT_MEMBER = String.raw`(?:(?> 1;
+ if (starts[mid] <= index) low = mid;
+ else high = mid - 1;
+ }
+
+ return low + 1;
+}
+
+/** Split on the commas that are not inside a nested bracket. */
+function splitTopLevel(body) {
+ const parts = [];
+ let depth = 0;
+ let start = 0;
+
+ for (let i = 0; i < body.length; i += 1) {
+ const c = body[i];
+ if (c === '{' || c === '[' || c === '(') depth += 1;
+ else if (c === '}' || c === ']' || c === ')') depth -= 1;
+ else if (c === ',' && depth === 0) {
+ parts.push(body.slice(start, i));
+ start = i + 1;
+ }
+ }
+
+ parts.push(body.slice(start));
+ return parts;
+}
+
+/**
+ * The entries of an object destructuring pattern.
+ * `{ files: { read }, agents: a, list, ...rest }`.
+ */
+function parseDestructuring(body) {
+ const entries = [];
+
+ for (const raw of splitTopLevel(body)) {
+ const part = raw.trim();
+ let m;
+
+ if (!part) continue;
+ if ((m = part.match(ENTRY_REST))) entries.push({ rest: m[1] });
+ else if ((m = part.match(ENTRY_NESTED))) entries.push({ key: m[1], nested: m[2] });
+ else if ((m = part.match(ENTRY_RENAMED))) entries.push({ key: m[1], local: m[2] });
+ else if ((m = part.match(ENTRY_PLAIN))) entries.push({ key: m[1], local: m[1] });
+ }
+
+ return entries;
+}
+
+/**
+ * Every `const { ... } = [.]` in the text, with the target.
+ * The pattern may contain nested braces, so it is found by counting them.
+ */
+function findDestructurings(text) {
+ const found = [];
+ DECLARATION.lastIndex = 0;
+ let match;
+
+ while ((match = DECLARATION.exec(text)) !== null) {
+ const open = match.index + match[0].length - 1;
+ const limit = Math.min(text.length, open + MAX_DESTRUCTURING_LENGTH);
+ let depth = 0;
+ let close = -1;
+
+ for (let i = open; i < limit; i += 1) {
+ if (text[i] === '{') depth += 1;
+ else if (text[i] === '}' && (depth -= 1) === 0) { close = i; break; }
+ }
+
+ if (close === -1) {
+ if (limit < text.length) hitLimit(`a destructuring pattern longer than ${MAX_DESTRUCTURING_LENGTH} characters`, match.index);
+ continue;
+ }
+
+ AFTER_DESTRUCTURING.lastIndex = close + 1;
+ const target = AFTER_DESTRUCTURING.exec(text);
+ if (!target) continue;
+
+ found.push({
+ index: match.index,
+ entries: parseDestructuring(text.slice(open + 1, close)),
+ object: target[1],
+ namespace: target[2] ?? null
+ });
+ }
+
+ return found;
+}
+
+/**
+ * Find every API call an add-on makes.
+ *
+ * The scanner follows the shapes real add-ons use, because the catalogue's
+ * own add-ons use all of them:
+ *
+ * - `addonAPI.agents.list()` and `addonAPI?.agents?.list()`
+ * - `const api = window.addonAPI; api.agents.list()`
+ * - `const buckets = addonAPI?.buckets; buckets.write()`
+ * - `addonAPI["agents"]["list"]()`
+ * - `const { agents, files: { read } } = addonAPI`, `const { list } = addonAPI.agents`
+ * - `const { addonAPI: api } = window`, `const api = { ...addonAPI }`
+ * - `globalThis.addonAPI.x.y()`
+ *
+ * A call it cannot resolve is a call it does not report. That direction is
+ * deliberate: an unresolved call can cost the author a missed warning, while
+ * a wrongly resolved one would block an add-on that is correct.
+ *
+ * The work is linear in the size of the file apart from a handful of passes
+ * per distinct name; no step re-scans the text for every match.
+ *
+ * @param {{ file: string, source: string }[]} files The add-on's source files.
+ * @param {object} [options]
+ * @param {string[]} [options.namespaces] The API namespace names.
+ * @returns {{ ns: string, method: string, file: string, line: number, root: boolean }[]}
+ */
+function* matchesWhere(pattern, text, accepts) {
+ pattern.lastIndex = 0;
+
+ for (let match; (match = pattern.exec(text)) !== null;) {
+ if (accepts(match)) yield match;
+ else pattern.lastIndex = match.index + 1;
+ }
+}
+
+export function scanApiCallsInFiles(files, options = {}) {
+ try {
+ return scanFiles(files, options);
+ } finally {
+ limitSink = null;
+ }
+}
+
+function scanFiles(files, options) {
+ const namespaces = Array.isArray(options.namespaces) ? options.namespaces : [];
+ const calls = [];
+ const seen = new Set();
+
+ for (const file of files) {
+ const limits = [];
+ limitSink = limits;
+ const text = normalizeSource(file.source);
+ const relative = file.file;
+ const starts = lineStarts(text);
+ const lineAt = index => lineNumber(starts, index);
+
+ const record = (ns, method, index, root = false) => {
+ const key = root ? `.${method}` : `${ns}.${method}`;
+ if (seen.has(key)) return;
+ seen.add(key);
+ calls.push({ ns, method, key, file: relative, line: lineAt(index), root });
+ };
+
+ const destructurings = findDestructurings(text);
+
+ // How often each name is assigned to, counted once. A name is an alias
+ // only while its own declaration is its one assignment: after
+ // `let api = addonAPI; api = other;` it is not the API object any more.
+ const assignments = new Map();
+ for (const [, name] of text.matchAll(ASSIGNMENT)) assignments.set(name, (assignments.get(name) ?? 0) + 1);
+
+ // Every name that holds the API object: the global itself, plus any
+ // variable bound to it directly, through another alias, by spreading it,
+ // by `...rest`, or by destructuring it off the global object.
+ //
+ // A worklist over "declared as `= value`" lists, so each declaration is
+ // looked at once however many aliases there are.
+ const boundTo = new Map();
+ const bind = (value, name, checked) => {
+ if (!boundTo.has(value)) boundTo.set(value, []);
+ boundTo.get(value).push({ name, checked });
+ };
+
+ for (const [, name, value] of text.matchAll(DIRECT_ALIAS)) bind(value, name, true);
+ for (const [, name, value] of text.matchAll(SPREAD_ALIAS)) bind(value, name, true);
+
+ const apiRefs = new Set([API_OBJECT]);
+ const pending = [API_OBJECT];
+
+ for (const d of destructurings) {
+ if (d.namespace) continue;
+
+ for (const entry of d.entries) {
+ // `const { addonAPI: api } = window`
+ if (GLOBAL_NAMES.has(d.object) && entry.key === API_OBJECT && entry.local && !apiRefs.has(entry.local)) {
+ apiRefs.add(entry.local);
+ pending.push(entry.local);
+ } else if (entry.rest) {
+ // `const { ...rest } = addonAPI`
+ bind(d.object, entry.rest, false);
+ }
+ }
+ }
+
+ while (pending.length) {
+ for (const { name, checked } of boundTo.get(pending.pop()) ?? []) {
+ if (apiRefs.has(name) || (checked && (assignments.get(name) ?? 0) > 1)) continue;
+ apiRefs.add(name);
+ pending.push(name);
+ }
+ }
+
+ // Names that hold one namespace of the API: `const buckets =
+ // addonAPI.buckets;` and `const { buckets: b } = addonAPI;`.
+ const holders = new Map();
+ const hold = (name, ns) => {
+ if (!holders.has(name)) holders.set(name, new Set());
+ holders.get(name).add(ns);
+ };
+
+ // One pass over the text finds every `.`, whatever the
+ // alias; the alias is then looked up, instead of one pass per alias.
+ const memberPattern = new RegExp(String.raw`${REFERENCE}(${NAME})${MEMBER_ACCESS}`, 'g');
+
+ for (const match of matchesWhere(memberPattern, text, m => apiRefs.has(m[1]))) {
+ const member = match[2] || match[3];
+ const end = match.index + match[0].length;
+
+ if (!namespaces.includes(member)) {
+ // A property of the API object that is not a namespace. It is
+ // either a root method — `parseError`, `invoke`, `init` — or a
+ // name that does not exist, and it may still be followed by a
+ // method: `addonAPI.vault.getBoxes()` is a namespace that is not
+ // there, not a root call.
+ CONTINUED_MEMBER.lastIndex = end;
+ const continued = CONTINUED_MEMBER.exec(text);
+
+ if (continued) {
+ record(member, continued[1] || continued[2], match.index);
+ continue;
+ }
+
+ OPEN_CALL.lastIndex = end;
+ if (OPEN_CALL.test(text)) record('', member, match.index, true);
+ continue;
+ }
+
+ const before = text.slice(Math.max(0, match.index - 120), match.index);
+ const bound = before.match(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*$/);
+ if (bound) hold(bound[1], member);
+ }
+
+ // `addonAPI..`, in one pass for every alias.
+ if (namespaces.length) {
+ const methodPattern = new RegExp(String.raw`${REFERENCE}(${NAME})${MEMBER_ACCESS}${MEMBER_ACCESS}`, 'g');
+ const isNamespaceCall = m => apiRefs.has(m[1]) && namespaces.includes(m[2] || m[3]);
+
+ for (const match of matchesWhere(methodPattern, text, isNamespaceCall)) {
+ record(match[2] || match[3], match[4] || match[5], match.index);
+ }
+ }
+
+ // Destructuring binds names without a member access, so the patterns
+ // above never see them.
+ for (const d of destructurings) {
+ if (GLOBAL_NAMES.has(d.object) && !d.namespace) continue;
+
+ if (d.namespace) {
+ // `const { list, get: g } = addonAPI.agents`
+ if (!apiRefs.has(d.object) || !namespaces.includes(d.namespace)) continue;
+ for (const entry of d.entries) if (entry.key) record(d.namespace, entry.key, d.index);
+ continue;
+ }
+
+ if (!apiRefs.has(d.object)) continue;
+
+ // `const { agents, buckets: b, files: { read } } = addonAPI`
+ for (const entry of d.entries) {
+ if (!entry.key || !namespaces.includes(entry.key)) continue;
+
+ if (entry.nested !== undefined) {
+ for (const inner of parseDestructuring(entry.nested)) if (inner.key) record(entry.key, inner.key, d.index);
+ continue;
+ }
+
+ hold(entry.local, entry.key);
+ }
+ }
+
+ // `.` for every variable that holds a namespace.
+ if (holders.size) {
+ const useOf = new RegExp(String.raw`(?=[A-Za-z_$])(? holders.has(m[1]))) {
+ for (const ns of holders.get(use[1])) record(ns, use[2] || use[3], use.index);
+ }
+ }
+
+ // What the scan could not read, with where, so the caller can say so.
+ const sourceStarts = lineStarts(file.source);
+ const reportedLimits = new Set();
+
+ for (const { kind, index } of limits) {
+ const line = lineNumber(sourceStarts, index);
+ if (reportedLimits.has(`${kind}|${line}`)) continue;
+ reportedLimits.add(`${kind}|${line}`);
+ options.onLimit?.({ file: relative, line, kind });
+ }
+ }
+
+ return calls;
+}
+
+/**
+ * Find references to a global the app does not expose.
+ *
+ * @param {{ file: string, source: string }[]} files The add-on's source files.
+ * @returns {{ file: string, line: number, name: string }[]}
+ */
+export function scanUnknownGlobalsInFiles(files) {
+ const found = [];
+
+ for (const file of files) {
+ // Comments and string bodies are blanked first: "this replaced
+ // window.mosaicAPI", in a comment or a message, is not a use of it.
+ const text = normalizeSource(file.source);
+
+ WRONG_GLOBAL_PATTERN.lastIndex = 0;
+ const starts = lineStarts(text);
+ const seen = new Set();
+ let match;
+
+ while ((match = WRONG_GLOBAL_PATTERN.exec(text)) !== null) {
+ // One finding per name and line: a minified file with thousands of
+ // uses on one line is one problem, not thousands of messages.
+ const line = lineNumber(starts, match.index);
+ if (seen.has(`${match[1]}|${line}`)) continue;
+ seen.add(`${match[1]}|${line}`);
+ found.push({ name: match[1], file: file.file, line });
+ }
+ }
+
+ return found;
+}
+
+/**
+ * Find every API namespace the source mentions, however it is reached.
+ *
+ * This is deliberately broader than `scanApiCallsInFiles`: it does not need
+ * to resolve where the API object came from, only that a namespace name is
+ * used as a property. It exists so a permission check can be conservative —
+ * an add-on that reaches the API through a React state variable the
+ * scanner cannot follow still gets the benefit of the doubt.
+ *
+ * @param {{ file: string, source: string }[]} files The add-on's source files.
+ * @param {string[]} namespaces The namespace names to look for.
+ * @returns {Set}
+ */
+export function scanMentionedNamespacesInFiles(files, namespaces) {
+ const mentioned = new Set();
+ if (!Array.isArray(namespaces) || !namespaces.length) return mentioned;
+
+ const pattern = new RegExp(
+ String.raw`\.\s*(${namespaces.join('|')})\b`,
+ 'g'
+ );
+
+ for (const file of files) {
+ const text = blankComments(file.source);
+ pattern.lastIndex = 0;
+ let match;
+
+ while ((match = pattern.exec(text)) !== null) {
+ mentioned.add(match[1]);
+ }
+ }
+
+ return mentioned;
+}
+
+/**
+ * The namespaces whose APIs require a given permission.
+ *
+ * @param {string} permission
+ * @returns {string[]}
+ */
+function namespacesForPermission(permission) {
+ const namespaces = new Set();
+ const index = exposedMethods();
+
+ for (const [key, detail] of index.entries()) {
+ if (detail.permission !== permission) continue;
+ namespaces.add(key.slice(0, key.lastIndexOf('.')));
+ }
+
+ return [...namespaces];
+}
+
+/**
+ * The highest release floor among the calls an add-on makes.
+ *
+ * @param {{ ns: string, method: string }[]} calls
+ * @returns {{ version: string, call: { ns: string, method: string } }|null}
+ */
+function highestFloor(calls) {
+ let best = null;
+
+ for (const call of calls) {
+ const floor = surfaceReleaseFloor(call.ns, call.method);
+ if (!floor) continue;
+
+ if (!best || semver.gt(floor, best.version)) {
+ best = { version: floor, call };
+ }
+ }
+
+ return best;
+}
+
+/**
+ * The checks themselves. `checkAddonCapabilitiesInFiles` wraps it so an
+ * unexpected failure is reported as a finding instead of escaping as an
+ * exception. Check an add-on's capabilities against the official add-on surface.
+ *
+ * @param {{ file: string, source: string }[]} files The add-on's source files.
+ * @param {object} manifest The parsed manifest.
+ * @returns {{ errors: string[], warnings: string[], checks: string[], calls: object[] }}
+ */
+function runCapabilityChecks(files, manifest) {
+ const errors = [];
+ const warnings = [];
+ const checks = [];
+
+ // Bail out honestly when the surface is unusable.
+ if (!SURFACE_IS_VALID) {
+ return {
+ errors: ['The pinned Mosaic add-on surface is invalid, so capabilities cannot be validated:', ...SURFACE_ERRORS],
+ warnings: [],
+ checks: [],
+ calls: []
+ };
+ }
+
+ const revision = ADDON_SURFACE?.app?.describe ?? 'the pinned Mosaic Companion version';
+ const exposed = exposedMethods();
+ const internal = internalMethods();
+ const roots = rootMembers();
+ const icons = renderableIcons();
+ const fallback = iconFallback();
+
+ // ── 1. the icon must be one the app renders ─────────────────────────────
+ const icon = manifest?.tab?.icon;
+
+ if (typeof icon === 'string' && icon && icons.length) {
+ if (icons.includes(icon)) {
+ checks.push(`tab.icon "${icon}" is one of the ${icons.length} icons Mosaic renders.`);
+ } else {
+ const fallbackMsg = fallback
+ ? ` (the app falls back to "${fallback}")`
+ : ' (the app uses its default fallback)';
+ errors.push(
+ `tab.icon "${icon}" is not an icon Mosaic renders. The app keeps a ` +
+ `curated set of ${icons.length} names${fallbackMsg}, so this icon will never appear. ` +
+ `Valid names: ${icons.join(', ')}.`
+ );
+ }
+ }
+
+ // ── 2. every API call must exist ────────────────────────────────────────
+ const calls = scanApiCallsInFiles(files, {
+ namespaces: namespaceNames(),
+ // Code the scanner could not read is code whose API calls are unknown.
+ // Approving it would let an add-on hide a call behind an oversized
+ // construct, so it is an error, not a warning.
+ onLimit: ({ file, line, kind }) => errors.push(
+ `${file}:${line} contains ${kind}, which the capability scanner does not read, ` +
+ 'so the API calls after it cannot be verified. Split or simplify it.'
+ )
+ });
+
+ for (const wrong of scanUnknownGlobalsInFiles(files)) {
+ errors.push(
+ `${wrong.file}:${wrong.line} references "${wrong.name}", which Mosaic ` +
+ `does not expose. The add-on API is "window.addonAPI".`
+ );
+ }
+
+ const validCalls = [];
+
+ for (const call of calls) {
+ if (call.root) {
+ if (!roots.includes(call.method)) {
+ errors.push(
+ `${call.file}:${call.line} calls addonAPI.${call.method}(), but ` +
+ `that does not exist. Mosaic ${revision} exposes ` +
+ `addonAPI.${roots.join(', addonAPI.')} at the top level.`
+ );
+ }
+ continue;
+ }
+
+ const methodDetail = exposed.get(`${call.ns}.${call.method}`);
+
+ if (!methodDetail) {
+ // Check if it's an internal method (exists in the app but not exposed).
+ if (internal.has(`${call.ns}.${call.method}`)) {
+ errors.push(
+ `${call.file}:${call.line} calls addonAPI.${call.ns}.${call.method}(), ` +
+ `but that method is internal to Mosaic ${revision} and is not callable by add-ons.`
+ );
+ } else {
+ errors.push(
+ `${call.file}:${call.line} calls addonAPI.${call.ns}.${call.method}(), ` +
+ `but that method does not exist. Mosaic ${revision} exposes ` +
+ `addonAPI.${call.ns}.${namespaceMethods(call.ns).join(', addonAPI.' + call.ns + '.')}.`
+ );
+ }
+ continue;
+ }
+
+ validCalls.push(call);
+ }
+
+ if (calls.length) {
+ checks.push(`Found ${calls.length} API call${calls.length === 1 ? '' : 's'} in the add-on source.`);
+ }
+
+ // ── 3. minAppVersion must cover the APIs used ───────────────────────────
+ const required = highestFloor(validCalls);
+
+ if (required) {
+ const declared = manifest?.minAppVersion;
+
+ if (!declared) {
+ errors.push(
+ `minAppVersion is not declared, but the add-on calls ` +
+ `addonAPI.${required.call.ns}.${required.call.method}(), which Mosaic ` +
+ `introduced in ${required.version}. Declare minAppVersion "${required.version}" ` +
+ `or newer.`
+ );
+ } else if (semver.valid(declared) && semver.lt(declared, required.version)) {
+ errors.push(
+ `minAppVersion is "${declared}", but the add-on calls ` +
+ `addonAPI.${required.call.ns}.${required.call.method}(), which Mosaic ` +
+ `introduced in ${required.version}. Raise minAppVersion to ` +
+ `"${required.version}" or newer.`
+ );
+ } else if (semver.valid(declared)) {
+ checks.push(
+ `minAppVersion "${declared}" covers every API the add-on calls ` +
+ `(highest floor: ${required.version}).`
+ );
+ }
+ }
+
+ // ── 4. the permissions the calls require must be declared ───────────────
+//
+// The application refuses an add-on that calls an API whose permission the
+// manifest does not declare (`perm-used-undeclared` in the upstream
+// adjudicator, a blocking gate). Without this direction the Studio accepted
+// add-ons the application itself refuses: an add-on could call a
+// permission-gated API and ask for nothing.
+ const declaredPermissions = Array.isArray(manifest?.permissions) ? manifest.permissions : [];
+
+ for (const call of validCalls) {
+ const needed = surfacePermissionForCall(call.ns, call.method);
+ if (!needed) continue;
+
+ if (!declaredPermissions.includes(needed)) {
+ errors.push(
+ `${call.file}:${call.line} calls addonAPI.${call.ns}.${call.method}(), ` +
+ `which requires the "${needed}" permission. Declare it in the manifest.`
+ );
+ }
+ }
+
+// ── 5. every declared permission should be used ─────────────────────────
+ const mentionedNamespaces = scanMentionedNamespacesInFiles(files, namespaceNames());
+
+ for (const permission of declaredPermissions) {
+ const called = validCalls.some(call => {
+ const needed = surfacePermissionForCall(call.ns, call.method);
+ return needed === permission;
+ });
+
+ // The namespace counts as used even when the scanner could not resolve
+ // the call. An add-on that reaches the API through a state variable the
+ // scanner cannot follow must not be told it declares a permission it
+ // does not use — a false warning costs the author more than a missed
+ // one.
+ const mentioned = namespacesForPermission(permission).some(
+ ns => mentionedNamespaces.has(ns)
+ );
+
+ if (!called && !mentioned) {
+ warnings.push(
+ `Permission "${permission}" is declared, but no API the add-on calls ` +
+ `requires it.`
+ );
+ }
+ }
+
+ return { errors, warnings, checks, calls };
+}
+
+/**
+ * The provenance of the pinned surface, for display.
+ *
+ * @returns {{ repository: string, revision: string, commit: string, sha256: string, retrievedAt: string }}
+ */
+export function referenceProvenance() {
+ return surfaceProvenance();
+}
+
+/**
+ * Check an add-on's capabilities against the official add-on surface.
+ *
+ * Never throws: a failure inside the scanner is returned as an error, so a
+ * hostile or unusual file makes validation fail loudly instead of crashing
+ * the caller (the CLI, the local API or the in-app validator).
+ *
+ * @param {{ file: string, source: string }[]} files The add-on's source files.
+ * @param {object} manifest The parsed manifest.
+ * @returns {{ errors: string[], warnings: string[], checks: string[], calls: object[] }}
+ */
+export function checkAddonCapabilitiesInFiles(files, manifest) {
+ try {
+ return runCapabilityChecks(files, manifest);
+ } catch (error) {
+ return {
+ errors: [`The capability scanner failed (${error?.name ?? 'Error'}: ${error?.message ?? error}); the add-on could not be checked.`],
+ warnings: [],
+ checks: [],
+ calls: []
+ };
+ }
+}
diff --git a/addons/mosaic-addon-studio/shared/license-texts.mjs b/addons/mosaic-addon-studio/shared/license-texts.mjs
new file mode 100644
index 0000000..ae27b9d
--- /dev/null
+++ b/addons/mosaic-addon-studio/shared/license-texts.mjs
@@ -0,0 +1,56 @@
+/**
+ * Complete texts of the licences the Studio can write into a new project, and
+ * the one rule that decides whether a LICENSE file is a complete licence.
+ *
+ * The texts are bundled here, as data, because a Mosaic renderer has no
+ * filesystem: the CLI and the in-Mosaic host must write the same bytes, and
+ * `scripts/license-templates/*.txt` is only read by a test that proves this
+ * module still matches it.
+ *
+ * Browser-safe: no imports, no side effects.
+ */
+
+export const APACHE_2_0 = "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n";
+
+export const GPL_3_0_OR_LATER = "GNU GENERAL PUBLIC LICENSE\nVersion 3, 29 June 2007\n\nCopyright © 2007 Free Software Foundation, Inc. \n\nEveryone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\n\nPreamble\n\nThe GNU General Public License is a free, copyleft license for software and other kinds of works.\n\nThe licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.\n\nWhen we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.\n\nTo protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.\n\nFor example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.\n\nDevelopers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.\n\nFor the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.\n\nSome devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.\n\nFinally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.\n\nThe precise terms and conditions for copying, distribution and modification follow.\n\nTERMS AND CONDITIONS\n\n0. Definitions.\n\n“This License” refers to version 3 of the GNU General Public License.\n\n“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.\n\n“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.\n\nTo “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.\n\nA “covered work” means either the unmodified Program or a work based on the Program.\n\nTo “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.\n\nTo “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.\n\nAn interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.\n\n1. Source Code.\nThe “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.\n\nA “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.\n\nThe “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.\n\nThe “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.\n\nThe Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.\n\nThe Corresponding Source for a work in source code form is that same work.\n\n2. Basic Permissions.\nAll rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.\n\nYou may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.\n\nConveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.\n\n3. Protecting Users' Legal Rights From Anti-Circumvention Law.\nNo covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.\n\nWhen you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.\n\n4. Conveying Verbatim Copies.\nYou may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.\n\nYou may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.\n\n5. Conveying Modified Source Versions.\nYou may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:\n\n a) The work must carry prominent notices stating that you modified it, and giving a relevant date.\n\n b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.\n\n c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.\n\n d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.\n\nA compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.\n\n6. Conveying Non-Source Forms.\nYou may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:\n\n a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.\n\n b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.\n\n c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.\n\n d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.\n\n e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.\n\nA separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.\n\nA “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.\n\n“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.\n\nIf you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).\n\nThe requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.\n\nCorresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.\n\n7. Additional Terms.\n“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.\n\nWhen you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.\n\nNotwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:\n\n a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or\n\n b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or\n\n c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or\n\n d) Limiting the use for publicity purposes of names of licensors or authors of the material; or\n\n e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or\n\n f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.\n\nAll other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.\n\nIf you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.\n\nAdditional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.\n\n8. Termination.\nYou may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).\n\nHowever, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.\n\nMoreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.\n\nTermination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.\n\n9. Acceptance Not Required for Having Copies.\nYou are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.\n\n10. Automatic Licensing of Downstream Recipients.\nEach time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.\n\nAn “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.\n\nYou may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.\n\n11. Patents.\nA “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.\n\nA contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.\n\nEach contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.\n\nIn the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.\n\nIf you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.\n\nIf, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.\n\nA patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.\n\nNothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.\n\n12. No Surrender of Others' Freedom.\nIf conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.\n\n13. Use with the GNU Affero General Public License.\nNotwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.\n\n14. Revised Versions of this License.\nThe Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.\n\nEach version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.\n\nIf the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.\n\nLater license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.\n\n15. Disclaimer of Warranty.\nTHERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n16. Limitation of Liability.\nIN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\n\n17. Interpretation of Sections 15 and 16.\nIf the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.\n\nEND OF TERMS AND CONDITIONS\n\nHow to Apply These Terms to Your New Programs\n\nIf you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.\n\nTo do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.\n\n \n Copyright (C) \n\n This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with this program. If not, see .\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:\n\n Copyright (C) \n This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.\n\nYou should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see .\n\nThe GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read .\n";
+
+/**
+ * The licence a LICENSE file contains, or null when it is a placeholder or an
+ * excerpt. A short pointer to a web page is not a licence: the
+ * add-on would ship without the text the licence requires.
+ *
+ * @param {string} text
+ * @returns {'MIT' | 'Apache-2.0' | 'GPL-3.0-or-later' | null}
+ */
+export function classifyLicense(text) {
+ const normalized = String(text ?? '').trim().replace(/\r\n/g, '\n');
+
+ if (!normalized || normalized.includes('CHOOSE A LICENSE') || normalized.includes('LICENSE NOT SELECTED')) {
+ return null;
+ }
+
+ if (
+ /^MIT License\b/m.test(normalized) &&
+ normalized.length >= 700 &&
+ normalized.includes('Permission is hereby granted') &&
+ normalized.includes('The above copyright notice and this permission notice') &&
+ normalized.includes('THE SOFTWARE IS PROVIDED "AS IS"')
+ ) return 'MIT';
+
+ if (
+ /^\s*Apache License\s*\r?\n\s*Version 2.0/m.test(normalized) &&
+ normalized.length >= 9000 &&
+ normalized.includes('END OF TERMS AND CONDITIONS') &&
+ normalized.includes('APPENDIX: How to apply the Apache License to your work')
+ ) return 'Apache-2.0';
+
+ if (
+ /GNU GENERAL PUBLIC LICENSE/i.test(normalized) &&
+ /Version 3/i.test(normalized) &&
+ normalized.length >= 30000 &&
+ normalized.includes('END OF TERMS AND CONDITIONS') &&
+ normalized.includes('How to Apply These Terms to Your New Programs')
+ ) return 'GPL-3.0-or-later';
+
+ return null;
+}
diff --git a/addons/mosaic-addon-studio/shared/manifest-rules.mjs b/addons/mosaic-addon-studio/shared/manifest-rules.mjs
new file mode 100644
index 0000000..06cc2ab
--- /dev/null
+++ b/addons/mosaic-addon-studio/shared/manifest-rules.mjs
@@ -0,0 +1,346 @@
+/**
+ * Mosaic manifest rules — the browser-safe half of the validator.
+ *
+ * These are the rules the Mosaic Companion runtime applies to a manifest at
+ * install time, derived from the official `addon-surface.json` artifact
+ * published by Mosaic Companion.
+ *
+ * Nothing here touches the filesystem: the function takes a parsed manifest
+ * and returns findings. That is what makes it usable from a renderer, where
+ * there is no filesystem to touch — only `window.addonAPI`.
+ *
+ * The Node-side validator (`scripts/mosaic-manifest-validator.mjs`) imports
+ * this module and adds the checks that genuinely need a disk: the LICENSE
+ * text, the package.json, whether the renderer entry was built.
+ */
+
+import semver from 'semver';
+
+/**
+ * Strict SemVer. `semver.valid` alone also accepts `v1.2.3`, `=1.2.3` and
+ * padded text; build metadata (`1.2.3+build`) is valid SemVer and stays valid.
+ */
+export const isStrictSemver = value =>
+ typeof value === 'string' && semver.valid(value) !== null && !/^[\s=v]|\s$/i.test(value);
+
+import {
+ BUCKET_ID_PATTERN,
+ BUCKET_KIND_PATTERN,
+ BUCKET_PUBLISH_METHOD,
+ ID_PATTERN,
+ IPC_NAMESPACE_PATTERN,
+ MAIN_ENTRY_ALLOWLIST,
+ MAX_BUCKET_LABEL_LENGTH,
+ MAX_BUCKET_KINDS_READ,
+ MAX_BUCKETS_PUBLISHED,
+ MAX_DESCRIPTION_LENGTH,
+ MAX_NAME_LENGTH,
+ MAX_TAB_LABEL_LENGTH,
+ PERMISSION_VOCABULARY,
+ permissionForCall,
+ RESERVED_IPC_NAMESPACES,
+ RESERVED_PERMISSIONS,
+ hasPathTraversal,
+ isAbsolutePath,
+ isObject,
+ validText,
+ BUCKET_HISTORY_VALUES,
+ RENDERABLE_ICONS,
+ ICON_FALLBACK,
+ hasSurfaceErrors,
+ surfaceErrors,
+ MANIFEST_VERSION,
+ MOUNT_POINTS,
+ UPDATE_CHECK_MODES
+} from './mosaic-schema.mjs';
+
+/**
+ * Validate a parsed manifest against the v1 schema.
+ *
+ * @param {unknown} manifest The parsed manifest.
+ * @param {string} [directoryName] The add-on directory name, when known.
+ * @returns {{ valid: boolean, errors: string[], warnings: string[] }}
+ */
+export function validateMosaicManifest(manifest, directoryName) {
+ // Bail out honestly when the pinned surface is unusable.
+ if (hasSurfaceErrors()) {
+ return {
+ valid: false,
+ errors: ['The pinned Mosaic add-on surface is invalid, so the manifest cannot be validated:', ...surfaceErrors()],
+ warnings: []
+ };
+ }
+
+ const errors = [];
+ const warnings = [];
+
+ const error = message => errors.push(message);
+
+ if (!isObject(manifest)) {
+ return {
+ valid: false,
+ errors: ['Manifest must be a JSON object.'],
+ warnings
+ };
+ }
+
+ if (manifest.manifestVersion !== MANIFEST_VERSION) {
+ error(`manifestVersion must be exactly ${MANIFEST_VERSION}.`);
+ }
+
+ if (typeof manifest.id !== 'string' || !ID_PATTERN.test(manifest.id)) {
+ error(`id must match ${ID_PATTERN.source}.`);
+ } else if (directoryName && manifest.id !== directoryName) {
+ error('Manifest ID must match the add-on directory name.');
+ }
+
+ if (!validText(manifest.name, 1, MAX_NAME_LENGTH)) {
+ error(`name must contain between 1 and ${MAX_NAME_LENGTH} characters.`);
+ }
+
+ if (!validText(manifest.description, 1, MAX_DESCRIPTION_LENGTH)) {
+ error(`description must contain between 1 and ${MAX_DESCRIPTION_LENGTH} characters.`);
+ }
+
+ if (!isStrictSemver(manifest.version)) {
+ error('version must be a valid SemVer version.');
+ }
+
+ for (const field of ['author', 'homepage']) {
+ if (manifest[field] !== undefined && typeof manifest[field] !== 'string') {
+ error(`${field} must be a string when provided.`);
+ }
+ }
+
+ if (
+ manifest.minAppVersion !== undefined &&
+ !isStrictSemver(manifest.minAppVersion)
+ ) {
+ error('minAppVersion must be a valid SemVer version.');
+ }
+
+ if (
+ typeof manifest.ipcNamespace !== 'string' ||
+ !IPC_NAMESPACE_PATTERN.test(manifest.ipcNamespace)
+ ) {
+ error(`ipcNamespace must match ${IPC_NAMESPACE_PATTERN.source}.`);
+ } else if (RESERVED_IPC_NAMESPACES.includes(manifest.ipcNamespace)) {
+ error(`ipcNamespace "${manifest.ipcNamespace}" is reserved by Mosaic.`);
+ }
+
+ if (!MOUNT_POINTS.includes(manifest.mountPoint)) {
+ error(`mountPoint must be one of: ${MOUNT_POINTS.join(', ')}.`);
+ }
+
+ if (!isObject(manifest.tab)) {
+ error('tab must be an object.');
+ } else {
+ if (!validText(manifest.tab.label, 1, MAX_TAB_LABEL_LENGTH)) {
+ error(`tab.label must contain between 1 and ${MAX_TAB_LABEL_LENGTH} characters.`);
+ }
+
+ // Icon validation against the official surface. The application accepts
+ // any non-empty icon string, so no length limit of our own.
+ if (typeof manifest.tab.icon !== 'string' || !manifest.tab.icon.length) {
+ error('tab.icon must be a non-empty icon name.');
+ } else if (!RENDERABLE_ICONS.includes(manifest.tab.icon)) {
+ const fallback = ICON_FALLBACK
+ ? ` (the app falls back to "${ICON_FALLBACK}")`
+ : ' (the app uses its default fallback)';
+ error(`tab.icon "${manifest.tab.icon}" is not a renderable icon.${fallback}`);
+ }
+
+ if (
+ manifest.tab.order !== undefined &&
+ (!Number.isInteger(manifest.tab.order))
+ ) {
+ error('tab.order must be an integer when provided.');
+ }
+
+ if (manifest.tab.deepLink !== undefined) {
+ const deepLink = manifest.tab.deepLink;
+
+ // The application requires a non-empty param, so the Studio refuses an
+ // empty one and a missing one alike.
+ if (
+ !isObject(deepLink) ||
+ typeof deepLink.param !== 'string' ||
+ !deepLink.param.length
+ ) {
+ error('tab.deepLink must be an object with a non-empty string param.');
+ }
+ }
+ }
+
+ if (
+ !isObject(manifest.renderer) ||
+ typeof manifest.renderer.entry !== 'string' ||
+ !manifest.renderer.entry.trim()
+ ) {
+ error('renderer.entry is required.');
+ } else if (
+ isAbsolutePath(manifest.renderer.entry) ||
+ hasPathTraversal(manifest.renderer.entry)
+ ) {
+ error('renderer.entry must be a safe relative path without traversal.');
+ }
+
+ if (manifest.main !== undefined) {
+ if (
+ !isObject(manifest.main) ||
+ typeof manifest.main.entry !== 'string' ||
+ !manifest.main.entry.trim()
+ ) {
+ error('main must be an object with a non-empty entry.');
+ } else if (hasPathTraversal(manifest.main.entry)) {
+ error('main.entry must not escape the add-on directory.');
+ } else if (!MAIN_ENTRY_ALLOWLIST.includes(manifest.id)) {
+ // Main-process code runs in the Mosaic main process, outside the
+ // permission model. The runtime restricts it to a reviewed allowlist
+ // keyed on add-on id, so an id outside it is refused at install time.
+ error(
+ `main.entry is reserved. The Mosaic runtime only allows main-process ` +
+ `code for reviewed add-ons (${MAIN_ENTRY_ALLOWLIST.join(', ')}), ` +
+ `because main-process code is not covered by the permission model.`
+ );
+ }
+ }
+
+ if (!Array.isArray(manifest.permissions)) {
+ error('permissions must be an array.');
+ } else {
+ for (const permission of manifest.permissions) {
+ if (typeof permission !== 'string') {
+ error('Every permission must be a string.');
+ } else if (RESERVED_PERMISSIONS.includes(permission)) {
+ error(`Permission "${permission}" is reserved and cannot be requested.`);
+ } else if (!PERMISSION_VOCABULARY.includes(permission)) {
+ error(`Unknown permission: "${permission}".`);
+ }
+ }
+
+ if (new Set(manifest.permissions).size !== manifest.permissions.length) {
+ error('permissions must not contain duplicates.');
+ }
+ }
+
+ if (manifest.buckets !== undefined) {
+ if (!isObject(manifest.buckets)) {
+ error('buckets must be an object.');
+ } else {
+ // `null` is not "absent": only a missing key defaults to an empty list.
+ const publishes = 'publishes' in manifest.buckets ? manifest.buckets.publishes : [];
+ const reads = 'reads' in manifest.buckets ? manifest.buckets.reads : [];
+
+ if (!Array.isArray(publishes) || publishes.length > MAX_BUCKETS_PUBLISHED) {
+ error(`buckets.publishes must be an array with at most ${MAX_BUCKETS_PUBLISHED} entries.`);
+ } else {
+ const ids = new Set();
+
+ for (const item of publishes) {
+ if (
+ !isObject(item) ||
+ typeof item.id !== 'string' ||
+ !BUCKET_ID_PATTERN.test(item.id) ||
+ typeof item.kind !== 'string' ||
+ !BUCKET_KIND_PATTERN.test(item.kind)
+ ) {
+ error('Each published bucket requires valid id and kind values.');
+ continue;
+ }
+
+ if (ids.has(item.id)) error(`Duplicate published bucket ID: "${item.id}".`);
+ ids.add(item.id);
+
+ if (
+ item.history !== undefined &&
+ !BUCKET_HISTORY_VALUES.includes(item.history)
+ ) {
+ error(`Bucket "${item.id}" has an invalid history value. Allowed: ${BUCKET_HISTORY_VALUES.join(', ')}.`);
+ }
+
+ if (item.label !== undefined && !validText(item.label, 1, MAX_BUCKET_LABEL_LENGTH)) {
+ error(`Each published bucket label must contain 1 to ${MAX_BUCKET_LABEL_LENGTH} characters.`);
+ }
+ }
+ }
+
+ if (!Array.isArray(reads) || reads.length > MAX_BUCKET_KINDS_READ) {
+ error(`buckets.reads must be an array with at most ${MAX_BUCKET_KINDS_READ} entries.`);
+ } else {
+ const kinds = new Set();
+
+ for (const kind of reads) {
+ if (typeof kind !== 'string' || !BUCKET_KIND_PATTERN.test(kind)) {
+ error('Each read bucket kind must be a valid identifier.');
+ continue;
+ }
+ if (kinds.has(kind)) error(`Duplicate read bucket kind: "${kind}".`);
+ kinds.add(kind);
+ }
+ }
+
+ }
+ }
+
+ // The permission that unlocks publishing is the one the application
+ // pairs with the buckets namespace, not a name typed here.
+ //
+ // The pairing is checked against a NORMALISED bucket set, not only when
+ // the manifest carries a `buckets` block. Inside that block the rule was
+ // unreachable whenever the block was absent, so an add-on could hold the
+ // publishing permission — which the application pairs with the
+ // destructive `buckets.clear` — without declaring a single bucket.
+ const publishMethodPermission = permissionForCall(
+ BUCKET_PUBLISH_METHOD.namespace,
+ BUCKET_PUBLISH_METHOD.method
+ );
+
+ const publishPermission =
+ PERMISSION_VOCABULARY.find(
+ permission => publishMethodPermission === permission
+ ) ?? null;
+
+ if (!publishPermission) {
+ // The surface publishes no permission for that method, so the rule
+ // cannot be checked — name the method, never a null permission.
+ error(
+ 'The add-on surface publishes no permission for ' +
+ `${BUCKET_PUBLISH_METHOD.namespace}.${BUCKET_PUBLISH_METHOD.method}, ` +
+ 'so the bucket publishing permission cannot be checked.'
+ );
+ } else {
+ const declaredPublishes = manifest.buckets?.publishes;
+ const hasPublishes = Array.isArray(declaredPublishes) && declaredPublishes.length > 0;
+ const hasPublishPermission =
+ Array.isArray(manifest.permissions) &&
+ manifest.permissions.includes(publishPermission);
+
+ if (hasPublishes && !hasPublishPermission) {
+ error(`Publishing buckets requires the ${publishPermission} permission.`);
+ }
+
+ if (!hasPublishes && hasPublishPermission) {
+ error(`${publishPermission} permission requires at least one published bucket.`);
+ }
+ }
+
+ if (manifest.updates !== undefined) {
+ if (
+ !isObject(manifest.updates) ||
+ (manifest.updates.checkMode !== undefined &&
+ !UPDATE_CHECK_MODES.includes(manifest.updates.checkMode))
+ ) {
+ error(`updates.checkMode must be one of: ${UPDATE_CHECK_MODES.join(', ')}.`);
+ }
+ }
+
+ if (
+ manifest.linkVisibilityToActivation !== undefined &&
+ typeof manifest.linkVisibilityToActivation !== 'boolean'
+ ) {
+ error('linkVisibilityToActivation must be a boolean.');
+ }
+
+ return { valid: errors.length === 0, errors, warnings };
+}
diff --git a/addons/mosaic-addon-studio/shared/mosaic-schema.mjs b/addons/mosaic-addon-studio/shared/mosaic-schema.mjs
new file mode 100644
index 0000000..85ca3c3
--- /dev/null
+++ b/addons/mosaic-addon-studio/shared/mosaic-schema.mjs
@@ -0,0 +1,555 @@
+/**
+ * Mosaic add-on schema — the single source of truth.
+ *
+ * Every vocabulary, pattern and limit the Studio enforces lives here. The
+ * validator, the project generator, the local API and the UI all import from
+ * this module, so they cannot disagree with each other.
+ *
+ * The application-defined values are now derived from the official
+ * `addon-surface.json` artifact published by Mosaic Companion, vendored
+ * alongside this module. The Studio-specific values (npm script allowlist,
+ * licence catalogue, update-check modes) remain hand-maintained because the
+ * artifact does not publish them.
+ *
+ * When the application updates its schema, the Studio updates by re-vendoring
+ * the artifact and running `npm run surface:verify`. The old drift-check
+ * script is replaced by the verifier.
+ *
+ * This module is deliberately dependency-free and side-effect-free: it must
+ * stay importable from a browser renderer as well as from Node, so that the
+ * same rules can run inside a Mosaic add-on.
+ */
+
+import surface from './addon-surface.json' with { type: 'json' };
+import provenance from './addon-surface.provenance.json' with { type: 'json' };
+
+// ── Schema validation helpers ────────────────────────────────────────────
+
+/** The surface schema this module understands. */
+export const SUPPORTED_SCHEMA = 1;
+
+/** Is this a non-empty array of strings? */
+function isStringArray(value) {
+ return Array.isArray(value) && value.every(item => typeof item === 'string');
+}
+
+/** Compile a published pattern into a RegExp. Returns null if it does not compile. */
+function toRegExp(pattern) {
+ if (typeof pattern !== 'string' || !pattern) return null;
+ try { return new RegExp(pattern); } catch { return null; }
+}
+
+/**
+ * Check the artifact's structure and collect every problem.
+ *
+ * @param {unknown} candidate
+ * @returns {string[]} The problems found. Empty means the surface is usable.
+ */
+export function validateSurface(candidate) {
+ const errors = [];
+
+ if (!isObject(candidate)) {
+ return ['The add-on surface is not a JSON object.'];
+ }
+
+ if (candidate.schema !== SUPPORTED_SCHEMA) {
+ errors.push(
+ `The add-on surface declares schema ${JSON.stringify(candidate.schema)}, ` +
+ `but this Studio understands schema ${SUPPORTED_SCHEMA}.`
+ );
+ return errors;
+ }
+
+ // ── the application the surface describes ─────────────────────────────────
+ if (!isObject(candidate.app)) {
+ errors.push('The add-on surface has no "app" block.');
+ } else {
+ for (const field of ['name', 'version', 'commit']) {
+ if (typeof candidate.app[field] !== 'string' || !candidate.app[field]) {
+ errors.push(`The add-on surface has no "app.${field}".`);
+ }
+ }
+ }
+
+ if (typeof candidate.sinceHorizon !== 'string' || !candidate.sinceHorizon) {
+ errors.push('The add-on surface has no "sinceHorizon".');
+ }
+
+ // ── the API surface ───────────────────────────────────────────────────────
+ if (!isObject(candidate.api)) {
+ errors.push('The add-on surface has no "api" block.');
+ } else {
+ if (!isObject(candidate.api.namespaces)) {
+ errors.push('The add-on surface has no "api.namespaces".');
+ } else {
+ for (const [namespace, spec] of Object.entries(candidate.api.namespaces)) {
+ if (!isObject(spec) || !isObject(spec.methods)) {
+ errors.push(`The namespace "${namespace}" has no "methods".`);
+ continue;
+ }
+ for (const [method, detail] of Object.entries(spec.methods)) {
+ if (!isObject(detail)) {
+ errors.push(`The method "${namespace}.${method}" has no definition.`);
+ continue;
+ }
+ if (detail.permission !== null && typeof detail.permission !== 'string') {
+ errors.push(
+ `The method "${namespace}.${method}" has a permission that is ` +
+ 'neither a string nor null.'
+ );
+ }
+ if (typeof detail.since !== 'string' || !detail.since) {
+ errors.push(`The method "${namespace}.${method}" has no release floor.`);
+ }
+ }
+ }
+ }
+
+ if (!isObject(candidate.api.members)) {
+ errors.push('The add-on surface has no "api.members".');
+ }
+
+ if (!isObject(candidate.api.internal)) {
+ errors.push('The add-on surface has no "api.internal" block.');
+ }
+ }
+
+ // ── the permission vocabularies ───────────────────────────────────────────
+ if (!isObject(candidate.permissions)) {
+ errors.push('The add-on surface has no "permissions" block.');
+ } else {
+ if (!isObject(candidate.permissions.grantable)) {
+ errors.push('The add-on surface has no "permissions.grantable".');
+ }
+ if (!isStringArray(candidate.permissions.reserved)) {
+ errors.push('The add-on surface has no "permissions.reserved" list.');
+ }
+ }
+
+ if (!isStringArray(candidate.reservedIpcNamespaces)) {
+ errors.push('The add-on surface has no "reservedIpcNamespaces" list.');
+ }
+
+ if (!isStringArray(candidate.mainEntryAllowlist)) {
+ errors.push('The add-on surface has no "mainEntryAllowlist" list.');
+ }
+
+ // ── the renderable icons ──────────────────────────────────────────────────
+ if (!isObject(candidate.tabIcons)) {
+ errors.push('The add-on surface has no "tabIcons" block.');
+ } else {
+ if (!isStringArray(candidate.tabIcons.names) || !candidate.tabIcons.names.length) {
+ errors.push('The add-on surface publishes no "tabIcons.names".');
+ }
+ if (
+ candidate.tabIcons.fallback !== null &&
+ typeof candidate.tabIcons.fallback !== 'string'
+ ) {
+ errors.push('The add-on surface has a "tabIcons.fallback" that is neither a string nor null.');
+ }
+ }
+
+ // ── the manifest rules ────────────────────────────────────────────────────
+ if (!isObject(candidate.manifest)) {
+ errors.push('The add-on surface has no "manifest" block.');
+ } else {
+ const numeric = [
+ 'manifestVersion',
+ 'maxNameLength',
+ 'maxDescriptionLength',
+ 'maxTabLabelLength',
+ 'defaultTabOrder',
+ 'maxBucketsPublished',
+ 'maxBucketKindsRead',
+ 'maxBucketLabelLength'
+ ];
+ for (const field of numeric) {
+ if (typeof candidate.manifest[field] !== 'number') {
+ errors.push(`The add-on surface has no numeric "manifest.${field}".`);
+ }
+ }
+ for (const field of ['idPattern', 'ipcNamespacePattern', 'bucketIdPattern', 'bucketKindPattern']) {
+ if (toRegExp(candidate.manifest[field]) === null) {
+ errors.push(`The add-on surface has no usable "manifest.${field}".`);
+ }
+ }
+ if (!isStringArray(candidate.manifest.mountPoints)) {
+ errors.push('The add-on surface has no "manifest.mountPoints" list.');
+ }
+ if (!isStringArray(candidate.manifest.bucketHistoryValues)) {
+ errors.push('The add-on surface has no "manifest.bucketHistoryValues" list.');
+ }
+ }
+
+ return errors;
+}
+
+/** The problems in the vendored surface, if any. */
+export const SURFACE_ERRORS = validateSurface(surface);
+
+/** Is the vendored surface usable? */
+export const SURFACE_IS_VALID = SURFACE_ERRORS.length === 0;
+
+/** The pinned surface, or null when it is unusable. */
+export const ADDON_SURFACE = SURFACE_IS_VALID ? surface : null;
+
+// ── Helper ────────────────────────────────────────────────────────────────────
+/** A regex that never matches — used when the surface is invalid so that
+ * every manifest check fails instead of silently passing. */
+const NEVER_MATCHES = /^(?!)/;
+
+/** Compile a pattern string from the artifact. Returns NEVER_MATCHES if the
+ * surface is invalid or the pattern does not compile. */
+function compilePattern(pattern) {
+ if (!SURFACE_IS_VALID) return NEVER_MATCHES;
+ if (typeof pattern !== 'string' || !pattern) return NEVER_MATCHES;
+ try { return new RegExp(pattern); } catch { return NEVER_MATCHES; }
+}
+
+/** Safe number getter — returns 0 when surface is invalid so that limits
+ * appear impossibly strict (every manifest fails) rather than infinitely
+ * permissive. */
+function safeNumber(value) {
+ return SURFACE_IS_VALID && typeof value === 'number' ? value : 0;
+}
+
+/** Safe array getter — returns [] when surface is invalid. */
+function safeArray(value) {
+ return SURFACE_IS_VALID && Array.isArray(value) ? value : [];
+}
+
+// ── Identity (from the artifact) ──────────────────────────────────────────────
+
+/** Add-on id pattern. 2–41 characters. */
+export const ID_PATTERN = compilePattern(ADDON_SURFACE?.manifest?.idPattern);
+
+/** IPC namespace pattern — published separately from the id pattern. */
+export const IPC_NAMESPACE_PATTERN = compilePattern(ADDON_SURFACE?.manifest?.ipcNamespacePattern);
+
+/** Bucket id pattern — published separately from the bucket kind pattern. */
+export const BUCKET_ID_PATTERN = compilePattern(ADDON_SURFACE?.manifest?.bucketIdPattern);
+
+/** Bucket kind pattern — published separately from the bucket id pattern. */
+export const BUCKET_KIND_PATTERN = compilePattern(ADDON_SURFACE?.manifest?.bucketKindPattern);
+
+export const MAX_NAME_LENGTH = safeNumber(ADDON_SURFACE?.manifest?.maxNameLength);
+export const MAX_DESCRIPTION_LENGTH = safeNumber(ADDON_SURFACE?.manifest?.maxDescriptionLength);
+export const MAX_TAB_LABEL_LENGTH = safeNumber(ADDON_SURFACE?.manifest?.maxTabLabelLength);
+export const MAX_BUCKET_LABEL_LENGTH = safeNumber(ADDON_SURFACE?.manifest?.maxBucketLabelLength);
+export const MAX_BUCKETS_PUBLISHED = safeNumber(ADDON_SURFACE?.manifest?.maxBucketsPublished);
+export const MAX_BUCKET_KINDS_READ = safeNumber(ADDON_SURFACE?.manifest?.maxBucketKindsRead);
+
+/** The only manifest version this runtime accepts. */
+export const MANIFEST_VERSION = safeNumber(ADDON_SURFACE?.manifest?.manifestVersion);
+
+/** The only mount point in v1. */
+export const MOUNT_POINTS = safeArray(ADDON_SURFACE?.manifest?.mountPoints);
+
+/** Default tab order when the manifest omits one. */
+export const DEFAULT_TAB_ORDER = safeNumber(ADDON_SURFACE?.manifest?.defaultTabOrder);
+
+/** Allowed bucket history values (for the bucket.kind field). */
+export const BUCKET_HISTORY_VALUES = safeArray(ADDON_SURFACE?.manifest?.bucketHistoryValues);
+
+// ── Reserved IPC namespaces (from the artifact) ────────────────────────────────
+// The runtime compares by exact match, not by prefix.
+
+export const RESERVED_IPC_NAMESPACES = reservedIpcNamespaces();
+
+// ── Permissions (from the artifact) ───────────────────────────────────────────
+// Grantable permissions are those an add-on may request. Reserved permissions
+// are refused at install time — they are not "request and be denied".
+
+export const PERMISSION_VOCABULARY = grantablePermissions();
+
+export const RESERVED_PERMISSIONS = reservedPermissions();
+
+/**
+ * The method whose permission unlocks bucket publishing.
+ *
+ * Named once so the rule that pairs a published bucket with its permission
+ * cannot drift from the method the application pairs it with.
+ */
+export const BUCKET_PUBLISH_METHOD = { namespace: 'buckets', method: 'write' };
+
+// ── Main-process entry (from the artifact) ────────────────────────────────────
+// An add-on's `main.entry` is imported into the Mosaic main process, where
+// the permission model does not apply. The runtime restricts it to a
+// one-entry allowlist, keyed on add-on id.
+
+export const MAIN_ENTRY_ALLOWLIST = mainEntryAllowlist();
+
+// ── Renderable icons (from the artifact) ──────────────────────────────────────
+
+/** The names the application's sidebar can render. */
+export const RENDERABLE_ICONS = renderableIcons();
+
+/** The fallback icon name, or null when the surface publishes none. */
+export const ICON_FALLBACK = iconFallback();
+
+
+// ── npm script names (Studio-specific — not published by the artifact) ────────
+//
+// Transcribed from `mosaic-open-platform/scripts/adjudicate/policy.mjs`
+// (ALLOWED_ADDON_SCRIPTS).
+//
+// This is an allowlist, not a denylist, and deliberately so: npm decides
+// which script names it runs on install, and for any script `X` it also runs
+// `preX` and `postX`. A denylist is a list of names npm controls, where
+// anything unlisted is safe by default — which is not true.
+//
+// A namespaced name (`test:unit`) is permitted when the segment BEFORE the
+// colon is on the list. npm has no namespaced lifecycle hooks, so nothing
+// installs, publishes or runs a script by reaching such a name. The segment
+// before the colon is what gets checked, so `pretest:unit` is refused exactly
+// like `pretest`.
+
+export const ALLOWED_ADDON_SCRIPTS = [
+ 'build',
+ 'dev',
+ 'test',
+ 'lint',
+ 'typecheck',
+ 'format',
+ 'clean',
+ 'watch',
+ 'preview',
+];
+
+/**
+ * Is this an npm script name an add-on may declare?
+ *
+ * @param {unknown} name
+ * @returns {boolean}
+ */
+export function isPermittedScriptName(name) {
+ if (typeof name !== 'string' || name === '') return false;
+ if (ALLOWED_ADDON_SCRIPTS.includes(name)) return true;
+ return ALLOWED_ADDON_SCRIPTS.includes(name.split(':')[0]);
+}
+
+// ── Update-check modes (Studio-specific — not published by the artifact) ──────
+// The application's manifest.ts defines these, but the artifact does not
+// publish them. They are hand-maintained; see docs/ADDON_SURFACE.md.
+
+export const UPDATE_CHECK_MODES = ['manual', 'automatic'];
+
+// ── Surface data accessors ────────────────────────────────────────────────────
+
+/** The methods an add-on may call, keyed `namespace.method`. */
+export function exposedMethods() {
+ const index = new Map();
+ if (!ADDON_SURFACE) return index;
+
+ for (const [namespace, spec] of Object.entries(ADDON_SURFACE.api.namespaces)) {
+ for (const [method, detail] of Object.entries(spec.methods)) {
+ index.set(`${namespace}.${method}`, {
+ permission: detail.permission ?? null,
+ since: detail.since,
+ namespace,
+ method
+ });
+ }
+ }
+ return index;
+}
+
+/** The methods the application has but does not expose to add-ons. */
+export function internalMethods() {
+ const internal = new Set();
+ if (!ADDON_SURFACE) return internal;
+ for (const key of Object.keys(ADDON_SURFACE.api.internal ?? {})) {
+ internal.add(key);
+ }
+ return internal;
+}
+
+/** The top-level members of `window.addonAPI`. */
+export function rootMembers() {
+ if (!ADDON_SURFACE) return [];
+ return Object.keys(ADDON_SURFACE.api.members ?? {});
+}
+
+/** The namespaces an add-on may reach. */
+export function namespaceNames() {
+ if (!ADDON_SURFACE) return [];
+ return Object.keys(ADDON_SURFACE.api.namespaces);
+}
+
+/** The methods of one namespace, as an add-on would write them. */
+export function namespaceMethods(namespace) {
+ if (!ADDON_SURFACE) return [];
+ const spec = ADDON_SURFACE.api.namespaces[namespace];
+ if (!spec) return [];
+ return Object.keys(spec.methods);
+}
+
+/** The permission an API call requires. */
+export function permissionForCall(namespace, method) {
+ const index = exposedMethods();
+ return index.get(`${namespace}.${method}`)?.permission ?? null;
+}
+
+/** The release floor for an API — the oldest Mosaic that has it. */
+export function releaseFloor(namespace, method) {
+ const index = exposedMethods();
+ return index.get(`${namespace}.${method}`)?.since ?? null;
+}
+
+/** The icon names the application's sidebar can render. */
+export function renderableIcons() {
+ if (!ADDON_SURFACE) return [];
+ return [...ADDON_SURFACE.tabIcons.names];
+}
+
+/** The icon the application falls back to for a name it does not know. */
+export function iconFallback() {
+ if (!ADDON_SURFACE) return null;
+ return ADDON_SURFACE.tabIcons.fallback ?? null;
+}
+
+/** The permissions an add-on may request. */
+export function grantablePermissions() {
+ if (!ADDON_SURFACE) return [];
+ return Object.keys(ADDON_SURFACE.permissions.grantable);
+}
+
+/** The permissions the application refuses outright. */
+export function reservedPermissions() {
+ if (!ADDON_SURFACE) return [];
+ return [...ADDON_SURFACE.permissions.reserved];
+}
+
+/** The IPC namespaces the application reserves for itself. */
+export function reservedIpcNamespaces() {
+ if (!ADDON_SURFACE) return [];
+ return [...ADDON_SURFACE.reservedIpcNamespaces];
+}
+
+/** The add-on ids allowed to ship main-process code. */
+export function mainEntryAllowlist() {
+ if (!ADDON_SURFACE) return [];
+ return [...ADDON_SURFACE.mainEntryAllowlist];
+}
+
+/** The manifest rules the application applies. */
+export function manifestRules() {
+ if (!ADDON_SURFACE) return {};
+ return ADDON_SURFACE.manifest;
+}
+
+/** The oldest Mosaic release the add-on bridge itself exists in. */
+export function sinceHorizon() {
+ if (!ADDON_SURFACE) return null;
+ return ADDON_SURFACE.sinceHorizon ?? null;
+}
+
+/** Where the vendored surface came from. */
+export function surfaceProvenance() {
+ const artifact = provenance?.artifact ?? {};
+ const application = provenance?.application ?? {};
+
+ return {
+ repository: artifact.repository ?? 'hypercycle-development/mosaic-open-platform',
+ path: artifact.path ?? 'scripts/adjudicate/addon-surface.json',
+ commit: artifact.commit ?? '',
+ sha256: artifact.sha256 ?? '',
+ retrievedAt: artifact.retrievedAt ?? '',
+ appVersion: application.version ?? '',
+ appCommit: application.commit ?? '',
+ appName: application.name ?? '',
+ appDescribe: application.describe ?? ''
+ };
+}
+
+/** Are there any problems with the pinned add-on surface? */
+export function hasSurfaceErrors() {
+ return SURFACE_ERRORS.length > 0;
+}
+
+/** The problems with the pinned add-on surface, if any. */
+export function surfaceErrors() {
+ return [...SURFACE_ERRORS];
+}
+
+// ── Helpers ───────────────────────────────────────────────────────────────────
+
+/**
+ * Is this a plain object (not an array, not null)?
+ *
+ * @param {unknown} value
+ * @returns {boolean}
+ */
+export function isObject(value) {
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
+}
+
+/**
+ * Is this a non-blank string whose raw length does not exceed max?
+ *
+ * The application (mosaic-companion electron/addons/manifest.ts) measures
+ * raw string length for the upper bound. This function mirrors that for
+ * the max check, but still requires at least one non-whitespace character
+ * (trimmed length >= min) as a conservative Studio-specific rule.
+ *
+ * @param {unknown} value
+ * @param {number} min
+ * @param {number} max
+ * @returns {boolean}
+ */
+export function validText(value, min, max) {
+ return (
+ typeof value === 'string' &&
+ value.trim().length >= min &&
+ value.length <= max
+ );
+}
+
+/**
+ * Does this relative path escape its own root?
+ *
+ * Rejects any path with a `..` segment, on either separator.
+ *
+ * @param {string} relPath
+ * @returns {boolean}
+ */
+export function hasPathTraversal(relPath) {
+ return String(relPath).split(/[\\/]/).some(segment => segment === '..');
+}
+
+/**
+ * Is this an absolute path? True for POSIX roots and Windows drive roots.
+ *
+ * @param {unknown} value
+ * @returns {boolean}
+ */
+export function isAbsolutePath(value) {
+ if (typeof value !== 'string') return false;
+ // POSIX root, Windows drive root (either case), UNC share or a rooted backslash.
+ return value.startsWith('/') || value.startsWith('\\') || /^[A-Za-z]:[\\/]/.test(value);
+}
+
+/**
+ * Derive an IPC namespace from an add-on id, avoiding the reserved list.
+ *
+ * The Mosaic guide advises prefixing with the id, which makes a collision
+ * very unlikely. When the id itself is reserved, the `-addon` suffix keeps
+ * the namespace distinct from the reserved one.
+ *
+ * @param {string} id
+ * @returns {string}
+ */
+export function deriveIpcNamespace(id) {
+ const trimmed = String(id ?? '').trim();
+ return RESERVED_IPC_NAMESPACES.includes(trimmed)
+ ? `${trimmed}-addon`
+ : trimmed;
+}
+
+/** The licence texts an add-on may declare, by SPDX identifier. */
+export const SUPPORTED_LICENSES = [
+ 'MIT',
+ 'Apache-2.0',
+ 'GPL-3.0-or-later',
+ 'pending',
+];
diff --git a/addons/mosaic-addon-studio/shared/starter-project.mjs b/addons/mosaic-addon-studio/shared/starter-project.mjs
new file mode 100644
index 0000000..34e8c05
--- /dev/null
+++ b/addons/mosaic-addon-studio/shared/starter-project.mjs
@@ -0,0 +1,282 @@
+/**
+ * The starter project the Studio writes for a new add-on.
+ *
+ * One generator for every place a project is born: the CLI
+ * (`scripts/addon-tools.mjs`), the in-Mosaic host (`src/host.js`) and the
+ * builder's live preview (`src/App.jsx`). They used to carry three copies
+ * that had drifted apart (the in-Mosaic host wrote an excerpt of the Apache
+ * and GPL licences that the validator refuses). The copies are gone; a test
+ * proves the three entry points now produce the same bytes.
+ *
+ * Browser-safe: no filesystem, no Node-only imports.
+ */
+
+import { APACHE_2_0, GPL_3_0_OR_LATER } from './license-texts.mjs';
+import { isStrictSemver } from './manifest-rules.mjs';
+import {
+ DEFAULT_TAB_ORDER,
+ ICON_FALLBACK,
+ ID_PATTERN,
+ MANIFEST_VERSION,
+ MAX_DESCRIPTION_LENGTH,
+ MAX_NAME_LENGTH,
+ MAX_TAB_LABEL_LENGTH,
+ MOUNT_POINTS,
+ RENDERABLE_ICONS,
+ SUPPORTED_LICENSES,
+ UPDATE_CHECK_MODES,
+ deriveIpcNamespace
+} from './mosaic-schema.mjs';
+
+/** The icon a new add-on asks for first. */
+export const PREFERRED_TAB_ICON = 'Sparkles';
+
+/**
+ * The icon a generated manifest declares.
+ *
+ * The preferred icon when the pinned surface can render it. When a future
+ * surface drops it, the surface's own fallback is used, and only if that is
+ * not renderable either, the first renderable icon. The manifest validator
+ * rejects an icon that is not renderable, so a generated project must never
+ * name one.
+ *
+ * @param {string[]} [renderable] The icons the surface renders.
+ * @param {string|null} [fallback] The surface's own fallback icon.
+ * @returns {string}
+ */
+export function defaultTabIcon(renderable = RENDERABLE_ICONS, fallback = ICON_FALLBACK) {
+ if (renderable.includes(PREFERRED_TAB_ICON)) return PREFERRED_TAB_ICON;
+ if (fallback && renderable.includes(fallback)) return fallback;
+ if (renderable.length) return renderable[0];
+ throw new Error('The pinned Mosaic add-on surface lists no renderable icon.');
+}
+
+// Newlines in these would break the README, the LICENSE and the manifest layout.
+const hasControlCharacters = text =>
+ [...text].some(character => {
+ const code = character.codePointAt(0);
+ // C0, DEL, C1, the line/paragraph separators, and format characters (bidi
+ // overrides, zero-width and soft hyphen) that change how a name reads.
+ return code < 32 || (code >= 127 && code <= 159) || code === 0x2028 || code === 0x2029 || /\p{Cf}/u.test(character);
+ });
+const WINDOWS_DEVICE_NAMES = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])$/;
+
+/** An http(s) URL with no whitespace in it. */
+function isHttpUrl(value) {
+ if (/\s/.test(value)) return false;
+ try {
+ return ['http:', 'https:'].includes(new URL(value).protocol);
+ } catch {
+ return false;
+ }
+}
+
+/**
+ * Trim and check what the user typed. Both entry points that create a project
+ * run it, so a project created from the renderer is held to the same rules as
+ * one created from the command line.
+ *
+ * @param {object} input
+ * @returns {{ value: object, errors: string[] }}
+ */
+export function normalizeStarterInput(input = {}) {
+ const text = (value, fallback = '') => String(value ?? fallback).trim();
+ const notText = key => input[key] !== undefined && input[key] !== null && typeof input[key] !== 'string';
+ const value = {
+ name: text(input.name),
+ id: text(input.id).toLowerCase(),
+ description: text(input.description),
+ license: text(input.license, 'pending'),
+ author: text(input.author),
+ homepage: text(input.homepage),
+ minAppVersion: text(input.minAppVersion)
+ };
+ const errors = [];
+
+ for (const key of ['name', 'id', 'description', 'license', 'author', 'homepage', 'minAppVersion']) {
+ if (notText(key)) errors.push(`${key} must be a string.`);
+ }
+
+ for (const key of ['name', 'description', 'author']) {
+ if (hasControlCharacters(value[key])) errors.push(`${key} must not contain control characters.`);
+ }
+
+ if (WINDOWS_DEVICE_NAMES.test(value.id)) {
+ errors.push(`ID "${value.id}" is a reserved device name on Windows and cannot be a folder.`);
+ }
+
+ if (!value.name || value.name.length > MAX_NAME_LENGTH) {
+ errors.push(`Add-on name must contain between 1 and ${MAX_NAME_LENGTH} characters.`);
+ }
+ if (!ID_PATTERN.test(value.id)) {
+ errors.push('Invalid ID. Use 2–41 lowercase characters, numbers and hyphens; start with a letter.');
+ }
+ if (!value.description || value.description.length > MAX_DESCRIPTION_LENGTH) {
+ errors.push(`Description must contain between 1 and ${MAX_DESCRIPTION_LENGTH} characters.`);
+ }
+ if (!SUPPORTED_LICENSES.includes(value.license)) {
+ errors.push('Unsupported license selection.');
+ }
+ if (value.author.length > 100) {
+ errors.push('Author must contain at most 100 characters.');
+ }
+ if (value.homepage && !isHttpUrl(value.homepage)) {
+ errors.push('Homepage must be an http or https URL.');
+ }
+ if (value.minAppVersion && !isStrictSemver(value.minAppVersion)) {
+ errors.push('Minimum app version must be a valid SemVer version.');
+ }
+
+ return { value, errors };
+}
+
+/**
+ * The manifest of a new add-on. Input is trimmed, not otherwise judged: call
+ * `normalizeStarterInput` first when it has not been checked.
+ *
+ * @param {object} input
+ * @returns {object}
+ */
+export function buildStarterManifest(input) {
+ const { name, id, description, author, homepage, minAppVersion } = normalizeStarterInput(input).value;
+
+ return {
+ manifestVersion: MANIFEST_VERSION,
+ id,
+ name,
+ version: '0.1.0',
+ description,
+ ...(author ? { author } : {}),
+ ...(homepage ? { homepage } : {}),
+ ...(minAppVersion ? { minAppVersion } : {}),
+ ipcNamespace: deriveIpcNamespace(id),
+ mountPoint: MOUNT_POINTS[0],
+ tab: {
+ label: name.slice(0, MAX_TAB_LABEL_LENGTH),
+ icon: defaultTabIcon(),
+ order: DEFAULT_TAB_ORDER
+ },
+ renderer: {
+ entry: 'renderer/index.html'
+ },
+ permissions: [],
+ updates: {
+ checkMode: UPDATE_CHECK_MODES[0]
+ },
+ linkVisibilityToActivation: true,
+ buckets: {
+ publishes: [],
+ reads: []
+ }
+ };
+}
+
+/** Escape text for an HTML text node or attribute. */
+export function escapeHtml(value) {
+ return String(value ?? '').replace(/[&<>"']/g, character => ({
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+ })[character]);
+}
+
+/**
+ * Every file of a new add-on project, keyed by relative path.
+ *
+ * @param {object} input Already checked with `normalizeStarterInput`.
+ * @param {{ year?: number }} [options] `year` is the copyright year of the MIT text.
+ * @returns {{ id: string, name: string, license: string, manifest: object, files: Record }}
+ */
+export function buildStarterFiles(input, { year = new Date().getFullYear() } = {}) {
+ const { name, id, description, license } = normalizeStarterInput(input).value;
+ const manifest = buildStarterManifest(input);
+
+ const contents = {
+ pending: `LICENSE NOT SELECTED
+
+This is a placeholder, not a legal license.
+
+Choose and insert the complete text of a license before publishing this add-on.
+Do not distribute this placeholder as a license.
+`,
+ MIT: `MIT License
+
+Copyright (c) ${year} The ${name} authors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+`,
+ 'Apache-2.0': APACHE_2_0,
+ 'GPL-3.0-or-later': GPL_3_0_OR_LATER
+ };
+
+ const licenseText = contents[license];
+
+ const files = {
+ 'manifest.json': JSON.stringify(manifest, null, 2),
+ 'LICENSE': licenseText,
+ 'renderer/index.html': `
+
+
+
+
+
+ ${escapeHtml(name)}
+
+
+
+
+ MOSAIC ADD-ON
+ ${escapeHtml(name)}
+ ${escapeHtml(description)}
+ Starter project generated by Mosaic Add-on Studio. Review the official Mosaic documentation before publication.
+
+
+
+`,
+ 'README.md': `# ${name}
+
+${description}
+
+## Project structure
+
+- \`manifest.json\`: Mosaic Add-on Manifest v1.
+- \`renderer/index.html\`: isolated add-on renderer entry.
+- \`LICENSE\`: selected license or a placeholder requiring your decision.
+
+## Development
+
+This starter uses static HTML and does not require a build step or npm dependencies.
+
+## Before publication
+
+1. Review the manifest and requested permissions.
+2. Select and verify the complete license text.
+3. Test the add-on in the target Mosaic Companion version.
+4. Review the official submission requirements.
+5. Remember that local validation does not constitute Mosaic approval.
+`
+ };
+
+ return { id, name, license, manifest, files };
+}
diff --git a/addons/mosaic-addon-studio/src/App.css b/addons/mosaic-addon-studio/src/App.css
new file mode 100644
index 0000000..a8f5002
--- /dev/null
+++ b/addons/mosaic-addon-studio/src/App.css
@@ -0,0 +1,1758 @@
+:root {
+ font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
+ color: #e8edf8;
+ background: #0b1020;
+ font-synthesis: none;
+ text-rendering: optimizeLegibility;
+ --bg: #0b1020;
+ --sidebar: #0d1425;
+ --surface: #121c30;
+ --surface-2: #17243a;
+ --border: #263650;
+ --text: #e8edf8;
+ --muted: #8c9bb3;
+ --blue: #83b9ff;
+ --violet: #a78bfa;
+ --green: #65d6ad;
+ --red: #ff8989;
+ --amber: #f2bd75;
+}
+
+* { box-sizing: border-box; }
+
+body {
+ margin: 0;
+ min-width: 320px;
+ min-height: 100vh;
+ background: var(--bg);
+}
+
+button, input, textarea, select { font: inherit; }
+button { -webkit-tap-highlight-color: transparent; }
+button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
+ outline: 2px solid var(--blue);
+ outline-offset: 3px;
+}
+
+.studio-shell { min-height: 100vh; }
+
+/* SIDEBAR */
+
+.sidebar {
+ position: fixed;
+ inset: 0 auto 0 0;
+ z-index: 30;
+ display: flex;
+ flex-direction: column;
+ width: 252px;
+ padding: 27px 17px 18px;
+ border-right: 1px solid #202e45;
+ background: linear-gradient(180deg, #10192b 0%, #0c1424 100%);
+}
+
+.sidebar-brand {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ padding: 0 7px;
+ margin-bottom: 48px;
+}
+
+.brand-mark {
+ display: grid;
+ place-items: center;
+ width: 43px;
+ height: 43px;
+ border: 1px solid #45618b;
+ border-radius: 13px;
+ color: #a8d1ff;
+ background: linear-gradient(145deg, #243f65, #182944);
+ box-shadow: 0 5px 22px #438bdf20;
+}
+
+.brand-copy strong {
+ display: block;
+ font-size: 15px;
+ letter-spacing: 1.3px;
+ font-weight: 850;
+}
+
+.brand-copy strong span { color: #91bfff; }
+.brand-copy small {
+ display: block;
+ margin-top: 5px;
+ color: #7789a5;
+ font-size: 9px;
+ letter-spacing: 1.45px;
+}
+
+.sidebar-section-label {
+ padding: 0 12px;
+ margin-bottom: 12px;
+ color: #687c99;
+ font-size: 9px;
+ font-weight: 800;
+ letter-spacing: 1.8px;
+}
+
+.side-nav { display: grid; gap: 6px; }
+
+.nav-item {
+ display: flex;
+ align-items: center;
+ gap: 13px;
+ width: 100%;
+ padding: 12px 13px;
+ border: 1px solid transparent;
+ border-radius: 10px;
+ background: transparent;
+ color: #9aaac1;
+ text-align: left;
+ cursor: pointer;
+ font-size: 12px;
+ font-weight: 600;
+ transition: .2s ease;
+}
+
+.nav-item:hover {
+ color: #e4edfc;
+ background: #1a2940;
+}
+
+.nav-item.active {
+ border-color: #35517a;
+ color: #c4e0ff;
+ background: linear-gradient(100deg, #203c60, #192b46);
+ box-shadow: inset 3px 0 #86bfff, 0 5px 20px #00000012;
+}
+
+.nav-arrow { margin-left: auto; color: #91bfff; }
+
+.sidebar-bottom { margin-top: auto; }
+
+.sidebar-help {
+ padding: 16px;
+ border: 1px solid #2a3d5b;
+ border-radius: 13px;
+ background: linear-gradient(145deg, #192944, #131f33);
+}
+
+.help-icon {
+ display: grid;
+ place-items: center;
+ width: 32px;
+ height: 32px;
+ margin-bottom: 13px;
+ border-radius: 9px;
+ background: #29466b;
+ color: #a9d1ff;
+}
+
+.sidebar-help > strong { font-size: 12px; }
+.sidebar-help p {
+ margin: 7px 0 13px;
+ color: #91a3bd;
+ font-size: 10px;
+ line-height: 1.7;
+}
+
+.sidebar-help button {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 0;
+ border: 0;
+ background: none;
+ color: #a9ceff;
+ cursor: pointer;
+ font-size: 10px;
+ font-weight: 700;
+}
+
+.sidebar-version {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 18px 5px 0;
+ color: #71829a;
+ font-size: 10px;
+}
+
+.sidebar-version > span:last-child {
+ margin-left: auto;
+ color: #52637d;
+ font-family: monospace;
+}
+
+.version-dot, .environment-label span {
+ width: 7px;
+ height: 7px;
+ border-radius: 50%;
+ background: var(--green);
+ box-shadow: 0 0 9px #65d6ad66;
+}
+
+/* MAIN AREA */
+
+.main-area {
+ min-height: 100vh;
+ margin-left: 252px;
+}
+
+.topbar {
+ position: sticky;
+ top: 0;
+ z-index: 20;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ min-height: 69px;
+ padding: 0 38px;
+ border-bottom: 1px solid #202e45;
+ background: #0c1424ed;
+ backdrop-filter: blur(16px);
+}
+
+.breadcrumb {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ color: #7789a4;
+ font-size: 11px;
+}
+
+.breadcrumb strong { color: #e3ebf8; font-weight: 650; }
+.topbar-right { display: flex; align-items: center; gap: 18px; }
+
+.environment-label {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ color: #8293ac;
+ font-size: 9px;
+ letter-spacing: 1px;
+ font-weight: 700;
+}
+
+.api-pill {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 8px 11px;
+ border: 1px solid #34564f;
+ border-radius: 30px;
+ background: #142b2a;
+ color: #83dabc;
+ font-size: 10px;
+ font-weight: 700;
+}
+
+.api-pill.offline {
+ border-color: #65404b;
+ background: #301d29;
+ color: #ffaaaa;
+}
+
+.api-pill.checking {
+ border-color: #4a5060;
+ background: #202638;
+ color: #bac4d3;
+}
+
+.status-dot {
+ width: 7px;
+ height: 7px;
+ border-radius: 50%;
+ background: currentColor;
+ box-shadow: 0 0 8px currentColor;
+}
+
+.page-content {
+ width: min(1320px, 100%);
+ margin: 0 auto;
+ padding: 38px 42px 25px;
+}
+
+.mobile-menu-button { display: none; }
+
+/* DASHBOARD HERO */
+
+.welcome-banner {
+ position: relative;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ min-height: 310px;
+ padding: 42px 48px;
+ overflow: hidden;
+ border: 1px solid #334a70;
+ border-radius: 20px;
+ background:
+ radial-gradient(ellipse at 78% 48%, #3e4d8d48, transparent 38%),
+ linear-gradient(115deg, #1c3151 0%, #192744 50%, #24284b 100%);
+ box-shadow: 0 15px 45px #0000001c;
+}
+
+.welcome-copy { position: relative; z-index: 2; max-width: 540px; }
+
+.eyebrow {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin-bottom: 18px;
+ color: #9ecaff;
+ font-size: 9px;
+ font-weight: 800;
+ letter-spacing: 1.7px;
+}
+
+.welcome-banner h1, .page-intro h1 {
+ margin: 0;
+ color: #f2f6ff;
+ font-size: clamp(36px, 4vw, 53px);
+ font-weight: 800;
+ letter-spacing: -2.3px;
+ line-height: 1.08;
+}
+
+.welcome-banner h1 span {
+ color: #9ac8ff;
+ text-shadow: 0 4px 25px #79b7ff30;
+}
+
+.welcome-copy > p {
+ max-width: 470px;
+ margin: 17px 0 23px;
+ color: #b1bfd5;
+ font-size: 12px;
+ line-height: 1.8;
+}
+
+.welcome-button {
+ display: inline-flex;
+ align-items: center;
+ gap: 10px;
+ padding: 12px 17px;
+ border: 1px solid #a5d0ff;
+ border-radius: 9px;
+ background: #a5d0ff;
+ color: #102039;
+ cursor: pointer;
+ font-size: 11px;
+ font-weight: 800;
+ transition: .2s ease;
+}
+
+.welcome-button:hover {
+ background: #c7e3ff;
+ transform: translateY(-2px);
+}
+
+.welcome-art {
+ position: relative;
+ z-index: 1;
+ display: grid;
+ place-items: center;
+ width: 290px;
+ height: 245px;
+ margin-right: 18px;
+}
+
+.art-orbit {
+ position: absolute;
+ border: 1px solid #a6c8ff35;
+ border-radius: 50%;
+}
+
+.orbit-one { width: 220px; height: 220px; transform: rotate(-28deg) scaleY(.65); }
+.orbit-two { width: 275px; height: 165px; transform: rotate(38deg); border-color: #b6a4ff35; }
+
+.art-core {
+ display: grid;
+ place-items: center;
+ width: 112px;
+ height: 112px;
+ border: 1px solid #9cc7ff70;
+ border-radius: 31px;
+ background: linear-gradient(145deg, #486ba4, #343e77);
+ color: #d8eaff;
+ box-shadow: 0 0 70px #7b9cff55, inset 0 1px #ffffff35;
+ transform: rotate(-8deg);
+}
+
+.art-chip {
+ position: absolute;
+ display: grid;
+ place-items: center;
+ width: 42px;
+ height: 42px;
+ border: 1px solid #8eafe85c;
+ border-radius: 13px;
+ background: #263c62;
+ color: #b9d7ff;
+ box-shadow: 0 10px 25px #00000035;
+}
+
+.chip-one { top: 17px; left: 34px; }
+.chip-two { right: 18px; top: 65px; color: #9be2c7; }
+.chip-three { bottom: 14px; left: 73px; color: #c5b2ff; }
+.banner-glow { display: none; }
+
+/* SECTION HEADINGS AND CARDS */
+
+.section-heading {
+ display: flex;
+ align-items: end;
+ justify-content: space-between;
+ margin: 38px 0 17px;
+}
+
+.section-kicker {
+ color: #7794b9;
+ font-size: 9px;
+ font-weight: 800;
+ letter-spacing: 1.6px;
+}
+
+.section-heading h2 {
+ margin: 5px 0 0;
+ font-size: 21px;
+ letter-spacing: -.5px;
+}
+
+.muted-caption { color: #73849c; font-size: 10px; }
+
+.overview-grid {
+ display: grid;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: 15px;
+}
+
+.overview-card {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ min-height: 222px;
+ padding: 21px;
+ border: 1px solid #293a55;
+ border-radius: 14px;
+ background: linear-gradient(145deg, #152238, #111b2d);
+ color: var(--text);
+ text-align: left;
+ cursor: pointer;
+ transition: .22s ease;
+}
+
+.overview-card:hover {
+ border-color: #5779a8;
+ background: #1a2a43;
+ transform: translateY(-3px);
+ box-shadow: 0 12px 28px #00000020;
+}
+
+.overview-icon, .heading-icon {
+ display: grid;
+ place-items: center;
+ width: 39px;
+ height: 39px;
+ border: 1px solid #40567b;
+ border-radius: 11px;
+ background: #223a5d;
+ color: #a9d0ff;
+}
+
+.overview-icon.purple, .heading-icon.violet { background: #30264e; border-color: #514274; color: #c3aaff; }
+.overview-icon.green, .heading-icon.green { background: #183d39; border-color: #315e54; color: #8cddbd; }
+.overview-icon.blue { background: #203b59; border-color: #355b7c; color: #9ed1ff; }
+
+.card-overline {
+ margin-top: 18px;
+ color: #7e94b1;
+ font-size: 8px;
+ font-weight: 800;
+ letter-spacing: 1.4px;
+}
+
+.overview-card > strong {
+ margin-top: 7px;
+ font-size: 14px;
+}
+
+.overview-card > p {
+ margin: 8px 0 17px;
+ color: #8fa1ba;
+ font-size: 10px;
+ line-height: 1.7;
+}
+
+.card-link {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ margin-top: auto;
+ color: #a8ceff;
+ font-size: 10px;
+ font-weight: 700;
+}
+
+.dashboard-lower {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 15px;
+ margin-top: 17px;
+}
+
+.content-card {
+ min-width: 0;
+ padding: 23px;
+ border: 1px solid #293a55;
+ border-radius: 14px;
+ background: linear-gradient(145deg, #152238, #111b2d);
+}
+
+.card-heading {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ margin-bottom: 22px;
+}
+
+.card-heading h3 {
+ margin: 0;
+ color: #e7edf8;
+ font-size: 13px;
+}
+
+.card-heading p {
+ margin: 5px 0 0;
+ color: #8294ad;
+ font-size: 10px;
+}
+
+.environment-row {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ padding: 12px 0;
+ border-top: 1px solid #27364d;
+}
+
+.environment-service {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ color: #aab9ce;
+ font-size: 11px;
+}
+
+.environment-service svg { color: #829fc4; }
+
+.service-state {
+ color: #b9c4d4;
+ font-size: 10px;
+ font-weight: 700;
+}
+
+.service-state.operational { color: #81d9b9; }
+.service-state.online { color: #81d9b9; }
+.service-state.offline { color: #ff9b9b; }
+.service-state.neutral { color: #8596af; }
+
+.quick-step {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ padding: 11px 0;
+ border-top: 1px solid #27364d;
+}
+
+.quick-step > span {
+ display: grid;
+ place-items: center;
+ width: 30px;
+ height: 30px;
+ border: 1px solid #40577a;
+ border-radius: 8px;
+ background: #213651;
+ color: #a8cbf7;
+ font: 10px monospace;
+}
+
+.quick-step > div { display: grid; gap: 4px; }
+.quick-step strong { font-size: 11px; }
+.quick-step small { color: #8294ad; font-size: 9px; }
+.quick-step > svg { margin-left: auto; color: #83a4cb; }
+
+/* PAGE INTRO */
+
+.page-intro { margin: 6px 0 29px; }
+
+.page-intro .eyebrow { margin-bottom: 12px; }
+
+.page-intro h1 {
+ font-size: clamp(32px, 4vw, 42px);
+ letter-spacing: -1.6px;
+}
+
+.page-intro > p {
+ max-width: 640px;
+ margin: 12px 0 0;
+ color: #91a1b8;
+ font-size: 12px;
+ line-height: 1.8;
+}
+
+/* BUILDER */
+
+.builder-layout {
+ display: grid;
+ grid-template-columns: minmax(0, 1.35fr) minmax(300px, .85fr);
+ align-items: start;
+ gap: 18px;
+}
+
+.builder-card { padding: 27px; }
+
+.form-section-label {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ margin: 28px 0 17px;
+ color: #91a5c0;
+ font-size: 9px;
+ font-weight: 800;
+ letter-spacing: 1.5px;
+}
+
+.form-section-label > span {
+ display: grid;
+ place-items: center;
+ width: 25px;
+ height: 25px;
+ border: 1px solid #3c5b82;
+ border-radius: 7px;
+ background: #1d3554;
+ color: #9cc9ff;
+ font: 10px monospace;
+}
+
+.builder-card label, .validator-card label {
+ display: block;
+ margin: 17px 0 8px;
+ color: #d5dfed;
+ font-size: 11px;
+ font-weight: 700;
+}
+
+.required { color: #91bfff; }
+
+.optional { color: #6f819b; font-weight: 600; }
+
+.builder-card input, .builder-card textarea, .builder-card select,
+.validator-card input {
+ display: block;
+ width: 100%;
+ min-height: 43px;
+ padding: 11px 13px;
+ border: 1px solid #344762;
+ border-radius: 9px;
+ outline: none;
+ background: #0d1728;
+ color: #e8effa;
+ font-size: 11px;
+ transition: .2s ease;
+}
+
+.builder-card textarea {
+ min-height: 105px;
+ resize: vertical;
+ line-height: 1.7;
+}
+
+.builder-card input:focus, .builder-card textarea:focus,
+.builder-card select:focus, .validator-card input:focus {
+ border-color: #80b9ff;
+ box-shadow: 0 0 0 3px #80b9ff18;
+}
+
+.builder-card input::placeholder, .builder-card textarea::placeholder,
+.validator-card input::placeholder { color: #64758d; }
+
+.builder-card input.input-error { border-color: #d87575; }
+
+.input-meta {
+ display: flex;
+ justify-content: space-between;
+ gap: 10px;
+ margin-top: 7px;
+ color: #7588a2;
+ font-size: 9px;
+ line-height: 1.6;
+}
+
+.license-label { margin-top: 30px; }
+
+.license-note {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin-top: 10px;
+ color: #86bda9;
+ font-size: 10px;
+}
+
+.field-feedback {
+ display: flex;
+ align-items: center;
+ gap: 7px;
+ margin-top: 10px;
+ font-size: 10px;
+ line-height: 1.6;
+}
+
+.field-feedback.error { color: #ff9e9e; }
+
+.builder-actions {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ margin-top: 27px;
+}
+
+.primary-button, .outline-button, .subtle-button {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ gap: 9px;
+ min-height: 42px;
+ padding: 11px 15px;
+ border-radius: 9px;
+ cursor: pointer;
+ font-size: 10px;
+ font-weight: 800;
+ transition: .2s ease;
+}
+
+.primary-button {
+ border: 1px solid #8ebfff;
+ background: linear-gradient(110deg, #a4ceff, #83b8f5);
+ color: #10213a;
+ box-shadow: 0 5px 18px #78b3f526;
+}
+
+.primary-button:hover:not(:disabled) {
+ background: #c0dfff;
+ transform: translateY(-1px);
+}
+
+.primary-button:disabled {
+ opacity: .42;
+ cursor: not-allowed;
+ box-shadow: none;
+}
+
+.subtle-button {
+ border: 1px solid #344761;
+ background: transparent;
+ color: #9eafc6;
+}
+
+.subtle-button:hover { background: #1c2b41; color: #e4edf9; }
+
+.builder-aside { display: grid; gap: 15px; }
+.preview-card { padding: 20px; }
+.preview-heading { margin-bottom: 17px; }
+
+.code-window {
+ overflow: hidden;
+ border: 1px solid #2b405c;
+ border-radius: 10px;
+ background: #0a1220;
+}
+
+.code-toolbar {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ min-height: 38px;
+ padding: 0 12px;
+ border-bottom: 1px solid #263850;
+ background: #111d30;
+ color: #8ea2bf;
+ font: 9px monospace;
+}
+
+.code-dots { display: flex; gap: 5px; }
+.code-dots i { width: 7px; height: 7px; border-radius: 50%; background: #e57f7f; }
+.code-dots i:nth-child(2) { background: #e8bf72; }
+.code-dots i:nth-child(3) { background: #73c89f; }
+
+.code-toolbar > button {
+ display: grid;
+ place-items: center;
+ width: 27px;
+ height: 27px;
+ margin-left: auto;
+ border: 0;
+ border-radius: 6px;
+ background: transparent;
+ color: #9ab5d8;
+ cursor: pointer;
+}
+
+.code-toolbar > button:hover { background: #233752; }
+
+.code-window pre {
+ max-height: 490px;
+ margin: 0;
+ padding: 16px;
+ overflow: auto;
+ color: #a9d2ff;
+ font: 10px/1.85 "Cascadia Code", Consolas, monospace;
+ white-space: pre-wrap;
+ overflow-wrap: anywhere;
+}
+
+.outline-button {
+ border: 1px solid #3b5c82;
+ background: #192c45;
+ color: #b9d9ff;
+}
+
+.outline-button:hover { border-color: #80b9ff; background: #203a5a; }
+.full-button { width: 100%; margin-top: 13px; }
+
+.info-card {
+ display: flex;
+ align-items: flex-start;
+ gap: 12px;
+ padding: 17px;
+ border: 1px solid #31574f;
+ border-radius: 12px;
+ background: linear-gradient(120deg, #142c2d, #172b31);
+}
+
+.info-card-icon { color: #8adbbd; }
+.info-card strong { color: #a9e2ce; font-size: 11px; }
+.info-card p {
+ margin: 6px 0 0;
+ color: #9ebfb8;
+ font-size: 10px;
+ line-height: 1.7;
+}
+
+/* VALIDATOR */
+
+.validator-card { padding: 25px; }
+.validator-card .card-heading { margin-bottom: 23px; }
+
+.validator-input-row {
+ display: flex;
+ align-items: center;
+ gap: 11px;
+}
+
+.validator-input-row input { flex: 1; min-width: 0; }
+.validator-input-row .primary-button { flex-shrink: 0; }
+
+.results-card { margin-top: 19px; }
+.results-card.success { border-color: #356253; }
+.results-card.warning { border-color: #6b5639; }
+.results-card.error { border-color: #71434b; }
+
+.results-heading {
+ display: flex;
+ align-items: center;
+ gap: 14px;
+ margin-bottom: 23px;
+}
+
+.result-symbol {
+ display: grid;
+ place-items: center;
+ width: 45px;
+ height: 45px;
+ border-radius: 13px;
+ background: #183c35;
+ color: #8be0bd;
+}
+
+.result-symbol.warning { background: #45351f; color: #f3c17b; }
+.result-symbol.error { background: #48272e; color: #ff9d9d; }
+
+.results-heading h2 {
+ margin: 5px 0 0;
+ font-size: 16px;
+}
+
+.result-summary {
+ display: grid;
+ grid-template-columns: repeat(4, minmax(0, 1fr));
+ gap: 10px;
+ margin-bottom: 23px;
+}
+
+.result-summary > div {
+ display: grid;
+ gap: 8px;
+ min-width: 0;
+ padding: 14px;
+ border: 1px solid #2e405b;
+ border-radius: 10px;
+ background: #101b2d;
+}
+
+.result-summary span { color: #8194af; font-size: 9px; }
+.result-summary strong { color: #dfeaff; font-size: 13px; }
+
+.result-list {
+ padding: 16px 0;
+ border-top: 1px solid #293a52;
+}
+
+.result-list h3 {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin: 0 0 13px;
+ color: #dce7f6;
+ font-size: 11px;
+}
+
+.result-list h3 svg { color: #92bfff; }
+
+.result-item {
+ display: flex;
+ align-items: flex-start;
+ gap: 9px;
+ padding: 9px 11px;
+ margin-top: 6px;
+ border-radius: 7px;
+ color: #aab9cc;
+ background: #111e30;
+ font-size: 10px;
+ line-height: 1.6;
+}
+
+.result-item svg { flex-shrink: 0; margin-top: 1px; }
+.result-item.pass svg { color: #72d6ad; }
+.result-item.fail svg { color: #ff9999; }
+.result-item.warning svg { color: #efbd75; }
+
+.validation-disclaimer {
+ margin: 15px 0 0;
+ padding: 12px;
+ border: 1px solid #51452f;
+ border-radius: 8px;
+ background: #29251e;
+ color: #d2b98c;
+ font-size: 9px;
+ line-height: 1.7;
+}
+
+.validation-reference {
+ margin: 15px 0 0;
+ padding: 12px;
+ border: 1px solid #344863;
+ border-radius: 8px;
+ background: #1b2433;
+ color: #9fb8d8;
+ font-size: 9px;
+ line-height: 1.7;
+}
+
+.validation-reference strong {
+ color: #cfe0f5;
+}
+
+.empty-state {
+ display: grid;
+ justify-items: center;
+ padding: 65px 20px;
+ margin-top: 18px;
+ border: 1px dashed #344863;
+ border-radius: 14px;
+ background: #111b2d;
+ text-align: center;
+}
+
+.empty-state > div {
+ display: grid;
+ place-items: center;
+ width: 60px;
+ height: 60px;
+ border: 1px solid #3d5c80;
+ border-radius: 17px;
+ background: #1d3552;
+ color: #a8ceff;
+}
+
+.empty-state h3 { margin: 17px 0 6px; font-size: 14px; }
+.empty-state p { max-width: 360px; color: #8496af; font-size: 10px; line-height: 1.8; }
+.raw-response { color: #b8cce6; font-size: 11px; white-space: pre-wrap; }
+
+/* SETTINGS */
+
+.settings-grid {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 15px;
+}
+
+.guidance-card { min-height: 190px; }
+.guidance-card h3 { margin: 16px 0 8px; font-size: 13px; }
+.guidance-card p {
+ margin: 0 0 17px;
+ color: #93a4bb;
+ font-size: 11px;
+ line-height: 1.8;
+}
+
+/* NOTICES AND FOOTER */
+
+.inline-notice {
+ margin-top: 19px;
+ padding: 17px;
+ border: 1px solid #356253;
+ border-radius: 11px;
+ background: #142b2b;
+}
+
+.inline-notice.warning { border-color: #6b5639; background: #2c271f; }
+.inline-notice.error { border-color: #71434b; background: #302027; }
+
+.inline-notice-heading {
+ display: flex;
+ align-items: center;
+ gap: 9px;
+ color: #91dfbf;
+ font-size: 11px;
+}
+
+.inline-notice.warning .inline-notice-heading { color: #efc47f; }
+.inline-notice.error .inline-notice-heading { color: #ffaaaa; }
+
+.notice-details {
+ margin-top: 12px;
+ color: #b4c5d5;
+ font-size: 10px;
+ line-height: 1.7;
+ overflow-wrap: anywhere;
+}
+
+.notice-details p { margin: 6px 0; }
+.notice-details strong { color: #e0eafa; }
+
+.text-action {
+ display: inline-flex;
+ align-items: center;
+ gap: 7px;
+ margin-top: 8px;
+ padding: 7px 10px;
+ border: 1px solid #3a5b76;
+ border-radius: 7px;
+ background: #203c4c;
+ color: #c0e0ed;
+ cursor: pointer;
+ font-size: 10px;
+}
+
+.app-footer {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: 15px;
+ padding: 29px 2px 8px;
+ margin-top: 27px;
+ border-top: 1px solid #202e45;
+ color: #70829a;
+ font-size: 9px;
+}
+
+.app-footer > div {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ font-weight: 800;
+ letter-spacing: 1px;
+}
+
+.app-footer svg { color: #8dbdff; }
+.app-footer > div span { color: #8dbdff; }
+
+/* MOTION */
+
+.spin { animation: spin 1s linear infinite; }
+@keyframes spin { to { transform: rotate(360deg); } }
+
+/* RESPONSIVE */
+
+.mobile-overlay { display: none; }
+
+@media (max-width: 1100px) {
+ .page-content { padding: 30px 25px 22px; }
+ .topbar { padding: 0 25px; }
+ .welcome-banner { padding: 35px; }
+ .welcome-art { margin-right: 0; transform: scale(.85); }
+ .builder-layout { grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); }
+}
+
+@media (max-width: 850px) {
+ .sidebar { width: 220px; }
+ .main-area { margin-left: 220px; }
+ .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+ .overview-card:last-child { grid-column: span 2; }
+ .builder-layout { grid-template-columns: 1fr; }
+ .builder-aside { grid-template-columns: 1fr 1fr; align-items: start; }
+ .welcome-art { width: 220px; transform: scale(.75); margin-left: -25px; }
+}
+
+@media (max-width: 650px) {
+ .sidebar {
+ width: 270px;
+ transform: translateX(-105%);
+ transition: transform .25s ease;
+ box-shadow: 15px 0 45px #00000055;
+ }
+
+ .sidebar.mobile-open { transform: translateX(0); }
+ .main-area { margin-left: 0; }
+
+ .mobile-overlay {
+ position: fixed;
+ inset: 0;
+ z-index: 25;
+ display: block;
+ width: 100%;
+ height: 100%;
+ border: 0;
+ background: #030712a8;
+ }
+
+ .topbar { min-height: 62px; padding: 0 16px; gap: 12px; }
+ .mobile-menu-button {
+ display: grid;
+ place-items: center;
+ width: 35px;
+ height: 35px;
+ border: 1px solid #30425c;
+ border-radius: 8px;
+ background: #17243a;
+ color: #c5d8f1;
+ cursor: pointer;
+ }
+
+ .breadcrumb { margin-right: auto; font-size: 10px; }
+ .topbar-right { gap: 0; }
+ .environment-label { display: none; }
+ .api-pill { padding: 7px 9px; font-size: 9px; }
+
+ .page-content { padding: 23px 15px 20px; }
+ .welcome-banner { min-height: 280px; padding: 27px 23px; }
+ .welcome-banner h1 { font-size: 39px; letter-spacing: -1.7px; }
+ .welcome-copy { max-width: 100%; }
+ .welcome-copy > p { max-width: 390px; }
+ .welcome-art { position: absolute; right: -65px; bottom: -65px; opacity: .19; }
+ .section-heading { margin-top: 29px; }
+ .muted-caption { display: none; }
+ .overview-grid { grid-template-columns: 1fr; }
+ .overview-card { min-height: 185px; }
+ .overview-card:last-child { grid-column: auto; }
+ .dashboard-lower { grid-template-columns: 1fr; }
+ .builder-aside { grid-template-columns: 1fr; }
+ .settings-grid { grid-template-columns: 1fr; }
+ .result-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+ .app-footer { flex-direction: column; align-items: flex-start; }
+ .validator-input-row { align-items: stretch; flex-direction: column; }
+ .validator-input-row .primary-button { width: 100%; }
+}
+
+@media (max-width: 390px) {
+ .welcome-banner { padding: 23px 18px; }
+ .welcome-banner h1 { font-size: 34px; }
+ .content-card { padding: 18px; }
+ .builder-card { padding: 19px; }
+ .builder-actions { align-items: stretch; flex-direction: column; }
+ .builder-actions button { width: 100%; }
+ .result-summary { gap: 7px; }
+ .result-summary > div { padding: 11px; }
+}
+
+/* =========================================
+ PROJECT MANAGER
+========================================= */
+
+.projects-page {
+ display: flex;
+ flex-direction: column;
+ gap: 25px;
+ animation: projectFadeIn .3s ease;
+}
+
+@keyframes projectFadeIn {
+ from { opacity: 0; transform: translateY(7px); }
+ to { opacity: 1; transform: translateY(0); }
+}
+
+.projects-heading {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: 20px;
+}
+
+.projects-heading h2 {
+ margin: 7px 0 5px;
+ font-size: 27px;
+ letter-spacing: -1px;
+}
+
+.projects-heading .muted-caption {
+ margin: 0;
+}
+
+.project-stats {
+ display: grid;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: 16px;
+}
+
+.project-stat-card {
+ min-width: 0;
+ padding: 21px 22px;
+ background: var(--surface, #151b27);
+ border: 1px solid var(--border, rgba(255,255,255,.08));
+ border-radius: 15px;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+}
+
+.project-stat-card > span,
+.project-detail-meta span {
+ color: var(--text-muted, #929bad);
+ font-size: 12px;
+ font-weight: 500;
+}
+
+.project-stat-card strong {
+ font-size: 29px;
+ line-height: 1.1;
+ letter-spacing: -1px;
+}
+
+.project-stat-card small {
+ color: var(--text-muted, #929bad);
+ font-size: 11px;
+ line-height: 1.5;
+}
+
+.project-stat-good,
+.file-present {
+ color: #39c98a !important;
+}
+
+.project-stat-warning,
+.file-missing {
+ color: #f0ad58 !important;
+}
+
+.project-browser {
+ background: var(--surface, #151b27);
+ border: 1px solid var(--border, rgba(255,255,255,.08));
+ border-radius: 17px;
+ overflow: hidden;
+}
+
+.project-toolbar {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ padding: 17px;
+ border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
+}
+
+.project-search {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ flex: 1;
+ min-width: 0;
+ height: 42px;
+ padding: 0 13px;
+ color: var(--text-muted, #929bad);
+ background: var(--background, #0e1420);
+ border: 1px solid var(--border, rgba(255,255,255,.08));
+ border-radius: 9px;
+}
+
+.project-search input {
+ width: 100%;
+ min-width: 0;
+ color: var(--text, #f1f4f9);
+ background: transparent;
+ border: 0;
+ outline: 0;
+ font: inherit;
+ font-size: 12px;
+}
+
+.project-search input::placeholder {
+ color: var(--text-muted, #929bad);
+}
+
+.project-filter {
+ height: 42px;
+ min-width: 165px;
+ padding: 0 12px;
+ color: var(--text, #f1f4f9);
+ background: var(--background, #0e1420);
+ border: 1px solid var(--border, rgba(255,255,255,.08));
+ border-radius: 9px;
+ font: inherit;
+ font-size: 12px;
+ outline: none;
+}
+
+.project-layout {
+ display: grid;
+ grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr);
+ min-height: 390px;
+}
+
+.project-list {
+ padding: 9px;
+ border-right: 1px solid var(--border, rgba(255,255,255,.08));
+}
+
+.project-list-item {
+ width: 100%;
+ min-width: 0;
+ display: flex;
+ align-items: center;
+ gap: 11px;
+ padding: 13px 11px;
+ color: var(--text, #f1f4f9);
+ background: transparent;
+ border: 1px solid transparent;
+ border-radius: 10px;
+ text-align: left;
+ cursor: pointer;
+ transition: background .18s ease, border-color .18s ease;
+}
+
+.project-list-item:hover {
+ background: rgba(255,255,255,.035);
+}
+
+.project-list-item.selected {
+ background: rgba(103,119,255,.09);
+ border-color: rgba(123,137,255,.23);
+}
+
+.project-item-icon {
+ width: 38px;
+ height: 38px;
+ flex: 0 0 38px;
+ display: grid;
+ place-items: center;
+ color: #9ba8ff;
+ background: rgba(111,126,255,.12);
+ border-radius: 10px;
+}
+
+.project-item-icon.large {
+ width: 47px;
+ height: 47px;
+ flex-basis: 47px;
+}
+
+.project-item-copy {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ flex: 1;
+ min-width: 0;
+}
+
+.project-item-copy strong {
+ overflow: hidden;
+ font-size: 12px;
+ font-weight: 600;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.project-item-copy small {
+ overflow: hidden;
+ color: var(--text-muted, #929bad);
+ font-size: 10px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.project-status {
+ padding: 5px 8px;
+ border-radius: 20px;
+ font-size: 9px;
+ font-weight: 700;
+}
+
+.project-status.valid {
+ color: #43d49a;
+ background: rgba(57,201,138,.11);
+}
+
+.project-status.invalid {
+ color: #f0ad58;
+ background: rgba(240,173,88,.11);
+}
+
+.project-list-item > svg:last-child {
+ flex: 0 0 auto;
+ color: var(--text-muted, #929bad);
+}
+
+.project-details {
+ min-width: 0;
+ padding: 23px;
+}
+
+.project-detail-header {
+ display: flex;
+ align-items: center;
+ gap: 14px;
+ margin-bottom: 23px;
+}
+
+.project-detail-header h3 {
+ margin: 5px 0 3px;
+ font-size: 17px;
+ letter-spacing: -.3px;
+ overflow-wrap: anywhere;
+}
+
+.project-detail-header p {
+ margin: 0;
+ color: var(--text-muted, #929bad);
+ font-size: 11px;
+ overflow-wrap: anywhere;
+}
+
+.project-detail-meta {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 12px;
+ margin-bottom: 25px;
+}
+
+.project-detail-meta > div {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 13px;
+ background: var(--background, #0e1420);
+ border: 1px solid var(--border, rgba(255,255,255,.07));
+ border-radius: 10px;
+}
+
+.project-detail-meta strong {
+ font-size: 12px;
+}
+
+.project-details h4 {
+ margin: 0 0 12px;
+ font-size: 12px;
+}
+
+.project-file-list {
+ display: flex;
+ flex-direction: column;
+ gap: 0;
+}
+
+.project-issue-list {
+ display: flex;
+ flex-direction: column;
+ gap: 7px;
+ margin: 0 0 16px;
+ padding: 12px;
+ border: 1px solid rgba(240,173,88,.18);
+ border-radius: 8px;
+ background: rgba(240,173,88,.06);
+}
+
+.project-issue-list h4 {
+ margin: 0;
+ color: #e5b46f;
+ font-size: 9px;
+ letter-spacing: .14em;
+ text-transform: uppercase;
+}
+
+.project-issue {
+ display: flex;
+ align-items: flex-start;
+ gap: 8px;
+ color: #d7c3a4;
+ font-size: 10px;
+ line-height: 1.6;
+}
+
+.project-issue svg {
+ flex-shrink: 0;
+ margin-top: 1px;
+ color: #e5b46f;
+}
+
+.project-file-list > div {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ min-height: 42px;
+ border-bottom: 1px solid var(--border, rgba(255,255,255,.06));
+}
+
+.project-file-list svg {
+ color: var(--text-muted, #929bad);
+}
+
+.project-file-list > div > span:nth-child(2) {
+ flex: 1;
+ font-size: 11px;
+}
+
+.project-file-list > div > span:last-child {
+ font-size: 10px;
+ font-weight: 600;
+}
+
+.project-detail-note {
+ display: flex;
+ align-items: flex-start;
+ gap: 9px;
+ margin-top: 18px;
+ padding: 12px;
+ color: #e5b46f;
+ background: rgba(240,173,88,.07);
+ border: 1px solid rgba(240,173,88,.14);
+ border-radius: 9px;
+}
+
+.project-detail-note svg {
+ flex: 0 0 auto;
+ margin-top: 1px;
+}
+
+.project-detail-note p {
+ margin: 0;
+ color: var(--text-muted, #929bad);
+ font-size: 10px;
+ line-height: 1.6;
+}
+
+.project-validate-button {
+ width: 100%;
+ justify-content: center;
+ margin-top: 17px;
+}
+
+.project-empty {
+ padding: 35px 20px;
+ color: var(--text-muted, #929bad);
+ text-align: center;
+ font-size: 12px;
+}
+
+.project-select-prompt {
+ min-height: 320px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 12px;
+}
+
+.project-select-prompt strong {
+ color: var(--text, #f1f4f9);
+ font-size: 14px;
+}
+
+.project-select-prompt span {
+ max-width: 230px;
+ line-height: 1.6;
+}
+
+.project-error {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ margin: 15px;
+ padding: 13px;
+ color: #f0ad58;
+ background: rgba(240,173,88,.08);
+ border-radius: 9px;
+ font-size: 11px;
+}
+
+.project-error span {
+ flex: 1;
+}
+
+.project-error button {
+ color: inherit;
+ background: transparent;
+ border: 0;
+ cursor: pointer;
+ font: inherit;
+ font-weight: 700;
+}
+
+@media (max-width: 850px) {
+ .project-layout {
+ grid-template-columns: 1fr;
+ }
+
+ .project-list {
+ border-right: 0;
+ border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
+ max-height: 360px;
+ overflow-y: auto;
+ }
+}
+
+@media (max-width: 600px) {
+ .projects-heading {
+ align-items: flex-start;
+ }
+
+ .project-stats {
+ grid-template-columns: 1fr;
+ gap: 10px;
+ }
+
+ .project-stat-card {
+ padding: 16px;
+ }
+
+ .project-toolbar {
+ align-items: stretch;
+ flex-direction: column;
+ }
+
+ .project-filter {
+ width: 100%;
+ }
+
+ .project-details {
+ padding: 18px;
+ }
+
+ .project-list-item {
+ gap: 8px;
+ padding: 11px 8px;
+ }
+}
+
+/* PROJECT MANAGER - REFRESH BUTTON */
+
+.projects-heading .secondary-button {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ gap: 9px;
+ min-height: 42px;
+ padding: 10px 15px;
+ color: #b9d9ff;
+ background: #192c45;
+ border: 1px solid #3b5c82;
+ border-radius: 9px;
+ cursor: pointer;
+ font-size: 11px;
+ font-weight: 700;
+ transition: background .2s ease, border-color .2s ease, transform .2s ease;
+}
+
+.projects-heading .secondary-button:hover:not(:disabled) {
+ background: #203a5a;
+ border-color: #80b9ff;
+ transform: translateY(-1px);
+}
+
+.projects-heading .secondary-button:disabled {
+ opacity: .45;
+ cursor: not-allowed;
+}
+
+.projects-heading .secondary-button:disabled svg {
+ animation: projectRefreshSpin 1s linear infinite;
+}
+
+@keyframes projectRefreshSpin {
+ to { transform: rotate(360deg); }
+}
+
+/* SURFACE ERROR CARD */
+
+.surface-error-card {
+ border-color: #71434b;
+ background: linear-gradient(130deg, #302027, #25181f);
+}
+
+.surface-error-card h3 {
+ margin: 0 0 10px;
+ color: #ffaaaa;
+ font-size: 13px;
+}
+
+.surface-error-card > p {
+ margin: 0 0 15px;
+ color: #d8b0b0;
+ font-size: 10px;
+ line-height: 1.7;
+}
+
+.surface-error-list {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ margin-bottom: 15px;
+}
+
+.surface-error-item {
+ display: flex;
+ align-items: flex-start;
+ gap: 8px;
+ padding: 8px 10px;
+ border: 1px solid #5a3a3f;
+ border-radius: 7px;
+ background: #2a181c;
+ color: #e8b8b8;
+ font-size: 9px;
+ line-height: 1.6;
+}
+
+.surface-error-item svg {
+ flex-shrink: 0;
+ margin-top: 1px;
+ color: #f49c9c;
+}
+
+.surface-error-note {
+ margin: 0;
+ padding: 10px;
+ border: 1px solid #4a3a3f;
+ border-radius: 7px;
+ background: #251a1d;
+ color: #d8b0b0;
+ font-size: 9px;
+ line-height: 1.7;
+}
+
+.surface-error-note code {
+ background: #3a2528;
+ padding: 2px 5px;
+ border-radius: 4px;
+ color: #f5c2c2;
+}
diff --git a/addons/mosaic-addon-studio/src/App.jsx b/addons/mosaic-addon-studio/src/App.jsx
new file mode 100644
index 0000000..26d7902
--- /dev/null
+++ b/addons/mosaic-addon-studio/src/App.jsx
@@ -0,0 +1,845 @@
+import { useEffect, useMemo, useState } from 'react'
+import {
+ Blocks, LayoutDashboard, Puzzle, ShieldCheck, Settings,
+ FolderPlus, FileCode2, Copy, Check, AlertTriangle,
+ Activity, ArrowUpRight, Terminal, Sparkles, ChevronRight,
+ CircleHelp, RefreshCw, Code2, LockKeyhole, Rocket,
+ Menu, X, Clock3, Server, BadgeCheck, FolderOpen, Search
+} from 'lucide-react'
+import './App.css'
+
+import {
+ ID_PATTERN,
+ MAX_DESCRIPTION_LENGTH,
+ MAX_NAME_LENGTH,
+ hasSurfaceErrors,
+ surfaceErrors
+} from '../shared/mosaic-schema.mjs'
+import { buildStarterManifest } from '../shared/starter-project.mjs'
+import { createHost } from './host.js'
+
+const NAV_ITEMS = [
+ { id: 'dashboard', label: 'Dashboard', icon: LayoutDashboard },
+ { id: 'projects', label: 'Projects', icon: FolderOpen },
+ { id: 'builder', label: 'Add-on Builder', icon: Puzzle },
+ { id: 'validator', label: 'Validator', icon: ShieldCheck },
+ { id: 'settings', label: 'Settings', icon: Settings }
+]
+
+export default function App() {
+ // The host decides where projects live: a local service on disk, or the
+ // add-on's own data jail inside Mosaic. The rules are identical either
+ // way; only the storage differs.
+ const host = useMemo(() => createHost(), [])
+ const [activeView, setActiveView] = useState('dashboard')
+ const [mobileMenu, setMobileMenu] = useState(false)
+ const [name, setName] = useState('My Add-on')
+ const [id, setId] = useState('my-addon')
+ const [description, setDescription] = useState('A starter add-on for Mosaic Companion.')
+ const [license, setLicense] = useState('MIT')
+ const [author, setAuthor] = useState('')
+ const [homepage, setHomepage] = useState('')
+ const [minAppVersion, setMinAppVersion] = useState('')
+ const [apiStatus, setApiStatus] = useState('checking')
+ const [hostDetail, setHostDetail] = useState('')
+ const [busy, setBusy] = useState(false)
+ const [notice, setNotice] = useState(null)
+ const [copied, setCopied] = useState(false)
+ const [lastAction, setLastAction] = useState(null)
+ const [projects, setProjects] = useState([])
+ const [projectsLoading, setProjectsLoading] = useState(false)
+ const [projectsError, setProjectsError] = useState('')
+ const [projectQuery, setProjectQuery] = useState('')
+ const [projectFilter, setProjectFilter] = useState('all')
+ const [selectedProject, setSelectedProject] = useState(null)
+ const [projectsReload, setProjectsReload] = useState(0)
+
+ const validId = ID_PATTERN.test(id.trim())
+ const validName = name.trim().length > 0 && name.trim().length <= MAX_NAME_LENGTH
+ const validDescription = description.trim().length > 0 && description.trim().length <= MAX_DESCRIPTION_LENGTH
+
+ const manifest = useMemo(
+ () => buildStarterManifest({ id, name, description, author, homepage, minAppVersion }),
+ [id, name, description, author, homepage, minAppVersion]
+ )
+
+ useEffect(() => {
+ let active = true
+
+ async function checkApi() {
+ try {
+ const health = await host.health()
+ if (!health.ok) throw new Error('Host unavailable')
+ if (active) {
+ setApiStatus('online')
+ setHostDetail(health.detail || '')
+ }
+ } catch {
+ if (active) setApiStatus('offline')
+ }
+ }
+
+ checkApi()
+ const interval = window.setInterval(checkApi, 10000)
+
+ return () => {
+ active = false
+ window.clearInterval(interval)
+ }
+ }, [host])
+
+ async function sendRequest(operation, payload, action) {
+ setBusy(true)
+ setNotice(null)
+
+ try {
+ const data = await operation(payload)
+
+ const isInvalid = data.valid === false
+ setNotice({
+ type: isInvalid ? 'warning' : 'success',
+ title: isInvalid ? 'Validation completed — issues found' : action,
+ data
+ })
+ setLastAction({
+ label: action,
+ time: new Date().toLocaleTimeString()
+ })
+ setActiveView(operation === host.validateProject ? 'validator' : 'builder')
+ } catch (error) {
+ setNotice({
+ type: 'error',
+ title: error.message || 'The request failed.',
+ data: null
+ })
+ } finally {
+ setBusy(false)
+ }
+ }
+
+ function createAddon() {
+ if (!validName) {
+ setNotice({ type: 'error', title: `Name must contain between 1 and ${MAX_NAME_LENGTH} characters.`, data: null })
+ return
+ }
+ if (!validId) {
+ setNotice({ type: 'error', title: 'Use an ID starting with a lowercase letter, followed by lowercase letters, numbers or hyphens (2–41 characters).', data: null })
+ return
+ }
+ if (!validDescription) {
+ setNotice({ type: 'error', title: `Description must contain between 1 and ${MAX_DESCRIPTION_LENGTH} characters.`, data: null })
+ return
+ }
+
+ sendRequest(host.createProject, {
+ name: name.trim(),
+ id: id.trim(),
+ description: description.trim(),
+ license,
+ author: author.trim(),
+ homepage: homepage.trim(),
+ minAppVersion: minAppVersion.trim()
+ }, 'Add-on project created successfully')
+ }
+
+ function validateAddon() {
+ if (!validId) {
+ setNotice({ type: 'error', title: 'Enter a valid add-on ID before validation.', data: null })
+ return
+ }
+ sendRequest(host.validateProject, { id: id.trim() }, 'Validation completed successfully')
+ }
+
+ async function copyText(text) {
+ try {
+ await navigator.clipboard.writeText(text)
+ setCopied(true)
+ window.setTimeout(() => setCopied(false), 1800)
+ } catch {
+ setNotice({
+ type: 'error',
+ title: 'Clipboard access failed. Please copy the text manually.',
+ data: { text }
+ })
+ }
+ }
+
+ const jsonText = JSON.stringify(manifest, null, 2)
+ const validation = notice?.data
+ const validationErrors = validation?.errors || []
+ const validationWarnings = validation?.warnings || []
+ const validationChecks = validation?.checks || []
+
+
+ useEffect(() => {
+ if (activeView !== 'projects') return
+
+ let active = true
+
+ async function loadProjects() {
+ setProjectsLoading(true)
+ setProjectsError('')
+
+ try {
+ const list = await host.listProjects()
+ if (!Array.isArray(list)) {
+ throw new Error('The host returned an unexpected project list.')
+ }
+
+ if (active) {
+ setProjects(list)
+ setSelectedProject(current =>
+ list.find(project => project.folder === current?.folder) || null
+ )
+ }
+ } catch (error) {
+ if (active) setProjectsError(error.message || 'Project loading failed.')
+ } finally {
+ if (active) setProjectsLoading(false)
+ }
+ }
+
+ loadProjects()
+
+ return () => {
+ active = false
+ }
+ }, [activeView, projectsReload, host])
+
+ const filteredProjects = projects.filter(project => {
+ const query = projectQuery.trim().toLowerCase()
+ const matchesQuery = !query ||
+ [project.name, project.id, project.folder]
+ .some(value => String(value || '').toLowerCase().includes(query))
+
+ const matchesFilter =
+ projectFilter === 'all' ||
+ (projectFilter === 'valid' && project.manifestStatus === 'valid') ||
+ (projectFilter === 'invalid' && project.manifestStatus !== 'valid') ||
+ (projectFilter === 'incomplete' &&
+ (!project.renderer || !project.readme || !project.license))
+
+ return matchesQuery && matchesFilter
+ })
+
+ const validProjectCount = projects.filter(
+ project => project.manifestStatus === 'valid'
+ ).length
+
+ const invalidProjectCount = projects.length - validProjectCount
+ function navigate(view) {
+ setActiveView(view)
+ setMobileMenu(false)
+ }
+
+ const statusPill = (
+
+
+ {apiStatus === 'online'
+ ? (host.host === 'mosaic' ? 'Mosaic Connected' : 'API Connected')
+ : apiStatus === 'offline'
+ ? (host.host === 'mosaic' ? 'Mosaic Unavailable' : 'API Offline')
+ : 'Connecting...'}
+
+ )
+
+ const sidebarContent = (
+ <>
+
+
+
+ MOSAICSTUDIO
+ ADD-ON DEVELOPMENT
+
+
+
+ WORKSPACE
+
+ {NAV_ITEMS.map(item => {
+ const Icon = item.icon
+ return (
+ navigate(item.id)}
+ >
+
+ {item.label}
+ {activeView === item.id && }
+
+ )
+ })}
+
+
+
+
+
+
Need a hand?
+
Build your first Mosaic add-on with confidence.
+
navigate('settings')}>View guidance
+
+
+
+ {host.host === 'mosaic' ? 'Inside Mosaic' : 'Local environment'}
+ v0.1
+
+
+ >
+ )
+
+ return (
+
+
+
+ {mobileMenu &&
setMobileMenu(false)} aria-label="Close menu" />}
+
+
+
+ setMobileMenu(!mobileMenu)} aria-label="Toggle menu">
+ {mobileMenu ? : }
+
+
+ Workspace
+
+ {NAV_ITEMS.find(item => item.id === activeView)?.label || 'Dashboard'}
+
+
+ {host.host === 'mosaic' ? 'MOSAIC COMPANION' : 'LOCAL ENVIRONMENT'}
+ {statusPill}
+
+
+
+
+ {activeView === 'dashboard' && (
+ <>
+
+
+
YOUR DEVELOPMENT WORKSPACE
+
Build somethingremarkable.
+
Create, configure and validate Mosaic Companion add-ons in one focused workspace.
+
navigate('builder')}>
+ Create an add-on
+
+
+
+
+
+
+
+
+ OVERVIEW
+
Your workspace
+
+
Everything you need to get started
+
+
+
+ navigate('builder')}>
+
+ GET STARTED
+ Build an add-on
+ Set up your project details and generate a starter structure.
+ Open builder
+
+ navigate('validator')}>
+
+ QUALITY CHECK
+ Validate a project
+ Review manifest, license and package configuration.
+ Open validator
+
+ navigate('settings')}>
+
+ DEVELOPER INFO
+ Studio guidance
+ Understand the local workflow and project requirements.
+ Explore guidance
+
+
+
+
+
+
+
+
Environment status {host.host === 'mosaic' ? 'Running as an add-on inside Mosaic' : 'Live connection to your local services'}
+
+
+
{host.host === 'mosaic' ? 'Mosaic Companion' : 'Studio API'}
+
{apiStatus === 'online' ? (hostDetail || 'Operational') : apiStatus === 'offline' ? 'Unavailable' : 'Checking'}
+
+
+
Local-first workflow
+
Enabled
+
+
+
Last activity
+
{lastAction?.time || 'No activity yet'}
+
+
+
+
+
+
+
Getting started Your path from idea to add-on
+
+ 01 Configure Give your add-on an identity
+ 02 Generate Create your starter project
+ 03 Validate Review issues before submission
+
+
+ >
+ )}
+
+ {activeView === 'projects' && (
+
+
+
+
WORKSPACE LIBRARY
+
Your projects
+
+ Browse and inspect your locally generated Mosaic add-ons.
+
+
+
setProjectsReload(value => value + 1)}
+ disabled={projectsLoading}
+ >
+
+ {projectsLoading ? 'Refreshing...' : 'Refresh'}
+
+
+
+
+
+ Total projects
+ {projects.length}
+ Local project folders
+
+
+ Valid manifests
+ {validProjectCount}
+ Manifest structure accepted by local checks
+
+
+ Needs attention
+
+ {invalidProjectCount}
+
+ Invalid manifests
+
+
+
+
+
+
+
+ setProjectQuery(event.target.value)}
+ />
+
+
+ setProjectFilter(event.target.value)}
+ aria-label="Filter projects"
+ >
+ All projects
+ Valid manifests
+ Invalid manifests
+ Missing files
+
+
+
+ {projectsError && (
+
+
+
{projectsError}
+
setProjectsReload(value => value + 1)}>
+ Try again
+
+
+ )}
+
+ {projectsLoading && projects.length === 0 && (
+
Loading your projects...
+ )}
+
+ {!projectsLoading && !projectsError && filteredProjects.length === 0 && (
+
+ No projects match your search or filter.
+
+ )}
+
+
+
+ {filteredProjects.map(project => (
+
setSelectedProject(project)}
+ >
+
+
+
+
+ {project.name}
+ {project.id}
+
+
+ {project.manifestStatus === 'valid' ? 'Valid' : 'Invalid'}
+
+
+
+ ))}
+
+
+
+ {selectedProject ? (
+ <>
+
+
+
+
+
+
PROJECT DETAILS
+
{selectedProject.name}
+
{selectedProject.id}
+
+
+
+
+
+ Version
+ {selectedProject.version || 'Not defined'}
+
+
+ Manifest
+
+ {selectedProject.manifestStatus === 'valid'
+ ? 'Valid'
+ : 'Invalid'}
+
+
+
+
+
Project structure
+ {selectedProject.manifestIssues?.length > 0 && (
+
+
Manifest issues
+ {selectedProject.manifestIssues.map((issue, index) => (
+
+ ))}
+
+ )}
+ {selectedProject.projectIssues?.length > 0 && (
+
+
Validation issues
+ {selectedProject.projectIssues.map((issue, index) => (
+
+ ))}
+
+ )}
+
+
+
+ manifest.json
+
+ {selectedProject.manifestStatus === 'valid'
+ ? 'Detected'
+ : 'Invalid'}
+
+
+
+
+ renderer/
+
+ {selectedProject.renderer ? 'Present' : 'Missing'}
+
+
+
+
+ README.md
+
+ {selectedProject.readme ? 'Present' : 'Missing'}
+
+
+
+
+ LICENSE
+
+ {selectedProject.license ? 'Present' : 'Missing'}
+
+
+
+
+
+
+
+ These indicators describe the local inventory only.
+ They do not confirm compatibility with the official
+ Mosaic Companion runtime.
+
+
+
+
{
+ setId(selectedProject.id)
+ setNotice(null)
+ navigate('validator')
+ }}
+ >
+
+ Validate this project
+
+ >
+ ) : (
+
+
+ Select a project
+ Choose a project from the list to inspect its details.
+
+ )}
+
+
+
+
+ )}
+
+ {activeView === 'builder' && (
+ <>
+
+
+
Add-on Builder
+
Define your add-on details. Studio will generate a starter project in your local workspace.
+
+
+
+
+
+
+
Project details Start with the essentials. You can expand your add-on later.
+
+
+ 01 BASIC INFORMATION
+ Add-on name *
+ setName(e.target.value)} placeholder="e.g. Node Monitor" maxLength={MAX_NAME_LENGTH} />
+ A clear, human-readable name. {name.length}/{MAX_NAME_LENGTH}
+
+ Unique project ID *
+ setId(e.target.value)} placeholder="e.g. node-monitor" maxLength={41} spellCheck="false" />
+ Lowercase letters, numbers and hyphens. Starts with a letter. {id.length}/41
+ {!validId && Use a valid ID with 2–41 characters.
}
+
+ Description *
+
+
+
+
+
+
+
Live manifest preview Updates as you edit
+
+
+
manifest.json copyText(jsonText)} aria-label="Copy manifest">
+
{jsonText}
+
+ copyText(jsonText)}>
+ {copied ? : }
+ {copied ? 'Copied!' : 'Copy manifest JSON'}
+
+
+
+
+
+ Local-first and non-custodial Your project is generated locally. Studio does not need your wallet private keys or recovery phrase.
+
+
+
+ >
+ )}
+
+ {activeView === 'validator' && (
+ <>
+
+
PROJECT QUALITY
+
Project Validator
+
Run local checks against an existing generated add-on and review the results.
+
+
+
+
+
+
Validate an add-on Enter the project ID from your {host.host === 'mosaic' ? "Studio's data directory" : 'generated-addons directory'}.
+
+ Project ID
+
+ setId(e.target.value)} placeholder="e.g. node-monitor" maxLength={41} spellCheck="false" />
+
+ {busy ? : }
+ {busy ? 'Checking...' : 'Run validation'}
+
+
+ {host.host === 'mosaic' ? 'Validation runs in this add-on, using the same rules as the local Studio.' : 'Validation runs through your local Studio API.'} {id.length}/41
+
+
+ {notice && (
+
+
+
+ {notice.type === 'success' ?
: notice.type === 'warning' ?
:
}
+
+
VALIDATION REPORT
{notice.title}
+
+
+ {validation && (
+ <>
+
+
Manifest checks {validation.valid ? 'Passed' : 'Issues found'}
+
Publication readiness {validation.publishReady ? 'Ready' : 'Not ready'}
+
Errors {validationErrors.length}
+
Warnings {validationWarnings.length}
+
+ {validationChecks.length > 0 && Passed checks ({validationChecks.length}){validationChecks.map((item, index) =>
{item}
)}
}
+ {validationErrors.length > 0 && Errors ({validationErrors.length}){validationErrors.map((item, index) =>
)}
}
+ {validationWarnings.length > 0 && Warnings ({validationWarnings.length}){validationWarnings.map((item, index) =>
)}
}
+ {validation.reference && (
+
+ Capability checks ran against Mosaic Companion {validation.reference.appDescribe}
+ {validation.reference.appCommit ? ` (${validation.reference.appCommit.slice(0, 7)})` : ''}.
+ {validation.reference.sha256 ? ` Pinned surface SHA-256: ${validation.reference.sha256.slice(0, 12)}...` : ''}
+ The icon set, the API surface and each API's release floor are read from that pinned surface.
+
+ )}
+ Local validation is not official Mosaic approval or a guarantee of runtime compatibility.
+ >
+ )}
+ {!validation && {notice.title} }
+ {notice.data && copyText(JSON.stringify(notice.data, null, 2))}> Copy report }
+
+ )}
+
+ {!notice &&
Ready when you are Run a validation to see project checks, errors and recommendations here.
}
+ >
+ )}
+
+ {activeView === 'settings' && (
+ <>
+
+
WORKSPACE INFORMATION
+
Studio guidance
+
Understand how the local development workflow works and what to expect.
+
+ {hasSurfaceErrors() && (
+
+
+ Pinned add-on surface is invalid
+ The vendored Mosaic add-on surface cannot be used. All manifest and capability checks will fail until the surface is repaired.
+
+ {surfaceErrors().map((err, i) => (
+
+ ))}
+
+ The surface must be re-vendored from scripts/adjudicate/addon-surface.json in the official Mosaic repository; shared/addon-surface.provenance.json records which revision is pinned.
+
+ )}
+
+
{host.host === 'mosaic' ? 'Mosaic Companion' : 'Local API'} {host.host === 'mosaic' ? 'The Studio runs inside Mosaic as an add-on. Projects live in this add-on own data directory.' : 'The Studio communicates with a local API service to generate and validate add-on projects.'}
{statusPill}
+
Security first Generated code is not automatically executed. Never enter private keys, recovery phrases or wallet passwords.
+
Project output {host.host === 'mosaic' ? 'Generated add-ons are written to this add-on own data directory. They are not your working directory.' : 'Generated add-ons are written to the project generated-addons directory. Review the files before use.'}
+
Official compatibility Local validation checks known project rules. Official Mosaic compatibility requires the appropriate review and approval process.
+
+ >
+ )}
+
+ {notice && activeView !== 'validator' && (
+
+
+ {notice.type === 'error' ?
: notice.type === 'warning' ?
:
}
+
{notice.title}
+
+ {notice.data && (
+
+ {notice.data.folder &&
Project folder: {notice.data.folder}
}
+ {notice.data.files &&
Generated files: {notice.data.files.join(', ')}
}
+ {notice.data.publishReady !== undefined &&
Publication readiness: {notice.data.publishReady ? 'Ready' : 'Not ready yet'}
}
+ {notice.data.errors?.length > 0 &&
Errors: {notice.data.errors.join(' · ')}
}
+ {notice.data.warnings?.length > 0 &&
Warnings: {notice.data.warnings.join(' · ')}
}
+
+ )}
+ {notice.data && copyText(JSON.stringify(notice.data, null, 2))}> Copy response }
+
+ )}
+
+
+
+
+
+ )
+}
+
diff --git a/addons/mosaic-addon-studio/src/assets/hero.png b/addons/mosaic-addon-studio/src/assets/hero.png
new file mode 100644
index 0000000000000000000000000000000000000000..02251f4b956c55af2d76fd0788124d7eee2b45eb
GIT binary patch
literal 13057
zcmV+cGycqpP)V|)f$;Qooc7=_G
zlYe)HToTQIc!$)^+J1M1y0*T%w!p~7%ux`!eRhO?c80XDxKQ*R^lUUMnA>6NT^?feoZ8xxvP32D&s-9ow
zqjcM}eesrC)NeDmsf)*P7wJ|K!&xP%Zy4iI8lF)Tv2!reW)tCzg_1=PmOwd1SQfxa
z8;58t!=z~Ba7CYlNWVG>he8aRPY|+-JmozNhn!#9i#77Aa_Edt$ijyCWL#=~I>~2X
zZNrQ8I0=D+NWD4pq=7~(i
zhfThMNw|G>g^y9pGzxX7ZSApl@tIxFcs{p#MX{Ax&XZT+cR#U+OWc@S)pkIuI}dzu
zH?^Q=<(y&Vq-oxSLfc0Zmq81bjZWf}RnssBaD6}2g-XJHLcN_|*IOu>m|x$nbm(?E
zyNy!Zp=RroS;?Vg*kmoJYBi!n5{_^@rA!)=t#a^;N$8GL!*DsQb}`yvEuX!G@||An
znOfUZAevPrkV_qjl|<~3QRZzG&h@C9Y5z
zqpNH4xqbF_InIPh)kX}Vn^5kyed|mOuq+2>M;v~KO37a#yrEn3XDqtOl=rc6_KZ!;
zreo)DFVB4|>1Zd(bvMI%8uM;3!)YMYu&cG?(PE!B~y@3yKBMt|R
zAf=I16tFwPsl)!jDqvYkLHaAQ+f@W1m6F5aZvwhm4JL
z{_l)@b;)mDSzle2gyFP5-r1x-5X{G}ot%VyWP@vEW80!Q=f%RTfpg>B*TA^pyWYUQ
z<=xPtz}WcZ!;rFl4m1D&FFHv?K~#9!?A%+fn=lXt;9!Fc#kQ;zk~gZFsH
z8e5iu@c_pzX&qb8&Dum*oXwB+fm6l6gFfC|o*wgEiy6tw~&co
z9Vd_4)P%wP-KwQW7|lN-znGK#?N+j24U=$982myIBM+vsiKsc*@4-rwJxuAaHKna6
zT3wi!C~a4ZKH03qU}_1bKyx0&$CaK7_%Z+Kl$)fF5^op
zZApQF2TvDav!s|krTjw-8US6ep
z%!VmX4luub+fseQz_D9ATJQ?iQQwD}TZz{-yo#l12a%+7bT@E(X-hyaVS-5vuXc#^
zx^w;L21;NphGVoj*{s3f4dme0y2LC=G1-7THd`#z?;tuC{^9k(dM{Rf2GOxg7Jzho
z7nSZHl7?M9kdalX`)YgoKEfiae5+;$(OGeN1eqxrv!ZCVKyH>xiyNqfe8xzY8*7)H
zQls8KMp)F4D>ED;idMOU^^WhVF@q>ZSmeB0y~qC~|DB648hr%Sh|*T(4q|w2l?m2+
zvBVw3@7+Mz?^Yc#+se6KM;a<=(W-I>k)$-qL2V*t}VaW`;?P4)WqI%maIDq8!oUcSYAD`}wWjkSyAVsnF65#2zQ
zZ>(K*TlS(E#4y$4Zq+e^_&}d)q20hCe3!LfLYP%nQpLJ~gM6a1hJlz3)aS<9C9me|
zAcmJ#>tOwBy{HoP0Sm1&_(E+S@6
zgBIFUoei8zJmdpiq8q5=OY7t@`)JWxn_&GvKVr=Zdb_pEL_j|=?f;WK^U9Q0efd#K
z9q7SfJTl4pmA$jsZ5oK8@O9#!I3Cv-kL)<8SalSsp#dcpvJ}Nz#G6FC0%9|7Fi#8;
zGDJXtj!&GljT3*HE@0EE>G8Se&d)*nkqe}-?`3vPl&UqK?xG
z!3XJ4M-x`EuQjhBbu?ik-)rmIt=DF_N?TVMP)8Gjn)TZ2V%H|zENbeix}kOxd@0}Q
z>)HuH6Ean!uS#~4g2Ne2WsMGel|h%j9*W_quQheG^JqmKhc*RYzp0wKlGjBq2VzY_
zgOv8WC1+%W=W)k)Yp_`8kfE=uiiwOZTXi8Uj9YGr$f@yJcJ;#&-Nq~sJ7anE(@;QN
z=~br%7%7`isKStX|7!1?L(apl^QvPKlrHV4S+6tNVQ*R1iGdC~WMNE1$a+=rpQmcB
z>wxiLIBvOnm;u*;9Y!kJdy(T4lk|8>JAm(&wEsFIF1$_*{>2ZNd$V6DS=SfrGxAv0
zzKe377JI`&o9Ljr+VnS*EwehA{f&{cKZF(6*MG5!p5MvrFA3ll{fmRG*L@6^cb;o^
z3Wm8c?Sc6$`>~VEWw(c$Y?nRO;2Q$=ulpqPtM^=1IZx;@xK0PgO7rKQ^WHVLwtgUT
z%|JF{^f(VH)wLKQ%dYiu2RmchBdxL0-M?wxxul_z*{h6ZZ`>-k(vizs((vW8Lt6Z6
zY;Dt?@JWyN`O`f;&d1Mb?e%9oyRK1ql?EE5XB2(W)|D1~Rx35$H6@6)$F?)7V|zEO
zI}fu0-0}8W5=6sg$fPnZ~7=tTudl?Ecb@pxbo)vni%gP-?hL|%*?62C;x6?@E`VRnJv
z?fTb;k4x;TS7Cu-z%J}uy}e-pwpLQ17Q@4DC+FCdAmNKklG$`I_pyw7E{fYmw~{Fj
zi?6KcVy=Wrel)EB_DWO|0CKmI|13!gBV?X`Ozp7x>?6jr`>Qz=^4ea35!$*f})
zS$i+x_k+@P2q1RFUH^ZTTk7=n?cjfR>hTq3l3SY~#w+I8SSutXGyhw;Ws~=zMQ%Vc
z>$On~47Ut?P*_!TOQ&PFmLAyJieB2X4_Fd_!WxI-AY`q1Lc-oK?+qcOTzlQ?@~x@OT}*9jTVNfl@3rGvZpWI=eKg>T
zZb@6YWz)J=IhP7CF|c?G62vMEG%#U}?#86$0jR4sG~i(jRd#jmn`7b(O#?N;3a;1t
zhXLssmUwGhp79luw#(*V8WL0|8+E
z6=YZ_O@er~$LrD_PYGc(kJgB=;yw#+Z3X6LDUZ(NcwN=B-hjdiHm!JFar%m{(5bEW
z@@_VEtG$5;`EJZ|OkJ@l&G9n((w@uNFwmU%bG|s#TbcJJos!{e+bjCjrCq_}LcN!UFgKtgg7siV*7#
z!}1whTRRi*-avJPu->C}Z8EiuK$#886+H_#_!btv+rsiBbv2jAJvJ+O0{#}y(%L3H
zfjU-kq_-L@2XrL*ae{{qYJkD{@dw%*bkh2P&YS-0!Xt!PRz7KHV0+~j(t9W8lAVWR
zt@B*DgURgEz4>WuN>o?_iKcw$?k{||Pg7{Q2o4|VmJ)mg?{VQJA<}zEr^YAAS
zgGm5RT4T3p)U;yz-tfBO^kw8?IoG!IVmc+Z3m#}AOQ?5MRa>)OcU!$N^_+yK6ayn?
zK>~WK0!#ysuj^oNLakm)Zvu+J)OSubX^kv!c*xgdIvs;kln!rgG4*uZ;w0mQQO4XD
zO9P{GNdv!=cQ(CAL{S(%KtuV^zC&Q{%g)PoXnp^gn^>c*`E>$hLYg2HjnbVGtWLa{7zHdG1jT@B{|Dm16
z7K2(jsfG+m*Zxof)iXxu+!H5Mo-0$pkyV3VV4B@Qms46M
zuBxGRV@HxU7Wwx-6CB
zaU*HO<_qn$5GH>&@?nRy1{z
zkik!sLfWQ)r#75)vVwCBU*r_)Q6mp?!j85{#Xqse)ApRdE$V0%I0*~e(_{)5H)`Mk
z#rExC>yjhZxuL@|+#v4#<Axw$+VpV
zuT;!2Vww$je$DpAW`$FX_Ab|Ip%$;&T$-lW8jS~B$>G}rd>eQG+$h9lQx4Mx0w={m
zx9?T6VU`>sR}XClkAhHEShOUe8awiq
zmizhL+}5UKs3}6~It7vBTig9dfQ2Q8coo+Miiaw7n~>4ybv2Ptt0^^=VqX(t*Yya9
zr`FxxFX8(v*H=+uJ#JJWIB2A(==HDYx~^zZ2nu?2`}|Wsa*f3h3ixc+U|FDtAG$Y!
z*lc_7se5Oso-Cgqe0){{!8H4g$3<8!R<6JOurD;((({c$1(pwb>(#TT!sge@4>r2@
zVL7>U`0`nsWAYErezk4(Z!gMI2?UTo{J3Ajo(u4)KYIRd>BRcG4BoS3G0EXyEp@tw
z%P7__?A^a>Q&AKL@ayDO9D*Qkc!NHnO9l}kpp_6hXbMppYL(X1L?njdFT|-h2<_$;
zAtDZ!1Rf%|yb!qbWKd}%0b`LzBeyNy43|QO(&h2mxQLUL)|0%agVOW)6TV!&Ip^Ls
z`PG2cygM8)IecQx=Fc+nqYRo4hS^^-nM_&-y8?EJXUczP=DIw(GkTJdpEdh<_STs{
z|A)4n1GKdE=Wu!!nYoZHcUQ4S&R;oDOKX2lrkdF(mK>hz<$Pp>igjOcvoRIjlN=W8
zu8Gx5(roqn8$>gEE5vy{GiGeW8Tq{vnf3hS-V=$tZkQuftUVuU8o6k&dn=Yg3)6MOIH>nlK^-2+C6BZITr~1@So?NvG#TwL)|~=1YXGMTLpS<)ziK_CSOabe
z=cB#5)yz|@0i9dSo?*CX)}UP=s6)B+F@~Em(u@Q(I9J9i_V{LmMu8BfXYMh~*oPP+
z!3~xTv|(>|=n6ZOtT~C@V!z!w%18*8T2t6}U2S##rC)mekBql&VsBX;$~ByGE$oA9
z`0Wzq8p?R{4)$l*on;!cLa}Dh^Xe?owiQZt9nH1fxxh$pN9K%CtOw?u3>85L7rr!d
zXs)l{TZ{xXP&U8exz?9cv~dNNibOmt*K4I$?RxqIBZ0(?Mg-9FS{*9Bc49Qc1`=sIF-rye`aNT1G@4NwXcnyc@+bw_mTsR>5<
zF<2;X0QesG_pw|TonqVBhRtfqI>ty(SIu&VOXd0CrLlfp+;WH7HYjhqnu^oAY!9cB
z=B6#R?Rfz9BP`dJ=@v_?70s3HxQPk+{6Y+lM85f2NF^00*^OcM0~?JOZfR9ZPYF+#
zYSs}(_BUYV8{n@2a1hD^SV41bwmi2uztR;PeBgF1F-`9>`zoNss-@3LaF2sjl~>OaaVmp7PNp+UT`6@}gR%uzqHDVeEZ14{Yt?n%JeQm+t(1_u
zSc}oj^{b;+rlS|ME%+LjzSI&xu0Bblxo$MJ-J$kJ?Qu_XUXh}*@*-x@ny|}wVM%Lg
z3tNB`yvr*}N?ClGL;H2cglcvErIccU3(eP7>@~4nOIcI~-`P8tSQnx=jI&{9)!1}l
z;gQ%_h>ZlPSV@o@Azq1R$C6ja5!^ZGh;YRhhxs58qJWo9@Bceac&yy(pET1hnn`~7@}2L0&dfPKYs$ih7m2}R!25!(hxqA(!UIw;
zK4+~Jowy3=RNC6nE=ncU{LH5?*9@W24lacJlvCZXB$CYtE@>c+~H
zkV=(5I&gb{xn2!~f&fs2NQgAL6`p|kyt6kpWk}iVlqIp(H;ig`{_U9yxs1jzu^ETM
z7~)Rg8C-NueqTYP&U8l{DY=Y47cR
zOR@U%$KQV{mkRF|4)z9Y^t3K`@p>duY&QLUFeh6VoV`a`$U@)(z!-N*5Cj<11$EZW&hJLX83TO{lJYP74rlDZQPkm@t<=U^I)x@|UnHHkdQlh?!ltZwl92rE;;^
zZuIappj4dhld1}kttYYV-j|KF1Kus
zWBnzttD^00%LFK(wrwNragFub6xiV8QE2rm<`&fcR4SLFcdtLxVuN!Aal-g6dE4%k
zARZ}|xeo;K{0yf7@9aua%2j5o)CPcIOc6uLHFJOcgtB5owlcNAwyAHc0QB0Dts?c@
zUemG~j_E&W7R%+x-IO4FJl8e&*2Blmp1S#RA|)geVrxvP)NHdYuxi~g&Etn?QdNK8ZDKZ?QFLU?zh30G|t9G>a_X4zk}Ygw<^$7K!GIn(Io$>(d4ODJQ2XSd%jpK
zm7>ptl$a3GyB}5-%p4>Q*p#VL^B{yQMuFCM^#l#+N!Ne
z5_PrJWB=@Iy+t)H`g1lX`{bm($KE5I?0c(JEYm#t{F}j!xtsbob0{xu@0TB_*>G7w0ICn
zr#VoBktqHZ~XxhiKD*lcG|b;H*|Ny3P^8ceV`sfBRfrhwZ!T+MFZ!F1Bt{q$8d9i6o?~
zODj^POr}&ivSa^R^YFIq7o0giLBKCycH_aU`F6)O6JX%nPTwh~Q`eq6*0iE#Srj2^
z*_hN3%*b83zfafy60@Cp3{J({RlSaEn&E?mrxRNC9GQ7#+f=s!
z0KBf-9Ny_v2VbE%aB|Di)5kNJ^t&C`4D(>t7zYUWUFtbxt+Oq=!@O7BU)}>d*R72o
zFF)3jQD_lLe4is&xzyJYC1-c{8TX$RU>&>P$%)ufpez0XSAukmh!xcekg`s$c<>-q
zI#zn^JU0zzF}V60)o$_gY}PQH>b2M9&8fRZa#OauglPb
zeQ@pMm&=!vNgos4CluQjLMV!pfkmxK+35bi^k&=k>9h02?l+u+m0agG;(h2|Jslc-llvtEwn~*w3bx7qnvZACG<8}AGeaDVvcHbKd2>3G^
zSFPULUn-?Pmo^-_`mLZr??uNH`2=I&yajlrF{DtUxMy#Nu}z=3y7qbUA;5`)hibMR
zhXL@@uKyV0-2&A@t@!xyrBnMJl&^o@Gx$&5_q6?D=ji5grd-~=?dlg;ur(_V0wjh!
zA=JV^C1m+DDkOsgr<%O9ZQFg!0}pD(#PSz4Dr_EyS5$`)VIAv);4n-SFP~YtC7sH=
z7&*MfpH;gd*FHbkmD#)hVxb6xjc9~`t?_{=JS+@ip_cTicXxG<=7m9&
zPX+Z8IC*GSAXuGCrZDHgR$r%jyk-fctis2Kx4HvZ|B~8uC@o)m^>Hy-O!&TKA?$&n
zkP2Xc54w~!=z2?^NafyL*L0V9cbYrugHBBUj`xVyZmGFR&kvk#>1J*Z~i
zNTz}?IAdJ$gkqd2!Gw(%LzE!O5s4C7q4%T~e_P{+z=DNDKrG**p=U`d5yg^vp`;Zn
zsU=8gd0a9s4s0FPJePWR9eH5=+O^Kks&kC-iblNqTh2&Pw*^(4384f+D8N|fewZu_
zg2ejQ)ov;ztz;NQl7yj;A`(!H!XQu_$sqY9h_IrH*}_%1{L&_YLDvO?%R5Z-t+ClW
z_qERbL?HKUZ!nt+!E9S`uoh^5A|DaIHe*_gf1`E_Vq+}{&T@t$EGhMnRjJ4z2w_W8
zp+qjs7as22^&S3wY1?+}^j-I=RcCE>#|39)g(lU7v_8;?=qK(9D8-*pPdiy)P3lIblG`+?%ea|
zYoD3dopYt!tKgFicfNmNi(EWE=E4hC6(r|PYtanqJlmt57YOVrr2^tfrG(eG9C##X
zu&1t@%L$RIvpj!wUA
z8i>Pqot#_+Cnp6L2XPcZy1ar|9MnY+7eNvK1E)@Tr#2KsXq1*>)uUCozT7L##ok?o
zhA6ofP4E|b*9tAfG?uf$#}>TIR&1A!yslP8}i7w-EzW(x#9VEvx18k%Tn=-$VV
zkOtUr0b2!w3t>h?#8AZl^Az*(6KCGlD;4j~yx};`#2gN1_gv=%7KVzecIRakN{f*4
zeaI>yH;-o4OGhvGTU)(quWI)-q?V*(sVesSMv|wMUQ3hLEt=lBB$KZ9TyHr>)f7o%)
zPYeU<3P)*P10*7vE)nA5#{c=6-E-_>r_u4e3i!I2+UksELwDqwMeBZ9FSP$;^Ajro
z_@M#_Ss$?ejoB@!wN|kbGKs(0zLo%0QpQXW#t;oC$B0MZYZ&Ej?8~fNhcCVvPo3vo
zFn0WWZaPliF^8_}yzb`*f@yg0uWv6HgNI)xa=pO%Ck(C<=-60l#uD3(wXP~c7!NoX
z0&^6=N`zcc90F#qt@=Rn@r!3(*1v(Tl{B!m?Mc7yIA+nEHpY{YWr$=)F7rhR1P}(v
zt{YhY#;jsW6G>#xhP*B`OCk|Pf+NN;ju1rxa*HAgoGq*rvqw&xe~;t1JA31$s?GBb
z*g7&@cbKo4n<`>)!UlIAgR6q&))B0KYU8r66GbFj?8Guw4E%&}Qi_lT003LtoIZei
zwD~=XZmeo+yZ2Pq3KYCF-R&11^p=
z@H%s+=G`}wrbJ{()Mh71#2SP3Zy3m>l1n?0N-N1Q;z6?oSxr-G(H5m4EO>~&;}VKi
zfY}3w+9z>vp#d)hVuu`)vG_aaH%3b=WKMnSu&c31;<3O;bz2iD=w+o4#oBb36
z5ZCF*Gu?zjZIR0S>_%pHY2$k8D^n7Sz_K8tCDeXM+dO<#LSg%h6`~dnVG1N@T7v&e
z%wEd1!k{^zfz_1BTW{!$!B%g)J^2b87!9Y>>100X1SgT7s0z$o>^lAA=Gp_cC1(h=*5Tmf8z&LGJJ>$|K^~s`z9*OWz5MFUr?>Bi?_PGBB)#psD5?>n+q{o_
zz7~ez&;t#h8l$jwGPCC&xq2YetXYQT+0F3j(`xmNGf8dj#an|p#I*pvI*kwW4iuB>
z+q3_7xB8y;pLzHG-S%+UHQA
zvqp;$kmGJY>lLsN4C~&TcvAS1SErTcwcw0r@wngk
zShAUA1M9b#g}^pL-zH7Q#z^&j#r9F8BTVfkR&qF<=e35goTu7c|GN)0mokj4m0%~0
zXJ8j4Hc_l;HJ&uU*Iw`8d_EscJ``s0tk9mkKo^TYXm-EoAzTQObxa@^u~g2t#T)
zJz|rE!I_?i4dCJC=B8(_pZ{YR>|V?0iCcnU;E@$239^x?SYCfNaMHN;CtHIS_zHN9
zTkQc1v@O35okiFtq5_u+5FkY55ap@pi)O?}x0D1c*qB0KpYR}>Ul+B0Vmr}Z@+%mJ|As}sis_=ROPbov@*2thpE&?!V#Qgu$snYvCZ
zrkhmkMU+fSf-s8(L37fPr&M*jRs{{THb!aXQu|P9l_-vJhHvLzMGH
zE?1U0H_+PmNABp9`|KzkGfrrZ%XvdGo6*<{d5m9~L7
z_^`M;X6xDo=m6LY6RfvJEvsTK1!u8d2HPx|$S}p;sRy!I
zWL55Yxu~_B`OP@~(q6&W3#)~I&+MGL%GWR$#udC151^wsswhqlii;rP9jJpiI7o&Z
zAb})=HY7?4HA|re3ns`%$)FuvKCFWjhb~?IE)F6dF2K5}poj-NK6Gf;hw$t3=1txY
zoxQxZWrQU6K!%|~!m?~Bnw-6Rr!F3BZ{u5!LqnZTDON}Coj9^@&le)V!NYrVwS~B%
zEL+>Sr@}qGwGvu|HrOo|gSt__ezN^&%~{*)a=rf7y1HujUcr`zZB<4#l@T#eN)si}
z)lZA<{=tKx8E%c9>A(##6}_p+~EZpKsl5a4pj`E*;_-6`ysiv
zffA!7=MT1vCz}-m4~tjVey1b2KSR4OEtLd-(_DdUqYZ74LaDkhH?KFh?%WAOP2WbX
zp@zT+Dx|5_f%JQiAGvVw!oh+g3e50u!aPfMxdC=E)XB{F5IcEZhePIM-
zph6Y`$Oy?JBL<8Ex(SqEhLeQ@XcrdA>a?rx+_~HLA;l14)WmmpH}_w?Pg#HBZs0eS
zwypwAW?M-x+3AU-(GGWSJ=ngxUEcEZ5OsX(Qlt!MQ
zn^(`S{GHkAv(8@D`EAfSYig%Cxv?z!{=w^F#y)5_d7FuKZH7qlR-#5B0bt806%D0I
zT7VdVP_?q*%Rq8UR;JkD4i^RXowt+E%#V2U>TfDqzZSDZ+dR!a#T3I>-z_$q9@k|m
zy5~A*m~&JWP@E7a=pc}4kVHTc4h&R;Li7d@f`|hKMLkbb^uhOakNr3&FLjlm~i5NBM<
zFaYI{;cpiHCNRdE0dg*>qIm(_t?#$h=(SCw?h3rJV2*ER8{O4^3#=dO)KwklZkoqU
zS8i5c%YL*y*4;FY#D=XmkQnYj%LH)?02~gSJH`Qp1XY64g>%c_K$xseI&|e)7vRoL
zAqRba$G@%fSGA7X7hQk%_3NVOYVS+$leU_!&6*5uN)8#5ZBz_6ASCA;azYS-Rt@ki
zg2NWz(=;t}SC(~Ibl63$5C8FPmhXqb^)5#jaJ~I{Ex3xZ!+2h8$}}h_g@Be>HZ;72
z6#y#>AY3^skuVKF#0WxFBQ()5d5_nWb?c6c>EeMM|Mh+*&wEpPyxHCq{R-Gdr-`hN
zF=1sxl&mBoK+#qRLl9#CEN|Fg8>nbmsTg3a1;#M9enQ$RgWk}kp#-5wh=EF&1tl%mJln2V^8o%Qv(*=zEuO7y
z=m*8?xpUn-*@h5Cl_3BK3joiGkyaScK+>|MWdMRWm@RT!Q1piAlv5hL@B6>3&GI8)
zP!xBc6}ZNIpJLL%2a8Y!+(<=f%WX>_uWVxlga9!D*oYt$l0cxRDMvqfU;Kq_mLK5k
z)dvqYcgLa_Lz?3HyeF)@$%$&6lI?r4I>6W#M*<)vq{?&Oqrx``d`mhpVPr>
z#q078F6gw_X<=?KR>8%^t%@wbITvNMu!hKiTSkCTJkw>1!e*Y{%31#_yMf=LW7{RJ
zYoC^w$6%3cBtVG5)x#{Hg6IVTh9XEcM{gQwXk!R^y95^f-hZ`d{aVa+xW1EO4wDV4
zB?JgD7*?qkvc|$nIykTvNl2x0j3Q!MXoLL^)~}d7jcYf(H8D~c+?$pKL(px>Z3`eb
z04RzS6_AgFT6Pn#iZAg$Sl_j8#;6ShF%&(Fag#E2asU@@LaN;=b=Wf7sgPKhfzhBM
zC@eFL8^MrnA*9&Khe*Ab@CC9*uyJGXyi(;y2>lQLJZt;ShtJi?3Yf_t`F+$hY!+Q2Ndsx=U+bjTiAy7djLji>7k%k`$9&--f<*BNA3Hy&ZrHH|4
zG5H&9cB?O#zI1_OOf0Ce%mDfQxdtp3vU%(iY6yji3iISS61XLv#z|!zI_sZqza@B+
zyu9st5-h+`H7QUKx9}3w@oU@EO}&cEzG?fu!!bLO->%zkcg;i9^j`S~=WKMnDi1f=
P00000NkvXXu0mjft=yBf
literal 0
HcmV?d00001
diff --git a/addons/mosaic-addon-studio/src/assets/react.svg b/addons/mosaic-addon-studio/src/assets/react.svg
new file mode 100644
index 0000000..6c87de9
--- /dev/null
+++ b/addons/mosaic-addon-studio/src/assets/react.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/addons/mosaic-addon-studio/src/assets/vite.svg b/addons/mosaic-addon-studio/src/assets/vite.svg
new file mode 100644
index 0000000..5101b67
--- /dev/null
+++ b/addons/mosaic-addon-studio/src/assets/vite.svg
@@ -0,0 +1 @@
+Vite
diff --git a/addons/mosaic-addon-studio/src/host.js b/addons/mosaic-addon-studio/src/host.js
new file mode 100644
index 0000000..bd5d8f8
--- /dev/null
+++ b/addons/mosaic-addon-studio/src/host.js
@@ -0,0 +1,300 @@
+/**
+ * The Studio's host adapter.
+ *
+ * The Studio runs in two places, and they do not have the same abilities:
+ *
+ * - **Inside Mosaic** (as an add-on): the renderer is an isolated webview.
+ * There is no local server, no filesystem, and no way to reach the user's
+ * real project tree. What there is: `window.addonAPI`, and a data jail
+ * (`addonAPI.files`) scoped to this add-on's own directory.
+ *
+ * - **Locally** (the development workspace): a Node service on 127.0.0.1
+ * that owns the project folder on disk.
+ *
+ * The Studio's rules are the same in both — they live in `shared/` — but the
+ * *project store* is not, and that is what this module abstracts. The UI
+ * asks for a list of projects, for a validation, for a project to be
+ * created, and never learns which host answered.
+ *
+ * The difference is not cosmetic, and the UI says so: a project created
+ * inside Mosaic lives in that add-on's data jail, not in the user's working
+ * directory, and the interface labels it accordingly.
+ */
+
+import { classifyLicense } from '../shared/license-texts.mjs';
+import { buildStarterFiles, normalizeStarterInput } from '../shared/starter-project.mjs';
+import { validateMosaicManifest } from '../shared/manifest-rules.mjs';
+import {
+ checkAddonCapabilitiesInFiles,
+ referenceProvenance,
+} from '../shared/capability-rules.mjs';
+
+/** Is the Studio running inside the Mosaic Companion as an add-on? */
+export function isInsideMosaic() {
+ return typeof window !== 'undefined' && !!window.addonAPI;
+}
+
+/**
+ * The API surface the UI depends on, resolved for the current host.
+ *
+ * @returns {{ health: Function, listProjects: Function, createProject: Function,
+ * validateProject: Function, host: 'mosaic'|'local', canReachUserProjects: boolean }}
+ */
+export function createHost() {
+ return isInsideMosaic() ? createMosaicHost() : createLocalHost();
+}
+
+/**
+ * The local development host: a Node service on 127.0.0.1.
+ */
+function createLocalHost() {
+ async function request(endpoint, options) {
+ const response = await fetch(endpoint, options);
+
+ let data;
+ try {
+ data = await response.json();
+ } catch {
+ throw new Error('The local API returned an unreadable response.');
+ }
+
+ if (!response.ok || data.ok === false) {
+ throw new Error(data.message || (data.errors || []).join('\n') || 'The request failed.');
+ }
+
+ return data;
+ }
+
+ return {
+ host: 'local',
+ canReachUserProjects: true,
+
+ async health() {
+ const data = await request('/api/health');
+ return { ok: data.ok === true, detail: data.node ? `Node ${data.node}` : '' };
+ },
+
+ async listProjects() {
+ const data = await request('/api/projects');
+ return data.projects || [];
+ },
+
+ async createProject(input) {
+ const data = await request('/api/create-addon', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(input)
+ });
+ return data;
+ },
+
+ async validateProject(id) {
+ return request('/api/validate-addon', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ id })
+ });
+ }
+ };
+}
+
+/**
+ * The Mosaic host: the renderer is the add-on.
+ *
+ * Two facts shape this implementation:
+ *
+ * 1. `addonAPI.files` is jailed to this add-on's own `data/` directory. The
+ * Studio can create and read projects there, and nowhere else — it cannot
+ * see the user's real project tree, and it cannot run their builds. The
+ * UI states this rather than implying a capability it does not have.
+ *
+ * 2. The rules are the same rules the local host applies, imported from
+ * `shared/`. A manifest that validates here validates there.
+ */
+function createMosaicHost() {
+ const api = window.addonAPI;
+ const JAIL_ROOT = 'projects';
+
+ async function writeFile(relPath, contents) {
+ await api.files.write(relPath, contents);
+ }
+
+ async function readFile(relPath) {
+ const content = await api.files.read(relPath);
+ return typeof content === 'string' ? content : null;
+ }
+
+ async function listDir(relDir) {
+ const entries = await api.files.list(relDir);
+ return Array.isArray(entries) ? entries : [];
+ }
+
+ /**
+ * Read one project out of the jail as a list of source files.
+ *
+ * The capability rules consume `{ file, source }` entries, so the jail's
+ * contents are read into exactly that shape.
+ */
+ async function readProjectFiles(projectId) {
+ const files = [];
+
+ const walk = async (relDir) => {
+ for (const entry of await listDir(relDir)) {
+ const relPath = relDir === '.' ? entry.name : `${relDir}/${entry.name}`;
+
+ if (entry.isDir) {
+ await walk(relPath);
+ continue;
+ }
+
+ const source = await readFile(relPath);
+ if (source === null) continue;
+
+ // Normalize to paths relative to the project root (strip jail prefix)
+ const projectRoot = `${JAIL_ROOT}/${projectId}`;
+ const relativeFile = relPath.replace(projectRoot + '/', '');
+ files.push({ file: relativeFile, source });
+ }
+ };
+
+ await walk(`${JAIL_ROOT}/${projectId}`);
+ return files;
+ }
+
+ return {
+ host: 'mosaic',
+ canReachUserProjects: false,
+
+ async health() {
+ try {
+ const info = await api.system.getAppInfo();
+ return {
+ ok: true,
+ detail: info?.appVersion ? `Mosaic ${info.appVersion}` : 'Mosaic Companion'
+ };
+ } catch {
+ return { ok: true, detail: 'Mosaic Companion' };
+ }
+ },
+
+ async listProjects() {
+ const entries = await listDir(JAIL_ROOT);
+ const projects = [];
+
+ for (const entry of entries) {
+ if (!entry.isDir) continue;
+
+ const projectId = entry.name;
+ const manifestText = await readFile(`${JAIL_ROOT}/${projectId}/manifest.json`);
+
+ const project = {
+ folder: projectId,
+ id: projectId,
+ name: projectId,
+ version: null,
+ manifestStatus: 'missing',
+ manifestIssues: [],
+ projectIssues: [],
+ renderer: false,
+ readme: false,
+ license: false
+ };
+
+ if (manifestText === null) {
+ project.manifestStatus = 'invalid';
+ project.manifestIssues = ['Missing file: manifest.json'];
+ projects.push(project);
+ continue;
+ }
+
+ let manifest;
+ try {
+ manifest = JSON.parse(manifestText);
+ } catch {
+ project.manifestStatus = 'invalid';
+ project.manifestIssues = ['manifest.json contains invalid JSON.'];
+ projects.push(project);
+ continue;
+ }
+
+ project.name = typeof manifest.name === 'string' ? manifest.name : projectId;
+ project.id = typeof manifest.id === 'string' ? manifest.id : projectId;
+ project.version = typeof manifest.version === 'string' ? manifest.version : null;
+
+ const result = validateMosaicManifest(manifest, projectId);
+ project.manifestStatus = result.valid ? 'valid' : 'invalid';
+ project.manifestIssues = result.errors;
+
+ const files = await readProjectFiles(projectId);
+ project.renderer = files.some(file => file.file === 'renderer/index.html');
+ project.readme = files.some(file => file.file === 'README.md');
+ project.license = files.some(file => file.file === 'LICENSE');
+
+ projects.push(project);
+ }
+
+ return projects;
+ },
+
+ async createProject(input) {
+ const { value, errors } = normalizeStarterInput(input);
+ if (errors.length) throw new Error(errors[0]);
+
+ const files = buildStarterFiles(value);
+ const projectId = files.id;
+
+ // The CLI refuses to overwrite a project folder; so does the host.
+ if ((await readFile(`${JAIL_ROOT}/${projectId}/manifest.json`)) !== null) {
+ throw new Error(`The project already exists: ${JAIL_ROOT}/${projectId}`);
+ }
+
+ for (const [relativePath, contents] of Object.entries(files.files)) {
+ await writeFile(`${JAIL_ROOT}/${projectId}/${relativePath}`, contents);
+ }
+
+ return {
+ ok: true,
+ message: 'Add-on project created successfully.',
+ id: projectId,
+ name: files.name,
+ folder: `${JAIL_ROOT}/${projectId}`,
+ files: Object.keys(files.files),
+ license: files.license,
+ publishReady: false
+ };
+ },
+
+ async validateProject(id) {
+ const manifestText = await readFile(`${JAIL_ROOT}/${id}/manifest.json`);
+
+ if (manifestText === null) {
+ throw new Error(`No project named "${id}" was found in this add-on's data directory.`);
+ }
+
+ let manifest;
+ try {
+ manifest = JSON.parse(manifestText);
+ } catch {
+ throw new Error('manifest.json contains invalid JSON.');
+ }
+
+ const manifestResult = validateMosaicManifest(manifest, id);
+ const files = await readProjectFiles(id);
+ const capabilities = checkAddonCapabilitiesInFiles(files, manifest);
+
+ const errors = [...manifestResult.errors, ...capabilities.errors];
+ const warnings = [...manifestResult.warnings, ...capabilities.warnings];
+ const checks = [...(capabilities.checks || [])];
+
+ return {
+ ok: true,
+ valid: errors.length === 0,
+ publishReady: errors.length === 0 && classifyLicense(await readFile(`${JAIL_ROOT}/${id}/LICENSE`)) !== null,
+ errors,
+ warnings,
+ checks,
+ reference: referenceProvenance()
+ };
+ }
+ };
+}
diff --git a/addons/mosaic-addon-studio/src/index.css b/addons/mosaic-addon-studio/src/index.css
new file mode 100644
index 0000000..1bb903f
--- /dev/null
+++ b/addons/mosaic-addon-studio/src/index.css
@@ -0,0 +1,40 @@
+:root {
+ font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
+ color: #e8edf5;
+ background: #0b1020;
+ font-synthesis: none;
+ text-rendering: optimizeLegibility;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+* {
+ box-sizing: border-box;
+}
+
+body {
+ min-width: 320px;
+ min-height: 100vh;
+ margin: 0;
+ background:
+ radial-gradient(ellipse at 50% -20%, #1e3155 0%, transparent 48%),
+ #0b1020;
+}
+
+button,
+input,
+textarea {
+ font: inherit;
+}
+
+button:focus-visible,
+input:focus-visible,
+textarea:focus-visible {
+ outline: 2px solid #8ac8ff;
+ outline-offset: 3px;
+}
+
+::selection {
+ color: #091626;
+ background: #8ac8ff;
+}
diff --git a/addons/mosaic-addon-studio/src/main.jsx b/addons/mosaic-addon-studio/src/main.jsx
new file mode 100644
index 0000000..b9a1a6d
--- /dev/null
+++ b/addons/mosaic-addon-studio/src/main.jsx
@@ -0,0 +1,10 @@
+import { StrictMode } from 'react'
+import { createRoot } from 'react-dom/client'
+import './index.css'
+import App from './App.jsx'
+
+createRoot(document.getElementById('root')).render(
+
+
+ ,
+)
diff --git a/addons/mosaic-addon-studio/test/addon-surface.test.mjs b/addons/mosaic-addon-studio/test/addon-surface.test.mjs
new file mode 100644
index 0000000..7ad127a
--- /dev/null
+++ b/addons/mosaic-addon-studio/test/addon-surface.test.mjs
@@ -0,0 +1,940 @@
+/**
+ * Regression tests for the official add-on surface migration.
+ *
+ * These tests are INDEPENDENT of the production parser. Every expected value
+ * is a literal transcribed from the pinned upstream artifact
+ * (`shared/addon-surface.json`, SHA-256
+ * 748c5d28e25c43f8e1d59c94e2d60c3b5d063ee2fb139b7b4a8e49ee5b3ac31e), or a
+ * hand-written fixture.
+ *
+ * That distinction matters. The old `--check` mechanism produced a false clean
+ * because the extractor and the comparator shared the same incomplete logic —
+ * both missed the `Eth` icon. A test that asserts the production accessor
+ * equals itself proves nothing, so nothing here compares a production
+ * accessor with another production accessor.
+ */
+
+import { describe, it } from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import path from 'node:path';
+import crypto from 'node:crypto';
+import { fileURLToPath } from 'node:url';
+
+import {
+ ADDON_SURFACE,
+ BUCKET_ID_PATTERN,
+ BUCKET_KIND_PATTERN,
+ BUCKET_HISTORY_VALUES,
+ DEFAULT_TAB_ORDER,
+ ICON_FALLBACK,
+ ID_PATTERN,
+ IPC_NAMESPACE_PATTERN,
+ MANIFEST_VERSION,
+ MAX_BUCKETS_PUBLISHED,
+ MAX_BUCKET_KINDS_READ,
+ MAX_BUCKET_LABEL_LENGTH,
+ MAX_DESCRIPTION_LENGTH,
+ MAX_NAME_LENGTH,
+ MAX_TAB_LABEL_LENGTH,
+ MOUNT_POINTS,
+ PERMISSION_VOCABULARY,
+ RESERVED_IPC_NAMESPACES,
+ RESERVED_PERMISSIONS,
+ RENDERABLE_ICONS,
+ SURFACE_IS_VALID,
+ UPDATE_CHECK_MODES,
+ deriveIpcNamespace,
+ exposedMethods,
+ internalMethods,
+ isPermittedScriptName,
+ permissionForCall,
+ releaseFloor,
+ rootMembers,
+ surfaceProvenance,
+ validateSurface
+} from '../shared/mosaic-schema.mjs';
+import { validateMosaicManifest } from '../shared/manifest-rules.mjs';
+import { checkAddonCapabilitiesInFiles } from '../shared/capability-rules.mjs';
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+
+const SHARED = path.join(HERE, '..', 'shared');
+const ARTIFACT_PATH = path.join(SHARED, 'addon-surface.json');
+const PROVENANCE_PATH = path.join(SHARED, 'addon-surface.provenance.json');
+
+// ── The pinned upstream artifact's content, as literals ──────────────────────
+
+const OFFICIAL_ICONS = [
+ 'Activity', 'BarChart3', 'Bot', 'Box', 'Boxes', 'BrainCircuit', 'Clock',
+ 'Code2', 'Cpu', 'Database', 'Eth', 'Globe', 'Hash', 'Home', 'Layers',
+ 'LayoutGrid', 'Lock', 'MessageSquare', 'Network', 'Plug', 'Power', 'Rocket',
+ 'Server', 'Settings', 'Shield', 'Sparkles', 'Star', 'Store', 'Telescope',
+ 'Trophy', 'Wallet', 'Zap'
+];
+
+const OFFICIAL_GRANTABLE = [
+ 'wallet:read', 'agents:read', 'agents:write', 'mcp:read', 'mcp:call',
+ 'nodes:read', 'shell:open-external', 'buckets:publish'
+];
+
+const OFFICIAL_RESERVED_PERMISSIONS = [
+ 'wallet:sign', 'agents:delete', 'vault:read', 'vault:write', 'notifications'
+];
+
+const OFFICIAL_RESERVED_IPC = [
+ 'nodes', 'ai-agents', 'ai-agents-history', 'themes', 'gmail', 'web3', 'vault',
+ 'media', 'window', 'dialog', 'sandbox', 'toolSandbox', 'chronicle', 'tools',
+ 'mcp', 'chat', 'ide', 'aimnodes', 'payments-jit', 'addon', 'addon-api',
+ 'addons', 'tab-prefs'
+];
+
+const OFFICIAL_ROOT_MEMBERS = ['init', 'invoke', 'parseError'];
+
+const OFFICIAL_INTERNAL = ['events.subscribe', 'events.unsubscribe'];
+
+// namespace.method -> [permission, release floor]
+const OFFICIAL_METHODS = {
+ 'system.getAppInfo': [null, '0.1.10'],
+ 'system.getManifest': [null, '0.1.10'],
+ 'system.getTheme': [null, '0.1.10'],
+ 'settings.clear': [null, '0.1.10'],
+ 'settings.get': [null, '0.1.10'],
+ 'settings.replace': [null, '0.1.10'],
+ 'settings.set': [null, '0.1.10'],
+ 'files.delete': [null, '0.1.10'],
+ 'files.list': [null, '0.1.10'],
+ 'files.mkdir': [null, '0.1.10'],
+ 'files.read': [null, '0.1.10'],
+ 'files.readBinary': [null, '0.1.10'],
+ 'files.write': [null, '0.1.10'],
+ 'events.on': [null, '0.1.10'],
+ 'ui.openExternal': ['shell:open-external', '0.1.10'],
+ 'ui.setTitle': [null, '0.1.10'],
+ 'wallet.getAddress': ['wallet:read', '0.1.10'],
+ 'wallet.getBalance': ['wallet:read', '0.1.10'],
+ 'wallet.getNetworkInfo': ['wallet:read', '0.1.10'],
+ 'agents.add': ['agents:write', '0.1.10'],
+ 'agents.get': ['agents:read', '0.1.10'],
+ 'agents.list': ['agents:read', '0.1.10'],
+ 'agents.update': ['agents:write', '0.1.10'],
+ 'mcp.callTool': ['mcp:call', '0.1.10'],
+ 'mcp.listServers': ['mcp:read', '0.1.10'],
+ 'mcp.listTools': ['mcp:read', '0.1.10'],
+ 'nodes.getSavedAims': ['nodes:read', '0.1.10'],
+ 'nodes.list': ['nodes:read', '0.1.10'],
+ 'buckets.clear': ['buckets:publish', '0.1.13'],
+ 'buckets.list': [null, '0.1.13'],
+ 'buckets.read': [null, '0.1.13'],
+ 'buckets.write': ['buckets:publish', '0.1.13']
+};
+
+const OFFICIAL_ID_PATTERN = '^[a-z][a-z0-9-]{1,40}$';
+const OFFICIAL_IPC_NAMESPACE_PATTERN = '^[a-z][a-z0-9-]{1,40}$';
+const OFFICIAL_BUCKET_ID_PATTERN = '^[a-z][a-z0-9-]{1,40}$';
+const OFFICIAL_BUCKET_KIND_PATTERN = '^[a-z][a-z0-9-]{1,40}$';
+const OFFICIAL_SHA256 = '748c5d28e25c43f8e1d59c94e2d60c3b5d063ee2fb139b7b4a8e49ee5b3ac31e';
+
+// ── Helpers ──────────────────────────────────────────────────────────────────
+
+const BASE_MANIFEST = {
+ manifestVersion: 1,
+ id: 'my-addon',
+ name: 'My Add-on',
+ description: 'An add-on used in the regression suite.',
+ version: '1.0.0',
+ ipcNamespace: 'my-addon',
+ mountPoint: 'tab',
+ tab: { label: 'Test', icon: 'Sparkles' },
+ renderer: { entry: 'index.html' },
+ permissions: []
+};
+
+/** A manifest with one field changed. */
+function withManifest(changes) {
+ return { ...BASE_MANIFEST, ...changes };
+}
+
+// ── 1. Icons ────────────────────────────────────────────────────────────────
+
+describe('the transcribed test oracle', () => {
+ it('still matches the vendored artefact, so a change upstream cannot pass silently', () => {
+ // The literals in this file are the test's own oracle. They are
+ // transcribed rather than derived, on purpose — a test that compared a
+ // production accessor with another production accessor proved nothing.
+ // But a transcribed oracle that nobody compares to the artefact would
+ // drift silently, so it is compared here, and a difference is a failure
+ // that says "re-transcribe and think about it", not "update a constant".
+ const artefact = JSON.parse(fs.readFileSync(ARTIFACT_PATH, 'utf8'));
+
+ assert.deepStrictEqual([...OFFICIAL_ICONS].sort(), [...artefact.tabIcons.names].sort());
+ assert.deepStrictEqual([...OFFICIAL_GRANTABLE].sort(), [...Object.keys(artefact.permissions.grantable)].sort());
+ assert.deepStrictEqual([...OFFICIAL_RESERVED_PERMISSIONS].sort(), [...artefact.permissions.reserved].sort());
+ assert.deepStrictEqual([...OFFICIAL_RESERVED_IPC].sort(), [...artefact.reservedIpcNamespaces].sort());
+ assert.deepStrictEqual([...OFFICIAL_ROOT_MEMBERS].sort(), [...Object.keys(artefact.api.members)].sort());
+ assert.deepStrictEqual([...OFFICIAL_INTERNAL].sort(), [...Object.keys(artefact.api.internal)].sort());
+ assert.strictEqual(OFFICIAL_ID_PATTERN, artefact.manifest.idPattern);
+ assert.strictEqual(OFFICIAL_IPC_NAMESPACE_PATTERN, artefact.manifest.ipcNamespacePattern);
+ assert.strictEqual(OFFICIAL_BUCKET_ID_PATTERN, artefact.manifest.bucketIdPattern);
+ assert.strictEqual(OFFICIAL_BUCKET_KIND_PATTERN, artefact.manifest.bucketKindPattern);
+ });
+});
+
+describe('renderable icons', () => {
+ it('recognises all 32 official icon names', () => {
+ assert.deepStrictEqual([...RENDERABLE_ICONS].sort(), [...OFFICIAL_ICONS].sort());
+ assert.strictEqual(RENDERABLE_ICONS.length, 32);
+ });
+
+ it('accepts Eth — the icon the old hardcoded list wrongly rejected', () => {
+ assert.ok(OFFICIAL_ICONS.includes('Eth'), 'Eth is in the official list');
+ assert.ok(RENDERABLE_ICONS.includes('Eth'), 'Eth is recognised');
+
+ const result = validateMosaicManifest(withManifest({
+ tab: { label: 'Test', icon: 'Eth' }
+ }));
+
+ const iconErrors = result.errors.filter(e => e.includes('icon'));
+ assert.deepStrictEqual(iconErrors, [], 'Eth must not produce an icon error');
+ assert.strictEqual(result.valid, true);
+ });
+
+ it('rejects an unsupported icon name', () => {
+ const result = validateMosaicManifest(withManifest({
+ tab: { label: 'Test', icon: 'NotAnIcon' }
+ }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.some(e => e.includes('NotAnIcon') && e.includes('not a renderable icon')),
+ 'the error names the rejected icon'
+ );
+ });
+
+ it('publishes no fallback icon, so an unknown name is refused rather than remapped', () => {
+ assert.strictEqual(ICON_FALLBACK, null);
+ });
+});
+
+// ── 2. Internal methods must not be presented as exposed capabilities ─────────
+
+describe('internal methods', () => {
+ it('holds exactly events.subscribe and events.unsubscribe', () => {
+ assert.deepStrictEqual([...internalMethods()].sort(), [...OFFICIAL_INTERNAL].sort());
+ });
+
+ it('does not present events.subscribe as an exposed addon method', () => {
+ assert.strictEqual(exposedMethods().has('events.subscribe'), false);
+
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: "addonAPI.events.subscribe('tick');" }],
+ BASE_MANIFEST
+ );
+
+ assert.ok(
+ result.errors.some(e => e.includes('events.subscribe') && e.includes('internal')),
+ 'the call is reported as internal to Mosaic and not callable by add-ons'
+ );
+ });
+
+ it('does not present events.unsubscribe as an exposed addon method', () => {
+ assert.strictEqual(exposedMethods().has('events.unsubscribe'), false);
+
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: "addonAPI.events.unsubscribe('tick');" }],
+ BASE_MANIFEST
+ );
+
+ assert.ok(
+ result.errors.some(e => e.includes('events.unsubscribe') && e.includes('internal')),
+ 'the call is reported as internal to Mosaic and not callable by add-ons'
+ );
+ });
+});
+
+// ── 3. Permissions ──────────────────────────────────────────────────────────
+
+describe('permissions', () => {
+ it('matches the artifact for every exposed method', () => {
+ const actual = {};
+ for (const [key, detail] of exposedMethods()) {
+ actual[key] = [detail.permission, detail.since];
+ }
+
+ assert.deepStrictEqual(actual, OFFICIAL_METHODS);
+ assert.strictEqual(Object.keys(actual).length, 32);
+ });
+
+ it('publishes exactly the 8 grantable permissions', () => {
+ assert.deepStrictEqual([...PERMISSION_VOCABULARY].sort(), [...OFFICIAL_GRANTABLE].sort());
+ });
+
+ it('resolves a method permission and release floor directly', () => {
+ assert.strictEqual(permissionForCall('wallet', 'getBalance'), 'wallet:read');
+ assert.strictEqual(permissionForCall('buckets', 'write'), 'buckets:publish');
+ assert.strictEqual(permissionForCall('system', 'getAppInfo'), null);
+ assert.strictEqual(releaseFloor('buckets', 'write'), '0.1.13');
+ assert.strictEqual(releaseFloor('wallet', 'getBalance'), '0.1.10');
+ });
+
+ it('enforces the 5 reserved permissions', () => {
+ assert.deepStrictEqual([...RESERVED_PERMISSIONS].sort(), [...OFFICIAL_RESERVED_PERMISSIONS].sort());
+
+ for (const permission of OFFICIAL_RESERVED_PERMISSIONS) {
+ const result = validateMosaicManifest(withManifest({ permissions: [permission] }));
+ assert.strictEqual(result.valid, false, `${permission} must be refused`);
+ assert.ok(
+ result.errors.some(e => e.includes(permission) && e.includes('reserved')),
+ `${permission} is reported as reserved`
+ );
+ }
+ });
+
+ it('refuses an unknown permission', () => {
+ const result = validateMosaicManifest(withManifest({ permissions: ['wallet:write'] }));
+ assert.strictEqual(result.valid, false);
+ assert.ok(result.errors.some(e => e.includes('Unknown permission')));
+ });
+});
+
+// ── 4. Reserved IPC namespaces ──────────────────────────────────────────────
+
+describe('reserved IPC namespaces', () => {
+ it('enforces exactly the 23 reserved namespaces', () => {
+ assert.deepStrictEqual([...RESERVED_IPC_NAMESPACES].sort(), [...OFFICIAL_RESERVED_IPC].sort());
+ assert.strictEqual(RESERVED_IPC_NAMESPACES.length, 23);
+ });
+
+ it('refuses a reserved ipcNamespace', () => {
+ const result = validateMosaicManifest(withManifest({ ipcNamespace: 'vault' }));
+ assert.strictEqual(result.valid, false);
+ assert.ok(result.errors.some(e => e.includes('vault') && e.includes('reserved')));
+ });
+
+ it('accepts an ipcNamespace that is not reserved', () => {
+ const result = validateMosaicManifest(withManifest({ ipcNamespace: 'my-addon' }));
+ assert.strictEqual(result.valid, true);
+ });
+});
+
+// ── 5. Manifest patterns and limits ─────────────────────────────────────────
+
+describe('manifest rules', () => {
+ it('matches the official id and bucket patterns', () => {
+ assert.strictEqual(ID_PATTERN.source, OFFICIAL_ID_PATTERN);
+ assert.strictEqual(IPC_NAMESPACE_PATTERN.source, OFFICIAL_IPC_NAMESPACE_PATTERN);
+ assert.strictEqual(BUCKET_ID_PATTERN.source, OFFICIAL_BUCKET_ID_PATTERN);
+ assert.strictEqual(BUCKET_KIND_PATTERN.source, OFFICIAL_BUCKET_KIND_PATTERN);
+ });
+
+ it('matches the official numeric limits', () => {
+ assert.strictEqual(MANIFEST_VERSION, 1);
+ assert.strictEqual(MAX_NAME_LENGTH, 40);
+ assert.strictEqual(MAX_DESCRIPTION_LENGTH, 200);
+ assert.strictEqual(MAX_TAB_LABEL_LENGTH, 24);
+ assert.strictEqual(MAX_BUCKET_LABEL_LENGTH, 40);
+ assert.strictEqual(MAX_BUCKETS_PUBLISHED, 8);
+ assert.strictEqual(MAX_BUCKET_KINDS_READ, 8);
+ assert.strictEqual(DEFAULT_TAB_ORDER, 100);
+ });
+
+ it('matches the official mount points and bucket history values', () => {
+ assert.deepStrictEqual([...MOUNT_POINTS], ['tab']);
+ assert.deepStrictEqual([...BUCKET_HISTORY_VALUES], ['all']);
+ });
+
+ it('applies the id pattern at its exact boundaries', () => {
+ // '^[a-z][a-z0-9-]{1,40}$' is one letter followed by 1 to 40 more, so the
+ // accepted length is 2 to 41 characters inclusive.
+ assert.strictEqual(ID_PATTERN.test('ab'), true, '2 characters is accepted');
+ assert.strictEqual(ID_PATTERN.test('a'.repeat(41)), true, '41 characters is accepted');
+ assert.strictEqual(ID_PATTERN.test('a'.repeat(42)), false, '42 characters is refused');
+ assert.strictEqual(ID_PATTERN.test('1addon'), false, 'an id must start with a letter');
+ assert.strictEqual(ID_PATTERN.test('a'), false, '1 character is refused');
+ });
+
+ it('applies the name length limit', () => {
+ const long = validateMosaicManifest(withManifest({ name: 'x'.repeat(41) }));
+ assert.strictEqual(long.valid, false);
+ assert.ok(long.errors.some(e => e.includes('name') && e.includes('40')));
+ });
+
+ it('publishes exactly the 3 root members', () => {
+ assert.deepStrictEqual([...rootMembers()].sort(), [...OFFICIAL_ROOT_MEMBERS].sort());
+ });
+});
+
+// ── 6. Invalid and unsupported surfaces fail safely ─────────────────────────
+
+describe('surface validation', () => {
+ const real = JSON.parse(fs.readFileSync(ARTIFACT_PATH, 'utf8'));
+
+ it('accepts the vendored artifact', () => {
+ assert.deepStrictEqual(validateSurface(real), []);
+ assert.strictEqual(SURFACE_IS_VALID, true);
+ assert.ok(ADDON_SURFACE);
+ });
+
+ it('rejects malformed JSON', () => {
+ assert.throws(() => JSON.parse('{ "schema": 1, '), 'a truncated document is a parse error');
+ assert.throws(() => JSON.parse('not json at all'));
+ });
+
+ it('rejects an unsupported schema version', () => {
+ const candidate = structuredClone(real);
+ candidate.schema = 2;
+ const errors = validateSurface(candidate);
+ assert.ok(errors.length > 0, 'schema 2 must be refused');
+ assert.ok(errors.some(e => e.includes('schema')), 'the error names the schema');
+ });
+
+ it('rejects a missing required property', () => {
+ const candidate = structuredClone(real);
+ delete candidate.manifest;
+ const errors = validateSurface(candidate);
+ assert.ok(errors.some(e => e.includes('manifest')), 'the missing block is named');
+ });
+
+ it('rejects an unexpected type', () => {
+ const candidate = structuredClone(real);
+ candidate.manifest.maxNameLength = 'forty';
+ const errors = validateSurface(candidate);
+ assert.ok(errors.some(e => e.includes('maxNameLength')), 'the mistyped field is named');
+ });
+
+ it('rejects an invalid capability definition', () => {
+ const candidate = structuredClone(real);
+ candidate.api.namespaces.wallet.methods.getBalance.permission = 42;
+ const errors = validateSurface(candidate);
+ assert.ok(errors.some(e => e.includes('getBalance')), 'the bad method is named');
+ });
+
+ it('rejects a surface that is not an object', () => {
+ assert.ok(validateSurface(null).length > 0);
+ assert.ok(validateSurface([]).length > 0);
+ assert.ok(validateSurface('a string').length > 0);
+ });
+});
+
+// ── 7. Integrity ────────────────────────────────────────────────────────────
+
+describe('integrity', () => {
+ it('matches the documented SHA-256 of the vendored artifact', () => {
+ const bytes = fs.readFileSync(ARTIFACT_PATH);
+ const actual = crypto.createHash('sha256').update(bytes).digest('hex');
+ assert.strictEqual(actual, OFFICIAL_SHA256);
+ assert.strictEqual(bytes.length, 6603);
+ });
+
+ it('records the same SHA-256 in the provenance file', () => {
+ const provenance = JSON.parse(fs.readFileSync(PROVENANCE_PATH, 'utf8'));
+ assert.strictEqual(provenance.artifact.sha256, OFFICIAL_SHA256);
+ });
+
+ it('exposes the provenance to the Studio', () => {
+ const provenance = surfaceProvenance();
+ assert.strictEqual(provenance.sha256, OFFICIAL_SHA256);
+ assert.strictEqual(provenance.repository, 'hypercycle-development/mosaic-open-platform');
+ assert.strictEqual(provenance.path, 'scripts/adjudicate/addon-surface.json');
+ assert.ok(provenance.commit.length > 0, 'the source commit is recorded');
+ });
+});
+
+// ── 8. Offline operation and permissions ────────────────────────────────────
+
+describe('offline operation', () => {
+ const sharedModules = ['mosaic-schema.mjs', 'manifest-rules.mjs', 'capability-rules.mjs'];
+
+ it('never reaches the network or the upstream repository', () => {
+ for (const name of sharedModules) {
+ const source = fs.readFileSync(path.join(SHARED, name), 'utf8');
+ assert.ok(!source.includes('fetch('), `${name} does not fetch`);
+ assert.ok(!source.includes('api.github.com'), `${name} does not reference the GitHub API`);
+ assert.ok(!source.includes('node:https'), `${name} does not import node:https`);
+ assert.ok(!source.includes('execSync'), `${name} does not spawn a process`);
+ // The upstream repository name may appear only as provenance text, never
+ // as something to connect to.
+ for (const line of source.split('\n')) {
+ if (!line.includes('hypercycle-development')) continue;
+ assert.ok(
+ line.includes('repository') || line.includes('??') || line.includes('default'),
+ `${name} names the upstream repository only as provenance: ${line.trim()}`
+ );
+ }
+ }
+ });
+
+ it('introduces no filesystem or process access in the shared rules', () => {
+ for (const name of sharedModules) {
+ const source = fs.readFileSync(path.join(SHARED, name), 'utf8');
+ for (const forbidden of ['node:fs', 'node:http', 'node:child_process', 'node:net']) {
+ assert.ok(!source.includes(forbidden), `${name} does not import ${forbidden}`);
+ }
+ }
+ });
+
+});
+
+// ── 9. Studio-specific rules still work ─────────────────────────────────────
+
+describe('Studio-specific rules', () => {
+ it('keeps the npm script allowlist', () => {
+ assert.strictEqual(isPermittedScriptName('build'), true);
+ assert.strictEqual(isPermittedScriptName('test'), true);
+ assert.strictEqual(isPermittedScriptName('pretest'), false);
+ assert.strictEqual(isPermittedScriptName('postinstall'), false);
+ assert.strictEqual(isPermittedScriptName('test:unit'), true);
+ });
+
+ it('keeps the update-check modes', () => {
+ assert.deepStrictEqual([...UPDATE_CHECK_MODES], ['manual', 'automatic']);
+ });
+
+ it('keeps the IPC namespace derivation', () => {
+ assert.strictEqual(deriveIpcNamespace('vault'), 'vault-addon');
+ assert.strictEqual(deriveIpcNamespace('my-addon'), 'my-addon');
+ });
+
+ it('still validates a well-formed manifest', () => {
+ const result = validateMosaicManifest(BASE_MANIFEST);
+ assert.deepStrictEqual(result.errors, []);
+ assert.strictEqual(result.valid, true);
+ });
+});
+
+// ── 10. The Studio enforces the artefact's own values ───────────────────────
+//
+// The expected values here are literals transcribed from the pinned artifact,
+// never a value read back from the accessor under test. A rule that quotes
+// the artefact's pattern and limits in its own error message must be caught
+// when the artifact changes — and a rule that enforces the artefact's limits
+// must be caught when the Studio drifts away from them.
+
+describe('the artefact values, not copies of them', () => {
+ it('refuses an id the official pattern refuses', () => {
+ const tooShort = validateMosaicManifest(withManifest({ id: 'a' }));
+ assert.strictEqual(tooShort.valid, false, '1 character is refused');
+
+ const tooLong = validateMosaicManifest(withManifest({ id: 'a'.repeat(42) }));
+ assert.strictEqual(tooLong.valid, false, '42 characters are refused');
+
+ const accepted = validateMosaicManifest(withManifest({ id: 'a'.repeat(41) }));
+ assert.strictEqual(accepted.valid, true, '41 characters are accepted');
+ });
+
+ it('applies the name limit of 40 characters', () => {
+ assert.strictEqual(
+ validateMosaicManifest(withManifest({ name: 'x'.repeat(40) })).valid,
+ true,
+ '40 characters are accepted'
+ );
+ assert.strictEqual(
+ validateMosaicManifest(withManifest({ name: 'x'.repeat(41) })).valid,
+ false,
+ '41 characters are refused'
+ );
+ });
+
+ it('refuses a name of 40 characters plus trailing whitespace (app measures raw length)', () => {
+ const name = 'x'.repeat(40) + ' ';
+ const result = validateMosaicManifest(withManifest({ name }));
+ assert.strictEqual(result.valid, false, '41 raw characters (40 + space) are refused by the app');
+ assert.ok(result.errors.some(e => e.includes('name') && e.includes('40')));
+ });
+
+ it('applies the description limit of 200 characters', () => {
+ assert.strictEqual(
+ validateMosaicManifest(withManifest({ description: 'x'.repeat(200) })).valid,
+ true,
+ '200 characters are accepted'
+ );
+ assert.strictEqual(
+ validateMosaicManifest(withManifest({ description: 'x'.repeat(201) })).valid,
+ false,
+ '201 characters are refused'
+ );
+ });
+
+ it('applies the tab label limit of 24 characters', () => {
+ const withLabel = length => withManifest({
+ tab: { label: 'x'.repeat(length), icon: 'Sparkles' }
+ });
+
+ assert.strictEqual(validateMosaicManifest(withLabel(24)).valid, true, '24 characters are accepted');
+ assert.strictEqual(validateMosaicManifest(withLabel(25)).valid, false, '25 characters are refused');
+ });
+});
+
+// ── 11. The error messages quote the artefact's own values ─────────────────
+
+describe('error messages carry the artefact values', () => {
+ it('quotes the official id pattern when the id does not match', () => {
+ const result = validateMosaicManifest(withManifest({ id: 'Not An Id' }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.includes('id must match ' + OFFICIAL_ID_PATTERN + '.'),
+ 'the error carries the official id pattern'
+ );
+ });
+
+ it('quotes the official ipc namespace pattern when the ipcNamespace does not match', () => {
+ const result = validateMosaicManifest(withManifest({ ipcNamespace: 'Not An Id' }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.includes('ipcNamespace must match ' + OFFICIAL_IPC_NAMESPACE_PATTERN + '.'),
+ 'the error carries the official ipc namespace pattern'
+ );
+ });
+
+ it('quotes the official bucket label limit of 40 characters', () => {
+ const result = validateMosaicManifest(withManifest({
+ permissions: ['buckets:publish'],
+ buckets: {
+ publishes: [{ id: 'feed', kind: 'feed', label: 'x'.repeat(41) }],
+ reads: []
+ }
+ }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.includes('Each published bucket label must contain 1 to 40 characters.'),
+ 'the error carries the official limit'
+ );
+ });
+
+ it('names the publishing permission rather than a null one', () => {
+ const result = validateMosaicManifest(withManifest({
+ buckets: { publishes: [{ id: 'feed', kind: 'feed' }], reads: [] }
+ }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.includes('Publishing buckets requires the buckets:publish permission.'),
+ 'the permission is named'
+ );
+ assert.ok(
+ !result.errors.some(e => e.includes('null')),
+ 'no message names a null permission'
+ );
+ });
+});
+
+// ── 12. The deep-link param is a non-empty string, as the application wants ─
+
+describe('tab.deepLink', () => {
+ it('refuses an empty param', () => {
+ const result = validateMosaicManifest(withManifest({
+ tab: { label: 'Test', icon: 'Sparkles', deepLink: { param: '' } }
+ }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.includes('tab.deepLink must be an object with a non-empty string param.'),
+ 'the empty param is refused'
+ );
+ });
+
+ it('accepts a non-empty param', () => {
+ const result = validateMosaicManifest(withManifest({
+ tab: { label: 'Test', icon: 'Sparkles', deepLink: { param: 'orders' } }
+ }));
+
+ assert.strictEqual(result.valid, true);
+ assert.deepStrictEqual(result.errors, []);
+ });
+});
+
+// ── 13. Rules that must survive a refactor ────────────────────────────────
+//
+// Every rule below was checked by mutation: the rule was deleted from the
+// production code and the suite still passed. A rule nobody exercises is a
+// rule that can be removed without anyone noticing, so each one now has a
+// test that fails when the rule is gone.
+
+describe('manifest rules that protect the add-on', () => {
+ it('refuses duplicate permissions', () => {
+ const result = validateMosaicManifest(withManifest({
+ permissions: ['wallet:read', 'wallet:read']
+ }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.includes('permissions must not contain duplicates.'),
+ `the duplicate is named: ${JSON.stringify(result.errors)}`
+ );
+ });
+
+ it('refuses more published buckets than the application publishes', () => {
+ const publishes = Array.from({ length: MAX_BUCKETS_PUBLISHED + 1 }, (_, i) => ({
+ id: `bucket-${i}`,
+ kind: 'log'
+ }));
+ const result = validateMosaicManifest(withManifest({
+ permissions: ['buckets:publish'],
+ buckets: { publishes, reads: [] }
+ }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.some(e => e.includes(`at most ${MAX_BUCKETS_PUBLISHED} entries`)),
+ `the official limit is quoted: ${JSON.stringify(result.errors)}`
+ );
+ });
+
+ it('refuses more read bucket kinds than the application publishes', () => {
+ const reads = Array.from({ length: MAX_BUCKET_KINDS_READ + 1 }, (_, i) => `kind-${i}`);
+ const result = validateMosaicManifest(withManifest({
+ buckets: { publishes: [], reads }
+ }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.some(e => e.includes(`at most ${MAX_BUCKET_KINDS_READ} entries`)),
+ `the official limit is quoted: ${JSON.stringify(result.errors)}`
+ );
+ });
+
+ it('refuses a renderer entry that escapes the add-on directory', () => {
+ const result = validateMosaicManifest(withManifest({
+ renderer: { entry: '../outside.js' }
+ }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.some(e => e.includes('renderer.entry')),
+ `the offending field is named: ${JSON.stringify(result.errors)}`
+ );
+ });
+
+ it('refuses the publishing permission when no bucket is published', () => {
+ // The rule was reachable only when a `buckets` block was present, so an
+ // add-on could hold the publishing permission — which the application
+ // pairs with the destructive `buckets.clear` — with nothing published.
+ const result = validateMosaicManifest(withManifest({
+ permissions: ['buckets:publish']
+ }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.includes('buckets:publish permission requires at least one published bucket.'),
+ `the missing bucket is named: ${JSON.stringify(result.errors)}`
+ );
+ });
+});
+
+// ── 14. The release floor must cover the APIs the add-on calls ────────────
+
+describe('the release floor', () => {
+ const MANIFEST = {
+ ...BASE_MANIFEST,
+ permissions: [],
+ minAppVersion: '0.1.0'
+ };
+
+ it('refuses a floor older than the API the add-on calls', () => {
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: 'addonAPI.buckets.write("k", "v");' }],
+ { ...MANIFEST, permissions: ['buckets:publish'] }
+ );
+
+ assert.ok(
+ result.errors.some(e => e.includes('minAppVersion')),
+ `the floor is named: ${JSON.stringify(result.errors)}`
+ );
+ });
+
+ it('accepts a floor that covers the API the add-on calls', () => {
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: 'addonAPI.buckets.write("k", "v");' }],
+ { ...MANIFEST, minAppVersion: '0.1.13', permissions: ['buckets:publish'] }
+ );
+
+ assert.deepStrictEqual(result.errors, [], `unexpected errors: ${JSON.stringify(result.errors)}`);
+ });
+});
+
+// ── 15. A global the application does not expose ──────────────────────────
+
+describe('a global the application does not expose', () => {
+ it('refuses window.mosaicAPI, which the application does not provide', () => {
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: 'const x = window.mosaicAPI.agents.list();' }],
+ BASE_MANIFEST
+ );
+
+ assert.ok(
+ result.errors.some(e => e.includes('mosaicAPI')),
+ `the wrong global is named: ${JSON.stringify(result.errors)}`
+ );
+ });
+
+ it('does not refuse an add-on own object that happens to share the name', () => {
+ // The check is about reaching for a HOST global. An identifier the
+ // add-on chose for itself is not that, and refusing it blocked a
+ // correct add-on over a name it picked.
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: 'const mosaicAPI = { agents: [] };\nconst x = mosaicAPI.agents;\n' }],
+ BASE_MANIFEST
+ );
+
+ assert.deepStrictEqual(result.errors, [], `unexpected errors: ${JSON.stringify(result.errors)}`);
+ });
+});
+
+// ── 16. The scanner must not be defeated by ordinary source ──────────────
+
+describe('the scanner sees through ordinary source', () => {
+ it('finds a call that follows a regex literal', () => {
+ // A regex literal whose body contains a comment opener used to blank the
+ // rest of the file, so the call after it was never reported and the
+ // Studio certified an add-on calling a method that does not exist.
+ const result = checkAddonCapabilitiesInFiles(
+ [{
+ file: 'renderer/app.js',
+ source: 'const re = /a/*b/;\nconst x = addonAPI.agents.nopeDoesNotExist();\n'
+ }],
+ BASE_MANIFEST
+ );
+
+ assert.ok(
+ result.errors.some(e => e.includes('nopeDoesNotExist')),
+ `the call is reported: ${JSON.stringify(result.errors)}`
+ );
+ });
+
+ it('does not mistake a division for a regex literal', () => {
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: 'const q = a / b;\nconst x = 1;\n' }],
+ BASE_MANIFEST
+ );
+
+ assert.deepStrictEqual(result.errors, [], `unexpected errors: ${JSON.stringify(result.errors)}`);
+ });
+});
+
+// ── 17. The Studio's own add-on passes the Studio's own validator ────────
+
+// ── 18. Rules that guard the add-on directory on disk ────────────────────
+
+// ── 19. Main-process code is reserved ────────────────────────────────────
+
+describe('main-process code', () => {
+ it('refuses main.entry for an add-on outside the allowlist', () => {
+ // Main-process code runs outside the permission model, so the runtime
+ // restricts it to a reviewed allowlist keyed on the add-on id.
+ const result = validateMosaicManifest(withManifest({
+ main: { entry: 'main.js' }
+ }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.some(e => e.includes('main.entry')),
+ `the offending field is named: ${JSON.stringify(result.errors)}`
+ );
+ });
+});
+
+// ── 20. Permissions must be a list ───────────────────────────────────────
+
+describe('the permissions field', () => {
+ it('refuses a permissions value that is not a list', () => {
+ const result = validateMosaicManifest(withManifest({ permissions: 'wallet:read' }));
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.includes('permissions must be an array.'),
+ `the type is named: ${JSON.stringify(result.errors)}`
+ );
+ });
+});
+
+// ── 21. A permission-gated call must declare its permission ──────────────
+
+describe('a permission-gated call', () => {
+ it('refuses a call whose permission the manifest does not declare', () => {
+ // The application refuses this add-on — `perm-used-undeclared` is a
+ // blocking gate in the upstream adjudicator — so the Studio must refuse
+ // it too. It did not: only the reverse direction was checked, so an
+ // add-on could call a permission-gated API and ask for nothing.
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: 'addonAPI.wallet.getAddress();' }],
+ { ...BASE_MANIFEST, permissions: [] }
+ );
+
+ assert.ok(
+ result.errors.some(e => e.includes('wallet:read')),
+ `the missing permission is named: ${JSON.stringify(result.errors)}`
+ );
+ });
+
+ it('accepts the call when the permission is declared', () => {
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: 'addonAPI.wallet.getAddress();' }],
+ { ...BASE_MANIFEST, permissions: ['wallet:read'], minAppVersion: '0.1.13' }
+ );
+
+ assert.deepStrictEqual(result.errors, [], `unexpected errors: ${JSON.stringify(result.errors)}`);
+ });
+});
+
+// ── 22. The scanner must not invent or misread calls ─────────────────────
+
+describe('the scanner reads calls, and only calls', () => {
+ it('does not read a call out of a string literal', () => {
+ // A call written in a literal is documentation. Reading it as a call
+ // produced an error about a method that does not exist and blocked a
+ // correct add-on.
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: 'const q = "addonAPI.agents.list()";\n' }],
+ BASE_MANIFEST
+ );
+
+ assert.deepStrictEqual(result.errors, [], `unexpected errors: ${JSON.stringify(result.errors)}`);
+ });
+
+ it('does not read a call out of a template literal', () => {
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: 'const q = `addonAPI.agents.list()`;\n' }],
+ BASE_MANIFEST
+ );
+
+ assert.deepStrictEqual(result.errors, [], `unexpected errors: ${JSON.stringify(result.errors)}`);
+ });
+
+ it('does not read an add-on own object as the API object', () => {
+ // `client.addonAPI` is a member of the add-on's own object. Reading it
+ // as the API reported a call to a method that does not exist.
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source: 'client.addonAPI.list();\n' }],
+ BASE_MANIFEST
+ );
+
+ assert.deepStrictEqual(result.errors, [], `unexpected errors: ${JSON.stringify(result.errors)}`);
+ });
+
+ it('still reads the API object however it is spelled', () => {
+ const shapes = [
+ 'addonAPI.agents.list();\n',
+ 'window.addonAPI.agents.list();\n',
+ 'window?.addonAPI.agents.list();\n',
+ 'const api = addonAPI;\napi.agents.list();\n',
+ 'const api = window.addonAPI;\napi.agents.list();\n',
+ 'addonAPI["agents"]["list"]();\n',
+ 'addonAPI?.agents?.list();\n'
+ ];
+
+ for (const source of shapes) {
+ const result = checkAddonCapabilitiesInFiles(
+ [{ file: 'renderer/app.js', source }],
+ { ...BASE_MANIFEST, permissions: [], minAppVersion: '0.1.13' }
+ );
+
+ assert.ok(
+ result.calls.some(c => c.key === 'agents.list'),
+ `the call is found in: ${JSON.stringify(source)} — ${JSON.stringify(result.calls)}`
+ );
+ }
+ });
+});
diff --git a/addons/mosaic-addon-studio/test/host-fixes.test.mjs b/addons/mosaic-addon-studio/test/host-fixes.test.mjs
new file mode 100644
index 0000000..f6e4734
--- /dev/null
+++ b/addons/mosaic-addon-studio/test/host-fixes.test.mjs
@@ -0,0 +1,294 @@
+/**
+ * Regression tests for the four critical blockers fixed in the host adapter.
+ *
+ * These tests import and exercise the ACTUAL production code:
+ * - createHost() from src/host.js, driven with a fake window.addonAPI
+ * - validateAddonDirectory() from scripts/mosaic-manifest-validator.mjs
+ *
+ * The previous version of this file asserted against copies of the
+ * implementation's own logic -- it re-implemented the `.replace()` and the
+ * `?? []` in the test body and asserted that the copy behaved as the copy
+ * was written. Such a test passes even when the production code is broken.
+ * Every assertion here goes through the production module.
+ */
+
+import { describe, it, before, after } from 'node:test';
+import assert from 'node:assert/strict';
+
+// Production modules under test.
+import { createHost } from '../src/host.js';
+import { buildStarterFiles } from '../shared/starter-project.mjs';
+
+const PROJECT_ID = 'test-addon';
+const JAIL_PREFIX = `projects/${PROJECT_ID}/`;
+const COMPLETE_MIT = buildStarterFiles({
+ name: 'Test', id: PROJECT_ID, description: 'Test add-on', license: 'MIT'
+}).files.LICENSE;
+
+/**
+ * A manifest that the pinned Mosaic surface actually accepts.
+ *
+ * Every value here is one the artifact publishes: mountPoint "tab", an
+ * ipcNamespace matching `^[a-z][a-z0-9-]{1,40}$`, and an icon from the
+ * 32 the application renders.
+ */
+function validManifest(overrides = {}) {
+ return {
+ manifestVersion: 1,
+ id: PROJECT_ID,
+ name: 'Test Add-on',
+ version: '0.1.0',
+ description: 'A test add-on',
+ ipcNamespace: 'test-addon',
+ mountPoint: 'tab',
+ tab: { label: 'Test', icon: 'Sparkles', order: 100 },
+ renderer: { entry: 'renderer/index.html' },
+ permissions: [],
+ updates: { checkMode: 'manual' },
+ linkVisibilityToActivation: true,
+ buckets: { publishes: [], reads: [] },
+ ...overrides
+ };
+}
+
+/**
+ * A fake window.addonAPI that serves one project from the data jail.
+ *
+ * `files.list` and `files.read` are the two calls the host adapter makes, and
+ * their paths are jail-relative: `projects//...`.
+ */
+function makeFakeAddonAPI({ manifest = validManifest(), omit = [], license = COMPLETE_MIT } = {}) {
+ // The jail is a directory tree, not a flat map: `files.list` returns the
+ // entries of one directory and the host walks it recursively. Modelling it
+ // as a flat map would hide whether the host actually descends.
+ //
+ // The keys are jail-relative, exactly like the paths the host passes in,
+ // so the fake resolves a path the same way the jail would.
+ const tree = {
+ [`${JAIL_PREFIX}manifest.json`]: JSON.stringify(manifest, null, 2),
+ [`${JAIL_PREFIX}README.md`]: '# Test Add-on',
+ [`${JAIL_PREFIX}LICENSE`]: license,
+ [`${JAIL_PREFIX}renderer/index.html`]: ''
+ };
+
+ for (const name of omit) delete tree[`${JAIL_PREFIX}${name}`];
+
+ return {
+ system: {
+ getAppInfo: async () => ({
+ appVersion: '0.1.13',
+ platform: 'darwin',
+ locale: 'en'
+ })
+ },
+ files: {
+ read: async relPath => (relPath in tree ? tree[relPath] : null),
+ list: async relDir => {
+ if (relDir === 'projects') return [{ name: PROJECT_ID, isDir: true }];
+
+ const prefix = `${relDir}/`;
+ const entries = new Map();
+
+ for (const path of Object.keys(tree)) {
+ if (!path.startsWith(prefix)) continue;
+ const rest = path.slice(prefix.length);
+ const slash = rest.indexOf('/');
+ entries.set(slash === -1 ? rest : rest.slice(0, slash), slash !== -1);
+ }
+
+ return [...entries].map(([name, isDir]) => ({ name, isDir }));
+ },
+ write: async () => {}
+ }
+ };
+}
+
+// The host adapter reads the bare global `window`, so that is what the fake
+// must be installed on.
+const originalWindow = global.window;
+
+before(() => {
+ global.window = { addonAPI: makeFakeAddonAPI() };
+});
+
+after(() => {
+ global.window = originalWindow;
+});
+
+// -- 1. getAppInfo contract --------------------------------------------------
+
+describe('getAppInfo contract (production host.health())', () => {
+ it('reads the appVersion field the host API actually returns', async () => {
+ global.window = { addonAPI: makeFakeAddonAPI() };
+ const host = createHost();
+ const health = await host.health();
+
+ // The broken adapter read `info.version`, which the API never returns,
+ // so the version always fell back to the generic label.
+ assert.strictEqual(health.detail, 'Mosaic 0.1.13');
+ });
+
+ it('falls back to a generic label when the API returns nothing usable', async () => {
+ global.window = {
+ addonAPI: {
+ ...makeFakeAddonAPI(),
+ system: { getAppInfo: async () => ({}) }
+ }
+ };
+ const host = createHost();
+ const health = await host.health();
+
+ assert.strictEqual(health.ok, true);
+ assert.strictEqual(health.detail, 'Mosaic Companion');
+ });
+
+ it('still reports healthy when getAppInfo throws', async () => {
+ global.window = {
+ addonAPI: {
+ ...makeFakeAddonAPI(),
+ system: {
+ getAppInfo: async () => {
+ throw new Error('unavailable');
+ }
+ }
+ }
+ };
+ const host = createHost();
+ const health = await host.health();
+
+ assert.strictEqual(health.ok, true);
+ assert.strictEqual(health.detail, 'Mosaic Companion');
+ });
+});
+
+// -- 2. validateProject contract ---------------------------------------------
+
+describe('validateProject (production host.validateProject())', () => {
+ it('returns a checks array even though the manifest rules return none', async () => {
+ global.window = { addonAPI: makeFakeAddonAPI() };
+ const host = createHost();
+ const result = await host.validateProject(PROJECT_ID);
+
+ // The broken adapter spread `manifestResult.checks`, which the manifest
+ // rules do not produce, so this threw a TypeError.
+ assert.ok(Array.isArray(result.checks), 'checks must be an array');
+ assert.ok(result.checks.length > 0, 'the capability checks must be present');
+ assert.strictEqual(typeof result.valid, 'boolean');
+ assert.ok(Array.isArray(result.errors));
+ assert.ok(Array.isArray(result.warnings));
+ assert.ok(result.reference, 'the provenance reference must be returned');
+ });
+
+ it('accepts a valid manifest and reports no errors', async () => {
+ global.window = { addonAPI: makeFakeAddonAPI() };
+ const host = createHost();
+ const result = await host.validateProject(PROJECT_ID);
+
+ assert.deepStrictEqual(result.errors, []);
+ assert.strictEqual(result.valid, true);
+ });
+
+ it('reports the manifest errors of an invalid manifest', async () => {
+ global.window = {
+ addonAPI: makeFakeAddonAPI({
+ manifest: validManifest({ mountPoint: 'sidebar' })
+ })
+ };
+ const host = createHost();
+ const result = await host.validateProject(PROJECT_ID);
+
+ assert.strictEqual(result.valid, false);
+ assert.ok(
+ result.errors.some(error => error.includes('mountPoint')),
+ `the error must name the offending field: ${JSON.stringify(result.errors)}`
+ );
+ });
+
+ it('rejects a project that does not exist in the jail', async () => {
+ global.window = { addonAPI: makeFakeAddonAPI() };
+ const host = createHost();
+
+ await assert.rejects(
+ () => host.validateProject('no-such-addon'),
+ /no-such-addon/,
+ 'the host must say which project was missing'
+ );
+ });
+});
+
+// -- 3. Path normalisation ----------------------------------------------------
+//
+// The jail serves paths under `projects//`. The inventory and the
+// validator compare bare paths, so the adapter must strip the prefix. If it
+// does not, the renderer/README/LICENSE flags are permanently false.
+
+describe('jail path normalisation (production host.listProjects())', () => {
+ it('matches bare filenames despite the jail prefix', async () => {
+ global.window = { addonAPI: makeFakeAddonAPI() };
+ const host = createHost();
+ const projects = await host.listProjects();
+
+ assert.strictEqual(projects.length, 1);
+ const project = projects[0];
+
+ assert.strictEqual(project.renderer, true, 'renderer/index.html must be found');
+ assert.strictEqual(project.readme, true, 'README.md must be found');
+ assert.strictEqual(project.license, true, 'LICENSE must be found');
+ });
+
+ it('reports a missing LICENSE as absent', async () => {
+ global.window = {
+ addonAPI: makeFakeAddonAPI({ omit: ['LICENSE'] })
+ };
+ const host = createHost();
+ const projects = await host.listProjects();
+
+ assert.strictEqual(projects[0].license, false);
+ });
+});
+
+// -- 4. publishReady ----------------------------------------------------------
+
+describe('publishReady (production host.validateProject())', () => {
+ it('is true only when the LICENSE is present in the jail', async () => {
+ global.window = { addonAPI: makeFakeAddonAPI() };
+ const host = createHost();
+ const result = await host.validateProject(PROJECT_ID);
+
+ // The broken adapter compared jail-prefixed paths, so this was always
+ // false even for a complete add-on.
+ assert.strictEqual(result.publishReady, true);
+ });
+
+ it('is false when the LICENSE is only a stub, as the CLI validator decides', async () => {
+ global.window = { addonAPI: makeFakeAddonAPI({ license: 'MIT License' }) };
+ const result = await createHost().validateProject(PROJECT_ID);
+
+ assert.strictEqual(result.publishReady, false);
+ });
+
+ it('is false when the LICENSE is missing', async () => {
+ global.window = {
+ addonAPI: makeFakeAddonAPI({ omit: ['LICENSE'] })
+ };
+ const host = createHost();
+ const result = await host.validateProject(PROJECT_ID);
+
+ assert.strictEqual(result.publishReady, false);
+ });
+
+ it('is false when the manifest has errors, even with a LICENSE present', async () => {
+ global.window = {
+ addonAPI: makeFakeAddonAPI({
+ manifest: validManifest({ mountPoint: 'sidebar' })
+ })
+ };
+ const host = createHost();
+ const result = await host.validateProject(PROJECT_ID);
+
+ assert.strictEqual(result.publishReady, false, 'errors must block publication');
+ assert.ok(result.errors.length > 0);
+ });
+});
+
+// -- 5. validateAddonDirectory on disk ----------------------------------------
diff --git a/addons/mosaic-addon-studio/test/mutation-coverage.test.mjs b/addons/mosaic-addon-studio/test/mutation-coverage.test.mjs
new file mode 100644
index 0000000..1c23f77
--- /dev/null
+++ b/addons/mosaic-addon-studio/test/mutation-coverage.test.mjs
@@ -0,0 +1,182 @@
+/**
+ * Rules the mutation check (scripts/mutation-check.mjs) found unprotected.
+ * Each test drives the production validator; none re-implements a rule.
+ */
+
+import { describe, it } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { validateMosaicManifest } from '../shared/manifest-rules.mjs';
+import { checkAddonCapabilitiesInFiles } from '../shared/capability-rules.mjs';
+import { classifyLicense } from '../shared/license-texts.mjs';
+import { buildStarterManifest } from '../shared/starter-project.mjs';
+
+const base = () => buildStarterManifest({ name: 'Mutant', id: 'mutant-test', description: 'Mutation fixture' });
+const errorsOf = manifest => validateMosaicManifest(manifest, 'mutant-test').errors;
+const has = (errors, text) => errors.some(error => error.includes(text));
+
+describe('mutation: manifest fields', () => {
+ it('the unmodified fixture is valid', () => {
+ assert.deepEqual(errorsOf(base()), []);
+ });
+
+ it('tab.order: refuses a float and a string, accepts a negative integer and an absent value', () => {
+ for (const order of [1.5, '5', null, NaN]) {
+ assert.ok(has(errorsOf({ ...base(), tab: { ...base().tab, order } }), 'tab.order must be an integer'), String(order));
+ }
+ assert.deepEqual(errorsOf({ ...base(), tab: { ...base().tab, order: -3 } }), []);
+
+ const tab = { ...base().tab };
+ delete tab.order;
+ assert.deepEqual(errorsOf({ ...base(), tab }), []);
+ });
+
+ it('renderer.entry: refuses blank, whitespace and absolute paths', () => {
+ for (const entry of ['', ' ', '/abs/index.html', 'C:\\abs\\index.html']) {
+ const errors = errorsOf({ ...base(), renderer: { entry } });
+ assert.ok(has(errors, 'renderer.entry'), JSON.stringify(entry));
+ }
+ assert.ok(has(errorsOf({ ...base(), renderer: { entry: '/abs/index.html' } }), 'safe relative path'));
+ assert.ok(has(errorsOf({ ...base(), renderer: {} }), 'renderer.entry is required'));
+ });
+
+ it('main.entry: an allowlisted add-on may not escape its directory', () => {
+ const manifest = { ...base(), id: 'hyperinsight', main: { entry: '../outside.js' } };
+ assert.ok(has(validateMosaicManifest(manifest, 'hyperinsight').errors, 'main.entry must not escape'));
+ assert.ok(!has(validateMosaicManifest({ ...manifest, main: { entry: 'main/index.js' } }, 'hyperinsight').errors, 'main.entry must not escape'));
+ });
+
+ it('updates.checkMode: refuses a value outside the enum, accepts both modes', () => {
+ assert.ok(has(errorsOf({ ...base(), updates: { checkMode: 'weekly' } }), 'updates.checkMode'));
+ assert.ok(has(errorsOf({ ...base(), updates: 'manual' }), 'updates.checkMode'));
+ for (const checkMode of ['manual', 'automatic']) {
+ assert.deepEqual(errorsOf({ ...base(), updates: { checkMode } }), []);
+ }
+ });
+
+ it('minAppVersion: refuses anything that is not a SemVer string', () => {
+ for (const minAppVersion of ['not-a-version', '1.2', 'v', 1, true, null]) {
+ assert.ok(has(errorsOf({ ...base(), minAppVersion }), 'minAppVersion must be a valid SemVer'), String(minAppVersion));
+ }
+ for (const minAppVersion of ['0.1.13', '1.0.0-beta.1']) {
+ assert.deepEqual(errorsOf({ ...base(), minAppVersion }), []);
+ }
+ });
+});
+
+describe('mutation: buckets', () => {
+ it('refuses a read bucket kind declared twice', () => {
+ assert.ok(has(errorsOf({ ...base(), buckets: { publishes: [], reads: ['feed-kind', 'feed-kind'] } }), 'Duplicate read bucket kind'));
+ });
+
+ it('refuses a published bucket id declared twice', () => {
+ const manifest = {
+ ...base(),
+ permissions: ['buckets:publish'],
+ buckets: { publishes: [{ id: 'same-id', kind: 'a-kind' }, { id: 'same-id', kind: 'b-kind' }], reads: [] }
+ };
+ assert.ok(has(errorsOf(manifest), 'Duplicate published bucket ID'));
+ });
+});
+
+describe('mutation: minAppVersion against the calls an add-on makes', () => {
+ const file = source => [{ file: 'renderer/app.js', source }];
+ const check = (source, minAppVersion) =>
+ checkAddonCapabilitiesInFiles(file(source), { ...base(), permissions: ['agents:read'], ...(minAppVersion ? { minAppVersion } : {}) });
+ const both = 'addonAPI.agents.list();\naddonAPI.buckets.list();\n';
+
+ it('field absent: an add-on that calls a versioned API must declare it', () => {
+ const result = check(both);
+ assert.ok(has(result.errors, 'minAppVersion is not declared'));
+ assert.ok(has(result.errors, '0.1.13'), 'names the highest floor, not the first');
+ });
+
+ it('field absent and no versioned call: nothing to declare', () => {
+ assert.ok(!has(check('const x = 1;\n').errors, 'minAppVersion'));
+ });
+
+ it('declared below the highest floor: error naming the highest floor', () => {
+ const result = check(both, '0.1.10');
+ assert.ok(has(result.errors, 'Raise minAppVersion to "0.1.13"'));
+ });
+
+ it('declared exactly at the floor: accepted', () => {
+ const result = check(both, '0.1.13');
+ assert.ok(!has(result.errors, 'minAppVersion'));
+ assert.ok(result.checks.some(c => c.includes('covers every API')));
+ });
+
+ it('declared above the floor: accepted', () => {
+ assert.ok(!has(check(both, '9.0.0').errors, 'minAppVersion'));
+ });
+
+ it('declared as a prerelease of the floor is below the floor', () => {
+ assert.ok(has(check(both, '0.1.13-rc.1').errors, 'Raise minAppVersion'));
+ });
+
+ it('declared but not SemVer: left to the manifest rule, no crash and no coverage claim', () => {
+ const result = check(both, 'banana');
+ assert.ok(!result.checks.some(c => c.includes('covers every API')));
+ });
+});
+
+describe('mutation: licence completeness', () => {
+ const MIT_SHORT =
+ 'MIT License\nPermission is hereby granted\nThe above copyright notice and this permission notice\nTHE SOFTWARE IS PROVIDED "AS IS"';
+ const APACHE_SHORT =
+ 'Apache License\nVersion 2.0\nEND OF TERMS AND CONDITIONS\nAPPENDIX: How to apply the Apache License to your work';
+ const GPL_SHORT =
+ 'GNU GENERAL PUBLIC LICENSE\nVersion 3\nEND OF TERMS AND CONDITIONS\nHow to Apply These Terms to Your New Programs';
+
+ it('a text with every marker but far too short is not a licence', () => {
+ assert.equal(classifyLicense(MIT_SHORT), null);
+ assert.equal(classifyLicense(APACHE_SHORT), null);
+ assert.equal(classifyLicense(GPL_SHORT), null);
+ });
+
+ it('padding the same text past the length floor makes it count', () => {
+ assert.equal(classifyLicense(MIT_SHORT + '\n' + 'x'.repeat(700)), 'MIT');
+ assert.equal(classifyLicense(APACHE_SHORT + '\n' + 'x'.repeat(9000)), 'Apache-2.0');
+ assert.equal(classifyLicense(GPL_SHORT + '\n' + 'x'.repeat(30000)), 'GPL-3.0-or-later');
+ });
+});
+
+describe('SEC-04: buckets:publish and the buckets block', () => {
+ const PUBLISH = 'buckets:publish';
+ const bucket = { id: 'feed-one', kind: 'feed-kind' };
+ const withBuckets = (permissions, buckets) => {
+ const manifest = { ...base(), permissions };
+ delete manifest.buckets;
+ return buckets === undefined ? manifest : { ...manifest, buckets };
+ };
+
+ it('permission without any buckets block is refused', () => {
+ assert.ok(has(errorsOf(withBuckets([PUBLISH])), 'requires at least one published bucket'));
+ });
+
+ it('permission with publishes: [] is refused', () => {
+ assert.ok(has(errorsOf(withBuckets([PUBLISH], { publishes: [], reads: [] })), 'requires at least one published bucket'));
+ });
+
+ it('permission with only reads is refused', () => {
+ assert.ok(has(errorsOf(withBuckets([PUBLISH], { reads: ['feed-kind'] })), 'requires at least one published bucket'));
+ });
+
+ it('publishing without the permission is refused', () => {
+ assert.ok(has(errorsOf(withBuckets([], { publishes: [bucket] })), 'requires the buckets:publish permission'));
+ });
+
+ it('a valid publication passes', () => {
+ assert.deepEqual(errorsOf(withBuckets([PUBLISH], { publishes: [bucket], reads: ['other-kind'] })), []);
+ });
+
+ it('reading buckets needs no permission', () => {
+ assert.deepEqual(errorsOf(withBuckets([], { reads: ['feed-kind'] })), []);
+ });
+
+ it('malformed structures are refused without throwing', () => {
+ for (const buckets of ['x', 5, [], { publishes: 'x' }, { publishes: [null] }, { publishes: [{ id: 'A', kind: 'b' }] }, { reads: [1] }, { reads: 'x' }]) {
+ assert.ok(errorsOf(withBuckets([], buckets)).length > 0, JSON.stringify(buckets));
+ }
+ });
+});
diff --git a/addons/mosaic-addon-studio/test/review-fixes.test.mjs b/addons/mosaic-addon-studio/test/review-fixes.test.mjs
new file mode 100644
index 0000000..8be04ba
--- /dev/null
+++ b/addons/mosaic-addon-studio/test/review-fixes.test.mjs
@@ -0,0 +1,288 @@
+/**
+ * Regression tests for the findings of the independent review (M1-M7 and the
+ * minor findings). Every test drives production code; each one fails on the
+ * pre-fix behaviour the reviewer reproduced.
+ */
+
+import { describe, it } from 'node:test';
+import assert from 'node:assert/strict';
+
+import {
+ blankComments,
+ checkAddonCapabilitiesInFiles,
+ normalizeSource,
+ scanApiCallsInFiles,
+ scanUnknownGlobalsInFiles
+} from '../shared/capability-rules.mjs';
+import { hasPathTraversal, isAbsolutePath } from '../shared/mosaic-schema.mjs';
+import { isStrictSemver, validateMosaicManifest } from '../shared/manifest-rules.mjs';
+import {
+ buildStarterFiles,
+ buildStarterManifest,
+ defaultTabIcon,
+ escapeHtml,
+ normalizeStarterInput
+} from '../shared/starter-project.mjs';
+
+const NS = { namespaces: ['agents', 'nodes', 'files', 'buckets'] };
+const keys = source => scanApiCallsInFiles([{ file: 'a.js', source }], NS).map(c => c.key);
+
+describe('M1: comments and regex bodies after a division', () => {
+ for (const source of [
+ 'x = a / b; // addonAPI.files.read()',
+ 'x = a / 2; /* addonAPI.files.read() */',
+ 'x = 10 / 2; // addonAPI.files.read()',
+ 'x = (a) / b; // addonAPI.files.read()',
+ 'x = arr[0] / b; // addonAPI.files.read()'
+ ]) {
+ it(`ignores the comment in ${JSON.stringify(source)}`, () => assert.deepEqual(keys(source), []));
+ }
+
+ it('ignores a regex literal that holds a call, with a class containing a slash', () => {
+ assert.deepEqual(keys('/[/]addonAPI.files.read()/'), []);
+ assert.deepEqual(keys('function f() { return /addonAPI.files.read()/.test(s); }'), []);
+ });
+
+ it('still reads a real call after a regex and after a division', () => {
+ assert.deepEqual(keys('const r = /x/g; addonAPI.files.read();'), ['files.read']);
+ assert.deepEqual(keys('const q = a / b; addonAPI.files.read();'), ['files.read']);
+ });
+
+ it('keeps offsets: a regex body is blanked to the same length', () => {
+ const source = 'x = /ab[/]c/g;';
+ assert.equal(blankComments(source).length, source.length);
+ assert.equal(blankComments(source), 'x = / /g;');
+ });
+});
+
+describe('M2: the scanner is linear', () => {
+ const seconds = work => { const t = performance.now(); work(); return (performance.now() - t) / 1000; };
+
+ it('scans 20000 calls and 20000 unknown members in a few seconds', () => {
+ assert.ok(seconds(() => keys('addonAPI.files.read("x");\n'.repeat(20000))) < 5);
+ assert.ok(seconds(() => keys(Array.from({ length: 20000 }, (_, i) => `addonAPI.zz${i}.go();`).join('\n'))) < 5);
+ assert.ok(seconds(() => keys('const b = addonAPI.buckets;\n' + 'b.list();\n'.repeat(20000))) < 5);
+ });
+
+ it('reports the line of a call without re-splitting the text', () => {
+ const [call] = scanApiCallsInFiles([{ file: 'a.js', source: '\n\n\naddonAPI.files.read();\n' }], NS);
+ assert.equal(call.line, 4);
+ });
+});
+
+describe('M3: hostile input never throws', () => {
+ const manifest = { minAppVersion: '0.1.13', permissions: [], tab: { icon: 'Sparkles' } };
+ const check = source => checkAddonCapabilitiesInFiles([{ file: 'a.js', source }], manifest);
+
+ it('survives 50000 unclosed ${ and finishes quickly', () => {
+ const t = performance.now();
+ assert.doesNotThrow(() => check('`${'.repeat(50000)));
+ assert.ok(performance.now() - t < 15000);
+ });
+
+ it('survives a huge run of whitespace between the object and the member', () => {
+ assert.deepEqual(keys('addonAPI' + ' '.repeat(200000) + '.files.read('), ['files.read']);
+ });
+
+ it('survives deeply nested templates and unbalanced destructuring', () => {
+ assert.doesNotThrow(() => check('`${'.repeat(5000) + 'x' + '}`'.repeat(5000)));
+ assert.doesNotThrow(() => check('const {'.repeat(50000)));
+ });
+
+ it('turns an internal failure into a finding, not an exception', () => {
+ const hostile = { get source() { throw new RangeError('boom'); }, file: 'a.js' };
+ const result = checkAddonCapabilitiesInFiles([hostile], manifest);
+ assert.ok(result.errors.some(e => e.includes('capability scanner failed') && e.includes('boom')));
+ });
+
+ it('normalisation keeps the length of an unterminated escape', () => {
+ assert.equal(normalizeSource('const s = "abc\\').length, 'const s = "abc\\'.length);
+ });
+});
+
+describe('M4: forms that reach the API object', () => {
+ it('nested destructuring of a namespace', () => {
+ assert.deepEqual(keys("const {files:{read}}=addonAPI; read('x')"), ['files.read']);
+ assert.deepEqual(keys('const { agents, files: { read, write } } = addonAPI;'), ['files.read', 'files.write']);
+ });
+
+ it('the API object taken off the global object, by any name', () => {
+ assert.deepEqual(keys("const {addonAPI: A} = window; A.files.read('x')"), ['files.read']);
+ assert.deepEqual(keys("const {addonAPI: A} = globalThis; A.files.read('x')"), ['files.read']);
+ assert.deepEqual(keys("globalThis.addonAPI.files.read('x')"), ['files.read']);
+ assert.deepEqual(keys("self['addonAPI'].files.read('x')"), ['files.read']);
+ });
+
+ it('a spread copy and a rest binding of the API object', () => {
+ assert.deepEqual(keys("const api={...addonAPI}; api.files.read('x')"), ['files.read']);
+ assert.deepEqual(keys("const {...rest}=addonAPI; rest.files.read('x')"), ['files.read']);
+ });
+
+ it('does not read a look-alike', () => {
+ assert.deepEqual(keys('const {files:{read}}=client.addonAPI; read(1)'), []);
+ assert.deepEqual(keys('const {addonAPI: A} = someObject; A.files.read(1)'), []);
+ assert.deepEqual(keys('const api={...other}; api.files.read(1)'), []);
+ });
+
+ it('globalThis.mosaicAPI is the same unknown global as window.mosaicAPI', () => {
+ const names = source => scanUnknownGlobalsInFiles([{ file: 'a.js', source }]).map(g => g.name);
+ assert.deepEqual(names('globalThis.mosaicAPI.x;'), ['mosaicAPI']);
+ assert.deepEqual(names("self['mosaicAPI'].x;"), ['mosaicAPI']);
+ assert.deepEqual(names('const mosaicAPI = {};'), []);
+ });
+});
+
+describe('M7: rules the reviewer found unprotected', () => {
+ const input = { name: 'Review', id: 'review-test', description: 'Review fixture', license: 'MIT' };
+ const valid = () => buildStarterManifest(input);
+ const errorsOf = manifest => validateMosaicManifest(manifest, 'review-test').errors;
+
+ it('escapes every HTML special character in the generated page', () => {
+ assert.equal(escapeHtml(`<&>"'`), '<&>"'');
+ const page = buildStarterFiles({ ...input, name: 'x ' }).files['renderer/index.html'];
+ assert.ok(!page.includes('x '));
+ assert.ok(page.includes('<b>x</b>'));
+ });
+
+ it('path traversal on either separator, and every absolute form', () => {
+ for (const value of ['..\\x', 'a\\..\\b', '../x', 'a/../b']) assert.equal(hasPathTraversal(value), true, value);
+ for (const value of ['a/b', 'a..b', '..a/b']) assert.equal(hasPathTraversal(value), false, value);
+ for (const value of ['/x', 'C:\\x', 'c:/x', 'z:\\x', '\\\\host\\share', '\\rooted']) assert.equal(isAbsolutePath(value), true, value);
+ for (const value of ['x/y', 'c:x', 'a:b\\c', '']) assert.equal(isAbsolutePath(value), false, value);
+ });
+
+ it('manifestVersion must be exactly the supported one', () => {
+ for (const manifestVersion of [2, 0, '1', undefined]) {
+ assert.ok(errorsOf({ ...valid(), manifestVersion }).some(e => e.includes('manifestVersion')), String(manifestVersion));
+ }
+ });
+
+ it('the starter truncates the tab label and lowercases the id', () => {
+ const manifest = buildStarterManifest({ ...input, name: 'N'.repeat(40), id: 'Mixed-Case' });
+ assert.equal(manifest.tab.label.length, 24);
+ assert.equal(manifest.id, 'mixed-case');
+ });
+
+ it('the default icon is renderable, falls back, and never names an unrenderable icon', () => {
+ assert.equal(defaultTabIcon(['Sparkles', 'Zap'], null), 'Sparkles');
+ assert.equal(defaultTabIcon(['Zap', 'Star'], 'Star'), 'Star');
+ assert.equal(defaultTabIcon(['Zap', 'Star'], 'Missing'), 'Zap');
+ assert.throws(() => defaultTabIcon([], null), /no renderable icon/);
+ });
+
+ it('input limits: homepage scheme, author length, description minimum', () => {
+ const errors = patch => normalizeStarterInput({ ...input, ...patch }).errors.join(' | ');
+ assert.match(errors({ homepage: 'ftp://x.org' }), /Homepage/);
+ assert.match(errors({ homepage: 'javascript:alert(1)' }), /Homepage/);
+ assert.match(errors({ homepage: 'https://example.com/a b' }), /Homepage/);
+ assert.equal(errors({ homepage: 'https://example.com/a' }), '');
+ assert.match(errors({ author: 'a'.repeat(101) }), /Author/);
+ assert.equal(errors({ author: 'a'.repeat(100) }), '');
+ assert.match(errors({ description: '' }), /Description/);
+ assert.match(errors({ description: ' ' }), /Description/);
+ });
+
+ it('a declared permission whose namespace is mentioned but unresolvable is not called unused', () => {
+ const manifest = { ...valid(), permissions: ['agents:read'], minAppVersion: '0.1.13' };
+ const unresolved = checkAddonCapabilitiesInFiles([{ file: 'a.js', source: 'const h = getApi(); h.agents.list();\n' }], manifest);
+ assert.ok(!unresolved.warnings.some(w => w.includes('agents:read')));
+ const unused = checkAddonCapabilitiesInFiles([{ file: 'a.js', source: 'const x = 1;\n' }], manifest);
+ assert.ok(unused.warnings.some(w => w.includes('agents:read')));
+ });
+});
+
+describe('minor findings', () => {
+ const input = { name: 'Minor', id: 'minor-test', description: 'Minor fixture' };
+ const errorsOf = manifest => validateMosaicManifest(manifest, 'minor-test').errors;
+
+ it('SemVer is strict: no leading v, no padding', () => {
+ for (const minAppVersion of ['v1.2.3', ' 1.2.3', '1.2.3 ', '=1.2.3']) {
+ assert.ok(errorsOf({ ...buildStarterManifest(input), minAppVersion }).some(e => e.includes('minAppVersion')), JSON.stringify(minAppVersion));
+ assert.match(normalizeStarterInput({ ...input, minAppVersion: minAppVersion.trim() }).errors.join('|') || 'ok', minAppVersion.trim() === '1.2.3' ? /ok/ : /Minimum app version/);
+ }
+ assert.ok(errorsOf({ ...buildStarterManifest(input), version: 'v0.1.0' }).some(e => e.includes('version')));
+ });
+
+ it('a non-string name, id or description is refused, not stringified', () => {
+ for (const key of ['name', 'id', 'description']) {
+ assert.match(normalizeStarterInput({ ...input, [key]: {} }).errors.join('|'), new RegExp(`${key} must be a string`));
+ }
+ });
+});
+
+describe('round 2: scanner', () => {
+ it('reads a call that follows `:`, `/` or `-` directly (minified code)', () => {
+ for (const source of [
+ 'x?1:addonAPI.agents.nope()', '({run:addonAPI.agents.nope})', 'switch(a){case 1:addonAPI.agents.nope()}',
+ 'a-addonAPI.agents.nope()', 'a/addonAPI.agents.nope()'
+ ]) assert.deepEqual(keys(source), ['agents.nope'], source);
+ });
+
+ it('still ignores a member of another object and a URL-like string', () => {
+ assert.deepEqual(keys('client.addonAPI.agents.nope()'), []);
+ assert.deepEqual(keys('const u = "https://example.com/addonAPI.agents.nope()";'), []);
+ });
+
+ it('a string inside an array literal is not a call, a member-name string still is', () => {
+ assert.deepEqual(keys("['addonAPI.agents.list()']"), []);
+ assert.deepEqual(keys("addonAPI['agents']['list']()"), ['agents.list']);
+ });
+
+ it('a division after a postfix ++ or -- does not open a regex', () => {
+ assert.deepEqual(keys('n++ / 2; window.addonAPI.agents.nope(); n / 3'), ['agents.nope']);
+ assert.deepEqual(keys('n-- / 2; window.addonAPI.agents.nope(); n / 3'), ['agents.nope']);
+ });
+
+ it('a regex after `return` is a regex; a ternary keeps its `.5`', () => {
+ assert.deepEqual(keys('function f(){ return /addonAPI.agents.nope()/.test(s) }'), []);
+ assert.equal(normalizeSource('a ? .5 : b'), 'a ? .5 : b');
+ assert.equal(normalizeSource('a?.5:b'), 'a?.5:b');
+ assert.equal(normalizeSource('a?.b'), 'a.b');
+ });
+
+ it('only window/globalThis/self make `mosaicAPI` the unknown global', () => {
+ const names = source => scanUnknownGlobalsInFiles([{ file: 'a.js', source }]).map(g => g.name);
+ assert.deepEqual(names('client.window.mosaicAPI.x()'), []);
+ assert.deepEqual(names('window.mosaicAPI.x()'), ['mosaicAPI']);
+ });
+
+ it('hostile runs of `/[` and `${` stay fast', () => {
+ for (const source of ['a=/['.repeat(25000), '`${'.repeat(33000)]) {
+ const t = performance.now();
+ keys(source);
+ assert.ok(performance.now() - t < 5000);
+ }
+ });
+});
+
+describe('round 2: input and structure', () => {
+ const input = { name: 'Round', id: 'round-two', description: 'Round fixture' };
+
+ it('SemVer build metadata is valid, padding and prefixes are not', () => {
+ for (const value of ['1.2.3+build', '1.2.3-rc.1+exp.sha', '0.1.13']) assert.equal(isStrictSemver(value), true, value);
+ for (const value of ['v1.2.3', '=1.2.3', ' 1.2.3', '1.2.3 ', '1.2', 'x', 1, null]) assert.equal(isStrictSemver(value), false, String(value));
+ assert.deepEqual(normalizeStarterInput({ ...input, minAppVersion: '0.1.13+build' }).errors, []);
+ });
+
+ it('control characters in name, description and author are refused', () => {
+ for (const key of ['name', 'description', 'author']) {
+ assert.match(normalizeStarterInput({ ...input, [key]: 'a\nb' }).errors.join('|'), /control characters/, key);
+ }
+ });
+
+ it('Windows device names cannot be an id', () => {
+ for (const id of ['con', 'nul', 'com1', 'lpt9', 'aux', 'prn']) {
+ assert.match(normalizeStarterInput({ ...input, id }).errors.join('|'), /reserved device name/, id);
+ }
+ assert.deepEqual(normalizeStarterInput({ ...input, id: 'console' }).errors, []);
+ });
+
+ it('buckets.publishes / reads set to null are refused, an absent key is fine', () => {
+ const base = buildStarterManifest(input);
+ for (const buckets of [{ publishes: null }, { reads: null }]) {
+ assert.ok(validateMosaicManifest({ ...base, buckets }, 'round-two').errors.length > 0, JSON.stringify(buckets));
+ }
+ assert.deepEqual(validateMosaicManifest({ ...base, buckets: {} }, 'round-two').errors, []);
+ });
+
+});
diff --git a/addons/mosaic-addon-studio/test/round3-fixes.test.mjs b/addons/mosaic-addon-studio/test/round3-fixes.test.mjs
new file mode 100644
index 0000000..5c3c945
--- /dev/null
+++ b/addons/mosaic-addon-studio/test/round3-fixes.test.mjs
@@ -0,0 +1,302 @@
+/**
+ * Round-3 findings: running time of the alias discovery (F1), what the scanner
+ * reports when a bound stops it (F2), and the rules F3-F5 left unprotected.
+ * Every test drives production code.
+ */
+
+import { describe, it } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { SCANNER_LIMITS, checkAddonCapabilitiesInFiles, normalizeSource, scanApiCallsInFiles, scanUnknownGlobalsInFiles } from '../shared/capability-rules.mjs';
+import { normalizeStarterInput } from '../shared/starter-project.mjs';
+
+const NAMESPACES = ['agents', 'files', 'nodes', 'buckets'];
+const MANIFEST = { id: 'bench', name: 'Bench', version: '1.0.0', description: 'd', permissions: [], tab: { icon: 'Sparkles' } };
+
+const scan = source => {
+ const limits = [];
+ const calls = scanApiCallsInFiles([{ file: 'a.js', source }], { namespaces: NAMESPACES, onLimit: hit => limits.push(hit) });
+ return { keys: calls.map(call => call.key), limits };
+};
+const seconds = work => { const t = performance.now(); work(); return (performance.now() - t) / 1000; };
+const lines = (n, line) => Array.from({ length: n }, (_, i) => line(i)).join('\n');
+
+describe('F1: alias discovery runs in linear time', () => {
+ const shapes = {
+ 'alias flood': n => lines(n, i => `const a${i} = addonAPI;`) + '\na0.agents.list();',
+ 'reverse chain': n => 'const a0 = addonAPI;\n' + lines(n, i => `const a${i + 1} = a${i};`) + `\na${n}.agents.list();`,
+ 'namespace bind': n => lines(n, i => `const n${i} = addonAPI.nodes;\nn${i}.list();`),
+ 'reassigned names': n => lines(n, i => `let r${i} = addonAPI;\nr${i} = null;\nr${i}.agents.nope();`)
+ };
+
+ it('190 KB and 489 KB alias floods finish quickly and are still read correctly', () => {
+ const small = shapes['alias flood'](8000);
+ const large = shapes['alias flood'](20000);
+ assert.ok(small.length > 180 * 1024 && large.length > 470 * 1024);
+
+ for (const [source, budget] of [[small, 3], [large, 8]]) {
+ let result;
+ const elapsed = seconds(() => { result = scan(source); });
+ assert.ok(elapsed < budget, `${Math.round(source.length / 1024)} KB took ${elapsed.toFixed(1)} s`);
+ assert.deepEqual(result.keys, ['agents.list']);
+ }
+ assert.ok(seconds(() => checkAddonCapabilitiesInFiles([{ file: 'a.js', source: large }], MANIFEST)) < 10);
+ });
+
+ for (const [name, make] of Object.entries(shapes)) {
+ it(`${name}: four times the input costs far less than sixteen times the time`, () => {
+ scan(make(500));
+ const t1 = Math.max(seconds(() => scan(make(5000))), 0.01);
+ const t4 = seconds(() => scan(make(20000)));
+ assert.ok(t4 / t1 < 10, `x4 input took x${(t4 / t1).toFixed(1)} (quadratic would be x16)`);
+ });
+ }
+
+ it('does not trade precision for speed: only a name assigned once is an alias', () => {
+ assert.deepEqual(scan('let api = addonAPI; api.agents.nope();').keys, ['agents.nope']);
+ assert.deepEqual(scan('let api = addonAPI; api = other; api.agents.nope();').keys, []);
+ assert.deepEqual(scan('const a = addonAPI; const b = a; const c = b; c.files.nope();').keys, ['files.nope']);
+ assert.deepEqual(scan('const { addonAPI: api } = window; api.nodes.nope();').keys, ['nodes.nope']);
+ assert.deepEqual(scan('const api = { ...addonAPI }; api.agents.nope();').keys, ['agents.nope']);
+ assert.deepEqual(scan('const b = addonAPI.buckets; b.nope();').keys, ['buckets.nope']);
+ });
+
+ it('the namespace.method pass only records namespaces; an unknown member is still found by the member pass', () => {
+ assert.deepEqual(scan('const a = addonAPI; a.vault.list(); addonAPI["vault"]["get"]();').keys, ['vault.list', 'vault.get']);
+ assert.deepEqual(scan('addonAPI.agents.list(); addonAPI.agents["get"]();').keys, ['agents.list', 'agents.get']);
+ });
+
+ it('a call to an unknown root method is recorded as a root call', () => {
+ const [call] = scanApiCallsInFiles([{ file: 'a.js', source: 'addonAPI.nope();' }], { namespaces: NAMESPACES });
+ assert.equal(call.root, true);
+ assert.equal(call.method, 'nope');
+ assert.deepEqual(scan('addonAPI.nope;').keys, []);
+ const { errors } = checkAddonCapabilitiesInFiles([{ file: 'a.js', source: 'addonAPI.nope();' }], MANIFEST);
+ assert.ok(errors.some(error => error.includes('addonAPI.nope(), but that does not exist')), errors.join('|'));
+ });
+});
+
+describe('F2: a bound is reported, not silent', () => {
+ const tail = '\naddonAPI.agents.nope();';
+ const cases = {
+ interpolation: {
+ limit: SCANNER_LIMITS.interpolation,
+ make: n => 'const s = `${' + 'x'.repeat(n) + '}`;' + tail,
+ kind: /template interpolation longer than/
+ },
+ regex: {
+ limit: SCANNER_LIMITS.regex,
+ make: n => "const r = /'" + 'a'.repeat(n) + "/;" + tail,
+ kind: /regex literal longer than/
+ },
+ destructuring: {
+ limit: SCANNER_LIMITS.destructuring,
+ make: n => 'const {' + ' a,'.repeat(Math.ceil(n / 3)) + ' } = addonAPI;' + tail,
+ kind: /destructuring pattern longer than/
+ }
+ };
+
+ for (const [name, { limit, make, kind }] of Object.entries(cases)) {
+ it(`${name}: just inside the bound nothing is reported and the call is read`, () => {
+ const { keys, limits } = scan(make(limit - 50));
+ assert.deepEqual(limits, []);
+ assert.ok(keys.includes('agents.nope'), keys.join());
+ });
+
+ it(`${name}: just past the bound it is reported with the file, the line and the kind`, () => {
+ const { limits } = scan(make(limit + 50));
+ assert.equal(limits.length, 1, JSON.stringify(limits));
+ assert.equal(limits[0].file, 'a.js');
+ assert.equal(limits[0].line, 1);
+ assert.match(limits[0].kind, kind);
+ });
+
+ it(`${name}: past the bound the add-on does not validate`, () => {
+ const { errors } = checkAddonCapabilitiesInFiles([{ file: 'a.js', source: make(limit + 50) }], MANIFEST);
+ const found = errors.filter(error => error.includes('a.js:1 contains') && error.includes('cannot be verified'));
+ assert.equal(found.length, 1, errors.join('|'));
+ });
+
+ it(`${name}: a call never vanishes without a report`, () => {
+ for (const n of [limit - 1, limit, limit + 1, limit * 2]) {
+ const { keys, limits } = scan(make(n));
+ assert.ok(keys.includes('agents.nope') || limits.length > 0, `n=${n}`);
+ }
+ });
+ }
+
+ it('ordinary code, including a long regex and a long template, reports nothing', () => {
+ const source = "const r = /[a-z]+\\d{2,}/g;\nconst t = `a ${b} c`;\nconst { agents, files } = addonAPI;\n";
+ assert.deepEqual(scan(source).limits, []);
+ });
+
+ it('the line is that of the construct, not of the end of the file', () => {
+ const { limits } = scan('a();\nb();\n' + cases.regex.make(SCANNER_LIMITS.regex + 50));
+ assert.equal(limits[0].line, 3);
+ });
+});
+
+describe('F5: control characters in names', () => {
+ const input = { name: 'Round', id: 'round-three', description: 'Round fixture' };
+ const refused = value => normalizeStarterInput({ ...input, name: value }).errors.join('|');
+
+ it('every C0 control character, including U+001F, is refused, and U+0020 is not', () => {
+ // The 32 C0 control characters, written out one by one.
+ const c0 = ['\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005', '\u0006', '\u0007',
+ '\u0008', '\u0009', '\u000a', '\u000b', '\u000c', '\u000d', '\u000e', '\u000f',
+ '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001a', '\u001b', '\u001c', '\u001d', '\u001e', '\u001f'];
+ assert.equal(c0.length, 32);
+ c0.forEach((character, code) => {
+ assert.match(refused(`a${character}b`), /control characters/, `U+${code.toString(16).padStart(4, '0')}`);
+ });
+ assert.equal(refused('a b'), '');
+ });
+
+ for (const [label, character] of [
+ ['NUL', '\u0000'], ['LF', '\n'], ['TAB', '\t'], ['DEL', '\u007f'],
+ ['C1 start', '\u0080'], ['NEL', '\u0085'], ['C1 end', '\u009f'],
+ ['line separator', '\u2028'], ['paragraph separator', '\u2029'],
+ ['right-to-left override', '\u202e'], ['left-to-right mark', '\u200e'], ['zero-width space', '\u200b'],
+ ['BOM', '\ufeff'], ['soft hyphen', '\u00ad'], ['bidi isolate', '\u2066']
+ ]) {
+ it(`${label} is refused in name, description and author`, () => {
+ for (const key of ['name', 'description', 'author']) {
+ assert.match(normalizeStarterInput({ ...input, [key]: `a${character}b` }).errors.join('|'), /control characters/, key);
+ }
+ });
+ }
+
+ it('printable text next to the refused ranges is accepted', () => {
+ for (const value of ['Café', 'Añadir', 'naïve', '日本語', 'a\u00a0b', 'a\u00a1b', 'a\u2027b', 'emoji 😀', '~tilde']) {
+ assert.equal(refused(value), '', JSON.stringify(value));
+ }
+ });
+});
+
+describe('round 4: scanner details', () => {
+ it('normalizeSource is linear in the number of quoted member names', () => {
+ const make = n => lines(n, i => `addonAPI['zz${i}']['a'].b();`);
+ scan(make(200));
+ const t1 = Math.max(seconds(() => scan(make(4000))), 0.01);
+ const t4 = seconds(() => scan(make(16000)));
+ assert.ok(t4 / t1 < 10, `x4 input took x${(t4 / t1).toFixed(1)}`);
+ assert.ok(t4 < 8, `${t4.toFixed(1)} s`);
+ assert.deepEqual(scan("addonAPI['agents']['list']();").keys, ['agents.list']);
+ assert.deepEqual(scan("const a = ['addonAPI.agents.list()'];").keys, []);
+ });
+
+ it('a member of another object is not the API even with whitespace after the dot', () => {
+ for (const source of ['client. addonAPI.agents.nope()', 'client.\n addonAPI.agents.nope()', 'client .addonAPI.agents.nope()']) {
+ assert.deepEqual(scan(source).keys, [], JSON.stringify(source));
+ }
+ assert.deepEqual(scan('x = 1;\n addonAPI.agents.nope()').keys, ['agents.nope']);
+ assert.deepEqual(scan('window. addonAPI.agents.nope()').keys, ['agents.nope']);
+ });
+
+ it('a name that starts with `$` can be an alias', () => {
+ assert.deepEqual(scan('const $a = addonAPI; $a.files.nope();').keys, ['files.nope']);
+ assert.deepEqual(scan('const $n = addonAPI.nodes; $n.nope();').keys, ['nodes.nope']);
+ });
+
+ it('whitespace runs do not make the scan quadratic', () => {
+ const t = seconds(() => scan('a' + ' '.repeat(300000) + 'addonAPI.agents.nope()'));
+ assert.ok(t < 3, `${t.toFixed(1)} s`);
+ });
+
+ it('const { x } = addonAPI. counts only for a real namespace', () => {
+ assert.deepEqual(scan('const { list } = addonAPI.agents;').keys, ['agents.list']);
+ assert.deepEqual(scan('const { list } = addonAPI.vault;').keys, []);
+ });
+
+ it('a namespace held in a variable is followed through bracket access', () => {
+ assert.deepEqual(scan("const b = addonAPI.buckets; b['write']();").keys, ['buckets.write']);
+ assert.deepEqual(scan('const b = addonAPI.buckets; b.write();').keys, ['buckets.write']);
+ });
+
+});
+
+describe('round 5: calls after keywords and statements', () => {
+ const holders = 'const f = addonAPI.files; ';
+ const cases = [
+ 'function g() { return addonAPI.files.nope(); }',
+ 'async function g() { await addonAPI.files.nope(); }',
+ 'function g() { return window.addonAPI.files.nope(); }',
+ 'const r = [...addonAPI.files.nope()];',
+ 'const a = 1\naddonAPI.files.nope()',
+ 'if (x) addonAPI.files.nope();',
+ 'else addonAPI.files.nope();',
+ 'const v = typeof addonAPI.files.nope;\n addonAPI.files.nope()',
+ 'throw addonAPI.files.nope()',
+ 'x = y ? addonAPI.files.nope() : 1'
+ ];
+
+ for (const source of cases) {
+ it(`reads ${JSON.stringify(source)}`, () => {
+ assert.ok(scan(source).keys.includes('files.nope'), source);
+ const { errors } = checkAddonCapabilitiesInFiles([{ file: 'a.js', source }], MANIFEST);
+ assert.ok(errors.some(error => error.includes('files.nope')), errors.join('|'));
+ });
+ }
+
+ it('reads a namespace holder used after return, await or a spread', () => {
+ for (const body of ['return f.nope();', 'await f.nope();', 'const r = [...f.nope()];']) {
+ assert.ok(scan(`${holders}async function g() { ${body} }`).keys.includes('files.nope'), body);
+ }
+ });
+
+ it('still refuses a member of another object, even over a newline', () => {
+ for (const source of ['return client.addonAPI.files.nope()', 'return client.\n addonAPI.files.nope()', 'return client. addonAPI.files.nope()']) {
+ assert.deepEqual(scan(source).keys, [], source);
+ }
+ });
+
+ it('unknown globals: linear time, one finding per name and line, correct line', () => {
+ const many = 'window.mosaicAPI;\n'.repeat(40000);
+ let found;
+ const t = seconds(() => { found = scanUnknownGlobalsInFiles([{ file: 'a.js', source: many }]); });
+ assert.ok(t < 3, `${t.toFixed(1)} s`);
+ assert.equal(found.length, 40000);
+ assert.equal(found[39999].line, 40000);
+ const oneLine = scanUnknownGlobalsInFiles([{ file: 'a.js', source: 'window.mosaicAPI;'.repeat(5000) }]);
+ assert.equal(oneLine.length, 1);
+ assert.equal(scanUnknownGlobalsInFiles([{ file: 'a.js', source: 'a;\r\nb;\r\nwindow.mosaicAPI.x()' }])[0].line, 3);
+ });
+});
+
+describe('round 5: line numbers and bounds', () => {
+ const callLine = source => scanApiCallsInFiles([{ file: 'a.js', source }], { namespaces: NAMESPACES })[0]?.line;
+
+ it('a TypeScript cast over several lines does not shift later line numbers', () => {
+ const source = 'const a = (x as\n A |\n B);\nconst c = (window\n).addonAPI;\n\naddonAPI.files.nope();';
+ assert.equal(callLine(source), 7);
+ assert.equal(normalizeSource(source).split('\n').length, source.split('\n').length);
+ });
+
+ it('a bound is reported once, on the line of the source, after a multi-line cast', () => {
+ const source = '(x as\nA|\nB);\n(y as\nC);\n' + 'const r = /\'' + 'a'.repeat(SCANNER_LIMITS.regex + 50) + '/;\naddonAPI.files.nope();';
+ const { limits } = scan(source);
+ assert.equal(limits.length, 1);
+ assert.equal(limits[0].line, 6);
+ });
+
+ it('the cast rewrite exists: `(x as T)` and `(window as any).addonAPI` are read', () => {
+ assert.deepEqual(scan('(addonAPI as AddonAPI).files.nope();').keys, ['files.nope']);
+ assert.deepEqual(scan('(window as any).addonAPI.files.nope();').keys, ['files.nope']);
+ });
+
+ it('a destructuring pattern between 400 and 4000 characters is read; one past the bound is reported', () => {
+ const pattern = n => 'const {' + ' agents: a,'.repeat(Math.ceil(n / 10)) + ' } = addonAPI;\na.nope();';
+ assert.deepEqual(scan(pattern(1000)).limits, []);
+ assert.deepEqual(scan(pattern(3500)).limits, []);
+ // Literal sizes, not the constant: a test that scales with the constant cannot see it change.
+ assert.equal(scan(pattern(8000)).limits.length, 1);
+ assert.equal(scan(pattern(4500)).limits.length, 1);
+ assert.equal(SCANNER_LIMITS.destructuring, 4000);
+ });
+
+ it('a holder after `. ` is a member of another object, a holder after `...` is not', () => {
+ assert.deepEqual(scan('const f = addonAPI.files; x. f.nope();').keys, []);
+ assert.deepEqual(scan('const f = addonAPI.files; g(...f.nope());').keys, ['files.nope']);
+ });
+});
diff --git a/addons/mosaic-addon-studio/test/scanner-and-generator.test.mjs b/addons/mosaic-addon-studio/test/scanner-and-generator.test.mjs
new file mode 100644
index 0000000..19cfb89
--- /dev/null
+++ b/addons/mosaic-addon-studio/test/scanner-and-generator.test.mjs
@@ -0,0 +1,100 @@
+/**
+ * Regression tests for the ARCH-17 scanner cases and the ARCH-05/06 generator.
+ * Every assertion goes through the production modules.
+ */
+
+import { describe, it } from 'node:test';
+import assert from 'node:assert/strict';
+
+import {
+ blankComments,
+ normalizeSource,
+ scanApiCallsInFiles,
+ scanUnknownGlobalsInFiles
+} from '../shared/capability-rules.mjs';
+import { classifyLicense } from '../shared/license-texts.mjs';
+import { buildStarterFiles, buildStarterManifest, defaultTabIcon } from '../shared/starter-project.mjs';
+import { validateMosaicManifest } from '../shared/manifest-rules.mjs';
+import { createHost } from '../src/host.js';
+
+const NS = { namespaces: ['agents', 'nodes', 'files'] };
+const calls = source => scanApiCallsInFiles([{ file: 'a.js', source }], NS).map(c => c.key);
+const globals = source => scanUnknownGlobalsInFiles([{ file: 'a.js', source }]).map(g => g.name);
+
+describe('scanner: text that is not code (ARCH-17 false positives)', () => {
+ it('ignores a comment that follows a template whose interpolation holds a backtick', () => {
+ // blankComments ended the template at the backtick inside `${ "`" }`
+ // and read the comment as code.
+ assert.deepEqual(calls('const s = `${ "`" }`; // addonAPI.agents.list()\n'), []);
+ });
+
+ it('ignores a member of another object, a string and a comment', () => {
+ assert.deepEqual(calls('client.addonAPI.agents.list();\n'), []);
+ assert.deepEqual(calls('const s = "addonAPI.agents.list()";\n'), []);
+ assert.deepEqual(calls('// addonAPI.agents.list()\n'), []);
+ });
+
+ it('does not flag a local named mosaicAPI, only window.mosaicAPI', () => {
+ assert.deepEqual(globals('const mosaicAPI = {};\n'), []);
+ assert.deepEqual(globals('window.mosaicAPI.x;\n'), ['mosaicAPI']);
+ });
+});
+
+describe('scanner: code that is code (ARCH-17 false negatives)', () => {
+ it('reads a call inside a template interpolation, nested or not', () => {
+ assert.deepEqual(calls('const s = `x ${addonAPI.agents.list()}`;\n'), ['agents.list']);
+ assert.deepEqual(calls('const s = `a ${ `b ${addonAPI.nodes.list()}` }`;\n'), ['nodes.list']);
+ assert.deepEqual(calls('const s = `a ${ "}" + addonAPI.nodes.list() }`;\n'), ['nodes.list']);
+ });
+
+ it('reads window["addonAPI"] and window["mosaicAPI"]', () => {
+ assert.deepEqual(calls("window['addonAPI'].agents.list();\n"), ['agents.list']);
+ assert.deepEqual(globals("window['mosaicAPI'].x;\n"), ['mosaicAPI']);
+ });
+
+ it('reads destructuring of the API object and of a namespace', () => {
+ assert.deepEqual(calls('const { agents } = addonAPI; agents.list();\n'), ['agents.list']);
+ assert.deepEqual(calls('const { agents: a } = window.addonAPI; a.list();\n'), ['agents.list']);
+ assert.deepEqual(calls('const { list, get: g } = addonAPI.agents;\n'), ['agents.list', 'agents.get']);
+ assert.deepEqual(calls('const { agents } = client.addonAPI; agents.list();\n'), []);
+ });
+
+ it('reports a window.mosaicAPI that sits in a template interpolation', () => {
+ assert.deepEqual(globals('const m = `${window.mosaicAPI.x}`;\n'), ['mosaicAPI']);
+ });
+});
+
+describe('scanner: offsets survive normalisation', () => {
+ for (const source of ['const s = "abc\\', 'const s = `${ "`" } b`;', 'x // c\n/* d */ y']) {
+ it(`keeps the length of ${JSON.stringify(source)}`, () => {
+ assert.equal(blankComments(source).length, source.length);
+ assert.equal(normalizeSource(source).length, source.length);
+ });
+ }
+});
+
+describe('starter generator: one source of truth (ARCH-05/06)', () => {
+ const input = { name: 'Equiv', id: 'equiv-test', description: 'Equivalence', license: 'MIT', minAppVersion: '0.1.13' };
+
+ it('declares a renderable icon and passes the manifest validator', () => {
+ assert.ok(defaultTabIcon());
+ const manifest = buildStarterManifest(input);
+ assert.equal(manifest.tab.icon, defaultTabIcon());
+ assert.deepEqual(validateMosaicManifest(manifest, input.id).errors, []);
+ });
+
+ it('writes a complete licence for every selectable licence', () => {
+ assert.equal(classifyLicense(buildStarterFiles({ ...input, license: 'MIT' }).files.LICENSE), 'MIT');
+ assert.equal(classifyLicense(buildStarterFiles({ ...input, license: 'Apache-2.0' }).files.LICENSE), 'Apache-2.0');
+ assert.equal(classifyLicense(buildStarterFiles({ ...input, license: 'GPL-3.0-or-later' }).files.LICENSE), 'GPL-3.0-or-later');
+ assert.equal(classifyLicense(buildStarterFiles({ ...input, license: 'pending' }).files.LICENSE), null);
+ assert.equal(classifyLicense('Apache License, Version 2.0 — see https://www.apache.org/licenses/LICENSE-2.0\n'), null);
+ });
+
+ it('refuses invalid input in the in-Mosaic host', async () => {
+ global.window = { addonAPI: { files: { read: async () => null, write: async () => {}, list: async () => [], mkdir: async () => {} } } };
+ await assert.rejects(createHost().createProject({ ...input, id: 'Bad Id' }), /Invalid ID/);
+ delete global.window;
+ });
+});
+
diff --git a/addons/mosaic-addon-studio/vite.config.js b/addons/mosaic-addon-studio/vite.config.js
new file mode 100644
index 0000000..3977eaf
--- /dev/null
+++ b/addons/mosaic-addon-studio/vite.config.js
@@ -0,0 +1,28 @@
+import { defineConfig } from 'vite';
+import react from '@vitejs/plugin-react';
+import { fileURLToPath } from 'node:url';
+import path from 'node:path';
+
+// Builds a fully self-contained bundle into ./renderer/ (relative asset
+// paths — no absolute "/assets", since this is served from
+// mosaic-addon://mosaic-addon-studio/, not from a domain root). The
+// manifest schema expects renderer.entry to be "renderer/index.html", and
+// the catalogue's build-addon.mjs tars up manifest.json + main/ + renderer/
+// from inside this add-on's own directory — outDir must therefore be inside
+// it, not a sibling.
+//
+// `root` is pinned to this directory so the build produces the same output
+// whether it is run from here or from the project root, where the local
+// development server also uses this config.
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+
+export default defineConfig({
+ root: HERE,
+ plugins: [react()],
+ base: './',
+ build: {
+ outDir: './renderer',
+ emptyOutDir: true,
+ assetsDir: 'assets',
+ },
+});