@collective-intelligence/extensions-sdk-frontend

中文文档
0.2.5发布于 2026/11/09TypeScriptES Module近 30 天下载 6886

Framework-neutral frontend declaration, catalog, and activation contracts for Collective Intelligence extension packages.

原始使用文档

@collective-intelligence/extensions-sdk-frontend

Framework-neutral declaration, catalog, and activation contracts for frontend extension packages. The package has no React or host-application dependency, so third-party extensions can publish declarations without depending on private platform packages.

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()
})

Use the optional load callback to make renderer imports visible to bundlers. Hosts supporting this callback load its module namespace lazily, then select exportName; module remains available for diagnostics and import fallback when no callback is supplied. Declaration and catalog activation never invoke the callback. The callback, module locator, and export name are runtime sidecars: canonical frontend manifests and component identity exclude them.

The root entrypoint is the public import surface. Internally, declarations/ owns immutable authoring values, catalog/ owns exact binding validation and resolution, and admitFrontendCatalog owns dynamic loader and authorized-result admission.

The /effect entrypoint is empty: this package has no I/O client and no Expected Error, so it has no Effect service. Its loaders come from the host. effect (^4.1.0) is a required peer dependency: the app installs one copy of effect, and the package build keeps it external.

Every Dashboard or Studio release contribution uses frontend-catalog/v1 and the fixed loadFrontendCatalog export. Admission checks logical and physical provenance, callable and async loader behavior, package/component ownership, and exact binding uniqueness before returning an immutable declaration set. Admission keeps each component's load callback and rejects a component whose load is not callable; a bundled Host cannot import a renderer by module, because its chunk exports minified names. This contract does not admit navigation, root-page, or shell contributions.

Declarations carry exact package, FQN, version, and role identity. Module references are runtime sidecars and are excluded from canonical declaration serialization. A component's target version identifies its own contract and may differ from the containing package release version. Canonical JSON and package identity come from @collective-intelligence/extensions-sdk; React loading, rendering, and hosted diagnostics live in @collective-intelligence/extensions-sdk-frontend-react/frontend.

版本与发布记录

@collective-intelligence/extensions-sdk-frontend 共发布 39 个版本,首次发布于 2026/10/08;过去 12 个月发布了 39 个版本。

版本发布日期距今
0.2.5latest2026/11/09今天
0.2.42026/11/091 天前
0.2.32026/11/063 天前
0.2.22026/11/055 天前
0.2.12026/11/055 天前
0.2.02026/11/055 天前

关于 @collective-intelligence/extensions-sdk-frontend 的常见问题

@collective-intelligence/extensions-sdk-frontend 是什么?

Framework-neutral frontend declaration, catalog, and activation contracts for Collective Intelligence extension packages.

如何安装 @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 和提交记录判断。