@aphrody/runtime-sdk

中文文档
1.4.7发布于 2026/10/23MIT AND Apache-2.0TypeScriptES Module近 30 天下载 4953

Light TypeScript SDK of the YOLO native runtime: loads the precompiled library through its versioned C ABI

原始使用文档

@aphrody/runtime-sdk

Light TypeScript SDK of the YOLO native runtime: loads the precompiled yolo_runtime library through its versioned C ABI with bun:ffi. Core modules are runtime:system and runtime:process; optional clients are runtime:desktop and runtime:browser. Nothing here compiles an engine. See the repository's runtime ABI and runtime decisions.

import { Runtime } from "@aphrody/runtime-sdk";

using runtime = Runtime.load(); // verified artifact, ABI negotiated first
using child = runtime.spawn({
  program: "server",
  args: ["--port", "8080"],
  stdio: "capture",
});
await child.waitForHttp({ port: 8080, path: "/health" });
await child.stopAsync(2000);

Library resolution: $YOLO_RUNTIME_LIB, then the installed artifact ($YOLO_RUNTIME_HOME/<target>/current, default ~/.yolo/runtime), then target/runtime/ of the this Bun OS checkout. Install with just yolo::runtime-install, roll back with just yolo::runtime-rollback.

For one-shot binary output, ABI 1.4 provides lossless capture with an explicit budget. Overflow rejects with RuntimeError / Status.OutputLimit; no successful response is truncated. The existing capture mode remains a 64 KiB diagnostic tail.

using runtime = Runtime.load();
using child = runtime.spawn({
  program: "converter",
  args: ["input"],
  stdio: "capture-lossless",
  maxOutputBytes: 8 * 1024 * 1024, // per stream, total across all drains
});
const { stdout, stderr, status } = await child.collectOutput({
  timeoutMs: 30_000,
});
// stdout/stderr are owned Uint8Arrays; arbitrary bytes survive without UTF-8 decoding.

collectOutput stops the child on timeout, abort or capture error, and drains terminal output after joined-reader shutdown. The caller releases the handle. Native capture workers are joined before process release/runtime destroy returns. After runtime close, SDK handles reject further native calls and can be disposed without entering unloaded code. Unix shutdown covers the owned process group; Windows process-tree shutdown and runtime behavior on other targets still need execution qualification.

Optional clients load without activating either engine. Desktop opens a separately installed yolo-desktop CEF host through the shared process supervisor. Import @aphrody/runtime-sdk/desktop and call desktop.open with explicit grants and exact allowedOrigins; dispose the session to close its windows and join its host. Verified desktop installation helpers are exported from @aphrody/runtime-sdk/desktop-artifact.

Import @aphrody/runtime-sdk/browser and call BrowserRuntime.load to use the optional native browser provider. Core ABI and browser.* capabilities are negotiated before any extension symbol is bound. Each context requires exact HTTP(S) allowedOrigins; private-network access needs an explicit context opt-in. Contexts own isolated in-memory cookies and JavaScript realms. Navigation, extraction, evaluation and PNG capture accept cancellation; disposing their owner joins the native workers before library unload.

These SDK APIs do not establish native rendering or distribution qualification. An ABI 1.4 core artifact lacks browser capabilities, and desktop requires its own verified native executable (it ships its CEF payload) plus the platform GTK 4 prerequisites on Linux. Native provider and target support remain subject to their actual build and execution gates.

版本与发布记录

@aphrody/runtime-sdk 共发布 7 个版本,首次发布于 2026/10/05;过去 12 个月发布了 7 个版本。

版本发布日期距今
1.4.7latest2026/10/2315 天前
1.4.42026/10/1820 天前
0.1.42026/10/1028 天前
0.1.32026/10/1029 天前
0.1.22026/10/0929 天前
0.1.12026/10/071 个月前

关于 @aphrody/runtime-sdk 的常见问题

@aphrody/runtime-sdk 是什么?

Light TypeScript SDK of the YOLO native runtime: loads the precompiled library through its versioned C ABI

如何安装 @aphrody/runtime-sdk?

在项目目录运行 npm install @aphrody/runtime-sdk,或使用 pnpm add / yarn add / bun add。

@aphrody/runtime-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aphrody/runtime-sdk 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@aphrody/runtime-sdk 可以商用吗?

@aphrody/runtime-sdk 使用 MIT AND Apache-2.0 许可。声明的许可为 MIT AND Apache-2.0,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@aphrody/runtime-sdk 的下载量有多少?

根据 npm 官方下载统计,@aphrody/runtime-sdk 在 2026/10/06 – 2026/11/04 这 30 天内被下载 4,953 次,日均约 165 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aphrody/runtime-sdk 还在维护吗?

最新版本 1.4.7 发布于 2026/10/23(15 天前);至今共发布 7 个版本,其中过去 12 个月发布了 7 个;首次发布于 2026/10/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。