# @equationalapplications/core-llm-tools 中文文档

规范地址：https://npmcn.com/package/%40equationalapplications/core-llm-tools/

版本：8\.4\.0
npm 元数据更新时间：2026-11-12T22:18:14.865Z
中文译文更新时间：2026-11-13T20:56:38.985Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40equationalapplications/core-llm-tools
原文对照：https://npmcn.com/package/%40equationalapplications/core-llm-tools/?lang=original
项目主页：https://equationalapplications.github.io/expo-llm-wiki/packages/core-llm-tools/
源码仓库：https://github.com/equationalapplications/expo-llm-wiki

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：56.9 kB，9 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=20
- 运行依赖：0 个
- 首次发布：2026-05-28T13:58:40.959Z
- 最新版本发布：2026-11-12T22:18:14.528Z
- 近 30 天下载量：4602（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：94（近 12 个月 94 个）

## 中文简介

零依赖双子座函数调用计划与能力范围工具注射用于边缘AI剂. 工作于Node.js,浏览器,以及React Introduct (Hermes).

## 安装

```sh
npm install @equationalapplications/core-llm-tools
```

也可以使用：`pnpm add @equationalapplications/core-llm-tools`、`yarn add @equationalapplications/core-llm-tools`、`bun add @equationalapplications/core-llm-tools`

## README

# @ 方程式应用程序/ 核心工具

零依赖双子座函数调用计划与能力范围工具注射用于边缘AI剂. 工作于Node.js,浏览器,以及React Introduct (Hermes).

