@cueframe/api-contract

中文文档
7.0.2发布于 2026/11/05Apache-2.0TypeScriptES Module零依赖构建来源已验证近 30 天下载 2295

Versioned OpenAPI contract and composition schemas for the CueFrame video editing and rendering API.

原始使用文档
文档目录5 节
  1. Use the contract
  2. One contract chain
  3. Contents and exports
  4. Version policy
  5. License

@cueframe/api-contract

The sanitized, versioned OpenAPI contract for CueFrame's public API. It is the only supported input for generated SDK, CLI, and MCP clients, and the only copy of the contract any consumer should read.

The package contains the public OpenAPI document, its reviewed operation inventory, the scene-shot JSON Schema with its examples, and two manifests. It intentionally excludes backend source provenance, storage identifiers, provider names, and internal cost data.

import { contractVersion, openApiSha256, operationCount } from "@cueframe/api-contract";
import openApi from "@cueframe/api-contract/openapi.json" with { type: "json" };

Use the contract

npm install @cueframe/api-contract

Requires Node.js 24 or newer for the JavaScript exports. Other languages and generators can read the public OpenAPI JSON directly. Use the versioned npm package when you need reproducible generation.

The contract describes the hosted API at https://api.cueframe.ai; installing it does not run a server. Start with the API reference, API walkthrough, or TypeScript SDK.

One contract chain

private CueFrame API ──sync──▶ cueframe-ai/cueframe-mcp: api/*.json ──build──▶ @cueframe/[email protected] ──▶ consumers
  1. The private API projects its public surface and writes api/openapi.json, api/scene-schema.json, api/scene-examples.json and api/contract-manifest.json into this repository, from one kernel build. The manifest records the kernel version, the private commit and the sha256 of each file as written.
  2. openapi.json carries the kernel's own OpenAPI components (Composition, CompositionOp, SceneShotSpecV2 and its recursive parts, ...) verbatim. This repository regenerates the SDK from it and commits both. api/public-surface.json, the reviewed operation inventory, is maintained here.
  3. pnpm --filter @cueframe/api-contract build copies the five api/*.json files into dist/ as they are committed and writes manifest.json, index.js and index.d.ts.
  4. Everything else reads the npm package: the application repository's MCP tool, composition-op and scene-contract generators and their tests, and any third party. Nothing reads api/ out of a second checkout.

Contents and exports

SubpathFileWhat it is
.dist/index.js, dist/index.d.tsLiteral exports: contractVersion, openApiSha256, operationCount, pathCount, componentCount, kernelVersion, privateCommit, syncedFiles.
./openapi.jsondist/openapi.jsonThe public OpenAPI 3.1 document, scene schema vendored.
./public-surface.jsondist/public-surface.jsonThe reviewed operation inventory; the build fails when the document adds or removes an operation the inventory does not list.
./scene-schema.jsondist/scene-schema.jsonThe canonical scene-shot JSON Schema (SceneShotSpecV2), as the kernel generates it.
./scene-examples.jsondist/scene-examples.jsonWorked scene-shot examples that validate against the schema.
./contract-manifest.jsondist/contract-manifest.jsonThe sync manifest as the private API wrote it (kernelVersion, privateCommit, per-file sha256 of the un-vendored inputs) plus contractVersion.
./manifest.jsondist/manifest.jsonThe build's manifest: contractVersion, the sha256 of the shipped openapi.json, operation/path/component counts, and the sync's fields.
./package.jsonpackage.jsonThe package manifest; resolve it (require.resolve("@cueframe/api-contract/package.json")) to locate the installed package and read its version.

contractVersion is the package version. Two installs that report the same contractVersion carry the same bytes; a consumer that records it alongside privateCommit in the headers of what it generates (the application repository's MCP generators will, once they read this package instead of a local copy) can tell a bumped pin from a regenerated tree.

Version policy

  • The version moves with the contract. Any byte change to one of the five shipped api/*.json files is a new version of this package, because every consumer reads the contract from npm and an npm version is immutable. pnpm check:contract-version (part of pnpm check and CI) fails a commit, pull request or working tree where api/*.json changed against the baseline and packages/api-contract/package.json did not: on main the baseline is the previous commit (HEAD, when the change is still uncommitted); on a branch it is the merge-base with origin/main; CI passes the pull request's base or the push's before commit.
  • Semver by consumer impact. Patch: descriptions, examples, the inventory, additive non-breaking schema detail. Minor: new operations, new optional fields, new schema components. Major: an operation or field removed or renamed, a type narrowed, a required field added, or the scene schema changed incompatibly. The reviewed inventory (public-surface.json) is the checklist: an operation added or removed there is at least a minor.
  • A resync with unchanged content does not move the version. contract-manifest.json carries privateCommit, but the private sync compares the three content files, their hashes, kernelVersion and contractVersion against the committed target and writes nothing when they are equal, so a sync run from a new private commit with identical content leaves the manifest (and its privateCommit) untouched. Only a contract change moves the version; when it does, the sync rewrites the manifest with the new stamp and the rule above applies.
  • The private sync may stamp the version. When api/contract-manifest.json carries contractVersion, it names the package version the sync was run against; the check and the build both fail when it differs from package.json, so a stale sync cannot publish.
  • Changes are recorded in the repository's CHANGELOG.md under @cueframe/api-contract <version>.

License

Apache-2.0. The document is what the hosted API already serves to every caller.

版本与发布记录

@cueframe/api-contract 共发布 21 个版本,首次发布于 2026/10/08;过去 12 个月发布了 21 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
7.0.2latest2026/11/056 天前
7.0.2-ea20261031.12026/11/0110 天前
7.0.12026/10/3111 天前
7.0.02026/10/3111 天前
6.1.02026/10/3111 天前
6.0.22026/10/2319 天前

其他发布通道:next → 3.0.1。

关于 @cueframe/api-contract 的常见问题

@cueframe/api-contract 是什么?

Versioned OpenAPI contract and composition schemas for the CueFrame video editing and rendering API.

如何安装 @cueframe/api-contract?

在项目目录运行 npm install @cueframe/api-contract,或使用 pnpm add / yarn add / bun add。

@cueframe/api-contract 支持 TypeScript 吗?

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

@cueframe/api-contract 支持 ESM 还是 CommonJS?

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

@cueframe/api-contract 需要什么版本的 Node.js?

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

@cueframe/api-contract 可以商用吗?

@cueframe/api-contract 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@cueframe/api-contract 的下载量有多少?

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

@cueframe/api-contract 还在维护吗?

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