refactor: 统一项目名称从OpenFang到ZCLAW
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
重构所有代码和文档中的项目名称,将OpenFang统一更新为ZCLAW。包括: - 配置文件中的项目名称 - 代码注释和文档引用 - 环境变量和路径 - 类型定义和接口名称 - 测试用例和模拟数据 同时优化部分代码结构,移除未使用的模块,并更新相关依赖项。
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* OpenFang Binary Downloader
|
||||
* Automatically downloads the correct OpenFang binary for the current platform
|
||||
* ZCLAW Binary Downloader
|
||||
* Automatically downloads the correct ZCLAW binary for the current platform
|
||||
* Run during Tauri build process
|
||||
*/
|
||||
|
||||
@@ -12,11 +12,11 @@ import { fileURLToPath } from 'url';
|
||||
import { platform, arch } from 'os';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const RESOURCES_DIR = join(__dirname, '../src-tauri/resources/openfang-runtime');
|
||||
const RESOURCES_DIR = join(__dirname, '../src-tauri/resources/zclaw-runtime');
|
||||
|
||||
// OpenFang release info
|
||||
const OPENFANG_REPO = 'RightNow-AI/openfang';
|
||||
const OPENFANG_VERSION = process.env.OPENFANG_VERSION || 'latest';
|
||||
// ZCLAW release info
|
||||
const ZCLAW_REPO = 'RightNow-AI/zclaw';
|
||||
const ZCLAW_VERSION = process.env.ZCLAW_VERSION || 'latest';
|
||||
|
||||
interface PlatformConfig {
|
||||
binaryName: string;
|
||||
@@ -30,28 +30,28 @@ function getPlatformConfig(): PlatformConfig {
|
||||
switch (currentPlatform) {
|
||||
case 'win32':
|
||||
return {
|
||||
binaryName: 'openfang.exe',
|
||||
binaryName: 'zclaw.exe',
|
||||
downloadName: currentArch === 'x64'
|
||||
? 'openfang-x86_64-pc-windows-msvc.exe'
|
||||
: 'openfang-aarch64-pc-windows-msvc.exe',
|
||||
? 'zclaw-x86_64-pc-windows-msvc.exe'
|
||||
: 'zclaw-aarch64-pc-windows-msvc.exe',
|
||||
};
|
||||
case 'darwin':
|
||||
return {
|
||||
binaryName: currentArch === 'arm64'
|
||||
? 'openfang-aarch64-apple-darwin'
|
||||
: 'openfang-x86_64-apple-darwin',
|
||||
? 'zclaw-aarch64-apple-darwin'
|
||||
: 'zclaw-x86_64-apple-darwin',
|
||||
downloadName: currentArch === 'arm64'
|
||||
? 'openfang-aarch64-apple-darwin'
|
||||
: 'openfang-x86_64-apple-darwin',
|
||||
? 'zclaw-aarch64-apple-darwin'
|
||||
: 'zclaw-x86_64-apple-darwin',
|
||||
};
|
||||
case 'linux':
|
||||
return {
|
||||
binaryName: currentArch === 'arm64'
|
||||
? 'openfang-aarch64-unknown-linux-gnu'
|
||||
: 'openfang-x86_64-unknown-linux-gnu',
|
||||
? 'zclaw-aarch64-unknown-linux-gnu'
|
||||
: 'zclaw-x86_64-unknown-linux-gnu',
|
||||
downloadName: currentArch === 'arm64'
|
||||
? 'openfang-aarch64-unknown-linux-gnu'
|
||||
: 'openfang-x86_64-unknown-linux-gnu',
|
||||
? 'zclaw-aarch64-unknown-linux-gnu'
|
||||
: 'zclaw-x86_64-unknown-linux-gnu',
|
||||
};
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${currentPlatform}`);
|
||||
@@ -60,19 +60,19 @@ function getPlatformConfig(): PlatformConfig {
|
||||
|
||||
function downloadBinary(): void {
|
||||
const config = getPlatformConfig();
|
||||
const baseUrl = `https://github.com/${OPENFANG_REPO}/releases`;
|
||||
const downloadUrl = OPENFANG_VERSION === 'latest'
|
||||
const baseUrl = `https://github.com/${ZCLAW_REPO}/releases`;
|
||||
const downloadUrl = ZCLAW_VERSION === 'latest'
|
||||
? `${baseUrl}/latest/download/${config.downloadName}`
|
||||
: `${baseUrl}/download/${OPENFANG_VERSION}/${config.downloadName}`;
|
||||
: `${baseUrl}/download/${ZCLAW_VERSION}/${config.downloadName}`;
|
||||
|
||||
const outputPath = join(RESOURCES_DIR, config.binaryName);
|
||||
|
||||
console.log('='.repeat(60));
|
||||
console.log('OpenFang Binary Downloader');
|
||||
console.log('ZCLAW Binary Downloader');
|
||||
console.log('='.repeat(60));
|
||||
console.log(`Platform: ${platform()} (${arch()})`);
|
||||
console.log(`Binary: ${config.binaryName}`);
|
||||
console.log(`Version: ${OPENFANG_VERSION}`);
|
||||
console.log(`Version: ${ZCLAW_VERSION}`);
|
||||
console.log(`URL: ${downloadUrl}`);
|
||||
console.log('='.repeat(60));
|
||||
|
||||
@@ -83,7 +83,7 @@ function downloadBinary(): void {
|
||||
|
||||
// Check if already downloaded
|
||||
if (existsSync(outputPath)) {
|
||||
console.log('✓ Binary already exists, skipping download.');
|
||||
console.log('Binary already exists, skipping download.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,11 +113,11 @@ function downloadBinary(): void {
|
||||
execSync(`chmod +x "${outputPath}"`);
|
||||
}
|
||||
|
||||
console.log('✓ Download complete!');
|
||||
console.log('Download complete!');
|
||||
} catch (error) {
|
||||
console.error('✗ Download failed:', error);
|
||||
console.error('Download failed:', error);
|
||||
console.log('\nPlease download manually from:');
|
||||
console.log(` ${baseUrl}/${OPENFANG_VERSION === 'latest' ? 'latest' : 'tag/' + OPENFANG_VERSION}`);
|
||||
console.log(` ${baseUrl}/${ZCLAW_VERSION === 'latest' ? 'latest' : 'tag/' + ZCLAW_VERSION}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -127,12 +127,12 @@ function updateManifest(): void {
|
||||
|
||||
const manifest = {
|
||||
source: {
|
||||
binPath: platform() === 'win32' ? 'openfang.exe' : `openfang-${arch()}-${platform()}`,
|
||||
binPath: platform() === 'win32' ? 'zclaw.exe' : `zclaw-${arch()}-${platform()}`,
|
||||
},
|
||||
stagedAt: new Date().toISOString(),
|
||||
version: OPENFANG_VERSION === 'latest' ? new Date().toISOString().split('T')[0].replace(/-/g, '.') : OPENFANG_VERSION,
|
||||
runtimeType: 'openfang',
|
||||
description: 'OpenFang Agent OS - Single binary runtime (~32MB)',
|
||||
version: ZCLAW_VERSION === 'latest' ? new Date().toISOString().split('T')[0].replace(/-/g, '.') : ZCLAW_VERSION,
|
||||
runtimeType: 'zclaw',
|
||||
description: 'ZCLAW Agent OS - Single binary runtime (~32MB)',
|
||||
endpoints: {
|
||||
websocket: 'ws://127.0.0.1:4200/ws',
|
||||
rest: 'http://127.0.0.1:4200/api',
|
||||
@@ -140,11 +140,11 @@ function updateManifest(): void {
|
||||
};
|
||||
|
||||
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
||||
console.log('✓ Manifest updated');
|
||||
console.log('Manifest updated');
|
||||
}
|
||||
|
||||
// Run
|
||||
downloadBinary();
|
||||
updateManifest();
|
||||
|
||||
console.log('\n✓ OpenFang runtime ready for build!');
|
||||
console.log('\nZCLAW runtime ready for build!');
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const desktopRoot = path.resolve(__dirname, '..');
|
||||
const outputDir = path.join(desktopRoot, 'src-tauri', 'resources', 'openclaw-runtime');
|
||||
const dryRun = process.argv.includes('--dry-run');
|
||||
|
||||
function log(message) {
|
||||
console.log(`[prepare-openclaw-runtime] ${message}`);
|
||||
}
|
||||
|
||||
function readFirstExistingPath(commandNames) {
|
||||
for (const commandName of commandNames) {
|
||||
try {
|
||||
const stdout = execFileSync('where.exe', [commandName], {
|
||||
encoding: 'utf8',
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
});
|
||||
const firstMatch = stdout
|
||||
.split(/\r?\n/)
|
||||
.map((line) => line.trim())
|
||||
.find(Boolean);
|
||||
if (firstMatch) {
|
||||
return firstMatch;
|
||||
}
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function ensureFileExists(filePath, label) {
|
||||
if (!filePath || !fs.existsSync(filePath) || !fs.statSync(filePath).isFile()) {
|
||||
throw new Error(`${label} 不存在:${filePath || '(empty)'}`);
|
||||
}
|
||||
}
|
||||
|
||||
function ensureDirExists(dirPath, label) {
|
||||
if (!dirPath || !fs.existsSync(dirPath) || !fs.statSync(dirPath).isDirectory()) {
|
||||
throw new Error(`${label} 不存在:${dirPath || '(empty)'}`);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveOpenClawBin() {
|
||||
const override = process.env.OPENCLAW_BIN;
|
||||
if (override) {
|
||||
return path.resolve(override);
|
||||
}
|
||||
|
||||
const resolved = readFirstExistingPath(['openclaw.cmd', 'openclaw']);
|
||||
if (!resolved) {
|
||||
throw new Error('未找到 openclaw 入口。请先安装 OpenClaw,或设置 OPENCLAW_BIN。');
|
||||
}
|
||||
|
||||
return resolved;
|
||||
}
|
||||
|
||||
function resolvePackageDir(openclawBinPath) {
|
||||
const override = process.env.OPENCLAW_PACKAGE_DIR;
|
||||
if (override) {
|
||||
return path.resolve(override);
|
||||
}
|
||||
|
||||
return path.join(path.dirname(openclawBinPath), 'node_modules', 'openclaw');
|
||||
}
|
||||
|
||||
function resolveNodeExe(openclawBinPath) {
|
||||
const override = process.env.OPENCLAW_NODE_EXE;
|
||||
if (override) {
|
||||
return path.resolve(override);
|
||||
}
|
||||
|
||||
const bundledNode = path.join(path.dirname(openclawBinPath), 'node.exe');
|
||||
if (fs.existsSync(bundledNode)) {
|
||||
return bundledNode;
|
||||
}
|
||||
|
||||
const resolved = readFirstExistingPath(['node.exe', 'node']);
|
||||
if (!resolved) {
|
||||
throw new Error('未找到 node.exe。请先安装 Node.js,或设置 OPENCLAW_NODE_EXE。');
|
||||
}
|
||||
|
||||
return resolved;
|
||||
}
|
||||
|
||||
function cleanOutputDirectory(dirPath) {
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const entry of fs.readdirSync(dirPath)) {
|
||||
fs.rmSync(path.join(dirPath, entry), { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
function writeCmdLauncher(dirPath) {
|
||||
const launcher = [
|
||||
'@ECHO off',
|
||||
'SETLOCAL',
|
||||
'SET "_prog=%~dp0\\node.exe"',
|
||||
'"%_prog%" "%~dp0\\node_modules\\openclaw\\openclaw.mjs" %*',
|
||||
'',
|
||||
].join('\r\n');
|
||||
|
||||
fs.writeFileSync(path.join(dirPath, 'openclaw.cmd'), launcher, 'utf8');
|
||||
}
|
||||
|
||||
function stageRuntime() {
|
||||
const openclawBinPath = resolveOpenClawBin();
|
||||
const packageDir = resolvePackageDir(openclawBinPath);
|
||||
const nodeExePath = resolveNodeExe(openclawBinPath);
|
||||
const packageJsonPath = path.join(packageDir, 'package.json');
|
||||
const entryPath = path.join(packageDir, 'openclaw.mjs');
|
||||
|
||||
ensureFileExists(openclawBinPath, 'OpenClaw 入口');
|
||||
ensureDirExists(packageDir, 'OpenClaw 包目录');
|
||||
ensureFileExists(packageJsonPath, 'OpenClaw package.json');
|
||||
ensureFileExists(entryPath, 'OpenClaw 入口脚本');
|
||||
ensureFileExists(nodeExePath, 'Node.js 可执行文件');
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
const destinationPackageDir = path.join(outputDir, 'node_modules', 'openclaw');
|
||||
const manifest = {
|
||||
source: {
|
||||
openclawBinPath,
|
||||
packageDir,
|
||||
nodeExePath,
|
||||
},
|
||||
stagedAt: new Date().toISOString(),
|
||||
version: packageJson.version ?? null,
|
||||
};
|
||||
|
||||
log(`OpenClaw version: ${packageJson.version || 'unknown'}`);
|
||||
log(`Source bin: ${openclawBinPath}`);
|
||||
log(`Source package: ${packageDir}`);
|
||||
log(`Source node.exe: ${nodeExePath}`);
|
||||
log(`Target dir: ${outputDir}`);
|
||||
|
||||
if (dryRun) {
|
||||
log('Dry run 完成,未写入任何文件。');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
cleanOutputDirectory(outputDir);
|
||||
fs.mkdirSync(path.join(outputDir, 'node_modules'), { recursive: true });
|
||||
fs.copyFileSync(nodeExePath, path.join(outputDir, 'node.exe'));
|
||||
fs.cpSync(packageDir, destinationPackageDir, { recursive: true, force: true });
|
||||
writeCmdLauncher(outputDir);
|
||||
fs.writeFileSync(path.join(outputDir, 'runtime-manifest.json'), JSON.stringify(manifest, null, 2), 'utf8');
|
||||
|
||||
log('OpenClaw runtime 已写入 src-tauri/resources/openclaw-runtime');
|
||||
}
|
||||
|
||||
try {
|
||||
stageRuntime();
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
console.error(`[prepare-openclaw-runtime] ${message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* OpenFang Runtime Preparation Script
|
||||
* ZCLAW Runtime Preparation Script
|
||||
*
|
||||
* Prepares the OpenFang binary for bundling with Tauri.
|
||||
* Prepares the ZCLAW binary for bundling with Tauri.
|
||||
* Supports cross-platform: Windows, Linux, macOS
|
||||
*
|
||||
* Usage:
|
||||
* node scripts/prepare-openfang-runtime.mjs
|
||||
* node scripts/prepare-openfang-runtime.mjs --dry-run
|
||||
* OPENFANG_VERSION=v1.2.3 node scripts/prepare-openfang-runtime.mjs
|
||||
* node scripts/prepare-zclaw-runtime.mjs
|
||||
* node scripts/prepare-zclaw-runtime.mjs --dry-run
|
||||
* ZCLAW_VERSION=v1.2.3 node scripts/prepare-zclaw-runtime.mjs
|
||||
*/
|
||||
|
||||
import { execSync, execFileSync } from 'node:child_process';
|
||||
@@ -20,64 +20,64 @@ import { arch as osArch, platform as osPlatform, homedir } from 'node:os';
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const desktopRoot = path.resolve(__dirname, '..');
|
||||
const outputDir = path.join(desktopRoot, 'src-tauri', 'resources', 'openfang-runtime');
|
||||
const outputDir = path.join(desktopRoot, 'src-tauri', 'resources', 'zclaw-runtime');
|
||||
const dryRun = process.argv.includes('--dry-run');
|
||||
const openfangVersion = process.env.OPENFANG_VERSION || 'latest';
|
||||
const zclawVersion = process.env.ZCLAW_VERSION || 'latest';
|
||||
|
||||
const PLATFORM = osPlatform();
|
||||
const ARCH = osArch();
|
||||
|
||||
function log(message) {
|
||||
console.log(`[prepare-openfang-runtime] ${message}`);
|
||||
console.log(`[prepare-zclaw-runtime] ${message}`);
|
||||
}
|
||||
|
||||
function warn(message) {
|
||||
console.warn(`[prepare-openfang-runtime] WARN: ${message}`);
|
||||
console.warn(`[prepare-zclaw-runtime] WARN: ${message}`);
|
||||
}
|
||||
|
||||
function error(message) {
|
||||
console.error(`[prepare-openfang-runtime] ERROR: ${message}`);
|
||||
console.error(`[prepare-zclaw-runtime] ERROR: ${message}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get platform-specific binary configuration
|
||||
* OpenFang releases: .zip for Windows, .tar.gz for Unix
|
||||
* ZCLAW releases: .zip for Windows, .tar.gz for Unix
|
||||
*/
|
||||
function getPlatformConfig() {
|
||||
const configs = {
|
||||
win32: {
|
||||
x64: {
|
||||
binaryName: 'openfang.exe',
|
||||
downloadName: 'openfang-x86_64-pc-windows-msvc.zip',
|
||||
binaryName: 'zclaw.exe',
|
||||
downloadName: 'zclaw-x86_64-pc-windows-msvc.zip',
|
||||
archiveFormat: 'zip',
|
||||
},
|
||||
arm64: {
|
||||
binaryName: 'openfang.exe',
|
||||
downloadName: 'openfang-aarch64-pc-windows-msvc.zip',
|
||||
binaryName: 'zclaw.exe',
|
||||
downloadName: 'zclaw-aarch64-pc-windows-msvc.zip',
|
||||
archiveFormat: 'zip',
|
||||
},
|
||||
},
|
||||
darwin: {
|
||||
x64: {
|
||||
binaryName: 'openfang-x86_64-apple-darwin',
|
||||
downloadName: 'openfang-x86_64-apple-darwin.tar.gz',
|
||||
binaryName: 'zclaw-x86_64-apple-darwin',
|
||||
downloadName: 'zclaw-x86_64-apple-darwin.tar.gz',
|
||||
archiveFormat: 'tar.gz',
|
||||
},
|
||||
arm64: {
|
||||
binaryName: 'openfang-aarch64-apple-darwin',
|
||||
downloadName: 'openfang-aarch64-apple-darwin.tar.gz',
|
||||
binaryName: 'zclaw-aarch64-apple-darwin',
|
||||
downloadName: 'zclaw-aarch64-apple-darwin.tar.gz',
|
||||
archiveFormat: 'tar.gz',
|
||||
},
|
||||
},
|
||||
linux: {
|
||||
x64: {
|
||||
binaryName: 'openfang-x86_64-unknown-linux-gnu',
|
||||
downloadName: 'openfang-x86_64-unknown-linux-gnu.tar.gz',
|
||||
binaryName: 'zclaw-x86_64-unknown-linux-gnu',
|
||||
downloadName: 'zclaw-x86_64-unknown-linux-gnu.tar.gz',
|
||||
archiveFormat: 'tar.gz',
|
||||
},
|
||||
arm64: {
|
||||
binaryName: 'openfang-aarch64-unknown-linux-gnu',
|
||||
downloadName: 'openfang-aarch64-unknown-linux-gnu.tar.gz',
|
||||
binaryName: 'zclaw-aarch64-unknown-linux-gnu',
|
||||
downloadName: 'zclaw-aarch64-unknown-linux-gnu.tar.gz',
|
||||
archiveFormat: 'tar.gz',
|
||||
},
|
||||
},
|
||||
@@ -97,26 +97,26 @@ function getPlatformConfig() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Find OpenFang binary in system PATH
|
||||
* Find ZCLAW binary in system PATH
|
||||
*/
|
||||
function findSystemBinary() {
|
||||
const override = process.env.OPENFANG_BIN;
|
||||
const override = process.env.ZCLAW_BIN;
|
||||
if (override) {
|
||||
if (fs.existsSync(override)) {
|
||||
return override;
|
||||
}
|
||||
throw new Error(`OPENFANG_BIN specified but file not found: ${override}`);
|
||||
throw new Error(`ZCLAW_BIN specified but file not found: ${override}`);
|
||||
}
|
||||
|
||||
try {
|
||||
let result;
|
||||
if (PLATFORM === 'win32') {
|
||||
result = execFileSync('where.exe', ['openfang'], {
|
||||
result = execFileSync('where.exe', ['zclaw'], {
|
||||
encoding: 'utf8',
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
});
|
||||
} else {
|
||||
result = execFileSync('which', ['openfang'], {
|
||||
result = execFileSync('which', ['zclaw'], {
|
||||
encoding: 'utf8',
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
});
|
||||
@@ -134,7 +134,7 @@ function findSystemBinary() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if OpenFang is installed via install script
|
||||
* Check if ZCLAW is installed via install script
|
||||
*/
|
||||
function findInstalledBinary() {
|
||||
const config = getPlatformConfig();
|
||||
@@ -142,12 +142,12 @@ function findInstalledBinary() {
|
||||
|
||||
const possiblePaths = [
|
||||
// Default install location
|
||||
path.join(home, '.openfang', 'bin', config.binaryName),
|
||||
path.join(home, '.zclaw', 'bin', config.binaryName),
|
||||
path.join(home, '.local', 'bin', config.binaryName),
|
||||
// macOS
|
||||
path.join(home, '.openfang', 'bin', 'openfang'),
|
||||
'/usr/local/bin/openfang',
|
||||
'/usr/bin/openfang',
|
||||
path.join(home, '.zclaw', 'bin', 'zclaw'),
|
||||
'/usr/local/bin/zclaw',
|
||||
'/usr/bin/zclaw',
|
||||
];
|
||||
|
||||
for (const p of possiblePaths) {
|
||||
@@ -160,21 +160,21 @@ function findInstalledBinary() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Download OpenFang binary from GitHub Releases
|
||||
* Download ZCLAW binary from GitHub Releases
|
||||
* Handles .zip for Windows, .tar.gz for Unix
|
||||
*/
|
||||
function downloadBinary(config) {
|
||||
const baseUrl = 'https://github.com/RightNow-AI/openfang/releases';
|
||||
const downloadUrl = openfangVersion === 'latest'
|
||||
const baseUrl = 'https://github.com/RightNow-AI/zclaw/releases';
|
||||
const downloadUrl = zclawVersion === 'latest'
|
||||
? `${baseUrl}/latest/download/${config.downloadName}`
|
||||
: `${baseUrl}/download/${openfangVersion}/${config.downloadName}`;
|
||||
: `${baseUrl}/download/${zclawVersion}/${config.downloadName}`;
|
||||
|
||||
const archivePath = path.join(outputDir, config.downloadName);
|
||||
const binaryOutputPath = path.join(outputDir, config.binaryName);
|
||||
|
||||
log(`Downloading OpenFang binary...`);
|
||||
log(`Downloading ZCLAW binary...`);
|
||||
log(` Platform: ${PLATFORM} (${ARCH})`);
|
||||
log(` Version: ${openfangVersion}`);
|
||||
log(` Version: ${zclawVersion}`);
|
||||
log(` Archive: ${config.downloadName}`);
|
||||
log(` URL: ${downloadUrl}`);
|
||||
|
||||
@@ -211,7 +211,7 @@ function downloadBinary(config) {
|
||||
// Find and rename the extracted binary
|
||||
// The archive contains a single binary file
|
||||
const extractedFiles = fs.readdirSync(outputDir).filter(f =>
|
||||
f.startsWith('openfang') && !f.endsWith('.zip') && !f.endsWith('.tar.gz') && !f.endsWith('.sha256')
|
||||
f.startsWith('zclaw') && !f.endsWith('.zip') && !f.endsWith('.tar.gz') && !f.endsWith('.sha256')
|
||||
);
|
||||
|
||||
if (extractedFiles.length === 0) {
|
||||
@@ -285,16 +285,16 @@ function writeManifest(config) {
|
||||
const manifest = {
|
||||
source: {
|
||||
binPath: config.binaryName,
|
||||
binPathLinux: 'openfang-x86_64-unknown-linux-gnu',
|
||||
binPathMac: 'openfang-x86_64-apple-darwin',
|
||||
binPathMacArm: 'openfang-aarch64-apple-darwin',
|
||||
binPathLinux: 'zclaw-x86_64-unknown-linux-gnu',
|
||||
binPathMac: 'zclaw-x86_64-apple-darwin',
|
||||
binPathMacArm: 'zclaw-aarch64-apple-darwin',
|
||||
},
|
||||
stagedAt: new Date().toISOString(),
|
||||
version: openfangVersion === 'latest'
|
||||
version: zclawVersion === 'latest'
|
||||
? new Date().toISOString().split('T')[0].replace(/-/g, '.')
|
||||
: openfangVersion,
|
||||
runtimeType: 'openfang',
|
||||
description: 'OpenFang Agent OS - Single binary runtime (~32MB)',
|
||||
: zclawVersion,
|
||||
runtimeType: 'zclaw',
|
||||
description: 'ZCLAW Agent OS - Single binary runtime (~32MB)',
|
||||
endpoints: {
|
||||
websocket: 'ws://127.0.0.1:4200/ws',
|
||||
rest: 'http://127.0.0.1:4200/api',
|
||||
@@ -322,21 +322,21 @@ function writeLauncherScripts(config) {
|
||||
// Windows launcher
|
||||
const cmdLauncher = [
|
||||
'@echo off',
|
||||
'REM OpenFang Agent OS - Bundled Binary Launcher',
|
||||
'REM ZCLAW Agent OS - Bundled Binary Launcher',
|
||||
`"%~dp0${config.binaryName}" %*`,
|
||||
'',
|
||||
].join('\r\n');
|
||||
fs.writeFileSync(path.join(outputDir, 'openfang.cmd'), cmdLauncher, 'utf8');
|
||||
fs.writeFileSync(path.join(outputDir, 'zclaw.cmd'), cmdLauncher, 'utf8');
|
||||
|
||||
// Unix launcher
|
||||
const shLauncher = [
|
||||
'#!/bin/bash',
|
||||
'# OpenFang Agent OS - Bundled Binary Launcher',
|
||||
'# ZCLAW Agent OS - Bundled Binary Launcher',
|
||||
`SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"`,
|
||||
`exec "$SCRIPT_DIR/${config.binaryName}" "$@"`,
|
||||
'',
|
||||
].join('\n');
|
||||
const shPath = path.join(outputDir, 'openfang.sh');
|
||||
const shPath = path.join(outputDir, 'zclaw.sh');
|
||||
fs.writeFileSync(shPath, shLauncher, 'utf8');
|
||||
fs.chmodSync(shPath, 0o755);
|
||||
|
||||
@@ -370,7 +370,7 @@ function cleanOldRuntime() {
|
||||
*/
|
||||
function main() {
|
||||
log('='.repeat(60));
|
||||
log('OpenFang Runtime Preparation');
|
||||
log('ZCLAW Runtime Preparation');
|
||||
log('='.repeat(60));
|
||||
|
||||
const config = getPlatformConfig();
|
||||
@@ -385,23 +385,23 @@ function main() {
|
||||
let binaryPath = findSystemBinary();
|
||||
|
||||
if (binaryPath) {
|
||||
log(`Found OpenFang in PATH: ${binaryPath}`);
|
||||
log(`Found ZCLAW in PATH: ${binaryPath}`);
|
||||
copyBinary(binaryPath, config);
|
||||
} else {
|
||||
binaryPath = findInstalledBinary();
|
||||
if (binaryPath) {
|
||||
log(`Found installed OpenFang: ${binaryPath}`);
|
||||
log(`Found installed ZCLAW: ${binaryPath}`);
|
||||
copyBinary(binaryPath, config);
|
||||
} else {
|
||||
log('OpenFang not found locally, downloading...');
|
||||
log('ZCLAW not found locally, downloading...');
|
||||
const downloaded = downloadBinary(config);
|
||||
if (!downloaded && !dryRun) {
|
||||
error('Failed to obtain OpenFang binary!');
|
||||
error('Failed to obtain ZCLAW binary!');
|
||||
error('');
|
||||
error('Please either:');
|
||||
error(' 1. Install OpenFang: curl -fsSL https://openfang.sh/install | sh');
|
||||
error(' 2. Set OPENFANG_BIN environment variable to binary path');
|
||||
error(' 3. Manually download from: https://github.com/RightNow-AI/openfang/releases');
|
||||
error(' 1. Install ZCLAW: curl -fsSL https://zclaw.sh/install | sh');
|
||||
error(' 2. Set ZCLAW_BIN environment variable to binary path');
|
||||
error(' 3. Manually download from: https://github.com/RightNow-AI/zclaw/releases');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -415,7 +415,7 @@ function main() {
|
||||
if (dryRun) {
|
||||
log('DRY RUN complete. No files were written.');
|
||||
} else {
|
||||
log('OpenFang runtime ready for build!');
|
||||
log('ZCLAW runtime ready for build!');
|
||||
}
|
||||
log('='.repeat(60));
|
||||
}
|
||||
|
||||
@@ -35,6 +35,6 @@ if (!process.env.TAURI_BUNDLER_TOOLS_GITHUB_MIRROR_TEMPLATE && process.env.ZCLAW
|
||||
env.TAURI_BUNDLER_TOOLS_GITHUB_MIRROR_TEMPLATE = process.env.ZCLAW_TAURI_TOOLS_GITHUB_MIRROR_TEMPLATE;
|
||||
}
|
||||
|
||||
run('node', ['scripts/prepare-openfang-runtime.mjs']);
|
||||
run('node', ['scripts/prepare-zclaw-runtime.mjs']);
|
||||
run('node', ['scripts/preseed-tauri-tools.mjs']);
|
||||
run('pnpm', ['exec', 'tauri', 'build', ...forwardArgs], env);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* OpenFang Backend API Connection Test Script
|
||||
* ZCLAW Backend API Connection Test Script
|
||||
*
|
||||
* Tests all API endpoints used by the ZCLAW desktop client against
|
||||
* the OpenFang Kernel backend.
|
||||
* the ZCLAW Kernel backend.
|
||||
*
|
||||
* Usage:
|
||||
* node desktop/scripts/test-api-connection.mjs [options]
|
||||
*
|
||||
* Options:
|
||||
* --url=URL Base URL for OpenFang API (default: http://127.0.0.1:50051)
|
||||
* --url=URL Base URL for ZCLAW API (default: http://127.0.0.1:50051)
|
||||
* --verbose Show detailed output
|
||||
* --json Output results as JSON
|
||||
* --timeout=MS Request timeout in milliseconds (default: 5000)
|
||||
@@ -41,12 +41,12 @@ for (const arg of args) {
|
||||
config.timeout = parseInt(arg.slice(10), 10);
|
||||
} else if (arg === '--help' || arg === '-h') {
|
||||
console.log(`
|
||||
OpenFang API Connection Tester
|
||||
ZCLAW API Connection Tester
|
||||
|
||||
Usage: node test-api-connection.mjs [options]
|
||||
|
||||
Options:
|
||||
--url=URL Base URL for OpenFang API (default: ${DEFAULT_BASE_URL})
|
||||
--url=URL Base URL for ZCLAW API (default: ${DEFAULT_BASE_URL})
|
||||
--verbose Show detailed output including response bodies
|
||||
--json Output results as JSON for programmatic processing
|
||||
--timeout=MS Request timeout in milliseconds (default: ${DEFAULT_TIMEOUT})
|
||||
@@ -324,7 +324,7 @@ function printSummary() {
|
||||
* Run all API tests
|
||||
*/
|
||||
async function runAllTests() {
|
||||
console.log(`\n=== OpenFang API Connection Test ===`);
|
||||
console.log(`\n=== ZCLAW API Connection Test ===`);
|
||||
console.log(`Base URL: ${config.baseUrl}`);
|
||||
console.log(`Timeout: ${config.timeout}ms`);
|
||||
console.log(`\n`);
|
||||
|
||||
@@ -13,7 +13,7 @@ websocket_port = 4200
|
||||
websocket_path = "/ws"
|
||||
|
||||
[agent.defaults]
|
||||
workspace = "~/.openfang/workspace"
|
||||
workspace = "~/.zclaw/workspace"
|
||||
default_model = "gpt-4"
|
||||
|
||||
[llm]
|
||||
|
||||
Reference in New Issue
Block a user