[![npm version](https://img.shields.io/npm/v/%40equationalapplications%2Fcore-llm-tools?label=core-llm-tools)](https://www.npmjs.com/package/@equationalapplications/core-llm-tools) [![npm downloads](https://img.shields.io/npm/dm/%40equationalapplications%2Fcore-llm-tools?label=downloads)](https://www.npmjs.com/package/@equationalapplications/core-llm-tools) [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/core-llm-tools/LICENSE)

**[医生](https://equationalapplications.github.io/expo-llm-wiki/)** • 妇女 **[GitHub 图像](https://github.com/equationalapplications/expo-llm-wiki)** • 妇女 **[范围Lab](https://equationalapplications.github.io/expo-llm-wiki/scopelab/)** • 妇女 **[维基解密](https://equationalapplications.github.io/expo-llm-wiki/wiki-demo/)** • 妇女 **[更改日志](https://github.com/equationalapplications/expo-llm-wiki/blob/main/CHANGELOG.md)** • 妇女 **[问题](https://github.com/equationalapplications/expo-llm-wiki/issues)**

> 缩小边际AI(Expo/React Index)和云代理(Cloud Run)之间的差距的通用登记册.

## 概览

`core-llm-tools` 为双子座模型提供JSON函数声明(Tools)的共享,严格类型的寄存器. 通过脱钩 **工具接口** (计划)从 **工具执行** (执行代码),这个软件包允许客户端-侧切换代理和重后端云代理共享完全相同的能力,而无需将Node.js服务器的依赖性导入到浏览器或移动环境.

还引入了强壮的 **基于能力的范围模型** (类似于OAuth 2.0),确保大语言模型只注入用户明确授权的工具.

## 特征

-   **平台不可知论** ——零运行时间依赖关系. 纯类型脚本. 安全地为Node.js,浏览器,以及React Introduct Hermes引擎编译.
-   **基于能力的安全** ——工具被锁定在特定瞄准镜后(例如, `calendar:read`, (中文(简体) ), `messages:send`) (中文(简体) ). 注射器确保模型不能对未经授权的工具产生幻觉.
-   **严格打字** - 提供刚性接口(`AgentToolSchema`, (中文(简体) ), `AgentToolManifest`),防止双子座API请求的畸形.
-   **统一边距/ 云层运行** ——使轻量级边缘模型(类似于双子座纳诺)能够使用重云跑后端使用的完全相同的策略来进行分解意图来执行.
-   **GraphRAG 工具计划** —— 说 `graphTraverseManifest` 财务报告和审定财务报表 `ontologyGetManifest` 用于 GraphRAG 检索 API 的预建双子工具计划;见 [GraphRAG 指南](https://equationalapplications.github.io/expo-llm-wiki/guides/graphrag/)。 。 。 .

## 安装

```bash
npm install @equationalapplications/core-llm-tools
# or
pnpm add @equationalapplications/core-llm-tools
```

## 快速启动

### 1\. 界定工具说明

工具的定义是通过将标准的双子座JSON schema包入一个需要的安全范围.

```typescript
import type { AgentToolManifest } from '@equationalapplications/core-llm-tools';

export const getCalendarEventsManifest: AgentToolManifest = {
  name: 'get_calendar_events',
  scope: 'calendar:read', // Security scope required to use this tool
  schema: {
    name: 'get_calendar_events',
    description: 'Fetch the user\'s schedule for a given date.',
    parameters: {
      type: 'object',
      properties: {
        date: { type: 'string' }
      }
    }
  }
};
```

### 2\. 注入授权工具

运行时使用 `buildAuthorizedToolsArray` 以用户的权限过滤工具库。 它会把双子座完全送回来 `tools[]` 数组:最多一个 `functionDeclarations` group 包含每个授权函数工具的 schema,每个授权内置工具外加一个条目(如Google Search grounding).

```typescript
import { buildAuthorizedToolsArray, escalateToCloudManifest } from '@equationalapplications/core-llm-tools';

// 1. Gather all manifests known to your app
const allAppTools = [escalateToCloudManifest, getCalendarEventsManifest];

// 2. Fetch the user's authorized scopes from your DB (e.g., SQLite/Postgres)
const userGrantedScopes = ['calendar:read'];

// 3. The injector automatically includes 'core' tools and authorized scoped tools,
//    collapsing all authorized function tools into a single functionDeclarations group
const tools = buildAuthorizedToolsArray(allAppTools, userGrantedScopes);
// => [{ functionDeclarations: [get_calendar_events, escalate_to_cloud] }]

// 4. Pass safely to Gemini
const response = await ai.models.generateContent({
  model: 'gemini-flash-latest',
  contents: userInput,
  config: { tools }, // @google/genai reads tools only from config
});
```

### 3\. 内建工具(轮廓)

> 这里"Grounding"指双子座的服务器-侧谷歌搜索工具. 这与 `core-llm-wiki`证据查证(`WikiConfig.grounding`以核实事实来源.

一些双子座能力,比如 [Google 搜索定位](https://ai.google.dev/gemini-api/docs/google-search), (中文(简体) ), 由 Google 执行内置工具, 而不是功能声明您的代码 执行。 兹以 `kind: 'built_in'` 和流经相同的 作为功能工具的能力范围模型,通过 `buildAuthorizedToolsArray`。 。 。 . 使用 `AnyAgentToolManifest` 当混合功能和内置显示时; `AgentToolManifest` 仍然是现有呼叫者的仅函数类型:

```typescript
import type { AnyAgentToolManifest } from '@equationalapplications/core-llm-tools';
import { buildAuthorizedToolsArray, googleSearchManifest, escalateToCloudManifest } from '@equationalapplications/core-llm-tools';

const allAppTools: AnyAgentToolManifest[] = [escalateToCloudManifest, googleSearchManifest];
const userGrantedScopes: string[] = [];

// Returns the full Gemini tools[] array: a functionDeclarations group (if any
// function tools are authorized) plus one entry per authorized built-in tool.
const tools = buildAuthorizedToolsArray(allAppTools, userGrantedScopes);
// => [{ functionDeclarations: [...] }, { googleSearch: {} }]
// The manifest is named `google_search`; the wire key is `googleSearch`,
// the only spelling @google/genai reads. The REST API accepts it too.
// The GeminiToolEntry type accepts both spellings, so call sites written
// against the pre-rename `google_search` shape keep compiling.

const response = await ai.models.generateContent({
  model: 'gemini-flash-latest',
  contents: userInput,
  config: { tools }, // @google/genai reads tools only from config
});
```

> **说明:** 当模型使用时 `google_search`双子座返回 a `groundingMetadata` 对象 (搜索查询,来源引用等)对答复. 解析元数据是 caller's responsibility——这个软件包只处理请求方工具声明.

### 内存表

`ontology_get` (单位:千美元)`ontologyGetManifest`, (中文(简体) ), `graph_traverse` (单位:千美元)`graphTraverseManifest`),以及 `instructions_get` (单位:千美元)`instructionsGetManifest`) 仅是计划 `memory:read` 工具。 派他们去 `WikiMemory.getOntologyManifest`, (中文(简体) ), `traverseGraph`,以及 `getInstructions`。 。 。 . `instructions_get` 返回您的帐号 `WikiConfig.prompts` 超音速 保密 名字跟Synapse Tree的一样 `<resource>_<verb>` 公约》的执行情况 `@equationalapplications/mcp-server` 工具也会使用.

### 在8.0.0中被删除: `wiki_*` 工具名称

| 删除导出( 工具名) | 改为使用 |
| --- | --- |
| `wikiTraverseGraphManifest` (单位:千美元)`wiki_traverse_graph`(中文(简体) ) | `graphTraverseManifest` (单位:千美元)`graph_traverse`(中文(简体) ) |
| `wikiGetOntologyManifest` (单位:千美元)`wiki_get_ontology`(中文(简体) ) | `ontologyGetManifest` (单位:千美元)`ontology_get`(中文(简体) ) |
| `wikiGetInstructionsManifest` (单位:千美元)`wiki_get_instructions`(中文(简体) ) | `instructionsGetManifest` (单位:千美元)`instructions_get`(中文(简体) ) |

`LEGACY_TOOL_NAMES` 财务报告和审定财务报表 `canonicalToolName` 被删除。 申报新名单,并按新姓名发出. 一个仍然告诉一个模型调用旧名的被存储的提示器必须更新,因为该模型不再有这个名字的工具.

## 有用资源与链接

-   [Google Gen AI: 函数调用教程](https://ai.google.dev/gemini-api/docs/function-calling) ——关于这个包中的JSON计划如何与双子座模型相互作用的官方文献.
-   [JSON Schema 规格](https://json-schema.org/understanding-json-schema/) - 结构基础 `AgentToolSchema.parameters`。 。 。 .
-   [OAuth 2.0 范围概念](https://oauth.net/2/scope/) - 以能力为基础的启发 `AgentScope` 允许等级.
-   [@google/adk (代理开发工具包)](https://github.com/google/adk-python) —— Cloud Run后端使用的服务器侧框架来包接和执行本包所定义的策略.

## 莫诺雷波生态系统

| 软件包 | 目的 |
| --- | --- |
| [@ 方程式应用程序/ core-llm-wiki](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/core/README.md) | 持续的零星记忆 |
| [@ 方程式应用程序/ expo- llm- wiki](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/expo/README.md) | 世博会/反应原生器的持久性瞬间记忆 |
| [@ 方程式应用/ react-llm-wiki](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/react/README.md) | Web 的持续的零星记忆 |
| [@equental applications/prisma-outbox (英语)](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/prisma-outbox/README.md) | 同步 SQLite 发件箱事件到 Prisma |
| [**@ 方程式应用程序/ 核心工具**](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/core-llm-tools/README.md) | 双子座工具计划和能力注射器 |
| [@ 方程式应用程序/ core-okf](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/okf/README.md) | 零依赖开放知识格式 (OKF) v0.1 + v0.2 原始人——剖析并生成可互通的知识捆. |
| [@equationalapplications/schema-org-llm-wiki (英语)](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/schema-org/README.md) | Cured schema.org 温剂肿瘤特征表 |
| [@equental应用程序/schema-software-org](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/schema-software-org/README.md) | 软件组织执行本体学表——17个节点类型,40个边缘,热剂超集,只数据 |
| [@ 公式应用程序/ mcp- server](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/mcp-server/README.md) | MCP 服务器向编码代理显示 SynapseTree 内存工具 |

* * *

由方程式应用有限责任公司制造. [https://equationalapplications.com/ (中文(简体) )](https://equationalapplications.com/)

## 常见问题

### @equationalapplications/core-llm-tools 是什么？

零依赖双子座函数调用计划与能力范围工具注射用于边缘AI剂\. 工作于Node\.js,浏览器,以及React Introduct \(Hermes\)\.

### 如何安装 @equationalapplications/core-llm-tools？

在项目目录运行 npm install @equationalapplications/core-llm-tools，或使用 pnpm add / yarn add / bun add。

### @equationalapplications/core-llm-tools 支持 TypeScript 吗？

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

### @equationalapplications/core-llm-tools 支持 ESM 还是 CommonJS？

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

### @equationalapplications/core-llm-tools 需要什么版本的 Node\.js？

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

### @equationalapplications/core-llm-tools 可以商用吗？

@equationalapplications/core-llm-tools 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @equationalapplications/core-llm-tools 的下载量有多少？

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

### @equationalapplications/core-llm-tools 还在维护吗？

最新版本 8\.4\.0 发布于 2026/11/13（1 天前）；至今共发布 94 个版本，其中过去 12 个月发布了 94 个；首次发布于 2026/05/28。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

