Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:777genius Agent teams ai stage runtime mjs

From Leeroopedia
Knowledge Sources
Domains Release, Build
Last Updated 2026-10-22 00:00 GMT

Overview

Concrete CLI tool for downloading, verifying, and staging external runtime binaries from GitHub releases into the Electron app's resources directory, provided by the Agent Teams application.

Description

The stage-runtime.mjs script downloads a pinned runtime binary from a GitHub release, verifies its checksum, extracts it, and places it in `resources/runtime/`. It reads `runtime.lock.json` for the pinned version and platform mapping.

Key behaviors:

  • Lock file: `runtime.lock.json` pins the runtime version and maps platform keys to download URLs.
  • Platform targeting: `--platform <key>` selects the target platform; defaults to the current platform.
  • Release tag override: `--release-tag <tag>` overrides the lock file's release tag.
  • Clean mode: `--clean` removes staged runtime files, keeping `resources/runtime/.gitkeep`.
  • Checksum verification: `verifyRuntimeArchiveChecksum()` verifies the downloaded archive.
  • Payload cache: `runtime-payload-cache.mjs` caches downloaded archives to avoid re-downloading.
  • Error formatting: `formatGitHubReleaseDownloadError()` provides user-friendly errors.
  • Archive extraction: `extractArchive()` from `runtime-payload-cache.mjs` handles archive extraction.

Usage

  • Pre-build staging: Run before `pnpm build` to ensure runtime binaries are in place.
  • CI packaging: Run with `--platform` for cross-platform builds in CI.
  • Clean reset: Run with `--clean` to remove stale runtime files.

Code Reference

Source Location

  • Repository: agent-teams
  • File: scripts/stage-runtime.mjs

Signature

node scripts/stage-runtime.mjs [--platform <key>] [--release-tag <tag>] [--clean] [--help]

Import

# CLI script — run directly with node
node scripts/stage-runtime.mjs --platform darwin-arm64

I/O Contract

Inputs

Name Type Required Description
--platform string No Target platform key (defaults to current platform)
--release-tag string No GitHub release tag (defaults to runtime.lock.json)
--clean flag No Remove staged runtime files, keep .gitkeep

Outputs

Name Type Description
side effect Files Staged runtime binary in resources/runtime/ with checksum verification

Usage Examples

Staging for Current Platform

# Stage runtime for the current platform
node scripts/stage-runtime.mjs

# Runtime binary is placed in resources/runtime/

Cross-Platform Staging

# Stage for a specific platform (e.g., for CI cross-builds)
node scripts/stage-runtime.mjs --platform darwin-arm64
node scripts/stage-runtime.mjs --platform linux-x64
node scripts/stage-runtime.mjs --platform win32-x64

With Release Tag Override

# Override the lock file's release tag
node scripts/stage-runtime.mjs --release-tag v2.1.0

Clean Staged Files

# Remove staged runtime files
node scripts/stage-runtime.mjs --clean
# resources/runtime/.gitkeep is preserved

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment