# @collective-intelligence/extensions-sdk-frontend 中文文档

规范地址：https://npmcn.com/package/%40collective-intelligence/extensions-sdk-frontend/

版本：0\.2\.5
npm 元数据更新时间：2026-11-09T15:31:41.951Z
中文译文更新时间：2026-11-10T11:13:02.461Z
软件包许可：未声明

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

原始 npm 页面：https://www.npmjs.com/package/%40collective-intelligence/extensions-sdk-frontend
原文对照：https://npmcn.com/package/%40collective-intelligence/extensions-sdk-frontend/?lang=original

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

- 包体积（解压后）：30.2 kB，15 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：1 个
- peer 依赖：effect ^4\.1\.0
- 首次发布：2026-10-08T14:19:45.423Z
- 最新版本发布：2026-11-09T15:31:41.731Z
- 近 30 天下载量：6886（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：39（近 12 个月 39 个）

## 中文简介

框架中立的前端声明,目录,以及集体情报扩展包的激活合同.

## 安装

```sh
npm install @collective-intelligence/extensions-sdk-frontend
```

也可以使用：`pnpm add @collective-intelligence/extensions-sdk-frontend`、`yarn add @collective-intelligence/extensions-sdk-frontend`、`bun add @collective-intelligence/extensions-sdk-frontend`

## README

# `@collective-intelligence/extensions-sdk-frontend`

前端框架中立声明、目录和激活合同 扩展包。 软件包没有反应或主机应用程序依赖性,所以 第三方扩展可以发布声明,而不取决于私人 平台软件包.

```ts
import {
  admitFrontendCatalog,
  createFrontendCatalog,
  declareFrontendCatalogContribution,
  declareFrontendComponent,
  declareFrontendPackage
} from "@collective-intelligence/extensions-sdk-frontend"

const field = declareFrontendComponent({
  target: {
    fqn: "com.acme.crm.fields.customer",
    packageFqn: "com.acme.crm",
    role: "render",
    version: "1.0.0"
  },
  implementation: {
    render: {
      exportName: "CustomerField",
      load: () => import("./customer-field"),
      module: "./customer-field"
    }
  }
})

const packageDeclaration = declareFrontendPackage({
  manifest: {
    fqn: "com.acme.crm",
    name: "Acme CRM",
    version: "1.0.0"
  },
  components: [field]
})

const catalog = createFrontendCatalog()
catalog.activate([packageDeclaration])

export const studioCatalog = declareFrontendCatalogContribution({
  fqn: "com.acme.crm.studio.catalog",
  host: "studio",
  load: () => import("./studio-catalog")
})

const admitted = await admitFrontendCatalog({
  authority: {
    logical: {
      ...studioCatalog.manifest,
      contributionFqn: studioCatalog.manifest.fqn,
      packageFqn: "com.acme.crm",
      packageVersion: "1.0.0",
      servingGeneration: 1
    },
    physical: {
      ...studioCatalog.manifest,
      assetDigest: "a".repeat(64),
      carrierPackageFqn: "com.acme.crm",
      contributionFqn: studioCatalog.manifest.fqn,
      extensionReleaseDigest: "b".repeat(64)
    }
  },
  loadedModule: await studioCatalog.load()
})
```

使用可选 `load` 调回,使发件人的进口对捆绑者可见. 支持此调用的主机将模块命名为空闲空间加载, 然后选择 `exportName`· ; `module` 诊断和进口回落 没有提供回调 。 宣言和目录激活 调用。 回调、模块定位器和导出名称为运行时侧车: 犬科前端的特征和组件身份排除了它们.

根入口为公入口地表. 内部, `declarations/` 拥有不可改变的作者值, `catalog/` 拥有精确的绑定 审定和解决,以及 `admitFrontendCatalog` 拥有动态加载器和 授权-结果录取.

这个 `/effect` 条目点为空 : 此软件包没有 I/O 客户端, 没有 预期出错, 因此它没有效果服务 。 它的装载器来自宿主. `effect` (单位:千美元)`^4.1.0`)是需要的对等依赖:应用程序安装一个副本 联 合 国 `effect`,而软件包构建则保持外部.

每个 Dashboard 或 Studio 发布贡献用途 `frontend-catalog/v1` 和固定的 `loadFrontendCatalog` 输出。 入学 核对逻辑和物理来源、可调用和合成加载器行为, 软件包/组件所有权,以及在返回 不可改变的声明设定。 收录每个组件 `load` 回调和 拒绝其 `load` 不可调用; 捆绑的主机无法导入 由 `module`,因为它的块输出 精密的名称。 本合同 不允许导航、根页或外壳贡献.

声明包含精确的软件包,FQN,版本,和角色身份. 模块 参考文献为运行时的侧车并被排除在犬科声明之外 连载化。 一个组件的目标版本确定了自己的合同,并可能 与包含的包放出版本不同. JSON和包装 身份来源于 `@collective-intelligence/extensions-sdk`; 反应加载、渲染和主机 诊断人员居住在 `@collective-intelligence/extensions-sdk-frontend-react/frontend`。 。 。 .

## 常见问题

### @collective-intelligence/extensions-sdk-frontend 是什么？

框架中立的前端声明,目录,以及集体情报扩展包的激活合同\.

### 如何安装 @collective-intelligence/extensions-sdk-frontend？

在项目目录运行 npm install @collective-intelligence/extensions-sdk-frontend，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：effect（^4\.1\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @collective-intelligence/extensions-sdk-frontend 支持 TypeScript 吗？

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

### @collective-intelligence/extensions-sdk-frontend 支持 ESM 还是 CommonJS？

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

### @collective-intelligence/extensions-sdk-frontend 可以商用吗？

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

### @collective-intelligence/extensions-sdk-frontend 的下载量有多少？

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

### @collective-intelligence/extensions-sdk-frontend 还在维护吗？

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

