diff --git a/.github/workflows/dependency-audit.yml b/.github/workflows/dependency-audit.yml index f1410eeac5..84aa64b8f6 100644 --- a/.github/workflows/dependency-audit.yml +++ b/.github/workflows/dependency-audit.yml @@ -8,6 +8,8 @@ on: pull_request: paths: - .github/workflows/dependency-audit.yml + - scripts/audit-shipped-dependencies.mjs + - scripts/third-party-closure.mjs - package.json - package-lock.json - 'apps/*/package.json' @@ -15,6 +17,8 @@ on: push: branches: [main] paths: + - scripts/audit-shipped-dependencies.mjs + - scripts/third-party-closure.mjs - package.json - package-lock.json - 'apps/*/package.json' @@ -44,10 +48,20 @@ jobs: cache: npm - name: Install dependencies - run: npm ci --ignore-scripts --omit=dev + # The full tree, not --omit=dev: the shipped-closure audit below walks + # the renderer roots, which npm labels dev even though they ship. + run: npm ci --ignore-scripts - name: Audit production dependencies run: npm audit --omit=dev --audit-level=moderate + - name: Audit shipped desktop closure + run: node scripts/audit-shipped-dependencies.mjs + - name: Verify registry signatures - run: npm audit signatures --omit=dev + # The full tree, not `--omit=dev`. Two reasons it has to be both: + # the renderer roots live in devDependencies while their code ships + # inside `dist-renderer`, and signature verification also protects + # everything that *executes* during the build — a tampered vite or + # biome can pollute the artifact without ever being packaged. + run: npm audit signatures diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml index b4977b05a8..d0fc2fc248 100644 --- a/.github/workflows/release-desktop.yml +++ b/.github/workflows/release-desktop.yml @@ -63,6 +63,9 @@ jobs: - name: Audit production dependencies run: npm audit --omit=dev --audit-level=moderate + - name: Audit shipped desktop closure + run: node scripts/audit-shipped-dependencies.mjs + - name: Write App Store Connect API key if: matrix.platform == 'macos' env: diff --git a/apps/desktop/electron-builder.config.mjs b/apps/desktop/electron-builder.config.mjs index 3d5e5bfe13..25edb53737 100644 --- a/apps/desktop/electron-builder.config.mjs +++ b/apps/desktop/electron-builder.config.mjs @@ -17,6 +17,15 @@ export default { directories: { output: 'release', }, + // `files` names what to include; the production dependency closure of + // `package.json` comes along automatically. Renderer-only packages are kept + // out of that closure by living in `devDependencies` — vite bundles them into + // `dist-renderer`, so a second copy of their sources in `app.asar` is never + // loaded. A hand-written exclude list was tried first and could not hold: it + // has to name every transitive package too, and it silently went stale. + // + // `@xterm/headless` stays a dependency on purpose — `@maka/runtime` imports + // it for the PTY stack, so only the renderer-side xterm packages moved. files: [ 'dist/**/*', 'dist-renderer/**/*', @@ -25,6 +34,14 @@ export default { // FakeBackend and the Desktop E2E candidate bootstrap live under // `test-only/`; they must not reach a packaged app. '!**/test-only/**', + // `build:main` emits renderer sources as tsc side-files so main's tests can + // import a few helpers. The main process reaches exactly one of them at + // runtime — the cursor overlay engine — while the rest import `react`, + // `@maka/ui` and `@astryxdesign/core`, which the renderer now bundles + // instead of shipping under `node_modules`. Shipping those files would put + // ESM in the archive whose static imports cannot resolve. + '!dist/renderer/**', + 'dist/renderer/computer-use-overlay/**', ], extraResources: [ { diff --git a/apps/desktop/package.json b/apps/desktop/package.json index f630fbd09b..72a72b501a 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -41,10 +41,6 @@ "smoke:browser": "npm run build:workspace-deps && npm run build:main && electron scripts/browser-observe-act-smoke.mjs" }, "dependencies": { - "@astryxdesign/core": "0.4.0", - "@astryxdesign/theme-neutral": "0.4.0", - "@dnd-kit/core": "^6.3.1", - "@dnd-kit/sortable": "^10.0.0", "@jackwener/opencli": "1.8.6", "@maka/computer-use": "0.1.0", "@maka/core": "0.1.0", @@ -52,33 +48,54 @@ "@maka/runtime": "0.1.0", "@maka/runtime-host": "0.1.0", "@maka/storage": "0.1.0", - "@maka/ui": "0.1.0", - "@xterm/addon-fit": "^0.11.0", - "@xterm/xterm": "^6.0.0", "electron-updater": "^6.8.9", "node-pty": "^1.2.0-beta.15", "qrcode": "^1.5.4", - "react": "^19.2.1", - "react-dom": "^19.2.1", "ws": "^8.21.0", "zod": "^4.4.3" }, "devDependencies": { "@ant-design/icons-svg": "4.5.0", + "@astryxdesign/core": "0.4.0", + "@astryxdesign/theme-neutral": "0.4.0", + "@dnd-kit/core": "^6.3.1", + "@dnd-kit/sortable": "^10.0.0", "@fontsource-variable/geist": "^5.3.0", "@fontsource-variable/geist-mono": "^5.3.0", + "@maka/ui": "0.1.0", "@playwright/test": "^1.62.1", "@storybook/react-vite": "^10.5.5", "@types/react": "^19.2.18", "@types/react-dom": "^19.2.4", "@types/ws": "^8.18.1", "@vitejs/plugin-react": "^6.0.5", + "@xterm/addon-fit": "^0.11.0", + "@xterm/xterm": "^6.0.0", "electron": "43.2.0", "electron-builder": "26.15.3", "esbuild": "^0.28.1", "linkedom": "^0.18.13", + "react": "^19.2.1", + "react-dom": "^19.2.1", "simple-icons": "16.28.0", "storybook": "^10.4.6", "vite": "^8.1.5" + }, + "maka": { + "rendererBundledDependencies": [ + "@ant-design/icons-svg", + "@astryxdesign/core", + "@astryxdesign/theme-neutral", + "@dnd-kit/core", + "@dnd-kit/sortable", + "@fontsource-variable/geist", + "@fontsource-variable/geist-mono", + "@maka/ui", + "@xterm/addon-fit", + "@xterm/xterm", + "react", + "react-dom", + "simple-icons" + ] } } diff --git a/apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt b/apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt index 41a5fa0a5d..14303bed11 100644 --- a/apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt +++ b/apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt @@ -2,7 +2,8 @@ Maka Desktop — Production npm Third-Party Notices ==================================================== Generated by scripts/generate-third-party-notices.mjs from the exact -@maka/desktop production dependency closure and package-lock.json. +@maka/desktop shipped dependency closure (Node production plus the +bundled renderer) and package-lock.json. Do not edit this file by hand. Policy: every package must resolve to an ASF-compatible SPDX license. Compound @@ -557,6 +558,36 @@ OTHER DEALINGS IN THE FONT SOFTWARE. ================================================================================ +Package: @ant-design/icons-svg@4.5.0 +Declared license: MIT +Selected license: MIT +Repository: git+https://github.com/ant-design/ant-design-icons.git + +--- VERSION-PINNED LICENSE TEXT OVERRIDE --- +MIT License + +Copyright (c) 2018-present Ant UED, https://xtech.antfin.com/ + +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. + +================================================================================ + Package: @antfu/install-pkg@1.1.0 Declared license: MIT Selected license: MIT @@ -13916,6 +13947,45 @@ SOFTWARE. ================================================================================ +Package: simple-icons@16.28.0 +Declared license: CC0-1.0 +Selected license: CC0-1.0 +Repository: git+ssh://git@github.com/simple-icons/simple-icons.git + +--- LICENSE.md --- +# CC0 1.0 Universal + +## Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an “owner”) of an original work of authorship and/or a database (each, a “Work”). + +Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works (“Commons”) that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the “Affirmer”), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights (“Copyright and Related Rights”). Copyright and Related Rights include, but are not limited to, the following: + 1. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; + 2. moral rights retained by the original author(s) and/or performer(s); + 3. publicity and privacy rights pertaining to a person’s image or likeness depicted in a Work; + 4. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(i), below; + 5. rights protecting the extraction, dissemination, use and reuse of data in a Work; + 6. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and + 7. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the “Waiver”). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer’s heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer’s express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer’s express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer’s Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the “License”). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer’s express Statement of Purpose. + +4. Limitations and Disclaimers. + 1. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. + 2. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. + 3. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person’s Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. + 4. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. + +For more information, please see . + +================================================================================ + Package: smart-buffer@4.2.0 Declared license: MIT Selected license: MIT diff --git a/apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt b/apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt index 5e42d67aa3..b7b61b447e 100644 --- a/apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt +++ b/apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt @@ -175,12 +175,18 @@ SOFTWARE. ## Simple Icons brand marks - Repository: https://github.com/simple-icons/simple-icons -- Package: `simple-icons` version `15.22.0` - License: CC0-1.0 -- Covered source assets: - - `packages/ui/src/bot-brand-logo.tsx`: Telegram, Discord, WeChat, QQ and Slack paths - - `apps/desktop/src/renderer/mcp-brand-marks.tsx`: Slack, LINE, Google Calendar, Figma, Vercel, Supabase, Notion and Apple paths - - `apps/desktop/src/renderer/settings/provider-brand-marks.tsx`: MiniMax path +- Covered source assets, by how the path data reaches the build: + - Vendored from `simple-icons` version `15.22.0` as pinned path constants + (upstream later removed some of these marks, so the pins stay at the + version they were copied from): + - `packages/ui/src/bot-brand-logo.tsx`: Telegram, Discord, WeChat, QQ and Slack paths + - `apps/desktop/src/renderer/mcp-brand-marks.tsx`: Slack paths + - Imported at build time from the installed `simple-icons` package, so the + bundled version is the one package-lock.json pins; that copy is licensed + through the generated `licenses/npm/THIRD_PARTY_NOTICES.txt`: + - `apps/desktop/src/renderer/mcp-brand-marks.tsx`: LINE, Google Calendar, Figma, Vercel, Supabase, Notion and Apple paths + - `apps/desktop/src/renderer/settings/provider-brand-marks.tsx`: MiniMax path - Full license text: packaged as `licenses/renderer/SIMPLE_ICONS_LICENSE.md`. - Trademark boundary: CC0 does not grant trademark rights. The marks are used only to identify the corresponding services. diff --git a/apps/desktop/src/renderer/settings/provider-brand-marks.tsx b/apps/desktop/src/renderer/settings/provider-brand-marks.tsx index dad26973de..f9f7e3bc5d 100644 --- a/apps/desktop/src/renderer/settings/provider-brand-marks.tsx +++ b/apps/desktop/src/renderer/settings/provider-brand-marks.tsx @@ -322,7 +322,8 @@ function ZAI(): ReactElement { return ; } -// MiniMax mark from simple-icons@15.22.0 (CC0-1.0). +// MiniMax mark from the simple-icons package (CC0-1.0); the bundled version +// is whatever package-lock.json pins, so no version is repeated here. function MiniMaxMark(): ReactElement { return (