Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(release): launch packaged desktop apps before publishing (#117)
Leoed018705fa43
diff --git a/.depot/workflows/release-smoke.yml b/.depot/workflows/release-smoke.ymlindex eaa18eab1..8e368be68 100644--- a/.depot/workflows/release-smoke.yml+++ b/.depot/workflows/release-smoke.yml@@ -217,6 +217,10 @@ jobs:xcrun stapler validate "${apps[0]}"spctl --assess --type execute --verbose=2 "${apps[0]}"+ - name: Launch macOS DMG+ if: matrix.platform == 'mac'+ run: vp run test:desktop-packaged-mac -- "release/Akeru-Bot-$RELEASE_VERSION-arm64.dmg"+- name: Upload smoke artifactuses: actions/upload-artifact@v7with:diff --git a/.depot/workflows/release.yml b/.depot/workflows/release.ymlindex b84efa3f7..79009615e 100644--- a/.depot/workflows/release.yml+++ b/.depot/workflows/release.yml@@ -220,6 +220,10 @@ jobs:xcrun stapler validate "${apps[0]}"spctl --assess --type execute --verbose=2 "${apps[0]}"+ - name: Launch macOS DMG+ if: matrix.platform == 'mac'+ run: vp run test:desktop-packaged-mac -- "release/Akeru-Bot-$RELEASE_VERSION-arm64.dmg"+- name: Upload desktop assetsuses: actions/upload-artifact@v7with:diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymldeleted file mode 100644index 8ff9ad2a0..000000000--- a/.github/workflows/release.yml+++ /dev/null@@ -1,249 +0,0 @@-# Depot builds every stable asset before the final job creates the tag and release.--name: Stable release native--on:- workflow_dispatch:- push:- branches: [main]- paths:- - apps/server/package.json- - apps/desktop/package.json- - apps/web/package.json- - packages/contracts/package.json--permissions:- contents: write--concurrency:- group: stable-release- cancel-in-progress: false--jobs:- preflight:- name: Release preflight- runs-on: ubuntu-24.04- timeout-minutes: 15- outputs:- version: ${{ steps.version.outputs.version }}- tag: ${{ steps.version.outputs.tag }}- steps:- - name: Checkout- uses: actions/checkout@v6- with:- fetch-depth: 0-- - name: Read stable version- id: version- shell: bash- run: |- version="$(node -p "require('./apps/server/package.json').version")"- if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then- printf 'Stable release version is invalid: %s\n' "$version" >&2- exit 1- fi- for manifest in apps/desktop/package.json apps/web/package.json packages/contracts/package.json; do- actual="$(node -p "require('./$manifest').version")"- if test "$actual" != "$version"; then- printf '%s has version %s, expected %s.\n' "$manifest" "$actual" "$version" >&2- exit 1- fi- done- if git rev-parse --verify --quiet "refs/tags/v$version"; then- printf 'Stable tag v%s already exists.\n' "$version" >&2- exit 1- fi- printf 'version=%s\ntag=v%s\n' "$version" "$version" >> "$GITHUB_OUTPUT"-- - name: Setup Vite+- uses: voidzero-dev/setup-vp@v1- with:- node-version-file: package.json- cache: true- run-install: true-- - name: Run release checks- run: |- vp run check:public-dependencies- vp test run scripts/verify-release-assets.test.ts-- desktop:- name: ${{ matrix.label }}- needs: preflight- runs-on: ${{ matrix.runner }}- timeout-minutes: 45- env:- RELEASE_VERSION: ${{ needs.preflight.outputs.version }}- T3CODE_DESKTOP_UPDATE_REPOSITORY: opencoredev/akeru-bot- strategy:- fail-fast: false- matrix:- include:- - label: macOS arm64 DMG- runner: macos-15- platform: mac- target: dmg- arch: arm64- rust_target: aarch64-apple-darwin- - label: Windows x64 NSIS- runner: windows-2025- platform: win- target: nsis- arch: x64- rust_target: x86_64-pc-windows-msvc- - label: Linux x64 AppImage- runner: ubuntu-24.04- platform: linux- target: AppImage- arch: x64- rust_target: x86_64-unknown-linux-gnu- steps:- - name: Checkout- uses: actions/checkout@v6-- - name: Setup Vite+- uses: voidzero-dev/setup-vp@8a7496fd44e8a1b0a88a7459e36213b2fefc1d15 # v1- with:- node-version-file: package.json- cache: ${{ matrix.platform != 'win' }}- run-install: false-- - name: Install desktop dependencies- run: vp install --frozen-lockfile --filter=@t3tools/desktop... --filter=akeru-bot... --filter=@t3tools/scripts...-- - name: Setup Rust- uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable- with:- targets: ${{ matrix.rust_target }}-- - name: Install ImageMagick- if: matrix.platform == 'linux'- run: |- sudo apt-get update- sudo apt-get install -y imagemagick-- - name: Validate signing credentials- shell: bash- env:- MACOS_CERTIFICATE_P12: ${{ secrets.MACOS_CERTIFICATE_P12 }}- MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}- MACOS_SIGNING_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY }}- APPSTORE_API_KEY_P8: ${{ secrets.APPSTORE_API_KEY_P8 }}- APPSTORE_API_KEY_ID: ${{ secrets.APPSTORE_API_KEY_ID }}- APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }}- AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}- AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}- AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}- AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}- AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}- AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}- AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}- run: |- signed=false- if test "${{ matrix.platform }}" = mac; then- values=("$MACOS_CERTIFICATE_P12" "$MACOS_CERTIFICATE_PASSWORD" "$MACOS_SIGNING_IDENTITY" "$APPSTORE_API_KEY_P8" "$APPSTORE_API_KEY_ID" "$APPSTORE_ISSUER_ID")- elif test "${{ matrix.platform }}" = win; then- values=("$AZURE_TRUSTED_SIGNING_PUBLISHER_NAME" "$AZURE_TRUSTED_SIGNING_ENDPOINT" "$AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME" "$AZURE_TRUSTED_SIGNING_ACCOUNT_NAME" "$AZURE_CLIENT_ID" "$AZURE_TENANT_ID" "$AZURE_CLIENT_SECRET")- else- values=()- fi- present=0- for value in "${values[@]}"; do test -n "$value" && present=$((present + 1)); done- if (( present != 0 && present != ${#values[@]} )); then- printf 'Signing credentials must be either complete or absent.\n' >&2- exit 1- fi- if (( present > 0 )); then signed=true; fi- printf 'SIGNED=%s\n' "$signed" >> "$GITHUB_ENV"-- - name: Import macOS signing certificate- if: matrix.platform == 'mac' && env.SIGNED == 'true'- uses: apple-actions/import-codesign-certs@5142e029c445c10ffc7149d172e540235a065466 # v7.0.0- with:- p12-file-base64: ${{ secrets.MACOS_CERTIFICATE_P12 }}- p12-password: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}-- - name: Configure macOS notarization- if: matrix.platform == 'mac' && env.SIGNED == 'true'- shell: bash- env:- MACOS_SIGNING_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY }}- APPSTORE_API_KEY_P8: ${{ secrets.APPSTORE_API_KEY_P8 }}- run: |- case "$MACOS_SIGNING_IDENTITY" in- "Developer ID Application:"*) ;;- *) printf 'MACOS_SIGNING_IDENTITY must name a Developer ID Application certificate.\n' >&2; exit 1 ;;- esac- printf '%s' "$APPSTORE_API_KEY_P8" > "$RUNNER_TEMP/notarytool-api-key.p8"- chmod 600 "$RUNNER_TEMP/notarytool-api-key.p8"-- - name: Build desktop artifact- shell: bash- env:- APPLE_API_KEY: ${{ runner.temp }}/notarytool-api-key.p8- APPLE_API_KEY_ID: ${{ secrets.APPSTORE_API_KEY_ID }}- APPLE_API_ISSUER: ${{ secrets.APPSTORE_ISSUER_ID }}- CSC_NAME: ${{ secrets.MACOS_SIGNING_IDENTITY }}- AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}- AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}- AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}- AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}- AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}- AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}- AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}- run: |- args=(--platform "${{ matrix.platform }}" --target "${{ matrix.target }}" --arch "${{ matrix.arch }}" --build-version "$RELEASE_VERSION" --verbose)- if test "$SIGNED" = true; then args+=(--signed); fi- vp run dist:desktop:artifact "${args[@]}"-- - name: Notarize and verify macOS DMG- if: matrix.platform == 'mac' && env.SIGNED == 'true'- shell: bash- env:- APPLE_API_KEY: ${{ runner.temp }}/notarytool-api-key.p8- APPLE_API_KEY_ID: ${{ secrets.APPSTORE_API_KEY_ID }}- APPLE_API_ISSUER: ${{ secrets.APPSTORE_ISSUER_ID }}- run: |- dmg="release/Akeru-Bot-$RELEASE_VERSION-arm64.dmg"- xcrun notarytool submit "$dmg" --key "$APPLE_API_KEY" --key-id "$APPLE_API_KEY_ID" --issuer "$APPLE_API_ISSUER" --wait- xcrun stapler staple "$dmg"- xcrun stapler validate "$dmg"- spctl --assess --type open --context context:primary-signature --verbose=2 "$dmg"- mount_point="$RUNNER_TEMP/akeru-dmg"- mkdir -p "$mount_point"- hdiutil attach "$dmg" -nobrowse -readonly -mountpoint "$mount_point"- trap 'hdiutil detach "$mount_point" >/dev/null 2>&1 || true' EXIT- apps=("$mount_point"/*.app)- test "${#apps[@]}" -eq 1- codesign --verify --deep --strict --verbose=2 "${apps[0]}"- xcrun stapler validate "${apps[0]}"- spctl --assess --type execute --verbose=2 "${apps[0]}"-- - name: Upload desktop assets- uses: actions/upload-artifact@v7- with:- name: stable-${{ matrix.platform }}-${{ matrix.arch }}- path: release/*- if-no-files-found: error- retention-days: 7-- release:- name: Publish stable release- needs: [preflight, desktop]- runs-on: ubuntu-24.04- timeout-minutes: 15- env:- GH_TOKEN: ${{ github.token }}- RELEASE_VERSION: ${{ needs.preflight.outputs.version }}- RELEASE_TAG: ${{ needs.preflight.outputs.tag }}- steps:- - uses: actions/checkout@v6- - uses: actions/download-artifact@v8- with:- pattern: stable-*- path: release- merge-multiple: true- - name: Verify names and hashes- run: node scripts/verify-release-assets.ts release "$RELEASE_VERSION"- - name: Create stable tag and GitHub Release- run: gh release create "$RELEASE_TAG" release/* --target "$GITHUB_SHA" --title "Akeru Bot $RELEASE_TAG" --generate-notesdiff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex 67db24d8f..c62ebde65 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -9,7 +9,8 @@"start": "node scripts/start-electron.mjs","typecheck": "tsgo --noEmit","test": "vp test run --passWithNoTests",- "smoke-test": "node scripts/smoke-test.mjs"+ "smoke-test": "node scripts/smoke-test.mjs",+ "smoke-test:packaged-mac": "node scripts/smoke-packaged-macos.mjs"},"dependencies": {"@effect/platform-node": "catalog:",diff --git a/apps/desktop/scripts/smoke-packaged-macos.mjs b/apps/desktop/scripts/smoke-packaged-macos.mjsnew file mode 100644index 000000000..7c437c908--- /dev/null+++ b/apps/desktop/scripts/smoke-packaged-macos.mjs@@ -0,0 +1,212 @@+import * as NodeChildProcess from "node:child_process";+import * as NodeFSP from "node:fs/promises";+import * as NodeNet from "node:net";+import * as NodeOS from "node:os";+import * as NodePath from "node:path";++import { chromium } from "playwright-core";++const STARTUP_TIMEOUT_MS = 30_000;++const delay = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));++async function reservePort() {+ const server = NodeNet.createServer();+ await new Promise((resolve, reject) => {+ server.once("error", reject);+ server.listen(0, "127.0.0.1", resolve);+ });+ const address = server.address();+ await new Promise((resolve, reject) =>+ server.close((error) => (error ? reject(error) : resolve())),+ );+ if (!address || typeof address === "string")+ throw new Error("Could not reserve a loopback port.");+ return address.port;+}++function runChecked(command, args) {+ const result = NodeChildProcess.spawnSync(command, args, { encoding: "utf8" });+ if (result.status === 0) return;+ throw new Error([result.stdout, result.stderr].filter(Boolean).join("\n").trim());+}++async function waitForRenderer(cdpPort, child) {+ const deadline = Date.now() + STARTUP_TIMEOUT_MS;+ let browser;+ let lastError;++ while (Date.now() < deadline && !browser) {+ if (child.exitCode !== null) throw new Error(`The app exited with code ${child.exitCode}.`);+ try {+ browser = await chromium.connectOverCDP(`http://127.0.0.1:${cdpPort}`);+ } catch (error) {+ lastError = error;+ await delay(100);+ }+ }+ if (!browser) throw lastError ?? new Error("The Electron debug endpoint did not start.");++ let page;+ while (Date.now() < deadline && !page) {+ page = browser+ .contexts()+ .flatMap((context) => context.pages())+ .find((candidate) => candidate.url().startsWith("akeru://app/"));+ if (!page) await delay(100);+ }+ if (!page) throw new Error("The packaged app did not create its akeru://app/ renderer.");++ const rendererErrors = [];+ page.on("console", (message) => {+ if (message.type() === "error") rendererErrors.push(`console: ${message.text()}`);+ });+ page.on("pageerror", (error) => rendererErrors.push(`page: ${error.message}`));+ page.on("requestfailed", (request) => {+ rendererErrors.push(`request: ${request.url()} ${request.failure()?.errorText ?? "failed"}`);+ });++ await page.reload({ waitUntil: "domcontentloaded" });+ try {+ await page.locator("[data-app-sidebar]").waitFor({+ state: "visible",+ timeout: Math.max(1, deadline - Date.now()),+ });+ } catch (error) {+ if (rendererErrors.length > 0) {+ throw new Error(`Renderer errors:\n${rendererErrors.join("\n")}`, { cause: error });+ }+ throw error;+ }+ if (rendererErrors.length > 0) {+ throw new Error(`Renderer errors:\n${rendererErrors.join("\n")}`);+ }+}++async function stopChild(child) {+ if (child.exitCode !== null) return;+ const descendants = listDescendantPids(child.pid);+ child.kill("SIGTERM");+ const exited = await Promise.race([+ new Promise((resolve) => child.once("exit", () => resolve(true))),+ delay(5_000).then(() => false),+ ]);+ if (!exited && child.exitCode === null) {+ child.kill("SIGKILL");+ await new Promise((resolve) => child.once("exit", resolve));+ }+ for (const pid of descendants.toReversed()) {+ try {+ process.kill(pid, "SIGTERM");+ } catch (error) {+ if (error?.code !== "ESRCH") throw error;+ }+ }+}++function listDescendantPids(rootPid) {+ const result = NodeChildProcess.spawnSync("ps", ["-axo", "pid=,ppid="], {+ encoding: "utf8",+ });+ if (result.status !== 0) throw new Error(result.stderr.trim());++ const childrenByParent = new Map();+ for (const line of result.stdout.trim().split("\n")) {+ const [pid, parentPid] = line.trim().split(/\s+/).map(Number);+ const children = childrenByParent.get(parentPid) ?? [];+ children.push(pid);+ childrenByParent.set(parentPid, children);+ }++ const descendants = [];+ const pending = [...(childrenByParent.get(rootPid) ?? [])];+ while (pending.length > 0) {+ const pid = pending.pop();+ descendants.push(pid);+ pending.push(...(childrenByParent.get(pid) ?? []));+ }+ return descendants;+}++async function readFailureLogs(stateRoot) {+ const logDir = NodePath.join(stateRoot, "userdata", "logs");+ const sections = [];+ for (const name of ["server-child.log", "desktop.trace.ndjson"]) {+ try {+ const contents = await NodeFSP.readFile(NodePath.join(logDir, name), "utf8");+ sections.push(`--- ${name} ---\n${contents.slice(-12_000)}`);+ } catch {}+ }+ return sections.join("\n");+}++async function main() {+ // oxlint-disable-next-line t3code/no-global-process-runtime -- Standalone release smoke script.+ if (process.platform !== "darwin")+ throw new Error("The packaged macOS smoke test requires macOS.");+ const dmgArgument = process.argv.slice(2).find((argument) => argument !== "--");+ const repositoryRoot = NodePath.resolve(import.meta.dirname, "../../..");+ const dmgPath = dmgArgument ? NodePath.resolve(repositoryRoot, dmgArgument) : undefined;+ if (!dmgPath) throw new Error("Usage: node smoke-packaged-macos.mjs <path-to-dmg>");++ const tempDir = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "akeru-packaged-smoke-"));+ const mountPoint = NodePath.join(tempDir, "mount");+ const stateRoot = NodePath.join(tempDir, "state");+ const chromiumDir = NodePath.join(tempDir, "chromium");+ await Promise.all([+ NodeFSP.mkdir(mountPoint),+ NodeFSP.mkdir(stateRoot),+ NodeFSP.mkdir(chromiumDir),+ ]);++ let mounted = false;+ let child;+ try {+ runChecked("hdiutil", ["attach", dmgPath, "-nobrowse", "-readonly", "-mountpoint", mountPoint]);+ mounted = true;+ const apps = (await NodeFSP.readdir(mountPoint)).filter((name) => name.endsWith(".app"));+ if (apps.length !== 1) throw new Error(`Expected one app in the DMG, found ${apps.length}.`);++ const appName = NodePath.basename(apps[0], ".app");+ const executable = NodePath.join(mountPoint, apps[0], "Contents", "MacOS", appName);+ const [backendPort, cdpPort] = await Promise.all([reservePort(), reservePort()]);+ const env = {+ ...process.env,+ T3CODE_HOME: stateRoot,+ T3CODE_PORT: String(backendPort),+ ELECTRON_ENABLE_LOGGING: "1",+ };+ delete env.ELECTRON_RUN_AS_NODE;++ child = NodeChildProcess.spawn(+ executable,+ [+ `--remote-debugging-port=${cdpPort}`,+ "--remote-debugging-address=127.0.0.1",+ "--headless=new",+ `--user-data-dir=${chromiumDir}`,+ ],+ { env, stdio: ["ignore", "pipe", "pipe"] },+ );++ let output = "";+ child.stdout.on("data", (chunk) => (output += chunk.toString()));+ child.stderr.on("data", (chunk) => (output += chunk.toString()));++ try {+ await waitForRenderer(cdpPort, child);+ } catch (error) {+ const logs = await readFailureLogs(stateRoot);+ throw new Error([String(error), output.slice(-12_000), logs].filter(Boolean).join("\n"), {+ cause: error,+ });+ }+ console.log("Packaged macOS smoke test passed.");+ } finally {+ if (child) await stopChild(child);+ if (mounted) runChecked("hdiutil", ["detach", mountPoint, "-force"]);+ await NodeFSP.rm(tempDir, { recursive: true, force: true });+ }+}++await main();diff --git a/apps/marketing/src/lib/macInstallPrompt.test.ts b/apps/marketing/src/lib/macInstallPrompt.test.tsindex 5ac8d37d2..676d9010d 100644--- a/apps/marketing/src/lib/macInstallPrompt.test.ts+++ b/apps/marketing/src/lib/macInstallPrompt.test.ts@@ -1,6 +1,7 @@import { describe, expect, it } from "vite-plus/test";import {+ MAC_INSTALL_PROMPT,MAC_INSTALL_SUCCESS,checksumForAsset,macInstallSuccess,@@ -12,6 +13,11 @@ const assets = [];describe("macOS install prompt", () => {+ it("uses the exact app name shipped in the DMG", () => {+ expect(MAC_INSTALL_PROMPT).toContain("/Applications/Akeru Bot (Alpha).app");+ expect(MAC_INSTALL_PROMPT).not.toContain("/Applications/Akeru Bot.app");+ });+it("selects the matching release asset and refuses unavailable architectures", () => {expect(selectMacInstallAsset("arm64", assets)).toBe(assets[0]);expect(selectMacInstallAsset("x86_64", assets)).toBeNull();diff --git a/apps/marketing/src/lib/macInstallPrompt.ts b/apps/marketing/src/lib/macInstallPrompt.tsindex d7d23a268..3bf429245 100644--- a/apps/marketing/src/lib/macInstallPrompt.ts+++ b/apps/marketing/src/lib/macInstallPrompt.ts@@ -2,7 +2,7 @@ import type { ReleaseAsset } from "./releases";export const MAC_INSTALL_SUCCESS = "You can open the app now with no issues.";-export const MAC_INSTALL_PROMPT = `Install the latest unsigned macOS release of Akeru Bot from opencoredev/akeru-bot. Use no other repository or download source. Detect the Mac architecture with uname -m before downloading. Continue only for arm64 and stop for x86_64 or every other architecture because the official release supports Apple silicon only. Download the exact Akeru-Bot-<version>-arm64.dmg asset and SHA256SUMS from the same latest stable vX.Y.Z GitHub release. Require an exact checksum entry for the DMG, verify it with shasum -a 256, and stop on a missing or mismatched checksum. Mount the verified DMG and install Akeru Bot.app in /Applications. Ask only for the native macOS administrator confirmation if /Applications requires it. Remove com.apple.quarantine only from the installed /Applications/Akeru Bot.app. Never disable Gatekeeper or change any system-wide security setting. Launch /Applications/Akeru Bot.app and verify that its process or window exists. Say exactly "${MAC_INSTALL_SUCCESS}" only after the checksum, install, launch, and process or window checks all succeed.`;+export const MAC_INSTALL_PROMPT = `Install the latest unsigned macOS release of Akeru Bot from opencoredev/akeru-bot. Use no other repository or download source. Detect the Mac architecture with uname -m before downloading. Continue only for arm64 and stop for x86_64 or every other architecture because the official release supports Apple silicon only. Download the exact Akeru-Bot-<version>-arm64.dmg asset and SHA256SUMS from the same latest stable vX.Y.Z GitHub release. Require an exact checksum entry for the DMG, verify it with shasum -a 256, and stop on a missing or mismatched checksum. Mount the verified DMG and install Akeru Bot (Alpha).app in /Applications. Ask only for the native macOS administrator confirmation if /Applications requires it. Remove com.apple.quarantine only from the installed /Applications/Akeru Bot (Alpha).app. Never disable Gatekeeper or change any system-wide security setting. Launch /Applications/Akeru Bot (Alpha).app and verify that its process or window exists. Say exactly "${MAC_INSTALL_SUCCESS}" only after the checksum, install, launch, and process or window checks all succeed.`;export function selectMacInstallAsset(architecture: string,diff --git a/apps/marketing/src/lib/releases.test.ts b/apps/marketing/src/lib/releases.test.tsindex 2f0c88c43..bbd97d0a6 100644--- a/apps/marketing/src/lib/releases.test.ts+++ b/apps/marketing/src/lib/releases.test.ts@@ -133,8 +133,8 @@ describe("release downloads", () => {NodeAssert.equal(selectReleaseAsset({ ...release, tag_name: "preview" }, "arm64.dmg"), null);});- it("prompts only for unsigned Windows and Linux artifacts", () => {- NodeAssert.equal(requiresUnsignedInstall("arm64.dmg"), false);+ it("prompts for every unsigned desktop artifact", () => {+ NodeAssert.equal(requiresUnsignedInstall("arm64.dmg"), true);NodeAssert.equal(requiresUnsignedInstall("x64.exe"), true);NodeAssert.equal(requiresUnsignedInstall("x64.AppImage"), true);});diff --git a/apps/marketing/src/lib/releases.ts b/apps/marketing/src/lib/releases.tsindex 611abe426..d6a83a792 100644--- a/apps/marketing/src/lib/releases.ts+++ b/apps/marketing/src/lib/releases.ts@@ -28,7 +28,7 @@ const TARGETS = {os: "mac",label: "Download for macOS",assetSuffix: "arm64.dmg",- unsigned: false,+ unsigned: true,},win: {os: "win",@@ -60,7 +60,9 @@ export function selectReleaseAsset(release: Release, assetSuffix: string): Relea}export function requiresUnsignedInstall(assetSuffix: string): boolean {- return assetSuffix === TARGETS.win.assetSuffix || assetSuffix === TARGETS.linux.assetSuffix;+ return Object.values(TARGETS).some(+ (target) => target.assetSuffix === assetSuffix && target.unsigned,+ );}type DownloadLink = EventTarget & {diff --git a/apps/server/package.json b/apps/server/package.jsonindex 13d7745c6..ad20ea1e3 100644--- a/apps/server/package.json+++ b/apps/server/package.json@@ -45,6 +45,7 @@"chat": "4.39.0","e2b": "^2.32.0","effect": "catalog:",+ "libsql": "0.5.29","msgpackr-extract": "3.0.4","node-pty": "^1.1.0","playwright-core": "1.60.0",diff --git a/apps/server/src/orchestration/Layers/BotPersistence.test.ts b/apps/server/src/orchestration/Layers/BotPersistence.test.tsindex 64fdc3ed1..eac52188c 100644--- a/apps/server/src/orchestration/Layers/BotPersistence.test.ts+++ b/apps/server/src/orchestration/Layers/BotPersistence.test.ts@@ -55,6 +55,7 @@ it.layer(TestLayer)("bot persistence", (it) => {const snapshots = yield* ProjectionSnapshotQuery;const sql = yield* SqlClient.SqlClient;const botId = BotId.make("bot-1");+ const specialistBotId = BotId.make("bot-2");const groupId = GroupId.make("group-1");const routineId = RoutineId.make("routine-1");const createdAt = "2026-01-01T00:00:00.000Z";@@ -139,12 +140,27 @@ it.layer(TestLayer)("bot persistence", (it) => {commandId: CommandId.make("cmd-bot-restore"),botId,});+ yield* engine.dispatch({+ type: "bot.create",+ commandId: CommandId.make("cmd-specialist-create"),+ botId: specialistBotId,+ name: "Verifier",+ title: "QA engineer",+ avatar: { kind: "dither", seed: "verifier" },+ engine: null,+ sandbox: "local",+ runtimeMode: "full-access",+ usageCap: null,+ groupId: null,+ createdAt,+ });yield* engine.dispatch({type: "group.create",commandId: CommandId.make("cmd-group-create"),groupId,name: "Product",bossBotId: botId,+ specialistBotIds: [specialistBotId],createdAt,});yield* engine.dispatch({@@ -157,33 +173,36 @@ it.layer(TestLayer)("bot persistence", (it) => {const restored = yield* snapshots.getShellSnapshot();assert.equal(restored.routines?.[0]?.lifecycle, "paused");assert.equal(restored.routines?.[0]?.enabled, false);- assert.deepEqual(restored.bots, [- {- id: botId,- name: "Pathfinder",- title: "Staff researcher",- label: "Discovery",- description: "Investigates the highest-risk assumptions.",- disabledMcpServerIds: [McpServerId.make("mcp-github")],- avatar: { kind: "dither", seed: "pathfinder" },- engine: null,- sandbox: null,- runtimeMode: "approval-required",- usageCap: { unit: "tokens", limit: 50_000 },- voiceEnabled: true,- channelBindings: [],- groupId: null,- archivedAt: null,- createdAt,- updatedAt: restored.bots[0]!.updatedAt,- },- ]);+ assert.equal(restored.bots.length, 2);+ const restoredBot = restored.bots.find((bot) => bot.id === botId);+ assert.deepEqual(restoredBot, {+ id: botId,+ name: "Pathfinder",+ title: "Staff researcher",+ label: "Discovery",+ description: "Investigates the highest-risk assumptions.",+ disabledMcpServerIds: [McpServerId.make("mcp-github")],+ avatar: { kind: "dither", seed: "pathfinder" },+ engine: null,+ sandbox: null,+ runtimeMode: "approval-required",+ usageCap: { unit: "tokens", limit: 50_000 },+ voiceEnabled: true,+ channelBindings: [],+ groupId: null,+ archivedAt: null,+ createdAt,+ updatedAt: restoredBot!.updatedAt,+ });assert.deepEqual(restored.groups, [{id: groupId,name: "Discovery",bossBotId: botId,- members: [{ kind: "bot", botId, role: "boss" }],+ members: [+ { kind: "bot", botId, role: "boss" },+ { kind: "bot", botId: specialistBotId, role: "specialist" },+ ],createdAt,updatedAt: restored.groups[0]!.updatedAt,},@@ -205,12 +224,12 @@ it.layer(TestLayer)("bot persistence", (it) => {yield* projectionPipeline.bootstrap;const rebuilt = yield* snapshots.getSnapshot();- assert.equal(rebuilt.bots.length, 1);- assert.equal(rebuilt.bots[0]?.id, botId);- assert.equal(rebuilt.bots[0]?.name, "Pathfinder");- assert.equal(rebuilt.bots[0]?.voiceEnabled, true);- assert.equal(rebuilt.bots[0]?.groupId, null);- assert.equal(rebuilt.bots[0]?.archivedAt, null);+ assert.equal(rebuilt.bots.length, 2);+ const rebuiltBot = rebuilt.bots.find((bot) => bot.id === botId);+ assert.equal(rebuiltBot?.name, "Pathfinder");+ assert.equal(rebuiltBot?.voiceEnabled, true);+ assert.equal(rebuiltBot?.groupId, null);+ assert.equal(rebuiltBot?.archivedAt, null);assert.deepEqual(rebuilt.groups, []);}),);@@ -436,6 +455,7 @@ it.layer(TestLayer)("bot persistence", (it) => {const sql = yield* SqlClient.SqlClient;const projectId = ProjectId.make("project-ownership");const botId = BotId.make("bot-owner");+ const specialistBotId = BotId.make("bot-owner-specialist");const groupId = GroupId.make("group-owner");const createdAt = "2026-01-02T00:00:00.000Z";const modelSelection = {@@ -466,12 +486,27 @@ it.layer(TestLayer)("bot persistence", (it) => {groupId: null,createdAt,});+ yield* engine.dispatch({+ type: "bot.create",+ commandId: CommandId.make("cmd-owner-specialist"),+ botId: specialistBotId,+ name: "Verifier",+ title: "QA engineer",+ avatar: { kind: "dither", seed: "owner-verifier" },+ engine: null,+ sandbox: "local",+ runtimeMode: "full-access",+ usageCap: null,+ groupId: null,+ createdAt,+ });yield* engine.dispatch({type: "group.create",commandId: CommandId.make("cmd-owner-group"),groupId,name: "Owners",bossBotId: botId,+ specialistBotIds: [specialistBotId],createdAt,});diff --git a/apps/server/src/orchestration/Layers/ProviderCommandReactor.ts b/apps/server/src/orchestration/Layers/ProviderCommandReactor.tsindex d75a42651..27204b421 100644--- a/apps/server/src/orchestration/Layers/ProviderCommandReactor.ts+++ b/apps/server/src/orchestration/Layers/ProviderCommandReactor.ts@@ -9,6 +9,7 @@ import {type ModelSelection,type McpServer,type OrchestrationEvent,+ isGroupBotMember,ProviderDriverKind,type ProjectId,type OrchestrationSession,@@ -874,7 +875,9 @@ const make = Effect.gen(function* () {botId: thread.groupId == null ? respondingBotId : null,groupId: thread.groupId ?? null,respondingBotId,- groupMemberBotIds: respondingGroup?.members.map((member) => member.botId) ?? [],+ groupMemberBotIds:+ respondingGroup?.members.filter(isGroupBotMember).map((member) => member.botId) ??+ [],},}: {}),diff --git a/apps/server/src/orchestration/decider.delegation.test.ts b/apps/server/src/orchestration/decider.delegation.test.tsindex c65420b04..68095da4c 100644--- a/apps/server/src/orchestration/decider.delegation.test.ts+++ b/apps/server/src/orchestration/decider.delegation.test.ts@@ -46,6 +46,7 @@ function makeBot(id: BotId): OrchestrationBot {runtimeMode: "approval-required",usageCap: null,voiceEnabled: false,+ channelBindings: [],groupId: null,archivedAt: null,createdAt: NOW,diff --git a/apps/server/src/orchestration/projector.ts b/apps/server/src/orchestration/projector.tsindex 098315506..9d3a25e49 100644--- a/apps/server/src/orchestration/projector.ts+++ b/apps/server/src/orchestration/projector.ts@@ -9,6 +9,7 @@ import type {import {DelegationCreatedPayload,DelegationUpdatedPayload,+ isGroupBotMember,OrchestrationCheckpointSummary,OrchestrationMessage,OrchestrationSession,diff --git a/apps/server/src/persistence/Layers/ProjectionThreadMessages.ts b/apps/server/src/persistence/Layers/ProjectionThreadMessages.tsindex e77374c34..c50bca708 100644--- a/apps/server/src/persistence/Layers/ProjectionThreadMessages.ts+++ b/apps/server/src/persistence/Layers/ProjectionThreadMessages.ts@@ -5,7 +5,11 @@ import * as Layer from "effect/Layer";import * as Option from "effect/Option";import * as Schema from "effect/Schema";import * as Struct from "effect/Struct";-import { ChatAttachment, OrchestrationMessageReaction } from "@t3tools/contracts";+import {+ ChannelMessageOrigin,+ ChatAttachment,+ OrchestrationMessageReaction,+} from "@t3tools/contracts";import { toPersistenceSqlError } from "../Errors.ts";import {@@ -21,6 +25,7 @@ const ProjectionThreadMessageDbRowSchema = ProjectionThreadMessage.mapFields(Struct.assign({isStreaming: Schema.Number,attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),+ channelOrigin: Schema.NullOr(Schema.fromJsonString(ChannelMessageOrigin)),reactions: Schema.fromJsonString(Schema.Array(OrchestrationMessageReaction)),}),);diff --git a/apps/server/src/portability.test.ts b/apps/server/src/portability.test.tsindex 62dbff470..09f7f31bd 100644--- a/apps/server/src/portability.test.ts+++ b/apps/server/src/portability.test.ts@@ -40,6 +40,7 @@ const LATER = "2026-08-30T13:00:00.000Z";const PROJECT_ID = ProjectId.make("project-portable");const THREAD_ID = ThreadId.make("thread-portable");const BOT_ID = BotId.make("bot-portable");+const SPECIALIST_BOT_ID = BotId.make("bot-portable-specialist");const GROUP_ID = GroupId.make("group-portable");const URL_MCP_ID = McpServerId.make("builtin-search");const STDIO_MCP_ID = McpServerId.make("local-tool");@@ -246,6 +247,34 @@ function makeSnapshot(overrides: Partial<OrchestrationReadModel> = {}): Orchestr};}+function makePreflightSnapshot(): OrchestrationReadModel {+ const snapshot = makeSnapshot();+ const boss = snapshot.bots[0]!;++ return {+ ...snapshot,+ bots: [+ boss,+ {+ ...boss,+ id: SPECIALIST_BOT_ID,+ name: "Verifier",+ title: "QA engineer",+ avatar: { kind: "dither", seed: SPECIALIST_BOT_ID },+ },+ ],+ groups: [+ {+ ...snapshot.groups[0]!,+ members: [+ { kind: "bot", botId: BOT_ID, role: "boss" },+ { kind: "bot", botId: SPECIALIST_BOT_ID, role: "specialist" },+ ],+ },+ ],+ };+}+function makeSettings(): ServerSettings {return {...DEFAULT_SERVER_SETTINGS,@@ -1172,7 +1201,7 @@ describe("portability import", () => {});effectIt.effect("preflights new project restores through the decider", () => {- const source = makeSnapshot();+ const source = makePreflightSnapshot();const target = makeSnapshot({projects: [],bots: [],@@ -1348,7 +1377,7 @@ describe("portability import", () => {});effectIt.effect("preflights the complete restore plan through the decider", () => {- const source = makeSnapshot();+ const source = makePreflightSnapshot();const target = makeSnapshot({ bots: [], groups: [], mcpServers: [], threads: [] });const commands = commandsForPortabilityImport(createPortabilityArchive(source, makeSettings(), NOW),diff --git a/apps/server/src/provider/AkeruBotStateRuntime.test.ts b/apps/server/src/provider/AkeruBotStateRuntime.test.tsindex ca8f97e64..f044111ef 100644--- a/apps/server/src/provider/AkeruBotStateRuntime.test.ts+++ b/apps/server/src/provider/AkeruBotStateRuntime.test.ts@@ -25,6 +25,7 @@ function snapshot(archivedAt: string | null = null) {runtimeMode: "approval-required" as const,usageCap: null,voiceEnabled: false,+ channelBindings: [],groupId: null,archivedAt,createdAt: now,@@ -43,6 +44,7 @@ function snapshot(archivedAt: string | null = null) {runtimeMode: "approval-required" as const,usageCap: null,voiceEnabled: false,+ channelBindings: [],groupId: null,archivedAt: null,createdAt: now,diff --git a/apps/server/src/provider/AkeruChannelRuntime.test.ts b/apps/server/src/provider/AkeruChannelRuntime.test.tsindex a539849b7..17036daa4 100644--- a/apps/server/src/provider/AkeruChannelRuntime.test.ts+++ b/apps/server/src/provider/AkeruChannelRuntime.test.ts@@ -31,6 +31,7 @@ const bot = (id: BotId, groupId: GroupId | null) => ({runtimeMode: "approval-required" as const,usageCap: null,voiceEnabled: false,+ channelBindings: [],groupId,archivedAt: null,createdAt: now,@@ -47,8 +48,8 @@ const snapshot: OrchestrationReadModel = {name: "Launch",bossBotId,members: [- { botId: bossBotId, role: "boss" },- { botId: specialistBotId, role: "specialist" },+ { kind: "bot", botId: bossBotId, role: "boss" },+ { kind: "bot", botId: specialistBotId, role: "specialist" },],createdAt: now,updatedAt: now,diff --git a/apps/server/src/provider/AkeruChannelRuntime.ts b/apps/server/src/provider/AkeruChannelRuntime.tsindex 49b19bfd0..1ea96065e 100644--- a/apps/server/src/provider/AkeruChannelRuntime.ts+++ b/apps/server/src/provider/AkeruChannelRuntime.ts@@ -11,6 +11,7 @@ import {type OrchestrationCommand,type OrchestrationReadModel,type OrchestrationThread,+ isGroupBotMember,} from "@t3tools/contracts";import * as DateTime from "effect/DateTime";@@ -83,7 +84,7 @@ export function createAkeruChannelRuntime(options: AkeruChannelRuntimeOptions) {(thread.groupId != null &&snapshot.groups.find((group) => group.id === thread.groupId)- ?.members.some((member) => member.botId === botId));+ ?.members.some((member) => isGroupBotMember(member) && member.botId === botId));if (!isVisible) throw new Error("The target message is not visible to this bot.");if (options.supportsReactions?.(thread) === false) {return {diff --git a/apps/server/src/provider/AkeruDelegationRuntime.test.ts b/apps/server/src/provider/AkeruDelegationRuntime.test.tsindex b0a7edb99..c620fa442 100644--- a/apps/server/src/provider/AkeruDelegationRuntime.test.ts+++ b/apps/server/src/provider/AkeruDelegationRuntime.test.ts@@ -58,6 +58,7 @@ function bot(id: BotId, overrides: Partial<OrchestrationBot> = {}): OrchestratioruntimeMode: "approval-required",usageCap: null,voiceEnabled: false,+ channelBindings: [],groupId: null,archivedAt: null,createdAt: NOW,@@ -576,8 +577,8 @@ describe("AkeruDelegationRuntime", () => {name: "Research",bossBotId: PARENT_BOT_ID,members: [- { botId: PARENT_BOT_ID, role: "boss" as const },- { botId: CHILD_BOT_ID, role: "specialist" as const },+ { kind: "bot" as const, botId: PARENT_BOT_ID, role: "boss" as const },+ { kind: "bot" as const, botId: CHILD_BOT_ID, role: "specialist" as const },],createdAt: NOW,updatedAt: NOW,@@ -614,7 +615,7 @@ describe("AkeruDelegationRuntime", () => {id: groupId,name: "Research",bossBotId: PARENT_BOT_ID,- members: [{ botId: PARENT_BOT_ID, role: "boss" as const }],+ members: [{ kind: "bot" as const, botId: PARENT_BOT_ID, role: "boss" as const }],createdAt: NOW,updatedAt: NOW,};diff --git a/apps/server/src/provider/AkeruDelegationRuntime.ts b/apps/server/src/provider/AkeruDelegationRuntime.tsindex 1adf51024..160a3bfd1 100644--- a/apps/server/src/provider/AkeruDelegationRuntime.ts+++ b/apps/server/src/provider/AkeruDelegationRuntime.ts@@ -21,6 +21,7 @@ import {type OrchestrationCommand,type OrchestrationReadModel,type TurnId,+ isGroupBotMember,} from "@t3tools/contracts";import { intersectDelegationAccess } from "./AkeruToolRuntime.ts";@@ -367,7 +368,7 @@ export function createAkeruDelegationRuntime(options: AkeruDelegationRuntimeOptibot.groupId !== null &&(!group ||parentThread.groupId !== group.id ||- !group.members.some((member) => member.botId === bot.id))+ !group.members.some((member) => isGroupBotMember(member) && member.botId === bot.id))) {throw new Error("The target bot is not available in the current group.");}diff --git a/apps/server/src/routines/RoutineDraftDispatcher.test.ts b/apps/server/src/routines/RoutineDraftDispatcher.test.tsindex 03d3bd366..a5dab621b 100644--- a/apps/server/src/routines/RoutineDraftDispatcher.test.ts+++ b/apps/server/src/routines/RoutineDraftDispatcher.test.ts@@ -50,6 +50,7 @@ function bot(id: BotId): OrchestrationBot {runtimeMode: "full-access",usageCap: null,voiceEnabled: false,+ channelBindings: [],groupId: null,archivedAt: null,createdAt: now,diff --git a/apps/server/src/server.test.ts b/apps/server/src/server.test.tsindex 9d2238798..c20f031a3 100644--- a/apps/server/src/server.test.ts+++ b/apps/server/src/server.test.ts@@ -437,12 +437,6 @@ const buildAppUnderTest = (options?: {orchestrationEngine?: Partial<OrchestrationEngine.OrchestrationEngineService["Service"]>;routineRepository?: Partial<RoutineRepositoryShape>;routineRuntime?: Partial<RoutineRuntimeShape>;- analyticsService?: Partial<AnalyticsService.AnalyticsService["Service"]> & {- readonly record?: (- event: string,- properties?: Readonly<Record<string, unknown>>,- ) => Effect.Effect<void>;- };projectionSnapshotQuery?: Partial<ProjectionSnapshotQuery.ProjectionSnapshotQuery["Service"]>;projectionBots?: Partial<ProjectionBots.ProjectionBotRepositoryShape>;botUsageLedger?: Partial<BotUsageLedgerShape>;@@ -949,7 +943,6 @@ const buildAppUnderTest = (options?: {Layer.provide(Layer.mock(AnalyticsService.AnalyticsService)({flush: Effect.void,- ...options?.layers?.analyticsService,}),),Layer.provide(@@ -3734,101 +3727,6 @@ it.layer(NodeServices.layer)("server router seam", (it) => {}).pipe(Effect.provide(NodeHttpServer.layerTest)),);- it.effect("records thread analytics only after a client command succeeds", () =>- Effect.gen(function* () {- const effects: string[] = [];- const analyticsProperties: Array<Readonly<Record<string, unknown>> | undefined> = [];- const failedCommandId = CommandId.make("cmd-thread-create-failed");-- yield* buildAppUnderTest({- layers: {- analyticsService: {- record: (event, properties) =>- Effect.sync(() => {- effects.push(`analytics:${event}`);- analyticsProperties.push(properties);- }),- },- orchestrationEngine: {- dispatch: (command) =>- Effect.sync(() => effects.push(`dispatch:${command.commandId}`)).pipe(- Effect.flatMap(() =>- command.commandId === failedCommandId- ? Effect.fail(- new OrchestrationListenerCallbackError({- listener: "domain-event",- detail: "thread creation failed",- }),- )- : Effect.succeed({ sequence: 1 }),- ),- ),- },- },- });-- const createThreadCommand = (commandId: CommandId, threadId: ThreadId) =>- ({- type: "thread.create",- commandId,- threadId,- projectId: defaultProjectId,- title: "Analytics test",- modelSelection: defaultModelSelection,- runtimeMode: "full-access",- interactionMode: "default",- branch: null,- worktreePath: null,- createdAt: "2026-01-01T00:00:00.000Z",- }) as const;-- const wsUrl = yield* getWsServerUrl(- "/ws?clientSurface=mobile&clientAppVersion=1.2.3&clientOs=iOS&clientOsMajorVersion=18&clientDeviceModel=iPhone+15+Pro",- );- yield* Effect.scoped(- withWsRpcClient(wsUrl, (client) =>- Effect.gen(function* () {- const failed = yield* client[ORCHESTRATION_WS_METHODS.dispatchCommand](- createThreadCommand(failedCommandId, ThreadId.make("thread-create-failed")),- ).pipe(Effect.result);-- assert.equal(failed._tag, "Failure");- assert.deepEqual(effects, [- "analytics:client.connected",- "dispatch:cmd-thread-create-failed",- ]);-- const succeeded = yield* client[ORCHESTRATION_WS_METHODS.dispatchCommand](- createThreadCommand(- CommandId.make("cmd-thread-create-succeeded"),- ThreadId.make("thread-create-succeeded"),- ),- );-- assert.equal(succeeded.sequence, 1);- }),- ),- );-- assert.deepEqual(effects, [- "analytics:client.connected",- "dispatch:cmd-thread-create-failed",- "dispatch:cmd-thread-create-succeeded",- "analytics:client.thread.started",- ]);- assert.deepEqual(analyticsProperties, [- {- surface: "mobile",- appVersion: "1.2.3",- os: "iOS",- osMajorVersion: 18,- deviceModel: "iPhone 15 Pro",- },- { surface: "mobile", appVersion: "1.2.3" },- ]);- }).pipe(Effect.provide(NodeHttpServer.layerTest)),- );-it.effect("reports a manual routine run that does not start", () =>Effect.gen(function* () {let dispatchCount = 0;diff --git a/apps/server/src/ws.ts b/apps/server/src/ws.tsindex add0522c5..d6497bac4 100644--- a/apps/server/src/ws.ts+++ b/apps/server/src/ws.ts@@ -39,6 +39,7 @@ import {type OrchestrationShellStreamEvent,type OrchestrationShellStreamItem,type OrchestrationThreadStreamItem,+ isGroupBotMember,OrchestrationGetFullThreadDiffError,OrchestrationGetSnapshotError,OrchestrationSearchThreadsError,@@ -651,7 +652,9 @@ const makeWsRpcLayer = (memoryOperationError(operation, "The thread group does not exist."),),onSome: (group) =>- Effect.succeed(group.members.map((member) => member.botId)),+ Effect.succeed(+ group.members.filter(isGroupBotMember).map((member) => member.botId),+ ),}),),Effect.mapError((cause) => memoryOperationError(operation, cause)),diff --git a/apps/web/src/components/roster/BotDetailsPanel.test.tsx b/apps/web/src/components/roster/BotDetailsPanel.test.tsxindex 4130c3deb..5818c322c 100644--- a/apps/web/src/components/roster/BotDetailsPanel.test.tsx+++ b/apps/web/src/components/roster/BotDetailsPanel.test.tsx@@ -36,7 +36,7 @@ describe("BotDetailsPanel", () => {it("shows the per-bot profile editor with simple panel chrome", () => {const markup = renderToStaticMarkup(<BotDetailsPanel bot={bot} />);expect(markup).toContain("Akeru's browser");- expect(markup).toContain("Open the desktop app to view the browser.");+ expect(markup).toContain('data-testid="bot-browser-preview"');expect(markup).toContain(">Settings</h2>");expect(markup).toContain('aria-label="Change bot avatar"');expect(markup).toContain('aria-label="Bot name"');diff --git a/apps/web/src/components/roster/BotDetailsPanel.tsx b/apps/web/src/components/roster/BotDetailsPanel.tsxindex 14f021747..50fa462c1 100644--- a/apps/web/src/components/roster/BotDetailsPanel.tsx+++ b/apps/web/src/components/roster/BotDetailsPanel.tsx@@ -146,6 +146,7 @@ function BotProfileEditor({const [usageCap, setUsageCap] = useState(() => bot.usageCap?.limit.toString() ?? "");const [toolsOpen, setToolsOpen] = useState(false);const [memoryOpen, setMemoryOpen] = useState(false);+ const [channelsOpen, setChannelsOpen] = useState(false);const [sandbox, setSandbox] = useState<BotSandboxChoice>(() => botSandboxChoice(bot.sandbox));const [voiceEnabled, setVoiceEnabled] = useState(bot.voiceEnabled);const [disabledMcpServerIds, setDisabledMcpServerIds] = useState<readonly McpServerId[]>(@@ -457,6 +458,7 @@ function BotProfileEditor({}}/><BotMemorySheet open={memoryOpen} onOpenChange={setMemoryOpen} threadRef={threadRef} />+ <BotChannelsSheet bot={bot} open={channelsOpen} onOpenChange={setChannelsOpen} /></div>);}diff --git a/apps/web/src/components/roster/BotRosterSidebar.tsx b/apps/web/src/components/roster/BotRosterSidebar.tsxindex 6049f778c..19b7cbb9a 100644--- a/apps/web/src/components/roster/BotRosterSidebar.tsx+++ b/apps/web/src/components/roster/BotRosterSidebar.tsx@@ -217,7 +217,6 @@ const BotRosterRow = memo(function BotRosterRow({const timestampFormat = useClientSettings((s) => s.timestampFormat);const presence = useBotPresence(bot.id);const latestMessage = useLatestBotMessage(bot.id, lastMessage);- const { listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: bot.id });return (<DraggabledraggableId={rosterBotDragId(bot.id)}@@ -545,11 +544,9 @@ export default function BotRosterSidebar() {() => filterRosterBots(bots, query).filter((bot) => bot.archivedAt === null),[bots, query],);- const pinnedBots = visibleBots.filter((bot) => bot.pinned);- const unpinnedBots = visibleBots.filter((bot) => !bot.pinned);- const groupSections = useMemo(- () => buildGroupedRosterSections(dragLayout ?? bots, groups, query),- [bots, dragLayout, groups, query],+ const visibleGroups = useMemo(+ () => filterRosterGroups(groups, bots, query),+ [bots, groups, query],);const groupRouteActive = pathname.startsWith("/groups/");const pinnedBotIds = useMemo(diff --git a/apps/web/src/components/roster/BotThreadLanding.tsx b/apps/web/src/components/roster/BotThreadLanding.tsxindex 3480d26ee..76c242cad 100644--- a/apps/web/src/components/roster/BotThreadLanding.tsx+++ b/apps/web/src/components/roster/BotThreadLanding.tsx@@ -1,5 +1,12 @@import { useAtomValue } from "@effect/atom-react";-import { BotId, type BotEngine, type EnvironmentId } from "@t3tools/contracts";+import {+ BotId,+ type BotEngine,+ type ChannelMessageOrigin,+ type EnvironmentId,+ type MessageId,+ type ThreadId,+} from "@t3tools/contracts";import { useNavigate } from "@tanstack/react-router";import { useEffect, useMemo, useState } from "react";@@ -35,7 +42,12 @@ import { BotInboxAlertStack } from "./BotInboxAlertStack";import { BotAvatarView } from "./BotAvatarView";import { BotConversationScrollArea } from "./BotConversationScrollArea";import { DelegationCard } from "./DelegationCard";-import { isBotConversationWorking, visibleBotChatMessages } from "./botConversationPresentation";+import {+ channelOriginForAssistantMessage,+ channelProviderLabel,+ isBotConversationWorking,+ visibleBotChatMessages,+} from "./botConversationPresentation";import { resolveStickyBotEngine } from "./botEngineSelection";import { BotPromptComposer } from "./BotPromptComposer";import { BotMessageAttachments } from "./BotMessageAttachments";@@ -105,6 +117,7 @@ export function BotThreadLanding({ botId }: { readonly botId: string }) {const navigate = useNavigate();const environmentId = usePrimaryEnvironmentId();const channelSession = useEnvironmentSessionState(environmentId ?? ("" as EnvironmentId));+ const canManageChannelBindings = canManageChannels(channelSession.data);const settings = usePrimarySettings();const providers = useAtomValue(primaryServerProvidersAtom);const updateBot = useAtomCommand(botEnvironment.update, { reportFailure: false });diff --git a/apps/web/src/components/roster/GroupThreadLanding.tsx b/apps/web/src/components/roster/GroupThreadLanding.tsxindex 7767d1aaa..0e3262eba 100644--- a/apps/web/src/components/roster/GroupThreadLanding.tsx+++ b/apps/web/src/components/roster/GroupThreadLanding.tsx@@ -201,7 +201,9 @@ export function GroupThreadLanding({ groupId }: { readonly groupId: string }) {}/>))}- {working ? <BotActivityStatus avatar={activeBot.avatar} name={activeBot.name} /> : null}+ {working && activeBot ? (+ <BotActivityStatus avatar={activeBot.avatar} name={activeBot.name} />+ ) : null}</BotConversationScrollArea><BotInboxAlertStackitems={inboxItems}diff --git a/apps/web/src/components/roster/ThreadLanding.delegations.test.tsx b/apps/web/src/components/roster/ThreadLanding.delegations.test.tsxindex d679f7754..615ae297b 100644--- a/apps/web/src/components/roster/ThreadLanding.delegations.test.tsx+++ b/apps/web/src/components/roster/ThreadLanding.delegations.test.tsx@@ -1,6 +1,7 @@import type { ReactElement } from "react";import {AkeruDelegationRecord,+ BotId,EnvironmentId,ThreadId,type OrchestrationShellSnapshot,@@ -15,6 +16,7 @@ import type { Bot, Group } from "./types";const mocks = vi.hoisted(() => ({providersAtom: Symbol("providers"),snapshotAtom: Symbol("snapshot"),+ peopleAtom: Symbol("people"),snapshot: null as OrchestrationShellSnapshot | null,bots: [] as Bot[],groups: [] as Group[],@@ -37,7 +39,12 @@ vi.mock("react/compiler-runtime", async () => {return { c: reactHookHarness.useMemoCache };});vi.mock("@effect/atom-react", () => ({- useAtomValue: (atom: unknown) => (atom === mocks.snapshotAtom ? mocks.snapshot : []),+ useAtomValue: (atom: unknown) =>+ atom === mocks.snapshotAtom+ ? mocks.snapshot+ : atom === mocks.peopleAtom+ ? { current: null, host: null }+ : [],}));vi.mock("@tanstack/react-router", () => ({ useNavigate: () => vi.fn() }));vi.mock("../../hooks/useSettings", () => ({ usePrimarySettings: () => ({}) }));@@ -50,7 +57,10 @@ vi.mock("../../providerInstances", () => ({deriveProviderInstanceEntries: () => [],sortProviderInstanceEntries: () => [],}));-vi.mock("../../state/bots", () => ({ botEnvironment: { update: Symbol("update") } }));+vi.mock("../../state/bots", () => ({+ botEnvironment: { update: Symbol("update"), channels: { send: Symbol("send") } },+ environmentPeopleAtom: () => mocks.peopleAtom,+}));vi.mock("../../state/environments", () => ({usePrimaryEnvironmentId: () => EnvironmentId.make("environment-1"),}));@@ -59,6 +69,9 @@ vi.mock("../../state/server", () => ({primaryServerProvidersAtom: mocks.providersAtom,serverEnvironment: { subscriptionAuth: () => null },}));+vi.mock("../../state/session", () => ({+ useEnvironmentSessionState: () => ({ data: null, isPending: false }),+}));vi.mock("../../state/shell", () => ({ environmentSnapshotAtom: () => mocks.snapshotAtom }));vi.mock("../../state/use-atom-command", () => ({ useAtomCommand: () => vi.fn() }));vi.mock("../../settingsDialogStore", () => ({ openSettings: vi.fn() }));@@ -80,6 +93,7 @@ vi.mock("./rosterStore", () => {vi.mock("./useBotThreadRuntime", () => ({useBotThreadRuntime: () => ({sending: false,+ respondingRequestIds: [],messages: [],error: null,latestTurn: null,@@ -140,8 +154,8 @@ const group: Group = {name: "Research",bossBotId: parentBot.id,members: [- { botId: parentBot.id, role: "boss" },- { botId: childBot.id, role: "specialist" },+ { kind: "bot", botId: BotId.make(parentBot.id), role: "boss" },+ { kind: "bot", botId: BotId.make(childBot.id), role: "specialist" },],createdAt: "2026-08-31T00:00:00.000Z",updatedAt: "2026-08-31T00:00:00.000Z",@@ -151,13 +165,13 @@ function delegation(id: string, parentThreadId: string) {return decodeDelegation({delegationId: id,parentDelegationId: null,- parentBotId: parentBot.id,- childBotId: childBot.id,+ parentBotId: BotId.make(parentBot.id),+ childBotId: BotId.make(childBot.id),parentThreadId,childThreadId: null,parentTurnId: "turn-parent",childTurnId: null,- ancestorBotIds: [parentBot.id],+ ancestorBotIds: [BotId.make(parentBot.id)],depth: 1,task: "Compare the release options.",expectedResult: "A short comparison.",@@ -173,7 +187,7 @@ function delegation(id: string, parentThreadId: string) {approvalCeiling: "none",},state: "queued",- billedBotId: childBot.id,+ billedBotId: BotId.make(childBot.id),result: null,failure: null,keep: false,diff --git a/apps/web/src/components/roster/roster.logic.test.ts b/apps/web/src/components/roster/roster.logic.test.tsindex c29210c47..88815f09d 100644--- a/apps/web/src/components/roster/roster.logic.test.ts+++ b/apps/web/src/components/roster/roster.logic.test.ts@@ -100,8 +100,8 @@ describe("buildGroupedRosterSections", () => {const group: Group = {id: "group-product",name: "Product",- bossBotId: "assigned",- members: [{ botId: "assigned", role: "boss" }],+ bossBotId: BotId.make("assigned"),+ members: [{ kind: "bot", botId: BotId.make("assigned"), role: "boss" }],createdAt: "2026-08-01T00:00:00.000Z",updatedAt: "2026-08-01T00:00:00.000Z",};diff --git a/apps/web/src/components/settings/SettingsDialog.tsx b/apps/web/src/components/settings/SettingsDialog.tsxindex 15a24d3ef..953653c8b 100644--- a/apps/web/src/components/settings/SettingsDialog.tsx+++ b/apps/web/src/components/settings/SettingsDialog.tsx@@ -31,6 +31,9 @@ const InboxPanel = lazy(async () => ({const ProvidersPanel = lazy(async () => ({default: (await import("./ProvidersPanel")).ProvidersPanel,}));+const BrowserSettingsPanel = lazy(async () => ({+ default: (await import("./BrowserSettings")).BrowserSettingsPanel,+}));const BotChannelsSettingsPanel = lazy(async () => ({default: (await import("./BotChannelsSettings")).BotChannelsSettingsPanel,}));@@ -62,6 +65,7 @@ const SECTION_PANELS: Readonly<Record<SettingsSection, ComponentType>> = {appearance: AppearanceSettingsPanel,providers: ProvidersPanel,browser: BrowserSettingsPanel,+ channels: BotChannelsSettingsPanel,sandbox: SandboxSettingsPanel,voice: VoiceSettingsPanel,privacy: PrivacySettingsPanel,diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.tsindex 9a9735c57..1dad01574 100644--- a/apps/web/src/components/settings/settingsSearch.ts+++ b/apps/web/src/components/settings/settingsSearch.ts@@ -6,6 +6,7 @@ export type SettingsPath =| "/settings/keybindings"| "/settings/providers"| "/settings/browser"+ | "/settings/channels"| "/settings/sandbox"| "/settings/voice"| "/settings/privacy"@@ -34,6 +35,7 @@ export const SETTINGS_SECTION_LABELS: Readonly<Record<SettingsPath, string>> = {"/settings/keybindings": "Keybindings","/settings/providers": "Providers","/settings/browser": "Browser",+ "/settings/channels": "Channels","/settings/sandbox": "Sandbox","/settings/voice": "Voice","/settings/privacy": "Privacy",@@ -320,6 +322,12 @@ export const SETTINGS_SEARCH_ITEMS = [to: "/settings/browser",targetId: "browser",},+ {+ id: "bot-channels",+ title: "Bot channels",+ to: "/settings/channels",+ keywords: ["Telegram", "iMessage", "Photon", "WhatsApp"],+ },{id: "source-control",title: "Source control",diff --git a/apps/web/src/components/sidebar/SidebarChrome.test.ts b/apps/web/src/components/sidebar/SidebarChrome.test.tsindex 99a1457cc..dac790002 100644--- a/apps/web/src/components/sidebar/SidebarChrome.test.ts+++ b/apps/web/src/components/sidebar/SidebarChrome.test.ts@@ -59,6 +59,7 @@ describe("sidebar footer", () => {runtimeMode: "approval-required",usageCap: null,voiceEnabled: false,+ channelBindings: [],groupId: null,disabledMcpServerIds: [],avatar: { kind: "blob", shape: "circle", color: "#5B7FD4" },diff --git a/apps/web/src/settingsDialogStore.test.ts b/apps/web/src/settingsDialogStore.test.tsindex c0ef20510..9c17b3ce7 100644--- a/apps/web/src/settingsDialogStore.test.ts+++ b/apps/web/src/settingsDialogStore.test.ts@@ -72,6 +72,8 @@ describe("legacy settings deep links", () => {expect(settingsSectionFromPathname("/settings/inbox")).toBe("inbox");expect(settingsSectionFromPathname("/settings/voice")).toBe("voice");expect(settingsSectionFromPathname("/settings/browser")).toBe("browser");+ expect(settingsSectionFromPathname("/settings/channels")).toBe("channels");+ expect(settingsSectionFromPathname("/settings/bots")).toBe("channels");expect(settingsSectionFromPathname("/settings/sandbox")).toBe("sandbox");expect(settingsSectionFromPathname("/settings/source-control")).toBe("source-control");});diff --git a/apps/web/src/settingsDialogStore.ts b/apps/web/src/settingsDialogStore.tsindex 96de3f5b7..0e1843db2 100644--- a/apps/web/src/settingsDialogStore.ts+++ b/apps/web/src/settingsDialogStore.ts@@ -18,6 +18,7 @@ export const SETTINGS_SECTIONS = ["appearance","providers","browser",+ "channels","sandbox","voice","privacy",diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.jsonindex c08be5388..8fe9c32ae 100644--- a/apps/web/tsconfig.json+++ b/apps/web/tsconfig.json@@ -32,7 +32,8 @@"test","scripts/warm-dep-cache.ts","../../plugins",- "../../scripts/lib/public-config.ts"+ "../../scripts/lib/public-config.ts",+ "../../scripts/lib/release-legal.ts"],"exclude": ["../../plugins/*.test.ts"]}diff --git a/package.json b/package.jsonindex 12c33bf7a..26bf1e041 100644--- a/package.json+++ b/package.json@@ -32,6 +32,7 @@"test": "vp run -r test","test:resource-monitor": "cargo test --locked --manifest-path native/resource-monitor/Cargo.toml","test:desktop-smoke": "vp run --filter @t3tools/desktop smoke-test",+ "test:desktop-packaged-mac": "vp run --filter @t3tools/desktop smoke-test:packaged-mac","fmt": "vp fmt","fmt:check": "vp fmt --check","build:contracts": "vp run --filter @t3tools/contracts build",diff --git a/packages/client-runtime/src/operations/commands.test.ts b/packages/client-runtime/src/operations/commands.test.tsindex de34d51d8..9bd4bc95e 100644--- a/packages/client-runtime/src/operations/commands.test.ts+++ b/packages/client-runtime/src/operations/commands.test.ts@@ -30,6 +30,7 @@ import {archiveThread,assignGroupMember,cancelDelegation,+ connectChannel,createMcpServer,createProject,disconnectChannel,diff --git a/packages/client-runtime/src/state/threadReducer.test.ts b/packages/client-runtime/src/state/threadReducer.test.tsindex 95ac9cb53..f6cc2dbd7 100644--- a/packages/client-runtime/src/state/threadReducer.test.ts+++ b/packages/client-runtime/src/state/threadReducer.test.ts@@ -370,6 +370,11 @@ describe("applyThreadDetailEvent", () => {turnId: null,authorPersonId: AuthSessionId.make("person-1"),authorDisplayName: "Leo",+ channelOrigin: {+ provider: "telegram",+ externalThreadId: "chat-1",+ externalSenderId: "user-1",+ },streaming: false,createdAt: "2026-04-01T06:00:00.000Z",updatedAt: "2026-04-01T06:00:00.000Z",@@ -382,6 +387,11 @@ describe("applyThreadDetailEvent", () => {expect(result.thread.messages[0]?.text).toBe("Hello, world!");expect(result.thread.messages[0]?.authorPersonId).toBe("person-1");expect(result.thread.messages[0]?.authorDisplayName).toBe("Leo");+ expect(result.thread.messages[0]?.channelOrigin).toEqual({+ provider: "telegram",+ externalThreadId: "chat-1",+ externalSenderId: "user-1",+ });}});diff --git a/packages/client-runtime/src/state/threadReducer.ts b/packages/client-runtime/src/state/threadReducer.tsindex f5e1bbfc8..840b9c067 100644--- a/packages/client-runtime/src/state/threadReducer.ts+++ b/packages/client-runtime/src/state/threadReducer.ts@@ -305,6 +305,7 @@ export function applyThreadDetailEvent(turnId: event.payload.turnId,authorPersonId: event.payload.authorPersonId ?? null,authorDisplayName: event.payload.authorDisplayName ?? null,+ channelOrigin: event.payload.channelOrigin ?? null,streaming: event.payload.streaming,createdAt: event.payload.createdAt,updatedAt: event.payload.updatedAt,diff --git a/packages/contracts/src/orchestration.ts b/packages/contracts/src/orchestration.tsindex c0a01a358..36d32f5d1 100644--- a/packages/contracts/src/orchestration.ts+++ b/packages/contracts/src/orchestration.ts@@ -463,6 +463,9 @@ export const OrchestrationMessage = Schema.Struct({attachments: Schema.optional(Schema.Array(ChatAttachment)),turnId: Schema.NullOr(TurnId),respondingBotId: Schema.optional(Schema.NullOr(BotId)),+ authorPersonId: Schema.optional(Schema.NullOr(AuthSessionId)),+ authorDisplayName: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)),+ channelOrigin: Schema.optional(Schema.NullOr(ChannelMessageOrigin)),reactions: Schema.optional(Schema.Array(OrchestrationMessageReaction)),streaming: Schema.Boolean,createdAt: IsoDateTime,diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex ab205e2e6..d595d9070 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -518,6 +518,9 @@ importers:effect:specifier: 4.0.0-beta.103version: 4.0.0-beta.103(patch_hash=af36b7948b6f9c56623074662b51dade5699880c1a7c71245de73e13c3185fb6)+ libsql:+ specifier: 0.5.29+ version: 0.5.29msgpackr-extract:specifier: 3.0.4version: 3.0.4diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.tsindex cbf54e544..05f4871f7 100644--- a/scripts/build-desktop-artifact.test.ts+++ b/scripts/build-desktop-artifact.test.ts@@ -20,6 +20,7 @@ import {DESKTOP_ELECTRON_LANGUAGES,DESKTOP_FILE_EXCLUSIONS,DESKTOP_EXTRA_RESOURCES,+ DESKTOP_PLUGIN_CATALOG_RESOURCE_SOURCE_DIR,MAC_FILE_EXCLUSIONS,InvalidMockUpdateServerPortError,UnsupportedDesktopBuildArchitectureError,@@ -458,6 +459,10 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {from: "apps/desktop/prod-resources/resource-monitor",to: "resource-monitor",},+ {+ from: DESKTOP_PLUGIN_CATALOG_RESOURCE_SOURCE_DIR,+ to: "plugins",+ },...WINDOWS_SERVER_EXTRA_RESOURCES,]);assert.deepStrictEqual(win.nsis, { differentialPackage: true });@@ -518,8 +523,10 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {"@ff-labs/fff-node": "0.9.4","@opencode-ai/sdk": "^1.3.15","@pierre/diffs": "1.3.0",+ libsql: "0.5.29","msgpackr-extract": "3.0.4","node-pty": "1.1.0",+ "playwright-core": "1.60.0",},desktopDependencies: {"@example/desktop-runtime": "1.0.0",@@ -530,8 +537,10 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {}),{"@ff-labs/fff-node": "0.9.4",+ libsql: "0.5.29","msgpackr-extract": "3.0.4","node-pty": "1.1.0",+ "playwright-core": "1.60.0","@example/desktop-runtime": "1.0.0",effect: "4.0.0-beta.103","@ff-labs/fff-bin-darwin-arm64": "0.9.4",@@ -1053,12 +1062,16 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {}).pipe(Effect.provide(ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })))),);- it("stages the resource monitor as an external executable resource", () => {+ it("stages runtime resources outside app.asar", () => {assert.deepStrictEqual(DESKTOP_EXTRA_RESOURCES, [{from: "apps/desktop/prod-resources/resource-monitor",to: "resource-monitor",},+ {+ from: DESKTOP_PLUGIN_CATALOG_RESOURCE_SOURCE_DIR,+ to: "plugins",+ },]);assert.deepStrictEqual(resolveResourceMonitorRustTargets("mac", "universal"), ["aarch64-apple-darwin",diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.tsindex d5fd9b0c6..04dfc7fdd 100644--- a/scripts/build-desktop-artifact.ts+++ b/scripts/build-desktop-artifact.ts@@ -27,7 +27,7 @@ import {import { getDefaultBuildArch } from "./lib/build-target-arch.ts";import {findInlinedExternalPackages,- selectCliRuntimeExternalDependencies,+ selectCliPackagedRuntimeDependencies,} from "./lib/cli-external-packages.ts";import { loadRepoEnv } from "./lib/public-config.ts";import { stageReleaseLegalFiles } from "./lib/release-legal.ts";@@ -792,6 +792,7 @@ export const MAC_FILE_EXCLUSIONS = [// runtime; the WSL backend cannot read asar archives, so enabling WSL lazily// extracts the sidecar to a version-keyed directory (see DesktopWslServerTree).export const WINDOWS_SERVER_ASAR_RESOURCE = "server.asar";+export const DESKTOP_PLUGIN_CATALOG_RESOURCE_SOURCE_DIR = "apps/desktop/prod-resources/plugins";// dlopen/spawn need real files, so native modules, shared libraries, and// helper executables live in the server.asar.unpacked sibling (the standard// asar redirect convention). Everything else stays packed.@@ -840,6 +841,10 @@ export const DESKTOP_EXTRA_RESOURCES = [from: "apps/desktop/prod-resources/resource-monitor",to: "resource-monitor",},+ {+ from: DESKTOP_PLUGIN_CATALOG_RESOURCE_SOURCE_DIR,+ to: "plugins",+ },] as const;export function renderMacEntitlements(): string {@@ -893,7 +898,7 @@ export function resolveMacStageDependencies(input: {readonly fffNodeVersion: string;}) {return {- ...selectCliRuntimeExternalDependencies(input.serverDependencies),+ ...selectCliPackagedRuntimeDependencies(input.serverDependencies),...input.desktopDependencies,...resolveFffNativeDependencies("mac", input.arch, input.fffNodeVersion),};@@ -2431,7 +2436,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (cause,}),});- const resolvedServerRuntimeExternalDependencies = selectCliRuntimeExternalDependencies(+ const resolvedServerPackagedRuntimeDependencies = selectCliPackagedRuntimeDependencies(resolvedServerDependencies,);const resolvedDesktopRuntimeDependencies = yield* Effect.try({@@ -2604,6 +2609,10 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (// electron-builder is filtering out stageResourcesDir directory in the AppImage for productionconst stageProdResourcesDir = path.join(stageAppDir, "apps/desktop/prod-resources");yield* fs.copy(stageResourcesDir, stageProdResourcesDir);+ yield* fs.copy(+ path.join(repoRoot, "plugins/entries"),+ path.join(stageProdResourcesDir, "plugins/entries"),+ );const macEntitlementsPath =options.platform === "mac" && options.signed@@ -2710,7 +2719,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (serverDistDir: distDirs.serverDist,arch: options.arch,appVersion,- runtimeExternalDependencies: resolvedServerRuntimeExternalDependencies,+ runtimeExternalDependencies: resolvedServerPackagedRuntimeDependencies,fffNodeVersion: serverPackageJson.dependencies["@ff-labs/fff-node"],allowBuilds: workspaceAllowBuilds,patchedDependencies: workspacePatchedDependencies,diff --git a/scripts/lib/cli-external-packages.test.ts b/scripts/lib/cli-external-packages.test.tsindex 61debf050..b5b931eab 100644--- a/scripts/lib/cli-external-packages.test.ts+++ b/scripts/lib/cli-external-packages.test.ts@@ -12,6 +12,7 @@ import serverPackageJson from "../../apps/server/package.json" with { type: "jsoimport {CLI_RUNTIME_EXTERNAL_PREFIXES,findInlinedExternalPackages,+ selectCliPackagedRuntimeDependencies,selectCliRuntimeExternalDependencies,shouldBundleCliDependency,} from "./cli-external-packages.ts";@@ -41,8 +42,9 @@ describe("shouldBundleCliDependency", () => {assert.strictEqual(shouldBundleCliDependency("node:fs"), false);});- it("leaves native addons and their dlopen wrappers external", () => {+ it("leaves non-bundle-safe packages external", () => {for (const id of [+ "playwright-core","node-pty","ffi-rs","@yuuang/ffi-rs-win32-x64-msvc",@@ -75,10 +77,12 @@ describe("selectCliRuntimeExternalDependencies", () => {"@ff-labs/fff-node": "2.0.0",effect: "3.0.0","node-pty": "4.0.0",+ "playwright-core": "1.60.0",}),{"@ff-labs/fff-node": "2.0.0","node-pty": "4.0.0",+ "playwright-core": "1.60.0",},);});@@ -86,7 +90,30 @@ describe("selectCliRuntimeExternalDependencies", () => {it("selects every external root declared by the server", () => {assert.deepStrictEqual(Object.keys(selectCliRuntimeExternalDependencies(serverPackageJson.dependencies)).sort(),- ["@ff-labs/fff-node", "msgpackr-extract", "node-pty"],+ ["@ff-labs/fff-node", "msgpackr-extract", "node-pty", "playwright-core"],+ );+ });+});++describe("selectCliPackagedRuntimeDependencies", () => {+ it("stages bundled packages that load platform-native bindings", () => {+ assert.deepStrictEqual(+ selectCliPackagedRuntimeDependencies({+ effect: "4.0.0",+ libsql: "0.5.29",+ "node-pty": "1.1.0",+ }),+ {+ libsql: "0.5.29",+ "node-pty": "1.1.0",+ },+ );+ });++ it("stages libsql from the server manifest", () => {+ assert.strictEqual(+ selectCliPackagedRuntimeDependencies(serverPackageJson.dependencies).libsql,+ serverPackageJson.dependencies.libsql,);});});diff --git a/scripts/lib/cli-external-packages.ts b/scripts/lib/cli-external-packages.tsindex 94d164a95..7ed4118bf 100644--- a/scripts/lib/cli-external-packages.ts+++ b/scripts/lib/cli-external-packages.ts@@ -26,6 +26,9 @@* enforced by a test, not by inspection.*/export const CLI_RUNTIME_EXTERNAL_PREFIXES = [+ // Playwright ships a prebuilt CommonJS core bundle that reads __dirname.+ // Inlining it into the ESM server bundle removes that CommonJS binding.+ "playwright-core","node-pty","ffi-rs","@yuuang/",@@ -62,6 +65,11 @@ export const CLI_BUILD_ONLY_EXTERNAL_PREFIXES = ["@effect/sql-sqlite-bun",] as const;+// These packages stay bundled, but load target-specific native bindings with a+// computed require. Ship their package roots so the staged install also brings+// the correct optional binding for the target OS and architecture.+export const CLI_BUNDLED_NATIVE_RUNTIME_PACKAGES = ["libsql"] as const;+export const CLI_EXTERNAL_PACKAGE_PREFIXES = [...CLI_RUNTIME_EXTERNAL_PREFIXES,...CLI_BUILD_ONLY_EXTERNAL_PREFIXES,@@ -100,6 +108,19 @@ export function selectCliRuntimeExternalDependencies();}+/** Select every dependency root the packaged server needs beside its bundle. */+export function selectCliPackagedRuntimeDependencies(+ dependencies: Readonly<Record<string, string>>,+): Record<string, string> {+ return Object.fromEntries(+ Object.entries(dependencies).filter(+ ([name]) =>+ isRuntimeExternalCliDependency(name) ||+ CLI_BUNDLED_NATIVE_RUNTIME_PACKAGES.some((packageName) => name === packageName),+ ),+ );+}+/*** Scan an emitted bundle chunk for runtime-external packages that were inlined.*