@fabricorg/sdui-release

中文文档
0.7.17发布于 2026/11/13MITTypeScriptESM + CJS近 30 天下载 2749

Versioned SDUI document, fragment, token-set, component-pack, and promoted release contracts validated independently of any renderer.

原始使用文档
文档目录4 节
  1. What this package owns
  2. Validation
  3. Channel consumption
  4. Relationship to other packages

@fabricorg/sdui-release

Versioned SDUI document, fragment, token-set, component-pack, and promoted release contracts validated independently of any renderer.

The browser-safe @fabricorg/sdui-release/contracts entry adds Release v3 route and tree-scoped grant contracts, RFC 8785 canonicalization, async crypto adapters, ES256 JWS verification, and signed monotonic release-channel pointers. It contains no Node builtin or runtime Platform import. Release v2 and the existing root entry remain compatible.

What this package owns

  • SduiDocument — a versioned tree of fragments with a token-set reference and declared component-pack ranges. variants enumerates every alternative tree a compositor may select at request time; each is validated against the same grants and covered by the release digest, which is what makes "selection may never widen grants" enforceable rather than merely stated.
  • SduiFragment — a node that renders a component, binds data from a capability view, and declares action handlers. Actions are always capability:// references to published action intents — never direct mutations.
  • SduiTokenSet — renderer-neutral design tokens (color, spacing, typography). Two channels consuming the same token set apply the same visual intent through different renderings.
  • SduiComponentPack — a versioned pack of components with prop schemas, slot declarations, and the published artifact digest used by assembly. A federated pack also declares its remote: the entry URL, a subresource-integrity value, and its exposed modules. A federated pack executes whatever its entry serves, so the artifact digest alone describes the pack that was reviewed rather than the code that runs.
  • SduiRelease — a promoted, validated, immutable bundle with a canonical SHA-256 digest. It includes the approved assembly identity and exact authorization grants. Two channels (web, mobile, CLI) can consume the same release while reads and actions remain capability references.

Validation

validateSduiRelease(input) is the single build gate. It rejects:

  • Unknown components — a fragment references a component not in any declared pack or the core vocabulary.
  • Incompatible packs — a component pack version does not satisfy the document's declared range.
  • Unapproved composition — a pack artifact or usage contract does not match the exact generated contract provenance and pack content in the supplied assembly lockfile.
  • Unauthorized data references — a fragment or prop references a capability view that no known contract publishes.
  • Denied data references — a published view is not present in the input's explicit grants.views list. Contract visibility is not authorization. A reference is resolved wherever it sits: at a prop key, inside an array, or nested in either, since an array is the ordinary shape for a list prop.
  • Grants that widen — grants.fragments narrows a fragment subtree to a subset of the release-wide grants, inherited by its children, so a page built from several teams' fragments gets least privilege instead of the union. Narrowing is an intersection, so a fragment entry can never widen, and naming a reference the release does not grant is reported rather than ignored.
  • Unlocked federated remotes — a pack's declared remote does not match the entry and integrity assembly locked, or a remote was added or dropped after locking.
  • Mutation bypasses — an action handler is not a capability:// reference or references an intent no known capability declares.
  • Denied intents — a published action intent is not present in the input's explicit grants.intents list.
  • Broken intent declarations — an experience action intent points to an action ID the capability does not declare.

It returns every finding rather than throwing, so one CI run tells a vertical everything it has to change. Use assertSduiReleaseValid(input) to throw on the first invalid result. Every release input must provide an integrity-verified assembly lockfile and both grant lists:

validateSduiRelease({
  document,
  tokenSet,
  componentPacks,
  contracts: usageContractDocuments,
  assembly,
  grants: {
    views: ["capability://orders/summary"],
    intents: ["capability://orders/submit"],
  },
});

An experience composer or adoption-binding build can derive these references from its reviewed grants. Supplying a contract, or merely finding a matching capability reference, never authorizes a read or mutation.

Channel consumption

createSduiChannel(id, coreComponents) creates a channel that consumes a validated release. The channel verifies the immutable release digest before it checks that every core component the document uses is in its vocabulary; pack-namespaced components are resolved from the release's locked packs. The integrity gate also validates the structure and format of releases loaded from persistence or a network before computing their digest. The channel never interprets or bypasses capability references — it renders fragments and forwards action intents through ProjectionHost (reads) and PlatformHost (actions).

Relationship to other packages

This package depends on @fabricorg/assembly for shared semver resolution, @fabricorg/gen-capability for UsageContractDocument validation, and @fabricorg/platform for PortableJsonSchema. It does not depend on a renderer, a Host, or a specific runtime. SDUI rendering, theming, and composition remain outside the portable kernel and governed Hosts. Separately versioned experience-tier packages support those concerns as established by ADR 0015.

版本与发布记录

@fabricorg/sdui-release 共发布 21 个版本,首次发布于 2026/08/31;过去 12 个月发布了 21 个版本。

版本发布日期距今
0.7.17latest2026/11/131 天前
0.7.162026/11/077 天前
0.7.152026/11/068 天前
0.7.142026/11/0410 天前
0.7.132026/11/0311 天前
0.7.122026/10/3114 天前

关于 @fabricorg/sdui-release 的常见问题

@fabricorg/sdui-release 是什么?

Versioned SDUI document, fragment, token-set, component-pack, and promoted release contracts validated independently of any renderer.

如何安装 @fabricorg/sdui-release?

在项目目录运行 npm install @fabricorg/sdui-release,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@fabricorg/platform(^1.17.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fabricorg/sdui-release 支持 TypeScript 吗?

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

@fabricorg/sdui-release 支持 ESM 还是 CommonJS?

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

@fabricorg/sdui-release 需要什么版本的 Node.js?

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

@fabricorg/sdui-release 可以商用吗?

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

@fabricorg/sdui-release 的下载量有多少?

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

@fabricorg/sdui-release 还在维护吗?

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