mirror of
https://github.com/nightly-labs/openbot.git
synced 2026-12-03 01:18:29 +08:00
* feat: ship a Linux x64 AppImage OpenBot shipped macOS and Windows only. This adds the third target as an AppImage, the one Linux format electron-updater can update in place. - Pin `linux-x64` artifacts for codex, claude, opencode, and grok, so the in-app provider download works as it does on macOS. - Discover a CLI through `$SHELL` on Linux instead of `/bin/zsh`, which most distributions do not install, and look in `/usr/bin` as well. - Register the `openbot://` scheme on Linux, and update in place only when `APPIMAGE` says the app runs from an AppImage. - Report voice transcription as unavailable when the build carries no whisper binary, rather than failing at transcribe time. The composer offers no microphone on Linux. - Move the whisper and remote-desktop resources out of the shared `extraResources` list, because neither is built for Linux. - Ship an AppArmor profile for the Ubuntu 23.10 and Debian 13 user-namespace restriction. `--no-sandbox` stays out of the product and the documentation. - Add the release job, the package verifier, the download route, and the install and troubleshooting sections. Remote desktop stays unavailable on Linux, and the AppImage is unsigned, as the Windows installer is. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(linux): install a desktop entry and keep the sandbox on in CI The protocol registration on Linux goes through `xdg-settings`, which can only name a desktop entry that already exists. An AppImage has none, so the first start now writes `~/.local/share/applications/openbot.desktop` with an `Exec` that points at the running AppImage and accepts `%U`, and a failed registration is logged instead of ignored. Ubuntu 24.04 restricts unprivileged user namespaces through AppArmor, so the release job loads a narrow profile for the verification executable and gives the SUID helper the ownership a package manager would give it. `--no-sandbox` stays out of the tree: the launch check must prove what a real install does. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(linux): keep the launcher icon after the AppImage unmounts An AppImage mounts its resources in a temporary directory the runtime removes on exit, so a desktop entry that names the packaged icon loses it as soon as OpenBot is not running. The first start now copies the icon to `<data home>/icons` and names the copy. A copy that fails still leaves the entry, because the entry is what registers the invitation scheme. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
113 lines
4.5 KiB
TypeScript
113 lines
4.5 KiB
TypeScript
import { readFile } from "node:fs/promises";
|
|
import { resolve } from "node:path";
|
|
import { z } from "zod";
|
|
|
|
const sha256Schema = z.string().regex(/^[0-9a-f]{64}$/u, "Must use a complete SHA-256 value.");
|
|
const codexArtifactSchema = z.object({
|
|
asset: z.string().min(1),
|
|
assetSha256: sha256Schema,
|
|
downloadBytes: z.number().int().positive(),
|
|
installedBytes: z.number().int().positive(),
|
|
executable: z.string().regex(/^bin\/codex(?:\.exe)?$/u),
|
|
});
|
|
const claudeArtifactSchema = z.object({
|
|
package: z.string().regex(/^@anthropic-ai\/claude-agent-sdk-(?:darwin-arm64|linux-x64|win32-x64)$/u),
|
|
asset: z.string().regex(/^claude-agent-sdk-(?:darwin-arm64|linux-x64|win32-x64)-\d+\.\d+\.\d+\.tgz$/u),
|
|
assetSha256: sha256Schema,
|
|
binarySha256: sha256Schema,
|
|
downloadBytes: z.number().int().positive(),
|
|
installedBytes: z.number().int().positive(),
|
|
executable: z.enum(["claude", "claude.exe"]),
|
|
platformDirectory: z.enum(["linux", "mac", "win"]),
|
|
});
|
|
const opencodeArtifactSchema = z.object({
|
|
package: z.string().regex(/^opencode-(?:darwin-arm64|linux-x64|windows-x64)$/u),
|
|
asset: z.string().regex(/^opencode-(?:darwin-arm64|linux-x64|windows-x64)-\d+\.\d+\.\d+\.tgz$/u),
|
|
assetSha256: sha256Schema,
|
|
binarySha256: sha256Schema,
|
|
downloadBytes: z.number().int().positive(),
|
|
installedBytes: z.number().int().positive(),
|
|
executable: z.enum(["opencode", "opencode.exe"]),
|
|
platformDirectory: z.enum(["linux", "mac", "win"]),
|
|
});
|
|
const grokArtifactSchema = z.object({
|
|
asset: z.string().regex(/^grok-\d+\.\d+\.\d+-(?:linux-x86_64|macos-aarch64|windows-x86_64(?:\.exe)?)$/u),
|
|
assetSha256: sha256Schema,
|
|
downloadBytes: z.number().int().positive(),
|
|
installedBytes: z.number().int().positive(),
|
|
executable: z.enum(["grok", "grok.exe"]),
|
|
platformDirectory: z.enum(["linux", "mac", "win"]),
|
|
});
|
|
|
|
const agentRuntimeLockSchema = z.object({
|
|
schemaVersion: z.literal(1),
|
|
codex: z.object({
|
|
repository: z.literal("https://github.com/openai/codex"),
|
|
version: z.string().regex(/^\d+\.\d+\.\d+$/u),
|
|
tag: z.string().regex(/^rust-v\d+\.\d+\.\d+$/u),
|
|
license: z.literal("Apache-2.0"),
|
|
licenseSha256: sha256Schema,
|
|
artifacts: z.object({
|
|
"darwin-arm64": codexArtifactSchema,
|
|
"linux-x64": codexArtifactSchema,
|
|
"win32-x64": codexArtifactSchema,
|
|
}),
|
|
}),
|
|
claude: z.object({
|
|
registry: z.literal("https://registry.npmjs.org"),
|
|
sdkVersion: z.string().regex(/^\d+\.\d+\.\d+$/u),
|
|
version: z.string().regex(/^\d+\.\d+\.\d+$/u),
|
|
license: z.literal("Anthropic Legal Agreements"),
|
|
licenseSha256: sha256Schema,
|
|
artifacts: z.object({
|
|
"darwin-arm64": claudeArtifactSchema,
|
|
"linux-x64": claudeArtifactSchema,
|
|
"win32-x64": claudeArtifactSchema,
|
|
}),
|
|
}),
|
|
/**
|
|
* OpenCode publishes one npm platform package per target, and the CLI reports the npm version
|
|
* verbatim. There is no `sdkVersion` split like `claude`, so one `version` field is the whole
|
|
* truth: the tarball name, the `package.json` inside it, and what `opencode --version` prints.
|
|
*/
|
|
opencode: z.object({
|
|
registry: z.literal("https://registry.npmjs.org"),
|
|
/** Canonical name. `github.com/sst/opencode` now redirects here, and the license fetch must not
|
|
* have to follow a redirect. */
|
|
repository: z.literal("https://github.com/anomalyco/opencode"),
|
|
version: z.string().regex(/^\d+\.\d+\.\d+$/u),
|
|
license: z.literal("MIT"),
|
|
licenseSha256: sha256Schema,
|
|
artifacts: z.object({
|
|
"darwin-arm64": opencodeArtifactSchema,
|
|
"linux-x64": opencodeArtifactSchema,
|
|
"win32-x64": opencodeArtifactSchema,
|
|
}),
|
|
}),
|
|
grok: z.object({
|
|
repository: z.literal("https://github.com/xai-org/grok-build"),
|
|
distribution: z.literal("https://x.ai/cli"),
|
|
version: z.string().regex(/^\d+\.\d+\.\d+$/u),
|
|
sourceCommit: z.string().regex(/^[0-9a-f]{40}$/u, "Must use a complete Git commit."),
|
|
license: z.literal("Apache-2.0"),
|
|
licenseSha256: sha256Schema,
|
|
noticesSha256: sha256Schema,
|
|
artifacts: z.object({
|
|
"darwin-arm64": grokArtifactSchema,
|
|
"linux-x64": grokArtifactSchema,
|
|
"win32-x64": grokArtifactSchema,
|
|
}),
|
|
}),
|
|
});
|
|
|
|
export type AgentRuntimeLock = z.infer<typeof agentRuntimeLockSchema>;
|
|
|
|
export async function loadAgentRuntimeLock(sourceRoot = process.cwd()): Promise<AgentRuntimeLock> {
|
|
const path = resolve(sourceRoot, "native-runtime.lock.json");
|
|
return parseAgentRuntimeLock(JSON.parse(await readFile(path, "utf8")));
|
|
}
|
|
|
|
export function parseAgentRuntimeLock(value: unknown): AgentRuntimeLock {
|
|
return agentRuntimeLockSchema.parse(value);
|
|
}
|