Files
elizaos--eliza/packages/feed/scripts/postinstall-agent-frameworks.ts
wehub-resource-sync 426e9eeabd
Voice Workbench / headless workbench (mocked backends) (push) Has been cancelled
Voice Workbench / real acoustic lane (nightly, provisioned only) (push) Has been cancelled
ci / test (push) Has been cancelled
ci / lint-and-format (push) Has been cancelled
ci / build (push) Has been cancelled
ci / dev-startup (push) Has been cancelled
gitleaks / gitleaks (push) Has been cancelled
Markdown Links / Relative Markdown Links (push) Has been cancelled
Quality (Extended) / Homepage Build (PR smoke) (push) Has been cancelled
Quality (Extended) / Comment-only diff guard (push) Has been cancelled
Quality (Extended) / Format + Type Safety Ratchet (push) Has been cancelled
Quality (Extended) / Develop Gate (secret scan + UI determinism) (push) Has been cancelled
Quality (Extended) / Develop Gate (lint) (push) Has been cancelled
Chat shell gestures / Chat shell gesture + parity e2e (push) Has been cancelled
Cloud Gateway Discord / Test (push) Has been cancelled
Benchmark Bridge Tests / benchmark (bunx @biomejs/biome check packages/lifeops-bench/src, benchmark-lint) (push) Has been cancelled
Benchmark Bridge Tests / benchmark (bunx vitest run --config packages/lifeops-bench/vitest.config.ts --root packages/lifeops-bench --passWithNoTests, benchmark-tests) (push) Has been cancelled
Build Agent Image / build-and-push (push) Has been cancelled
Dev Smoke / bun run dev onboarding chat (push) Has been cancelled
Dev Smoke / Vite HMR dependency-level smoke (push) Has been cancelled
Electrobun Submodule Guard / electrobun gitlink is fetchable (push) Has been cancelled
Publish @elizaos/example-code / check_npm (push) Has been cancelled
Publish @elizaos/example-code / publish_npm (push) Has been cancelled
Publish @elizaos/plugin-elizacloud / verify_version (push) Has been cancelled
Publish @elizaos/plugin-elizacloud / publish_npm (push) Has been cancelled
Sandbox Live Smoke / Sandbox live smoke (push) Has been cancelled
Snap Build & Test / Build Snap (amd64) (push) Has been cancelled
Snap Build & Test / Build Snap (arm64) (push) Has been cancelled
Test Packaging / elizaos CLI global-install smoke (node + bun) (push) Has been cancelled
Cloud Gateway Webhook / Test (push) Has been cancelled
Cloud Tests / lint-and-types (push) Has been cancelled
Cloud Tests / unit-tests (push) Has been cancelled
Cloud Tests / integration-tests (push) Has been cancelled
Cloud Tests / e2e-tests (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Apps Worker (Product 2) / Determine environment (push) Has been cancelled
Deploy Apps Worker (Product 2) / Deploy apps worker to apps-control host (${{ needs.determine-env.outputs.environment }}) (push) Has been cancelled
Deploy Eliza Provisioning Worker / Determine environment (push) Has been cancelled
Deploy Eliza Provisioning Worker / Deploy worker to Hetzner host (${{ needs.determine-env.outputs.environment }} @ ${{ needs.determine-env.outputs.deployment_sha }}) (push) Has been cancelled
Dev Smoke / Classify changed paths (push) Has been cancelled
supply-chain / sbom (push) Has been cancelled
supply-chain / vulnerability-scan (push) Has been cancelled
Build, Push & Deploy to Phala Cloud / build-and-push (push) Has been cancelled
Test Packaging / Validate Packaging Configs (push) Has been cancelled
Test Packaging / Build & Test PyPI Package (push) Has been cancelled
Test Packaging / PyPI on Python ${{ matrix.python }} (push) Has been cancelled
Test Packaging / Pack & Test JS Tarballs (push) Has been cancelled
UI Fixture E2E / ui-fixture-e2e (push) Has been cancelled
UI Fixture E2E / fixture-e2e (push) Has been cancelled
UI Story Gate / story-gate (push) Has been cancelled
vault-ci / test (macos-latest) (push) Has been cancelled
vault-ci / test (ubuntu-latest) (push) Has been cancelled
vault-ci / test (windows-latest) (push) Has been cancelled
vault-ci / app-core wiring tests (push) Has been cancelled
verify-patches / verify patches/CHECKSUMS.sha256 (push) Has been cancelled
Voice Benchmark Smoke / voice-emotion fixture smoke (push) Has been cancelled
Voice Benchmark Smoke / voiceagentbench fixture smoke (push) Has been cancelled
Voice Benchmark Smoke / voicebench-quality unit smoke (push) Has been cancelled
Voice Benchmark Smoke / voicebench TypeScript unit (no audio) (push) Has been cancelled
Voice Benchmark Smoke / voice bench smoke summary (push) Has been cancelled
Windows CI / windows ([bun run --cwd packages/app-core test bun run --cwd packages/elizaos test bun run --cwd packages/cloud/shared test], app-and-cli) (push) Has been cancelled
Windows CI / windows ([bun run --cwd packages/scenario-runner test bun run --cwd packages/vault test bun run --cwd packages/security test bun run --cwd plugins/plugin-coding-tools test], framework-packages) (push) Has been cancelled
Windows CI / windows ([bun run --cwd plugins/plugin-elizacloud test bun run --cwd plugins/plugin-discord test bun run --cwd plugins/plugin-anthropic test bun run --cwd plugins/plugin-openai test bun run --cwd plugins/plugin-app-control test bun run --cwd plugins/pl… (push) Has been cancelled
Windows CI / windows ([node packages/scripts/run-turbo.mjs run build --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/agent --concurrency=4 node packages/scripts/run-bash-linux-only.mjs scripts/verify-riscv64-buildpaths.sh node packages/scripts/run… (push) Has been cancelled
Windows CI / windows ([node packages/scripts/run-turbo.mjs run typecheck --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/cloud-shared --concurrency=4 bun run --cwd packages/core test bun run --cwd packages/shared test], core-runtime, 75) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:43:05 +08:00

261 lines
7.5 KiB
TypeScript

#!/usr/bin/env bun
/**
* Bootstrap external agent frameworks and simulator sources needed by ScamBench.
*
* This script is intentionally idempotent and best-effort:
* - clones public repos when missing
* - installs/builds Hermes and OpenClaw
* - clones Eliza for reference while the benchmark bridge uses Feed's local packages
* - prepares ClawBench and its TrajectoryRL OpenClaw fork for deterministic simulation
* - reports missing provider API keys needed for live benchmark runs
*/
import { existsSync, mkdirSync, readFileSync } from "node:fs";
import { join } from "node:path";
type FrameworkSpec = {
name: string;
repoUrl: string;
repoPath: string;
install?: () => Promise<void>;
};
const FEED_ROOT = join(import.meta.dir, "..");
const WORKSPACE_ROOT = join(FEED_ROOT, "..");
const EXTERNAL_SOURCES_ROOT = join(WORKSPACE_ROOT, "external-sources");
function readEnvFiles(): Record<string, string> {
const merged: Record<string, string> = {};
for (const file of [
join(WORKSPACE_ROOT, ".env"),
join(WORKSPACE_ROOT, ".env.local"),
join(FEED_ROOT, ".env"),
join(FEED_ROOT, ".env.local"),
]) {
if (!existsSync(file)) continue;
const content = readFileSync(file, "utf8");
for (const rawLine of content.split(/\r?\n/)) {
const line = rawLine.trim();
if (!line || line.startsWith("#") || !line.includes("=")) continue;
const [rawKey, ...rest] = line.split("=");
const key = rawKey.trim();
const value = rest
.join("=")
.trim()
.replace(/^['"]|['"]$/g, "");
if (key) merged[key] = value;
}
}
for (const [key, value] of Object.entries(process.env)) {
if (typeof value === "string") merged[key] = value;
}
return merged;
}
async function runCommand(
command: string[],
cwd: string,
extraEnv?: Record<string, string>,
): Promise<void> {
const proc = Bun.spawn(command, {
cwd,
env: { ...process.env, ...extraEnv },
stdout: "inherit",
stderr: "inherit",
});
const exitCode = await proc.exited;
if (exitCode !== 0) {
throw new Error(`${command.join(" ")} failed with exit code ${exitCode}`);
}
}
async function ensureRepo(spec: FrameworkSpec): Promise<void> {
if (existsSync(spec.repoPath)) {
console.log(` ✓ ${spec.name}: repository present`);
return;
}
console.log(` ⬇ ${spec.name}: cloning ${spec.repoUrl}`);
await runCommand(
["git", "clone", "--depth", "1", spec.repoUrl, spec.repoPath],
WORKSPACE_ROOT,
);
}
async function ensureHermes(): Promise<void> {
const repoPath = join(EXTERNAL_SOURCES_ROOT, "hermes-agent");
const venvPython = join(repoPath, ".venv", "bin", "python");
if (!existsSync(join(repoPath, "pyproject.toml"))) {
console.log(" ⚠️ Hermes: pyproject.toml missing, skipping install");
return;
}
if (!existsSync(venvPython)) {
console.log(" 📦 Hermes: creating .venv");
await runCommand(["uv", "venv", ".venv", "--python", "python3"], repoPath);
} else {
console.log(" ✓ Hermes: .venv already present");
}
console.log(" 📦 Hermes: installing editable package");
await runCommand(
["uv", "pip", "install", "--python", venvPython, "-e", "."],
repoPath,
);
}
async function ensureOpenClaw(): Promise<void> {
const repoPath = join(EXTERNAL_SOURCES_ROOT, "openclaw");
const builtEntry = join(repoPath, "dist", "index.js");
if (!existsSync(join(repoPath, "package.json"))) {
console.log(" ⚠️ OpenClaw: package.json missing, skipping install");
return;
}
console.log(" 📦 OpenClaw: installing dependencies");
await runCommand(
["corepack", "pnpm", "install", "--frozen-lockfile"],
repoPath,
);
if (!existsSync(builtEntry)) {
console.log(" 🏗 OpenClaw: building dist");
await runCommand(["corepack", "pnpm", "build"], repoPath);
} else {
console.log(" ✓ OpenClaw: dist already built");
}
}
async function ensureElizaReferenceClone(): Promise<void> {
const repoPath = join(EXTERNAL_SOURCES_ROOT, "eliza");
if (existsSync(repoPath)) {
console.log(" ✓ ElizaOS: repository present");
return;
}
console.log(" ⬇ ElizaOS: cloning reference repository");
await runCommand(
[
"git",
"clone",
"--depth",
"1",
"https://github.com/elizaos/eliza.git",
repoPath,
],
WORKSPACE_ROOT,
);
console.log(
" ✓ ElizaOS: reference clone ready (ScamBench uses Feed's installed eliza packages at runtime)",
);
}
async function ensureClawBench(): Promise<void> {
const repoPath = join(EXTERNAL_SOURCES_ROOT, "clawbench");
const venvPython = join(repoPath, ".venv", "bin", "python");
if (!existsSync(join(repoPath, "requirements.txt"))) {
console.log(
" ⚠️ ClawBench: requirements.txt missing, skipping host install",
);
return;
}
if (!existsSync(venvPython)) {
console.log(" 📦 ClawBench: creating .venv");
await runCommand(["uv", "venv", ".venv", "--python", "python3"], repoPath);
} else {
console.log(" ✓ ClawBench: .venv already present");
}
console.log(" 📦 ClawBench: installing host runner requirements");
await runCommand(
[
"uv",
"pip",
"install",
"--python",
venvPython,
"-r",
"requirements.txt",
"-r",
"requirements-mock.txt",
],
repoPath,
);
}
async function main() {
if (process.env.FEED_SKIP_AGENT_FRAMEWORKS_BOOTSTRAP === "1") {
console.log(
"🤖 Skipping agent framework bootstrap (FEED_SKIP_AGENT_FRAMEWORKS_BOOTSTRAP=1)",
);
return;
}
console.log("\n🤖 Bootstrapping ScamBench agent frameworks...");
mkdirSync(EXTERNAL_SOURCES_ROOT, { recursive: true });
const frameworks: FrameworkSpec[] = [
{
name: "Hermes",
repoUrl: "https://github.com/NousResearch/hermes-agent.git",
repoPath: join(EXTERNAL_SOURCES_ROOT, "hermes-agent"),
install: ensureHermes,
},
{
name: "OpenClaw",
repoUrl: "https://github.com/openclaw/openclaw.git",
repoPath: join(EXTERNAL_SOURCES_ROOT, "openclaw"),
install: ensureOpenClaw,
},
{
name: "ElizaOS",
repoUrl: "https://github.com/elizaos/eliza.git",
repoPath: join(EXTERNAL_SOURCES_ROOT, "eliza"),
install: ensureElizaReferenceClone,
},
{
name: "ClawBench",
repoUrl: "https://github.com/trajectoryRL/clawbench.git",
repoPath: join(EXTERNAL_SOURCES_ROOT, "clawbench"),
install: ensureClawBench,
},
{
name: "TrajectoryRL OpenClaw",
repoUrl: "https://github.com/trajectoryRL/openclaw.git",
repoPath: join(EXTERNAL_SOURCES_ROOT, "trajectoryrl-openclaw"),
},
];
for (const framework of frameworks) {
try {
await ensureRepo(framework);
if (framework.install) {
await framework.install();
}
} catch (error) {
console.log(
` ⚠️ ${framework.name}: ${
error instanceof Error ? error.message : String(error)
}`,
);
}
}
const env = readEnvFiles();
const missingKeys = [
"OPENAI_API_KEY",
"ANTHROPIC_API_KEY",
"GROQ_API_KEY",
].filter((key) => !env[key]);
if (missingKeys.length > 0) {
console.log(
` ⚠️ Missing supported live-provider keys: ${missingKeys.join(", ")}`,
);
} else {
console.log(
" ✓ Live-provider keys for OpenAI, Anthropic, and Groq are present",
);
}
console.log(" ✅ Agent framework bootstrap complete\n");
}
main().catch((error) => {
console.error("Agent framework bootstrap failed:", error);
process.exit(1);
});