Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
fix: complete Linux source dependency support
Orkas-AI60b67b1f247f
diff --git a/.github/workflows/linux-source-smoke.yml b/.github/workflows/linux-source-smoke.ymlindex b0e9e2d5..086f3084 100644--- a/.github/workflows/linux-source-smoke.yml+++ b/.github/workflows/linux-source-smoke.yml@@ -10,9 +10,18 @@ permissions:contents: readjobs:- linux-x64:- runs-on: ubuntu-latest- timeout-minutes: 20+ linux-source:+ name: Linux ${{ matrix.arch }} source+ strategy:+ fail-fast: false+ matrix:+ include:+ - arch: x64+ runner: ubuntu-22.04+ - arch: arm64+ runner: ubuntu-22.04-arm+ runs-on: ${{ matrix.runner }}+ timeout-minutes: 45steps:- name: Check out source@@ -24,21 +33,43 @@ jobs:node-version: 24cache: npm+ - name: Restore verified built-in dependency cache+ uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4+ with:+ path: |+ resources/embedding-model+ resources/officecli+ resources/runtime/python+ resources/runtime/uv+ resources/runtime/node+ resources/runtime/ffmpeg+ resources/runtime/whisper+ key: linux-source-${{ matrix.arch }}-${{ hashFiles('package-lock.json', 'resources/runtime/manifest.json', 'bin/runtime-gate.cjs', 'bin/packaged-resource-gate.cjs', 'scripts/fetch-embedding-model.mjs', 'scripts/fetch-officecli.cjs', 'scripts/fetch-ffmpeg.cjs', 'scripts/fetch-whisper.cjs') }}+- name: Install JavaScript dependencies- run: npm ci --ignore-scripts+ run: npm ci- - name: Run Linux dependency regressions- run: >-- node node_modules/vitest/vitest.mjs run- test/main/util/officecli-fetch.test.ts- test/main/util/ensure-dev-dependencies.test.ts- test/main/paths.test.ts+ - name: Run Linux platform-native test lane+ run: npm run test:platform-native- name: Type-checkrun: node node_modules/typescript/bin/tsc --noEmit- - name: Fetch pinned Linux OfficeCLI- run: node scripts/fetch-officecli.cjs --platform=linux-x64+ - name: Prepare and verify built-in Linux dependencies+ run: node scripts/ensure-dev-dependencies.cjs++ - name: Install Xvfb when the runner image does not provide it+ run: |+ if ! command -v xvfb-run >/dev/null 2>&1; then+ sudo apt-get update+ sudo apt-get install --yes xvfb+ fi++ - name: Run native inference and Electron GUI smoke+ run: xvfb-run --auto-servernum npm run test:linux-source++ - name: Run real Linux local transcription smoke+ run: npm run test:linux-whisper- - name: Verify native OfficeCLI contract- run: node bin/officecli-policy-gate.cjs --require-host-binary+ - name: Verify first-use Linux OCR runtime+ run: npm run test:linux-ocrdiff --git a/README.md b/README.mdindex da5f0407..c969ad22 100644--- a/README.md+++ b/README.md@@ -121,7 +121,7 @@ Yes. Beyond its own Commander and specialist agents, Orkas can drive external CLClaude Desktop is a single assistant; CrewAI and LangChain are code-first frameworks. Orkas is a local-first multi-agent desktop app: the Commander coordinates specialist agents, keeps data and keys local, and gives each agent its own private skills and memory. See the [full comparisons](https://orkas.ai/compare/orkas-vs-langchain?source=gh-orkas).**Which platforms does Orkas support?**-macOS (Apple Silicon and Intel) and Windows 10+ have packaged installers. glibc-based Linux x64/arm64 runs from source today, with no installer yet. Local speech transcription is not currently available on Linux. Alpine and other musl-based distributions are not supported. The source build needs Node 20+ and Python 3.+macOS (Apple Silicon and Intel) and Windows 10+ have packaged installers. glibc 2.34+ Linux x64/arm64 runs from source today, with no installer yet. Local speech transcription is supported on Linux through the pinned whisper.cpp runtime prepared on first launch. Alpine and other musl-based distributions are not supported. The source bootstrap needs Node 20+; Python 3 and a C/C++ build toolchain are needed only when a native npm package has no compatible prebuilt binary and must be rebuilt locally.**Is Orkas free and open source?**Yes — the app is MIT licensed and free to use. Bring your own model keys and you pay only your model providers; Orkas never takes a cut. Optionally, the desktop app also offers a built-in **Orkas model** for people who don't want to manage API keys — that one is billed by Orkas in credits (membership or credit packs). It is entirely opt-in, and every other feature works on your own keys. [Pricing →](https://orkas.ai/pricing/?source=gh-orkas)@@ -132,7 +132,7 @@ Yes — the app is MIT licensed and free to use. Bring your own model keys and yWant a packaged installer instead? See [Download](#download) above. To run from source — currently the way to run Orkas on Linux:-**Requirements**: Node 20+ · Python 3 · macOS / Windows 10+ / glibc-based Linux x64 or arm64+**Requirements**: Node 20+ · macOS / Windows 10+ / glibc 2.34+ Linux x64 or arm64. Keep Python 3 and a C/C++ build toolchain available for the uncommon native-module source-build fallback.```bashgit clone https://github.com/Orkas-AI/Orkas.git@@ -141,9 +141,9 @@ cd Orkasrun.cmd # Windows```-Linux source runs currently require glibc. Alpine and other musl-based distributions are not supported, and local speech transcription is unavailable on Linux.+Linux source runs require glibc 2.34+. Alpine and other musl-based distributions are not supported. Local speech transcription downloads and verifies the target-native whisper.cpp runtime and multilingual model during the first source launch.-`run.sh` / `run.cmd` auto-installs dependencies and downloads the embedding model (~95 MB). First launch creates a workspace under `~/.orkas/` (macOS / Linux) or `<smallest non-system drive>:\.orkas\` (Windows). Then open **Settings → AI Providers** to add an API key or OAuth.+`run.sh` / `run.cmd` installs the locked npm dependency tree and prepares the pinned Python, uv, Node, embedding model (~95 MB), OfficeCLI, FFmpeg, whisper.cpp, and multilingual speech model resources on first launch. Linux startup then verifies the platform-native modules and Whisper runtime under Electron's ABI before opening the app. OCR and Skill-specific Python packages are installed into isolated local environments when those features are first used. First launch creates a workspace under `~/.orkas/` (macOS / Linux) or `<smallest non-system drive>:\.orkas\` (Windows). Then open **Settings → AI Providers** to add an API key or OAuth.---diff --git a/README.zh-CN.md b/README.zh-CN.mdindex fe7e1c13..598d20e5 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -121,7 +121,7 @@ Orkas 是一个开源、本地优先的多智能体桌面应用。一个超强Claude Desktop 是单个助理;CrewAI 和 LangChain 是代码优先的框架。Orkas 是一个本地优先的多智能体桌面应用:指挥官协调多个专业智能体,数据与 key 留在本地,每个智能体拥有私有技能与记忆。见[逐项对比](https://orkas.ai/compare/orkas-vs-langchain?source=gh-orkas)。**支持哪些平台?**-macOS(Apple 芯片与 Intel)和 Windows 10+ 提供安装包。基于 glibc 的 Linux x64/arm64 目前从源码运行,暂时没有安装包,且本地语音转写功能不可用。当前不支持 Alpine 及其他基于 musl 的发行版。源码运行需要 Node 20+ 与 Python 3。+macOS(Apple 芯片与 Intel)和 Windows 10+ 提供安装包。基于 glibc 2.34+ 的 Linux x64/arm64 目前从源码运行,暂时没有安装包。本地语音转写通过首次启动时准备的固定版本 whisper.cpp 运行时提供。当前不支持 Alpine 及其他基于 musl 的发行版。源码启动需要 Node 20+;只有在原生 npm 包没有匹配的预编译二进制、必须本地编译时,才额外需要 Python 3 和 C/C++ 构建工具链。**Orkas 免费且开源吗?**是的 —— 应用本身 MIT 许可证、免费使用。自带模型 key 时,你只需为你的模型服务商付费,Orkas 不抽成。此外,桌面版还提供一个可选的内置 **Orkas 模型**,供不想自己配置 key 的用户使用 —— 这部分由 Orkas 按 credits 计费(会员或 credits 包)。它完全可选,其余所有功能用你自己的 key 即可。[价格 →](https://orkas.ai/pricing/?source=gh-orkas)@@ -132,7 +132,7 @@ macOS(Apple 芯片与 Intel)和 Windows 10+ 提供安装包。基于 glibc想直接用安装包?见上方 [下载](#下载)。以下是从源码运行的方式 —— 也是目前在 Linux 上运行 Orkas 的方式:-**环境要求**:Node 20+ · Python 3 · macOS / Windows 10+ / 基于 glibc 的 Linux x64 或 arm64+**环境要求**:Node 20+ · macOS / Windows 10+ / 基于 glibc 2.34+ 的 Linux x64 或 arm64。建议保留 Python 3 与 C/C++ 构建工具链,用于少数原生模块需要源码编译的兜底场景。```bashgit clone https://github.com/Orkas-AI/Orkas.git@@ -141,9 +141,9 @@ cd Orkasrun.cmd # Windows```-Linux 源码运行目前需要 glibc,不支持 Alpine 及其他基于 musl 的发行版;本地语音转写功能在 Linux 上也暂不可用。+Linux 源码运行需要 glibc 2.34+,不支持 Alpine 及其他基于 musl 的发行版。本地语音转写会在首次源码启动时下载并校验目标架构对应的 whisper.cpp 运行时及多语言模型。-`run.sh` / `run.cmd` 会自动安装依赖并下载嵌入模型(约 95 MB)。首次启动会在 `~/.orkas/`(macOS / Linux)或 `<最小的非系统盘>:\.orkas\`(Windows)下创建工作区。随后进入 **设置 → AI 服务商** 配置 API key 或 OAuth。+`run.sh` / `run.cmd` 会在首次启动时安装 lockfile 固定的 npm 依赖,并准备固定版本的 Python、uv、Node、嵌入模型(约 95 MB)、OfficeCLI、FFmpeg、whisper.cpp 与多语言语音模型。Linux 启动还会在 Electron ABI 下验证平台原生模块及 Whisper 运行时后再打开应用。OCR 与 Skill 专属 Python 包会在首次使用对应功能时安装到隔离的本地环境。首次启动会在 `~/.orkas/`(macOS / Linux)或 `<最小的非系统盘>:\.orkas\`(Windows)下创建工作区。随后进入 **设置 → AI 服务商** 配置 API key 或 OAuth。---diff --git a/bin/runtime-gate.cjs b/bin/runtime-gate.cjsindex 834c721f..073c5eed 100644--- a/bin/runtime-gate.cjs+++ b/bin/runtime-gate.cjs@@ -116,6 +116,55 @@ const WHISPER_RUNTIME_CONTRACT = Object.freeze({}),appLocalFiles: appLocalVcFiles('bin'),}),+ 'linux-x64': Object.freeze({+ version: '1.9.1',+ minimumGlibc: '2.34',+ source: 'official-release-ubuntu-cpu-dispatch',+ archive: Object.freeze({+ cacheName: 'whisper-bin-ubuntu-x64-v1.9.1.tar.gz',+ url: 'https://github.com/ggml-org/whisper.cpp/releases/download/v1.9.1/whisper-bin-ubuntu-x64.tar.gz',+ bytes: 9_379_235,+ sha256: 'f3bf3b4369a99b54665b0f19b88483b30de27f25963b0414235dea03198515c5',+ }),+ files: Object.freeze({+ 'bin/whisper-cli': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/whisper-cli', bytes: 976_312, sha256: '427dfb509f2c04d0f01c101978b5666102c6f7e3abf2a236452db5939f5b533a', executable: true }),+ 'bin/libwhisper.so.1': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libwhisper.so.1.9.1', bytes: 610_672, sha256: 'b7d624111b72c70a7351d07d403efae15990aa1112b950557457a12cb90cebee', executable: true }),+ 'bin/libggml.so.0': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml.so.0.15.1', bytes: 54_936, sha256: '1c2d4b9d4a46a481c3c153fabad00dbba6342b107255667d60727b05c3935a00', executable: true }),+ 'bin/libggml-base.so.0': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-base.so.0.15.1', bytes: 901_704, sha256: '8924f4eef14b7b2f4d5f44d5744ace615601257fee2d7e1e2f02d21188824c26', executable: true }),+ 'bin/libggml-cpu-x64.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-x64.so', bytes: 857_072, sha256: '6a8d1913baaa9d7f99bd46df7624fb5f45a8fa87230f52fc5f075cf5e48691c2', executable: true }),+ 'bin/libggml-cpu-sse42.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-sse42.so', bytes: 860_992, sha256: '4ac045e80cbbd159d912cfef558b24108571f997b484ae0431508a9228080ab7', executable: true }),+ 'bin/libggml-cpu-piledriver.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-piledriver.so', bytes: 934_848, sha256: 'fbdbedd47c6bf7f5ca4c4b7128c6fb6b7e69a630b4a79111d2966bbdf26c85fc', executable: true }),+ 'bin/libggml-cpu-sandybridge.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-sandybridge.so', bytes: 938_944, sha256: 'e56a2f68a5e77c1fae9216b6985490ada833ffbfc02625e6a49f1bd7bf7d4f40', executable: true }),+ 'bin/libggml-cpu-ivybridge.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-ivybridge.so', bytes: 934_848, sha256: 'b9103c1af212acd5834bc67dcbed688eb187315013da0829e69ab284fa5c7c9d', executable: true }),+ 'bin/libggml-cpu-haswell.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-haswell.so', bytes: 1_000_600, sha256: 'd296d5e08a889a9ef6cef925ea594e421f7139edc0064484494e47342d975e66', executable: true }),+ 'bin/libggml-cpu-alderlake.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-alderlake.so', bytes: 1_000_600, sha256: 'ea900a9e0b2be2b2218ae43ad9886a4a0ad657c86f6b73dd3627603d1dc04522', executable: true }),+ 'bin/libggml-cpu-cannonlake.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-cannonlake.so', bytes: 1_058_056, sha256: '4a01017310b60b8bf7e4cde4a07b2ddef38c87e4ce2174359fdf71a1d9bc0826', executable: true }),+ 'bin/libggml-cpu-skylakex.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-skylakex.so', bytes: 1_058_056, sha256: '83eb651f2c71a6c9a495ba50dd9361122600550e6b33ec0d348d82b4c213b7af', executable: true }),+ 'bin/libggml-cpu-cascadelake.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-cascadelake.so', bytes: 1_053_960, sha256: 'c1ec6a03ed9473ab4d5ff66bb6253dcc4e93e3a83946d83407c38b8b2c01bc3b', executable: true }),+ 'bin/libggml-cpu-cooperlake.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-cooperlake.so', bytes: 1_053_960, sha256: 'cd581c6b77f93ca840dcdcdeb792d167243bffdfd9ddd6631591dbdc559b4475', executable: true }),+ 'bin/libggml-cpu-icelake.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-icelake.so', bytes: 1_053_960, sha256: 'bbc71cf146645f8c9d2aea68de095785d6a66fa099007009f7f59d3e666b95a1', executable: true }),+ 'bin/libggml-cpu-sapphirerapids.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-sapphirerapids.so', bytes: 1_320_320, sha256: 'bccc143b4dc92095ee3fcc1f83cd5f7d38cc48e0fad901bef15fbd5f180a5336', executable: true }),+ 'bin/libggml-cpu-zen4.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-x64/libggml-cpu-zen4.so', bytes: 1_053_960, sha256: '41ed84f5414d76197b055a04c5a5261459f09eba5d63f4189f0ff5ca7fc3c3ac', executable: true }),+ }),+ }),+ 'linux-arm64': Object.freeze({+ version: '1.9.1',+ minimumGlibc: '2.34',+ source: 'official-release-ubuntu',+ archive: Object.freeze({+ cacheName: 'whisper-bin-ubuntu-arm64-v1.9.1.tar.gz',+ url: 'https://github.com/ggml-org/whisper.cpp/releases/download/v1.9.1/whisper-bin-ubuntu-arm64.tar.gz',+ bytes: 4_555_819,+ sha256: 'e0b66cd551ff6f2a28fabe3c6e89691eea037bb76833493abb9a71ca788994b3',+ }),+ files: Object.freeze({+ 'bin/whisper-cli': Object.freeze({ archivePath: 'whisper-bin-ubuntu-arm64/whisper-cli', bytes: 943_928, sha256: '511ee3ef9bbe7acfabaafc463c1ccceb34bf8f4caab9aaf18b260883eab32b98', executable: true }),+ 'bin/libwhisper.so.1': Object.freeze({ archivePath: 'whisper-bin-ubuntu-arm64/libwhisper.so.1.9.1', bytes: 553_208, sha256: 'ae31d9c3f094d5aa7e2dcf049d7ca3238811b738fccdadfee3e8fc8b1a680051', executable: true }),+ 'bin/libggml.so.0': Object.freeze({ archivePath: 'whisper-bin-ubuntu-arm64/libggml.so.0.15.1', bytes: 44_152, sha256: 'ca15013bacf6c8b2281a10b02191741db14fd5d189eedda89ec210c5deab1a94', executable: true }),+ 'bin/libggml-base.so.0': Object.freeze({ archivePath: 'whisper-bin-ubuntu-arm64/libggml-base.so.0.15.1', bytes: 815_504, sha256: '066b7c88f3a2d9d884a9344acaa0cea312968a6d342bf68c1c41920221baa496', executable: true }),+ 'bin/libggml-cpu.so': Object.freeze({ archivePath: 'whisper-bin-ubuntu-arm64/libggml-cpu.so', bytes: 831_520, sha256: '56fe7e9ecc212ae32ff88837f812d450eee1e842cb5bb759ef60a533f2e9f2eb', executable: true }),+ }),+ }),}),});diff --git a/package-lock.json b/package-lock.jsonindex 6a66b2a8..b594aeb9 100644--- a/package-lock.json+++ b/package-lock.json@@ -40,6 +40,7 @@"electron": "42.8.0","ffmpeg-static": "^5.3.0","semver": "7.8.5",+ "tar": "7.5.21","typescript": "^6.0.3","vitest": "^4.1.5"}@@ -65,23 +66,26 @@}},"node_modules/@anush008/tokenizers": {- "version": "0.0.0",- "resolved": "https://registry.npmjs.org/@anush008/tokenizers/-/tokenizers-0.0.0.tgz",- "integrity": "sha512-IQD9wkVReKAhsEAbDjh/0KrBGTEXelqZLpOBRDaIRvlzZ9sjmUP+gKbpvzyJnei2JHQiE8JAgj7YcNloINbGBw==",+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/@anush008/tokenizers/-/tokenizers-0.6.0.tgz",+ "integrity": "sha512-vbKFjlFM15Ljm6HMh2FSiyPq4236xHoe31XMveTMdwqowHf1/UCwySPT331wl/wRWpdHWdQ3eU5ENl5XbXnPQQ==","license": "MIT","engines": {"node": ">= 10"},"optionalDependencies": {- "@anush008/tokenizers-darwin-universal": "0.0.0",- "@anush008/tokenizers-linux-x64-gnu": "0.0.0",- "@anush008/tokenizers-win32-x64-msvc": "0.0.0"+ "@anush008/tokenizers-darwin-universal": "0.6.0",+ "@anush008/tokenizers-linux-arm64-gnu": "0.6.0",+ "@anush008/tokenizers-linux-arm64-musl": "0.6.0",+ "@anush008/tokenizers-linux-x64-gnu": "0.6.0",+ "@anush008/tokenizers-linux-x64-musl": "0.6.0",+ "@anush008/tokenizers-win32-x64-msvc": "0.6.0"}},"node_modules/@anush008/tokenizers-darwin-universal": {- "version": "0.0.0",- "resolved": "https://registry.npmjs.org/@anush008/tokenizers-darwin-universal/-/tokenizers-darwin-universal-0.0.0.tgz",- "integrity": "sha512-SACpWEooTjFX89dFKRVUhivMxxcZRtA3nJGVepdLyrwTkQ1TZQ8581B5JoXp0TcTMHfgnDaagifvVoBiFEdNCQ==",+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/@anush008/tokenizers-darwin-universal/-/tokenizers-darwin-universal-0.6.0.tgz",+ "integrity": "sha512-s27bL2x22NiDlhthi7UjGm+Is1tpAg4riLMBzna7Knzp26RdmnhbclWNEDd5UflRzFD49sdHzqv2XP0F2XFrqA==","license": "MIT","optional": true,"os": [@@ -91,10 +95,58 @@"node": ">= 10"}},+ "node_modules/@anush008/tokenizers-linux-arm64-gnu": {+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/@anush008/tokenizers-linux-arm64-gnu/-/tokenizers-linux-arm64-gnu-0.6.0.tgz",+ "integrity": "sha512-Go1ssG7AylDFpsDzLkh+nqXt1RcIGhL9pSpPH1nLF504lutxkCZcihESUt6vobtjnCONOAIwCWe1AVEoHui+9A==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@anush008/tokenizers-linux-arm64-musl": {+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/@anush008/tokenizers-linux-arm64-musl/-/tokenizers-linux-arm64-musl-0.6.0.tgz",+ "integrity": "sha512-xfnDkjmOUXkVp5jNCnFzd8hTfAbei6UnoYetiadqbfX1o/K+drCV6sHzKadhHuPQlqa+erXdSyQDOtWkAAjN8Q==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 10"+ }+ },"node_modules/@anush008/tokenizers-linux-x64-gnu": {- "version": "0.0.0",- "resolved": "https://registry.npmjs.org/@anush008/tokenizers-linux-x64-gnu/-/tokenizers-linux-x64-gnu-0.0.0.tgz",- "integrity": "sha512-TLjByOPWUEq51L3EJkS+slyH57HKJ7lAz/aBtEt7TIPq4QsE2owOPGovByOLIq1x5Wgh9b+a4q2JasrEFSDDhg==",+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/@anush008/tokenizers-linux-x64-gnu/-/tokenizers-linux-x64-gnu-0.6.0.tgz",+ "integrity": "sha512-4C9KiC0tdsOJCyOE2sD23zZHW16RbytRfMf81bdkDOLOrvOy0dYT9ZTnpwEl2k7jgzSdSpk9YKCkfEpkqbVvVg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@anush008/tokenizers-linux-x64-musl": {+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/@anush008/tokenizers-linux-x64-musl/-/tokenizers-linux-x64-musl-0.6.0.tgz",+ "integrity": "sha512-4CiqyQEFQpr7xTHv2IGZAoOKr/hIN7obTCaLvxUEjv3MHcpCGYBFpKa5RiRrcskY5k3w06dN9cRaxwsITeAHjw==","cpu": ["x64"],@@ -108,9 +160,9 @@}},"node_modules/@anush008/tokenizers-win32-x64-msvc": {- "version": "0.0.0",- "resolved": "https://registry.npmjs.org/@anush008/tokenizers-win32-x64-msvc/-/tokenizers-win32-x64-msvc-0.0.0.tgz",- "integrity": "sha512-/5kP0G96+Cr6947F0ZetXnmL31YCaN15dbNbh2NHg7TXXRwfqk95+JtPP5Q7v4jbR2xxAmuseBqB4H/V7zKWuw==",+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/@anush008/tokenizers-win32-x64-msvc/-/tokenizers-win32-x64-msvc-0.6.0.tgz",+ "integrity": "sha512-ydjCu4wLdtcS8xOr0uMbRAOHviuFNEMCFM/T/Sw4zxLb+iHS9QboSJZtxMN1VF2dOkjRchtQmLiKK0ttE1iJEQ==","cpu": ["x64"],diff --git a/package.json b/package.jsonindex f7b50cba..1002ad13 100644--- a/package.json+++ b/package.json@@ -32,6 +32,9 @@"test:platform-native": "node scripts/run-platform-native-tests.mjs","test:windows-native": "node scripts/run-windows-native-tests.mjs","test:windows-stability": "node scripts/run-windows-stability-tests.mjs",+ "test:linux-source": "node scripts/verify-linux-source-dependencies.cjs --full-embedding --gui",+ "test:linux-ocr": "tsx scripts/verify-linux-ocr-runtime.mjs",+ "test:linux-whisper": "ORKAS_REAL_WHISPER_TEST=1 node scripts/run-tests.mjs run --maxWorkers=1 -t \"Linux real bundled whisper transcribes within the performance budget\" test/main/features/video_studio_native_qa.test.ts","runtime:ensure": "node bin/ensure-runtime.cjs --root resources/runtime","officecli:policy-check": "node bin/officecli-policy-gate.cjs","officecli:fetch": "node scripts/fetch-officecli.cjs && node bin/officecli-policy-gate.cjs --require-host-binary",@@ -59,6 +62,7 @@"electron": "42.8.0","ffmpeg-static": "^5.3.0","semver": "7.8.5",+ "tar": "7.5.21","typescript": "^6.0.3","vitest": "^4.1.5"},@@ -82,6 +86,7 @@"zod": "^3.24.0"},"overrides": {+ "@anush008/tokenizers": "0.6.0","@hono/node-server": "2.0.11","esbuild": "0.28.1","tar": "7.5.21"@@ -265,10 +270,6 @@],"rfc3161TimeStampServer": "http://ts.ssl.com"}- },- "linux": {- "target": "AppImage",- "category": "Utility"}},"license": "MIT"diff --git a/resources/runtime/README.md b/resources/runtime/README.mdindex 9ce2e742..154421c5 100644--- a/resources/runtime/README.md+++ b/resources/runtime/README.md@@ -35,6 +35,8 @@ runtime/python/python.exe # Windows python-build-standalonedarwin-arm64/darwin-x64/+ linux-arm64/+ linux-x64/win32-x64/uv/current/@@ -42,6 +44,8 @@ runtime/uv.exedarwin-arm64/darwin-x64/+ linux-arm64/+ linux-x64/win32-x64/node/current/@@ -51,7 +55,19 @@ runtime/node.exe # Windows official Node archivedarwin-arm64/darwin-x64/+ linux-arm64/+ linux-x64/win32-x64/+ ffmpeg/+ linux-arm64/+ linux-x64/+ whisper/+ linux-arm64/+ bin/whisper-cli+ models/ggml-base-q5_1.bin+ linux-x64/+ bin/whisper-cli+ models/ggml-base-q5_1.bin```The app resolves `current` first, then `<platform>-<arch>`. It injectsdiff --git a/run.sh b/run.shindex 6a82b5fb..52d6e93d 100755--- a/run.sh+++ b/run.sh@@ -69,6 +69,15 @@ wait_for_relaunch_owner() {wait_for_relaunch_owner+if ! command -v node >/dev/null 2>&1; then+ echo "[Orkas] Node.js 20+ is required to bootstrap the source checkout. Install Node.js, then run ./run.sh again." >&2+ exit 1+fi++if [ "$(uname -s)" = "Linux" ]; then+ node "$APP_DIR/scripts/verify-linux-source-dependencies.cjs" --host-only+fi+node "$APP_DIR/scripts/ensure-deps.cjs"node "$APP_DIR/scripts/ensure-dev-dependencies.cjs"# macOS source runs need the same connector callback declaration that electron-builder adds todiff --git a/scripts/ensure-dev-dependencies.cjs b/scripts/ensure-dev-dependencies.cjsindex 613da19e..21498518 100644--- a/scripts/ensure-dev-dependencies.cjs+++ b/scripts/ensure-dev-dependencies.cjs@@ -24,6 +24,9 @@ function shouldProvisionWhisper(platform = process.platform, arch = process.archfunction main() {console.log(`[dev-deps] preparing built-in dependencies for ${process.platform}-${process.arch}`);+ if (process.platform === 'linux') {+ run('Linux host preflight', 'scripts/verify-linux-source-dependencies.cjs', ['--host-only']);+ }run('notification permission addon', 'scripts/build-notification-permission-addon.cjs', ['--platform', process.platform,'--arch', process.arch,@@ -55,6 +58,9 @@ function main() {} else {console.log(`[dev-deps] Whisper not provisioned for ${process.platform}-${process.arch}; skipping (local speech transcription unavailable)`);}+ if (process.platform === 'linux') {+ run('Linux source dependencies', 'scripts/verify-linux-source-dependencies.cjs');+ }console.log('[dev-deps] built-in dependencies ready');}diff --git a/scripts/fetch-whisper.cjs b/scripts/fetch-whisper.cjsindex 91d078c7..8c92b2dc 100644--- a/scripts/fetch-whisper.cjs+++ b/scripts/fetch-whisper.cjs@@ -15,6 +15,7 @@ const os = require('node:os');const path = require('node:path');const { spawnSync } = require('node:child_process');const AdmZip = require('adm-zip');+const tar = require('tar');const { WHISPER_RUNTIME_CONTRACT } = require('../bin/runtime-gate.cjs');const { installWindowsVcRuntime } = require('./fetch-win-vc-runtime.cjs');@@ -29,6 +30,24 @@ function runtimeVersion(target) {function noticeForTarget(target) {const version = runtimeVersion(target);+ const windowsNotice = target.source?.startsWith('official-release-openblas') ? `+The Windows CLI is the official whisper.cpp x64 release. Its required Microsoft+Visual C++ runtime DLLs are deployed application-locally beside whisper-cli;+Orkas does not install or modify the machine-wide Visual C++ Redistributable.+Microsoft redistributable terms apply:+ https://visualstudio.microsoft.com/license-terms/+` : '';+ const linuxNotice = target.source?.startsWith('official-release-ubuntu') ? `+The Linux CLI and its CPU runtime libraries are the official whisper.cpp Ubuntu+release for the target architecture. They are deployed application-locally+beside whisper-cli and selected by the dynamic loader through the executable's+origin-relative run path.+` : '';+ const macNotice = target.source === 'vendored-static-cli' ? `+The macOS CLI is a static target-native build whose pinned source, toolchain,+flags, size, and hash are documented in+vendor/whisper/v${WHISPER_RUNTIME_CONTRACT.version}/BUILD.md.+` : '';const openBlasNotice = target.openBlasVersion ? `Windows OpenBLAS acceleration:https://github.com/OpenMathLib/OpenBLAS/tree/v${target.openBlasVersion}@@ -48,15 +67,10 @@ Multilingual Whisper base-q5_1 model:https://huggingface.co/ggerganov/whisper.cppDerived from OpenAI Whisper; MIT; see LICENSE.model.-The Windows CLI is the official whisper.cpp x64 release. Its required Microsoft-Visual C++ runtime DLLs are deployed application-locally beside whisper-cli;-Orkas does not install or modify the machine-wide Visual C++ Redistributable.-Microsoft redistributable terms apply:- https://visualstudio.microsoft.com/license-terms/-+${windowsNotice}+${linuxNotice}+${macNotice}${openBlasNotice}-The macOS CLIs are static target-native builds whose pinned source, toolchain,-flags, sizes, and hashes are documented in vendor/whisper/v${WHISPER_RUNTIME_CONTRACT.version}/BUILD.md.`;}@@ -284,6 +298,38 @@ function writeWindowsFiles(archiveFile, tempDir, target) {}}+function safeArchivePath(value) {+ const normalized = String(value || '').replaceAll('\\', '/');+ if (!normalized || normalized.startsWith('/') || normalized.split('/').includes('..')) {+ throw new Error(`unsafe whisper.cpp archive path: ${value}`);+ }+ return normalized;+}++function writeLinuxFiles(archiveFile, tempDir, target) {+ const extractDir = path.join(tempDir, '.archive');+ const archivePaths = new Set(Object.values(target.files).map(expected => (+ safeArchivePath(expected.archivePath)+ )));+ fs.mkdirSync(extractDir, { recursive: true });+ try {+ tar.x({+ cwd: extractDir,+ file: archiveFile,+ filter: entryPath => archivePaths.has(safeArchivePath(entryPath)),+ preservePaths: false,+ strict: true,+ sync: true,+ });+ for (const [relativePath, expected] of Object.entries(target.files)) {+ const source = rel(extractDir, safeArchivePath(expected.archivePath));+ copyPinned(source, rel(tempDir, relativePath), expected, expected.executable === true);+ }+ } finally {+ fs.rmSync(extractDir, { recursive: true, force: true });+ }+}+function writeWindowsAppLocalFiles(vcRuntimeDir, tempDir, target) {for (const [relativePath, expected] of Object.entries(target.appLocalFiles || {})) {copyPinned(path.join(vcRuntimeDir, path.basename(relativePath)), rel(tempDir, relativePath), expected, true);@@ -376,6 +422,9 @@ async function installWhisper(options = targetOptions()) {const archive = await cachedDownload(target.archive.cacheName || `whisper-bin-x64-v${version}.zip`, target.archive);writeWindowsFiles(archive, tempDir, target);writeWindowsAppLocalFiles(vcRuntimeDir, tempDir, target);+ } else if (options.platform === 'linux') {+ const archive = await cachedDownload(target.archive.cacheName || `whisper-bin-ubuntu-${options.arch}-v${version}.tar.gz`, target.archive);+ writeLinuxFiles(archive, tempDir, target);}const model = await cachedDownload('ggml-base-q5_1.bin', WHISPER_RUNTIME_CONTRACT.model);@@ -413,5 +462,6 @@ module.exports = {runtimeVersion,targetOptions,writeCapabilityState,+ writeLinuxFiles,writeWindowsAppLocalFiles,};diff --git a/scripts/linux-electron-smoke.cjs b/scripts/linux-electron-smoke.cjsnew file mode 100644index 00000000..73c408ff--- /dev/null+++ b/scripts/linux-electron-smoke.cjs@@ -0,0 +1,39 @@+#!/usr/bin/env node+'use strict';++const { app, BrowserWindow } = require('electron');++const timeout = setTimeout(() => {+ console.error('[linux-electron-smoke] timed out waiting for Electron');+ app.exit(1);+}, 30_000);++app.disableHardwareAcceleration();+app.whenReady().then(async () => {+ const window = new BrowserWindow({+ show: false,+ webPreferences: {+ contextIsolation: true,+ nodeIntegration: false,+ sandbox: true,+ },+ });+ try {+ await window.loadURL('data:text/html;charset=utf-8,%3Cbody%3Eorkas-linux-smoke%3C%2Fbody%3E');+ const text = await window.webContents.executeJavaScript('document.body.textContent');+ if (text !== 'orkas-linux-smoke') throw new Error('hidden BrowserWindow did not render expected content');+ console.log('[linux-electron-smoke] Electron app and hidden BrowserWindow are ready');+ clearTimeout(timeout);+ window.destroy();+ app.quit();+ } catch (err) {+ clearTimeout(timeout);+ window.destroy();+ console.error(`[linux-electron-smoke] failed: ${err.message}`);+ app.exit(1);+ }+}).catch((err) => {+ clearTimeout(timeout);+ console.error(`[linux-electron-smoke] failed: ${err.message}`);+ app.exit(1);+});diff --git a/scripts/linux-native-dependency-probe.cjs b/scripts/linux-native-dependency-probe.cjsnew file mode 100644index 00000000..ec1fc782--- /dev/null+++ b/scripts/linux-native-dependency-probe.cjs@@ -0,0 +1,111 @@+#!/usr/bin/env node+'use strict';++const fs = require('node:fs');+const path = require('node:path');++const pcRoot = path.resolve(__dirname, '..');+const modelRoot = path.join(+ pcRoot,+ 'resources',+ 'embedding-model',+ 'fast-bge-small-zh-v1.5',+);++function requireCondition(condition, message) {+ if (!condition) throw new Error(message);+}++async function probeSqlite() {+ const Database = require('better-sqlite3');+ const sqliteVec = require('sqlite-vec');+ const db = new Database(':memory:');+ try {+ sqliteVec.load(db);+ const row = db.prepare('SELECT vec_version() AS version').get();+ requireCondition(typeof row?.version === 'string' && row.version.length > 0, 'sqlite-vec returned no version');+ } finally {+ db.close();+ }+}++async function probeSharp() {+ const sharp = require('sharp');+ const png = await sharp({+ create: {+ width: 2,+ height: 2,+ channels: 4,+ background: { r: 20, g: 40, b: 60, alpha: 1 },+ },+ }).png().toBuffer();+ requireCondition(+ png.length > 8 && png.subarray(1, 4).toString('ascii') === 'PNG',+ 'sharp did not produce a PNG',+ );+}++async function probeCanvas() {+ const { createCanvas } = require('@napi-rs/canvas');+ const canvas = createCanvas(2, 2);+ const context = canvas.getContext('2d');+ context.fillStyle = '#123456';+ context.fillRect(0, 0, 2, 2);+ const png = canvas.toBuffer('image/png');+ requireCondition(Buffer.isBuffer(png) && png.length > 8, '@napi-rs/canvas did not produce a PNG');+}++async function probeEmbedding(fullEmbedding) {+ const tokenizers = require('@anush008/tokenizers');+ const tokenizerFile = path.join(modelRoot, 'tokenizer.json');+ requireCondition(fs.existsSync(tokenizerFile), 'embedding tokenizer is missing');+ const tokenizer = tokenizers.Tokenizer.fromFile(tokenizerFile);+ const encoded = await tokenizer.encode('Orkas Linux dependency probe');+ requireCondition(encoded.getIds().length > 0, 'tokenizer returned no token ids');++ // fastembed eagerly loads onnxruntime-node as well as tokenizers. Requiring+ // the public entrypoint catches missing shared libraries even in the fast+ // startup probe. CI additionally creates a real ONNX session and inference.+ const fastembed = require('fastembed');+ requireCondition(typeof fastembed.FlagEmbedding?.init === 'function', 'fastembed entrypoint is incomplete');+ if (!fullEmbedding) return;++ const embedder = await fastembed.FlagEmbedding.init({+ model: fastembed.EmbeddingModel.BGESmallZH,+ cacheDir: path.dirname(modelRoot),+ showDownloadProgress: false,+ });+ const batches = embedder.embed(['Orkas Linux dependency probe'], 1);+ let vector = null;+ for await (const batch of batches) {+ vector = batch?.[0] || null;+ break;+ }+ requireCondition(vector && vector.length === 512, 'embedding inference did not return a 512-dimensional vector');+ requireCondition(Array.from(vector).every(Number.isFinite), 'embedding inference returned a non-finite value');+}++async function main() {+ if (process.platform !== 'linux') {+ console.log(`[linux-native-probe] skipped on ${process.platform}-${process.arch}`);+ return;+ }+ const fullEmbedding = process.argv.includes('--full-embedding');+ await probeSqlite();+ await probeSharp();+ await probeCanvas();+ await probeEmbedding(fullEmbedding);+ console.log(+ `[linux-native-probe] verified better-sqlite3, sqlite-vec, sharp, canvas, tokenizers, onnxruntime`+ + `${fullEmbedding ? ', embedding-inference' : ''}`,+ );+}++if (require.main === module) {+ main().catch((err) => {+ console.error(`[linux-native-probe] failed: ${err.message}`);+ process.exit(1);+ });+}++module.exports = { probeCanvas, probeEmbedding, probeSharp, probeSqlite };diff --git a/scripts/run-platform-native-tests.mjs b/scripts/run-platform-native-tests.mjsindex 413e30d3..80fcbaf4 100644--- a/scripts/run-platform-native-tests.mjs+++ b/scripts/run-platform-native-tests.mjs@@ -8,17 +8,17 @@ const here = dirname(fileURLToPath(import.meta.url));const pcRoot = resolve(here, '..');const runner = resolve(here, 'run-tests.mjs');-if (process.platform !== 'win32' && process.platform !== 'darwin') {+if (!['win32', 'darwin', 'linux'].includes(process.platform)) {console.log(`[platform-native-tests] skipped: unsupported host ${process.platform}`);process.exit(0);}// Keep system/native tests explicit and serial. This lane intentionally-// overlaps the general suite: a Windows-only process-tree or PowerShell case-// must remain visible as a dedicated CI failure instead of being buried among-// hundreds of platform-neutral tests. Real bundled Whisper remains the-// release-only `test:windows-native` lane because it requires downloaded-// FFmpeg, model, VC runtime, and CPU-dispatch payloads.+// overlaps the general suite: host-specific process, native-module, and OS+// integration cases must remain visible as a dedicated CI failure instead of+// being buried among hundreds of platform-neutral tests. Real bundled Whisper+// runs after dependency provisioning in the platform-specific Windows and+// Linux lanes because it requires downloaded FFmpeg, model, and native payloads.const commonSuites = ['src/core-agent/test/oauth-flow.test.ts','src/core-agent/test/tools.test.ts',@@ -57,12 +57,19 @@ const platformSuites = process.platform === 'win32''test/main/util/prepare-win-native-deps.test.ts','test/main/util/fetch-win-vc-runtime.test.ts',]- : [- 'test/main/features/platform-foundations.test.ts',- 'test/main/features/user_workspace.test.ts',- 'test/main/conversation-files.test.ts',- 'test/main/native/notification-permissions-darwin.test.ts',- ];+ : process.platform === 'darwin'+ ? [+ 'test/main/features/platform-foundations.test.ts',+ 'test/main/features/user_workspace.test.ts',+ 'test/main/conversation-files.test.ts',+ 'test/main/native/notification-permissions-darwin.test.ts',+ ]+ : [+ 'test/main/util/linux-source-dependencies.test.ts',+ 'test/main/util/officecli-fetch.test.ts',+ 'test/main/util/ensure-dev-dependencies.test.ts',+ 'test/main/util/ensure-sqlite-electron-abi.test.ts',+ ];console.log(`[platform-native-tests] host=${process.platform}; suites=${commonSuites.length + platformSuites.length}`);const result = spawnSync(process.execPath, [diff --git a/scripts/verify-linux-ocr-runtime.mjs b/scripts/verify-linux-ocr-runtime.mjsnew file mode 100644index 00000000..5afa123f--- /dev/null+++ b/scripts/verify-linux-ocr-runtime.mjs@@ -0,0 +1,29 @@+#!/usr/bin/env node++import * as fs from 'node:fs';+import * as os from 'node:os';+import * as path from 'node:path';++if (process.platform !== 'linux') {+ console.log(`[linux-ocr-probe] skipped on ${process.platform}-${process.arch}`);+ process.exit(0);+}++const ownsWorkspace = !process.env.ORKAS_WORKSPACE_ROOT;+const workspace = process.env.ORKAS_WORKSPACE_ROOT+ || fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-linux-ocr-'));+process.env.ORKAS_WORKSPACE_ROOT = workspace;++try {+ const { _ensureOcrRuntimeForTest } = await import('../src/main/features/ocr_runtime.ts');+ const result = await _ensureOcrRuntimeForTest((event) => {+ if (!event.data?.heartbeat) console.log(`[linux-ocr-probe] ${event.phase}: ${event.message}`);+ });+ if (!result.ok) throw new Error(`${result.errorCode}: ${result.message}`);+ console.log(`[linux-ocr-probe] RapidOCR runtime verified (${result.installed ? 'installed' : 'reused'})`);+} catch (err) {+ console.error(`[linux-ocr-probe] failed: ${err.message}`);+ process.exitCode = 1;+} finally {+ if (ownsWorkspace) fs.rmSync(workspace, { recursive: true, force: true });+}diff --git a/scripts/verify-linux-source-dependencies.cjs b/scripts/verify-linux-source-dependencies.cjsnew file mode 100644index 00000000..0b8cbcef--- /dev/null+++ b/scripts/verify-linux-source-dependencies.cjs@@ -0,0 +1,275 @@+#!/usr/bin/env node+'use strict';++const fs = require('node:fs');+const path = require('node:path');+const { spawnSync } = require('node:child_process');++const { verifyEmbeddingModelRoot } = require('../bin/packaged-resource-gate.cjs');+const {+ WHISPER_RUNTIME_CONTRACT,+ verifyFfmpegRuntimeDir,+ verifyRuntimeDir,+ verifyWhisperRuntimeDir,+} = require('../bin/runtime-gate.cjs');++const PC_ROOT = path.resolve(__dirname, '..');+const MINIMUM_NODE_MAJOR = 20;+// The official whisper.cpp v1.9.1 Ubuntu x64/arm64 releases require symbols+// through GLIBC_2.34, so the source bootstrap must reject older hosts before+// downloading runtimes that cannot execute there.+const MINIMUM_GLIBC = WHISPER_RUNTIME_CONTRACT.targets['linux-x64'].minimumGlibc;+if (!MINIMUM_GLIBC+ || WHISPER_RUNTIME_CONTRACT.targets['linux-arm64'].minimumGlibc !== MINIMUM_GLIBC) {+ throw new Error('Linux Whisper targets must declare one shared minimum glibc version');+}+const SUPPORTED_ARCHES = Object.freeze(['x64', 'arm64']);++function versionTuple(value) {+ const match = /^(\d+)\.(\d+)/.exec(String(value || '').trim());+ return match ? [Number(match[1]), Number(match[2])] : null;+}++function versionAtLeast(actual, minimum) {+ const a = versionTuple(actual);+ const b = versionTuple(minimum);+ if (!a || !b) return false;+ return a[0] > b[0] || (a[0] === b[0] && a[1] >= b[1]);+}++function runtimeGlibcVersion(report = process.report) {+ try {+ return String(report?.getReport()?.header?.glibcVersionRuntime || '').trim();+ } catch {+ return '';+ }+}++function assertLinuxHost({+ platform = process.platform,+ arch = process.arch,+ nodeVersion = process.versions.node,+ glibcVersionRuntime = runtimeGlibcVersion(),+} = {}) {+ if (platform !== 'linux') return Object.freeze([]);+ if (!SUPPORTED_ARCHES.includes(arch)) {+ throw new Error(`unsupported Linux architecture ${arch}; Orkas source runs support x64 and arm64`);+ }+ const nodeMajor = Number.parseInt(String(nodeVersion).split('.', 1)[0], 10);+ if (!Number.isFinite(nodeMajor) || nodeMajor < MINIMUM_NODE_MAJOR) {+ throw new Error(`Node.js ${MINIMUM_NODE_MAJOR}+ is required; found ${nodeVersion || 'unknown'}`);+ }+ if (!glibcVersionRuntime) {+ throw new Error('glibc is required; Alpine and other musl-based Linux distributions are not supported');+ }+ if (!versionAtLeast(glibcVersionRuntime, MINIMUM_GLIBC)) {+ throw new Error(`glibc ${MINIMUM_GLIBC}+ is required; found ${glibcVersionRuntime}`);+ }+ return Object.freeze([+ `host:linux-${arch}`,+ `host:node-${nodeMajor}`,+ `host:glibc-${glibcVersionRuntime}`,+ ]);+}++function requiredLinuxPackages(arch) {+ if (!SUPPORTED_ARCHES.includes(arch)) {+ throw new Error(`unsupported Linux architecture ${arch}`);+ }+ return Object.freeze([+ '@anush008/tokenizers',+ `@anush008/tokenizers-linux-${arch}-gnu`,+ `@esbuild/linux-${arch}`,+ '@napi-rs/canvas',+ `@napi-rs/canvas-linux-${arch}-gnu`,+ `@img/sharp-linux-${arch}`,+ `@img/sharp-libvips-linux-${arch}`,+ 'better-sqlite3',+ 'fastembed',+ 'sharp',+ 'sqlite-vec',+ `sqlite-vec-linux-${arch}`,+ ]);+}++function readJson(file, label) {+ try {+ return JSON.parse(fs.readFileSync(file, 'utf8'));+ } catch {+ throw new Error(`${label} is missing or invalid`);+ }+}++function packageDir(root, packageName) {+ return path.join(root, 'node_modules', ...packageName.split('/'));+}++function verifyPackageContract(root, arch) {+ const lock = readJson(path.join(root, 'package-lock.json'), 'package-lock.json');+ const verified = [];+ for (const packageName of requiredLinuxPackages(arch)) {+ const locked = lock.packages?.[`node_modules/${packageName}`]?.version;+ if (!locked) throw new Error(`package-lock.json does not declare ${packageName}`);+ const installed = readJson(path.join(packageDir(root, packageName), 'package.json'), packageName).version;+ if (installed !== locked) {+ throw new Error(`${packageName} version mismatch: package-lock=${locked}, installed=${installed || 'missing'}`);+ }+ verified.push(`package:${packageName}@${installed}`);+ }++ const onnxCandidates = [+ path.join(root, 'node_modules', 'fastembed', 'node_modules', 'onnxruntime-node'),+ path.join(root, 'node_modules', 'onnxruntime-node'),+ ].filter((candidate) => fs.existsSync(path.join(candidate, 'package.json')));+ if (onnxCandidates.length !== 1) {+ throw new Error(`expected exactly one onnxruntime-node installation; found ${onnxCandidates.length}`);+ }+ const onnxDir = onnxCandidates[0];+ for (const name of ['onnxruntime_binding.node', 'libonnxruntime.so.1']) {+ const file = path.join(onnxDir, 'bin', 'napi-v3', 'linux', arch, name);+ if (!fs.existsSync(file) || !fs.statSync(file).isFile()) {+ throw new Error(`onnxruntime-node is missing its linux-${arch} ${name}`);+ }+ }+ verified.push(`package:onnxruntime-node:linux-${arch}`);+ return Object.freeze(verified);+}++function firstUsefulLine(value) {+ return String(value || '').split(/\r?\n/).map((line) => line.trim()).find(Boolean) || '';+}++function processFailureReason(result) {+ const output = `${result.stderr || ''}\n${result.stdout || ''}`;+ const sharedLibrary = /error while loading shared libraries:\s*([^:\s]+)[^\n]*/i.exec(output);+ if (sharedLibrary) {+ return `missing Linux shared library ${sharedLibrary[1]}; install the Electron runtime library from your distribution and retry`;+ }+ return result.error?.message+ || firstUsefulLine(result.stderr)+ || firstUsefulLine(result.stdout)+ || `exit ${result.status}`;+}++function runChecked(label, command, args, options = {}) {+ const result = (options.spawn || spawnSync)(command, args, {+ cwd: options.cwd || PC_ROOT,+ encoding: 'utf8',+ env: options.env || process.env,+ timeout: options.timeout || 30_000,+ maxBuffer: 8 * 1024 * 1024,+ });+ if (result.error || result.status !== 0) {+ throw new Error(`${label} failed: ${processFailureReason(result)}`);+ }+ return result;+}++function verifyRuntimeContract(root, arch) {+ const runtimeRoot = path.join(root, 'resources', 'runtime');+ const manifest = readJson(path.join(runtimeRoot, 'manifest.json'), 'runtime manifest');+ const key = `linux-${arch}`;+ const verified = [];+ for (const kind of ['python', 'uv', 'node']) {+ const spec = manifest[kind];+ const asset = spec?.assets?.[key];+ if (!spec || !asset) throw new Error(`runtime manifest does not declare ${kind} for ${key}`);+ const dir = path.join(runtimeRoot, kind, key);+ const executable = verifyRuntimeDir(kind, dir, key, spec, asset, 'linux', arch);+ runChecked(`${kind} runtime`, executable, ['--version']);+ verified.push(`runtime:${kind}:${key}`);+ }+ verifyFfmpegRuntimeDir(runtimeRoot, 'linux', arch);+ verified.push(`runtime:ffmpeg:${key}`);+ verifyWhisperRuntimeDir(runtimeRoot, 'linux', arch);+ verified.push(`runtime:whisper:${key}`);+ return Object.freeze(verified);+}++function verifyOfficeCli(root, arch) {+ runChecked(+ 'OfficeCLI policy gate',+ process.execPath,+ [path.join(root, 'bin', 'officecli-policy-gate.cjs'), `--root=${root}`, '--require-host-binary'],+ { cwd: root, timeout: 60_000 },+ );+ return Object.freeze([`runtime:officecli:linux-${arch}`]);+}++function runNativeProbe(root, { fullEmbedding = false } = {}) {+ const electronCli = require.resolve('electron/cli.js', { paths: [root] });+ const args = [electronCli, path.join(root, 'scripts', 'linux-native-dependency-probe.cjs')];+ if (fullEmbedding) args.push('--full-embedding');+ runChecked('Electron native dependency probe', process.execPath, args, {+ cwd: root,+ env: { ...process.env, ELECTRON_RUN_AS_NODE: '1' },+ timeout: fullEmbedding ? 2 * 60_000 : 60_000,+ });+ return Object.freeze([fullEmbedding ? 'native:embedding-inference' : 'native:load-probe']);+}++function runElectronSmoke(root) {+ const electronCli = require.resolve('electron/cli.js', { paths: [root] });+ const env = { ...process.env };+ delete env.ELECTRON_RUN_AS_NODE;+ runChecked(+ 'Electron GUI smoke',+ process.execPath,+ [electronCli, path.join(root, 'scripts', 'linux-electron-smoke.cjs')],+ { cwd: root, env, timeout: 60_000 },+ );+ return Object.freeze(['electron:hidden-window']);+}++function parseArgs(argv) {+ const options = { fullEmbedding: false, gui: false, hostOnly: false, root: PC_ROOT };+ for (const arg of argv) {+ if (arg === '--full-embedding') options.fullEmbedding = true;+ else if (arg === '--gui') options.gui = true;+ else if (arg === '--host-only') options.hostOnly = true;+ else if (arg.startsWith('--root=')) options.root = path.resolve(arg.slice('--root='.length));+ else throw new Error(`unknown argument: ${arg}`);+ }+ return options;+}++function main(argv = process.argv.slice(2)) {+ const options = parseArgs(argv);+ if (process.platform !== 'linux') {+ console.log(`[linux-deps] skipped on ${process.platform}-${process.arch}`);+ return;+ }+ const verified = [...assertLinuxHost()];+ if (!options.hostOnly) {+ verified.push(...verifyPackageContract(options.root, process.arch));+ verified.push(verifyEmbeddingModelRoot(path.join(options.root, 'resources', 'embedding-model')));+ verified.push(...verifyRuntimeContract(options.root, process.arch));+ verified.push(...verifyOfficeCli(options.root, process.arch));+ verified.push(...runNativeProbe(options.root, { fullEmbedding: options.fullEmbedding }));+ if (options.gui) verified.push(...runElectronSmoke(options.root));+ }+ console.log(`[linux-deps] verified ${verified.join(', ')}`);+}++if (require.main === module) {+ try {+ main();+ } catch (err) {+ console.error(`[linux-deps] failed: ${err.message}`);+ process.exit(1);+ }+}++module.exports = {+ MINIMUM_GLIBC,+ MINIMUM_NODE_MAJOR,+ SUPPORTED_ARCHES,+ assertLinuxHost,+ firstUsefulLine,+ parseArgs,+ processFailureReason,+ requiredLinuxPackages,+ runtimeGlibcVersion,+ verifyPackageContract,+ versionAtLeast,+};diff --git a/test/main/features/video_studio_native_qa.test.ts b/test/main/features/video_studio_native_qa.test.tsindex 9cae596a..8e15f9ad 100644--- a/test/main/features/video_studio_native_qa.test.ts+++ b/test/main/features/video_studio_native_qa.test.ts@@ -4920,13 +4920,22 @@ describe('native VideoStudio draft QA parity', () => {expect(resolveSpeechTranscribeBackend()).toEqual({ cli, model, source: 'bundled' });});- it.runIf(process.platform === 'win32' && process.env.ORKAS_REAL_WHISPER_TEST === '1')(- 'Windows real bundled whisper transcribes within the performance budget', async () => {+ const realWhisperPlatform = process.platform === 'win32'+ ? 'Windows'+ : process.platform === 'linux' ? 'Linux' : process.platform;+ it.runIf(['win32', 'linux'].includes(process.platform) && process.env.ORKAS_REAL_WHISPER_TEST === '1')(+ `${realWhisperPlatform} real bundled whisper transcribes within the performance budget`, async () => {const p = tmpProject('bundled-whisper');const input = path.join(p.root, 'raw.mp4');const transcript = path.join(p.root, 'project', 'transcript.json');const runtimeRoot = path.resolve(process.cwd(), 'resources', 'runtime');- const ffmpeg = path.join(runtimeRoot, 'ffmpeg', 'win32-x64', 'ffmpeg.exe');+ const runtimeKey = `${process.platform}-${process.arch}`;+ const ffmpeg = path.join(+ runtimeRoot,+ 'ffmpeg',+ runtimeKey,+ process.platform === 'win32' ? 'ffmpeg.exe' : 'ffmpeg',+ );const generated = spawnSync(ffmpeg, ['-hide_banner', '-loglevel', 'error', '-y','-f', 'lavfi', '-i', 'anullsrc=r=16000:cl=mono:d=0.2', input,diff --git a/test/main/util/ensure-dev-dependencies.test.ts b/test/main/util/ensure-dev-dependencies.test.tsindex 1274c023..63ed4f6a 100644--- a/test/main/util/ensure-dev-dependencies.test.ts+++ b/test/main/util/ensure-dev-dependencies.test.ts@@ -12,13 +12,13 @@ describe('ensure-dev-dependencies.cjs', () => {['darwin', 'arm64'],['darwin', 'x64'],['win32', 'x64'],+ ['linux', 'x64'],+ ['linux', 'arm64'],])('keeps Whisper required for supported target %s-%s', (platform, arch) => {expect(shouldProvisionWhisper(platform, arch)).toBe(true);});it.each([- ['linux', 'x64'],- ['linux', 'arm64'],['win32', 'arm64'],])('does not provision Whisper for unsupported target %s-%s', (platform, arch) => {expect(shouldProvisionWhisper(platform, arch)).toBe(false);diff --git a/test/main/util/fetch-whisper.test.ts b/test/main/util/fetch-whisper.test.tsindex f7b8d90e..96f2fb05 100644--- a/test/main/util/fetch-whisper.test.ts+++ b/test/main/util/fetch-whisper.test.ts@@ -1,6 +1,7 @@import { afterEach, describe, expect, it } from 'vitest';import { createRequire } from 'node:module';import * as fs from 'node:fs';+import * as crypto from 'node:crypto';import * as os from 'node:os';import * as path from 'node:path';@@ -18,6 +19,7 @@ const fetchWhisper = require('../../../scripts/fetch-whisper.cjs') as {runtimeVersion: (target: any) => string;targetOptions: (argv: string[]) => { platform: string; arch: string; force: boolean };writeCapabilityState: (dir: string, capability: { status: string; reason?: string }) => void;+ writeLinuxFiles: (archive: string, dir: string, target: any) => void;};const { WHISPER_RUNTIME_CONTRACT } = require('../../../bin/runtime-gate.cjs') as {WHISPER_RUNTIME_CONTRACT: any;@@ -65,6 +67,65 @@ describe('fetch-whisper', () => {expect(fetchWhisper.noticeForTarget(darwin)).not.toContain('LICENSE.openblas');});+ it.each(['x64', 'arm64'])('pins the official Linux %s archive and application-local runtime libraries', (arch) => {+ const target = WHISPER_RUNTIME_CONTRACT.targets[`linux-${arch}`];+ expect(fetchWhisper.runtimeVersion(target)).toBe('1.9.1');+ expect(target.minimumGlibc).toBe('2.34');+ expect(target.archive.url).toContain(`whisper-bin-ubuntu-${arch}.tar.gz`);+ expect(target.archive.bytes).toBeGreaterThan(1_000_000);+ expect(target.archive.sha256).toMatch(/^[a-f0-9]{64}$/);+ expect(Object.keys(fetchWhisper.expectedFiles(target))).toEqual(expect.arrayContaining([+ 'bin/whisper-cli',+ 'bin/libwhisper.so.1',+ 'bin/libggml.so.0',+ 'bin/libggml-base.so.0',+ 'models/ggml-base-q5_1.bin',+ 'LICENSE.whisper.cpp',+ 'LICENSE.model',+ ]));+ expect(fetchWhisper.noticeForTarget(target)).toContain('official whisper.cpp Ubuntu');+ });++ it('extracts only contracted Linux archive files and verifies them before installation', async () => {+ const tar = await import('tar');+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-whisper-linux-archive-'));+ tempDirs.push(root);+ const sourceRoot = path.join(root, 'source');+ const archiveRoot = path.join(sourceRoot, 'whisper-bin-ubuntu-x64');+ fs.mkdirSync(archiveRoot, { recursive: true });+ const cli = Buffer.from('fake linux whisper cli');+ const library = Buffer.from('fake linux whisper library');+ fs.writeFileSync(path.join(archiveRoot, 'whisper-cli'), cli);+ fs.writeFileSync(path.join(archiveRoot, 'libwhisper.so.1.9.1'), library);+ fs.writeFileSync(path.join(archiveRoot, 'unregistered'), 'must not be extracted');+ const archive = path.join(root, 'runtime.tar.gz');+ tar.c({ cwd: sourceRoot, file: archive, gzip: true, sync: true }, ['whisper-bin-ubuntu-x64']);+ const record = (value: Buffer) => ({+ bytes: value.length,+ sha256: crypto.createHash('sha256').update(value).digest('hex'),+ executable: true,+ });+ const target = {+ files: {+ 'bin/whisper-cli': {+ archivePath: 'whisper-bin-ubuntu-x64/whisper-cli',+ ...record(cli),+ },+ 'bin/libwhisper.so.1': {+ archivePath: 'whisper-bin-ubuntu-x64/libwhisper.so.1.9.1',+ ...record(library),+ },+ },+ };+ const destination = path.join(root, 'destination');++ fetchWhisper.writeLinuxFiles(archive, destination, target);++ expect(fs.readFileSync(path.join(destination, 'bin', 'whisper-cli'))).toEqual(cli);+ expect(fs.readFileSync(path.join(destination, 'bin', 'libwhisper.so.1'))).toEqual(library);+ expect(fs.existsSync(path.join(destination, 'unregistered'))).toBe(false);+ });+it('persists an unsupported-CPU capability state without changing verified file records', () => {const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-whisper-marker-'));tempDirs.push(dir);diff --git a/test/main/util/linux-source-dependencies.test.ts b/test/main/util/linux-source-dependencies.test.tsnew file mode 100644index 00000000..2113728f--- /dev/null+++ b/test/main/util/linux-source-dependencies.test.ts@@ -0,0 +1,173 @@+import { afterEach, describe, expect, it } from 'vitest';+import * as fs from 'node:fs';+import * as os from 'node:os';+import * as path from 'node:path';++const {+ MINIMUM_GLIBC,+ assertLinuxHost,+ processFailureReason,+ requiredLinuxPackages,+ verifyPackageContract,+ versionAtLeast,+} = require(path.join(process.cwd(), 'scripts', 'verify-linux-source-dependencies.cjs')) as {+ MINIMUM_GLIBC: string;+ assertLinuxHost: (input: {+ platform: NodeJS.Platform;+ arch: string;+ nodeVersion: string;+ glibcVersionRuntime: string;+ }) => readonly string[];+ processFailureReason: (result: {+ error?: Error;+ status?: number | null;+ stderr?: string;+ stdout?: string;+ }) => string;+ requiredLinuxPackages: (arch: string) => readonly string[];+ verifyPackageContract: (root: string, arch: string) => readonly string[];+ versionAtLeast: (actual: string, minimum: string) => boolean;+};++const tempRoots: string[] = [];++afterEach(() => {+ for (const root of tempRoots.splice(0)) fs.rmSync(root, { recursive: true, force: true });+});++function writeJson(file: string, value: unknown): void {+ fs.mkdirSync(path.dirname(file), { recursive: true });+ fs.writeFileSync(file, `${JSON.stringify(value, null, 2)}\n`);+}++function fakePackageRoot(arch: 'x64' | 'arm64'): string {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-linux-deps-'));+ tempRoots.push(root);+ const packages: Record<string, { version: string }> = {};+ for (const packageName of requiredLinuxPackages(arch)) {+ packages[`node_modules/${packageName}`] = { version: '1.2.3' };+ writeJson(+ path.join(root, 'node_modules', ...packageName.split('/'), 'package.json'),+ { name: packageName, version: '1.2.3' },+ );+ }+ writeJson(path.join(root, 'package-lock.json'), { packages });+ const onnx = path.join(+ root,+ 'node_modules',+ 'fastembed',+ 'node_modules',+ 'onnxruntime-node',+ );+ writeJson(path.join(onnx, 'package.json'), { name: 'onnxruntime-node', version: '1.21.0' });+ const onnxHost = path.join(onnx, 'bin', 'napi-v3', 'linux', arch);+ fs.mkdirSync(onnxHost, { recursive: true });+ fs.writeFileSync(path.join(onnxHost, 'onnxruntime_binding.node'), 'elf');+ fs.writeFileSync(path.join(onnxHost, 'libonnxruntime.so.1'), 'elf');+ return root;+}++describe('Linux source dependency contract', () => {+ it.each(['x64', 'arm64'] as const)('accepts a supported glibc Linux %s host', (arch) => {+ expect(assertLinuxHost({+ platform: 'linux',+ arch,+ nodeVersion: '24.17.0',+ glibcVersionRuntime: MINIMUM_GLIBC,+ })).toContain(`host:linux-${arch}`);+ });++ it('fails before downloads on musl, old glibc, old Node, and unsupported architectures', () => {+ expect(() => assertLinuxHost({+ platform: 'linux', arch: 'x64', nodeVersion: '24.17.0', glibcVersionRuntime: '',+ })).toThrow(/musl-based Linux distributions are not supported/);+ expect(() => assertLinuxHost({+ platform: 'linux', arch: 'x64', nodeVersion: '24.17.0', glibcVersionRuntime: '2.33',+ })).toThrow(/glibc 2\.34\+ is required/);+ expect(() => assertLinuxHost({+ platform: 'linux', arch: 'x64', nodeVersion: '18.20.0', glibcVersionRuntime: '2.39',+ })).toThrow(/Node\.js 20\+ is required/);+ expect(() => assertLinuxHost({+ platform: 'linux', arch: 'riscv64', nodeVersion: '24.17.0', glibcVersionRuntime: '2.39',+ })).toThrow(/support x64 and arm64/);+ });++ it('uses GNU native packages for both supported architectures', () => {+ expect(requiredLinuxPackages('x64')).toContain('@anush008/tokenizers-linux-x64-gnu');+ expect(requiredLinuxPackages('arm64')).toContain('@anush008/tokenizers-linux-arm64-gnu');+ expect(requiredLinuxPackages('arm64')).not.toContain('@anush008/tokenizers-linux-arm64-musl');+ });++ it.each(['x64', 'arm64'] as const)('accepts a complete locked Linux %s package set', (arch) => {+ const root = fakePackageRoot(arch);+ expect(verifyPackageContract(root, arch)).toContain(`package:onnxruntime-node:linux-${arch}`);+ });++ it('rejects a missing arm64 tokenizer binding instead of deferring failure to Library use', () => {+ const root = fakePackageRoot('arm64');+ fs.rmSync(path.join(root, 'node_modules', '@anush008', 'tokenizers-linux-arm64-gnu'), {+ recursive: true,+ force: true,+ });+ expect(() => verifyPackageContract(root, 'arm64')).toThrow(/tokenizers-linux-arm64-gnu.*missing or invalid/);+ });++ it('keeps version comparison at the documented glibc boundary', () => {+ expect(versionAtLeast('2.34', '2.34')).toBe(true);+ expect(versionAtLeast('2.39', '2.34')).toBe(true);+ expect(versionAtLeast('2.33', '2.34')).toBe(false);+ expect(versionAtLeast('unknown', '2.34')).toBe(false);+ });++ it('turns a dynamic-loader failure into an actionable dependency error', () => {+ expect(processFailureReason({+ status: 127,+ stderr: '/checkout/node_modules/electron/electron: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file',+ })).toBe(+ 'missing Linux shared library libgtk-3.so.0; install the Electron runtime library from your distribution and retry',+ );+ });++ it('locks the tokenizer release that publishes GNU x64 and arm64 binaries', () => {+ const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'));+ const lock = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package-lock.json'), 'utf8'));+ expect(packageJson.overrides['@anush008/tokenizers']).toBe('0.6.0');+ expect(lock.packages['node_modules/@anush008/tokenizers']?.version).toBe('0.6.0');+ expect(lock.packages['node_modules/@anush008/tokenizers-linux-x64-gnu']?.version).toBe('0.6.0');+ expect(lock.packages['node_modules/@anush008/tokenizers-linux-arm64-gnu']?.version).toBe('0.6.0');+ expect(packageJson.build.linux).toBeUndefined();+ });++ it('keeps real x64 and arm64 source journeys in Linux CI', () => {+ const workflow = fs.readFileSync(+ path.join(process.cwd(), '.github', 'workflows', 'linux-source-smoke.yml'),+ 'utf8',+ );+ expect(workflow).toContain('runner: ubuntu-22.04');+ expect(workflow).toContain('runner: ubuntu-22.04-arm');+ expect(workflow).toMatch(/run:\s+npm ci\s*$/m);+ expect(workflow).not.toContain('npm ci --ignore-scripts');+ expect(workflow).toContain('node scripts/ensure-dev-dependencies.cjs');+ expect(workflow).toContain('xvfb-run --auto-servernum npm run test:linux-source');+ expect(workflow).toContain('npm run test:linux-whisper');+ expect(workflow).toContain('npm run test:linux-ocr');++ const nativeRunner = fs.readFileSync(+ path.join(process.cwd(), 'scripts', 'run-platform-native-tests.mjs'),+ 'utf8',+ );+ expect(nativeRunner).toContain("['win32', 'darwin', 'linux']");+ expect(nativeRunner).toContain('test/main/util/linux-source-dependencies.test.ts');++ const dependencyProvisioner = fs.readFileSync(+ path.join(process.cwd(), 'scripts', 'ensure-dev-dependencies.cjs'),+ 'utf8',+ );+ expect(dependencyProvisioner).toContain("run('Linux host preflight'");+ expect(dependencyProvisioner).toContain("run('Linux source dependencies'");++ const launcher = fs.readFileSync(path.join(process.cwd(), 'run.sh'), 'utf8');+ expect(launcher).toContain('Node.js 20+ is required to bootstrap the source checkout');+ expect(launcher).toContain('verify-linux-source-dependencies.cjs\" --host-only');+ });+});