@byterover/brv-bridge

中文文档
1.2.0发布于 2026/05/06Elastic-2.0TypeScriptES Module零依赖近 30 天下载 4168

Standard interface for connecting agent frameworks to ByteRover's Context Tree.

原始使用文档
文档目录11 节
  1. Install
  2. Usage
  3. API
  4. new BrvBridge(config)
  5. bridge.ready(): Promise<boolean>
  6. bridge.recall(query, options?): Promise<RecallResult>
  7. bridge.persist(context, options?): Promise<PersistResult>
  8. bridge.search(query, options?): Promise<SearchResult>
  9. bridge.shutdown(): Promise<void>
  10. For adapter authors
  11. License

brv-bridge

Standard interface for connecting agent frameworks to ByteRover's Context Tree.

Any agent harness that implements the bridge gets context sharing for free - recall curated knowledge before a turn, persist new knowledge after a turn, and search the context tree for structured file results.

Install

npm install @byterover/brv-bridge

Prerequisites: ByteRover CLI installed and a space initialized.

Usage

import { BrvBridge } from "@byterover/brv-bridge";

const bridge = new BrvBridge({ cwd: "/path/to/project" });

// Check if brv is set up
if (await bridge.ready()) {
  // Retrieve relevant context (synthesized answer)
  const { content } = await bridge.recall("what did we decide about auth?");

  // Search for structured file results (paths, scores, excerpts)
  const { results } = await bridge.search("authentication");
  for (const r of results) {
    console.log(`${r.title} [${r.score}] — ${r.path}`);
  }

  // Store knowledge
  await bridge.persist("User prefers JWT over session cookies");
}

// Clean up
await bridge.shutdown();

API

new BrvBridge(config)

OptionTypeDefaultDescription
cwdstringprocess.cwd()Working directory with .brv/ initialized
brvPathstring"brv"Path to the brv binary
recallTimeoutMsnumber10000Timeout for recall operations
persistTimeoutMsnumber60000Timeout for persist operations
searchTimeoutMsnumber5000Timeout for search operations
loggerBrvLoggerno-opLogger instance

bridge.ready(): Promise<boolean>

Check if the bridge is configured — verifies cwd exists and has a .brv directory. Does not make network calls.

bridge.recall(query, options?): Promise<RecallResult>

Retrieve relevant context from the Context Tree. Returns { content: "" } on failure — never throws.

Options: signal (AbortSignal), cwd (override per-call).

bridge.persist(context, options?): Promise<PersistResult>

Store context into the Context Tree. Defaults to detach mode (fire-and-forget). Returns { status, message? }.

Options: detach (default true), cwd (override per-call).

bridge.search(query, options?): Promise<SearchResult>

Search the Context Tree for structured file results. Returns ranked results with paths, scores, and excerpts. Pure BM25 retrieval - no LLM, no token cost.

Unlike recall() which returns a synthesized answer, search() returns individual file-level results.

Options: limit (default 10, max 50), scope (path prefix, no trailing slash), cwd (override per-call).

const { results, totalFound } = await bridge.search("authentication", {
  limit: 5,
  scope: "auth",
});
// results: [{ path, title, excerpt, score, symbolKind?, backlinkCount? }]

bridge.shutdown(): Promise<void>

Clean up resources. Adapters should call this for forward compatibility.

For adapter authors

The bridge is designed to be wrapped by framework-specific adapters. Each adapter maps its framework's lifecycle hooks to recall(), persist(), and search():

// OpenClaw adapter example
class ByteRoverContextEngine {
  private bridge = new BrvBridge({ cwd, logger });

  async assemble(params) {
    const { content } = await this.bridge.recall(query);
    // inject content into system prompt
  }

  async afterTurn(params) {
    await this.bridge.persist(serializedConversation);
  }
}

License

Elastic License 2.0 (ELv2)

版本与发布记录

@byterover/brv-bridge 共发布 5 个版本,首次发布于 2026/04/02;过去 12 个月发布了 5 个版本。

版本发布日期距今
1.2.0latest2026/05/066 个月前
1.1.02026/04/116 个月前
1.0.22026/04/037 个月前
1.0.12026/04/037 个月前
1.0.02026/04/027 个月前

关于 @byterover/brv-bridge 的常见问题

@byterover/brv-bridge 是什么?

Standard interface for connecting agent frameworks to ByteRover's Context Tree.

如何安装 @byterover/brv-bridge?

在项目目录运行 npm install @byterover/brv-bridge,或使用 pnpm add / yarn add / bun add。

@byterover/brv-bridge 支持 TypeScript 吗?

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

@byterover/brv-bridge 支持 ESM 还是 CommonJS?

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

@byterover/brv-bridge 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@byterover/brv-bridge 可以商用吗?

@byterover/brv-bridge 使用 Elastic-2.0 许可。声明的许可为 Elastic-2.0,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@byterover/brv-bridge 的下载量有多少?

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

@byterover/brv-bridge 还在维护吗?

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