@buoy-gg/agent-core

中文文档
7.0.87发布于 2026/11/07TypeScriptESM + CJS零依赖近 30 天下载 5187

Headless agent core for Ask Buoy - the tool catalog, BYO-model providers, turn loop and effect ledger that let an LLM drive Buoy devtools

原始使用文档
文档目录3 节
  1. Use it
  2. Docs
  3. License

@buoy-gg/agent-core

The headless engine used by Ask Buoy. It has no React, React Native, or Node built-in imports.

It provides:

  • The tool catalog — Buoy tool actions, generated from one source file. JSON-Schema params validated before dispatch, per-action effect classes (read / write / destructive), and per-action release-build truth: actions requiring development-only capabilities are refused with an explanation, never allowed to fake success. Parameter schemas describe the names and values accepted by each action.
  • The turn loop — provider streaming (Anthropic and OpenAI wire shapes, with prompt caching where the provider offers it), tool dispatch with independent reads overlapped, result redaction (credential field names and value shapes), self-traffic stripping, loop detection, history compression before rounds are dropped, and step and time caps — with a stopReason on every done, the rounds holding a still-applied change dropped from memory last, and a throttled or oversized request retried narrowly: only when the stream produced nothing, so nothing runs twice.
  • The evidence store — every result kept in full after redaction, so ask-buoy.retrieve can read any part of a result cut at 24k, or re-read exactly what the model saw before a write. Session-scoped, in memory, never persisted.
  • Outcome checks — five writes are read back after they land (storage, store and cache edits, navigation, override rules); the verdict rides in the tool result and on a tool-verified event: verified / unverified (landed, not yet visible — and what would make it so) / failed (one correction, never a repeat).
  • Token calibration — budgets stated in tokens and converted at a ratio measured from the provider's own usage reports, not a guessed 4 chars/token.
  • The grounding digest — a compact, values-free picture of the running app built from the tools themselves: route paths, storage and store key names, mounted-first query keys, and the item shape of every non-empty list in a store, with empty lists named as unknown rather than left to a guess. Bounded in depth, width and total characters, so a store keyed by a few hundred records can't turn a "compact" sketch into the largest thing in the prompt.
  • The effect ledger — what the agent changed and how to put it back. Storage writes and query-cache edits are pre-read so undo restores exact prior values; whatever can't be undone is reported as permanent rather than hidden.
  • Policy — approval gates (destructive waits for a human tap by default), allow/deny rules, per-call approval, read-only mode, and a SecureStore-values gate that is off by default. requestApproval may resolve { approved, reason, trust }: a note with a decline reaches the model verbatim, and trust waives the card for that action for the session — approval only, never past policy.
  • Procedures — context.procedures are the app's playbooks; only id — summary is in the prompt, the body is served by the engine-served ask-buoy.openProcedure.
  • Blocks — the closed, declarative UI catalog (buoy_ui) the model authors rich responses with, plus engine-made receipts projected from tool results.

A host supplies the model endpoint, protocol, model, available actions, and a dispatch(toolId, action, params) function. The host must also enforce account access, authenticate model requests, and handle permissions and lifecycle events.

Use it

For the React Native chat interface, use @buoy-gg/ask-buoy, the React Native chat sheet built on this. It installs this engine as a dependency.

Direct use is for custom hosts. This is an integration sketch: endpoint, model, myDispatch, and availableActions come from your host; it is not a standalone app.

import { createAskBuoySession } from "@buoy-gg/agent-core";

const session = createAskBuoySession({
  endpoint, protocol: "anthropic", model,
  dispatch: myDispatch,           // (toolId, action, params) => Promise<unknown>
  availableActions,               // what this host can actually reach
  isRelease: false,
});

for await (const event of session.send("what did the last network call return?")) {
  // text deltas, reasoning, tool starts/ends, blocks, approvals, token usage
}

The built-in catalog validates supported actions and their parameters. Expose only actions your host can dispatch, and consult the Ask Buoy configuration guide for policy and custom-tool integration.

Docs

buoy.gg/docs/tools/ask-buoy

License

See buoy.gg for licensing.

版本与发布记录

@buoy-gg/agent-core 共发布 54 个版本,首次发布于 2026/09/03;过去 12 个月发布了 54 个版本。

版本发布日期距今
7.0.87latest2026/11/071 天前
7.0.862026/11/062 天前
7.0.852026/11/053 天前
7.0.842026/11/035 天前
7.0.832026/11/035 天前
7.0.822026/11/036 天前

关于 @buoy-gg/agent-core 的常见问题

@buoy-gg/agent-core 是什么?

Headless agent core for Ask Buoy - the tool catalog, BYO-model providers, turn loop and effect ledger that let an LLM drive Buoy devtools

如何安装 @buoy-gg/agent-core?

在项目目录运行 npm install @buoy-gg/agent-core,或使用 pnpm add / yarn add / bun add。

@buoy-gg/agent-core 支持 TypeScript 吗?

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

@buoy-gg/agent-core 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@buoy-gg/agent-core 可以商用吗?

@buoy-gg/agent-core 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@buoy-gg/agent-core 的下载量有多少?

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

@buoy-gg/agent-core 还在维护吗?

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