@happyvertical/smrt-assets-ergot

中文文档
0.62.1发布于 2026/11/17MITTypeScriptES Module近 30 天下载 1.4万

Ergot-backed processing, search, and workflow adapter for SMRT assets

原始使用文档
文档目录6 节
  1. Installation
  2. Quick start
  3. Capabilities
  4. Source references and outputs
  5. Public API
  6. Development

@happyvertical/smrt-assets-ergot

Ergot-backed processing, search, synchronization, and workflow capabilities for the s-m-r-t asset runtime. Applications continue to use @happyvertical/smrt-assets as their asset API and opt into Ergot only at composition time.

Use this adapter when an application needs MAM-backed search, generated media candidates, cloud processors, workflow jobs, or synchronization with an Ergot library. Use smrt-assets-local for lightweight local image processing.

Installation

pnpm add @happyvertical/smrt-assets @happyvertical/smrt-assets-ergot

The adapter is structurally typed around a small consumer client. It does not force every s-m-r-t application to install an Ergot SDK.

Quick start

import { createAssetRuntime } from '@happyvertical/smrt-assets';
import {
  createErgotAssetProcessor,
  type ErgotConsumerAssetClient,
} from '@happyvertical/smrt-assets-ergot';

const ergot: ErgotConsumerAssetClient = createErgotClient();
const runtime = await createAssetRuntime({
  db: 'assets.db',
  storage: './data/assets',
  capabilityProviders: [createErgotAssetProcessor({ client: ergot })],
});

const asset = await runtime.storeSourceAsset(
  'Lead image',
  imageBytes,
  { mimeType: 'image/jpeg', typeSlug: 'image' },
);

const synced = await runtime.syncExternalAsset(asset);
console.log(synced.externalAssetId);

Synchronization uses stable source references and external IDs. A s-m-r-t asset ID and an Ergot asset ID are separate identities and must never be treated as interchangeable.

Capabilities

Asset runtime operationErgot behavior
syncExternalAsset()Idempotently find or upload by source reference
searchNearbyAssets()Query Ergot's tenant-scoped nearby search
ensureVariant()Resolve Ergot delivery variants when available
submitAssetWorkflow()Submit a workflow job with source lineage
processAsset()Delegate supported processing to Ergot

Every request that can expose tenant data must carry tenant scope. Direct asset and job lookups are validated even when the upstream client already scopes list operations.

Source references and outputs

  • sourceRef is the canonical idempotent synchronization key.
  • externalId is used when the consumer already owns a stable upstream key.
  • Generated candidates remain candidates until approved and materialized into the s-m-r-t asset runtime.
  • Variant metadata may reference Ergot delivery URLs without copying bytes.
  • Workflow outputs preserve lineage to both the source asset and Ergot job.

Public API

ExportPurpose
createErgotAssetProcessor()Create the s-m-r-t capability provider
ErgotConsumerAssetClientMinimal client contract a host implements
ErgotAssetSummaryProvider-neutral view of an Ergot asset
ErgotAssetProcessorOptionsClient and source-system configuration

Development

pnpm --filter @happyvertical/smrt-assets-ergot test
pnpm --filter @happyvertical/smrt-assets-ergot typecheck
pnpm --filter @happyvertical/smrt-assets-ergot build

See AGENTS.md for provider, tenancy, and lineage invariants.

版本与发布记录

@happyvertical/smrt-assets-ergot 共发布 366 个版本,首次发布于 2026/06/23;过去 12 个月发布了 366 个版本。

版本发布日期距今
0.62.1latest2026/11/17今天
0.62.02026/11/17今天
0.61.62026/11/161 天前
0.61.52026/11/161 天前
0.61.42026/11/161 天前
0.61.32026/11/152 天前

关于 @happyvertical/smrt-assets-ergot 的常见问题

@happyvertical/smrt-assets-ergot 是什么?

Ergot-backed processing, search, and workflow adapter for SMRT assets

如何安装 @happyvertical/smrt-assets-ergot?

在项目目录运行 npm install @happyvertical/smrt-assets-ergot,或使用 pnpm add / yarn add / bun add。

@happyvertical/smrt-assets-ergot 支持 TypeScript 吗?

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

@happyvertical/smrt-assets-ergot 支持 ESM 还是 CommonJS?

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

@happyvertical/smrt-assets-ergot 可以商用吗?

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

@happyvertical/smrt-assets-ergot 的下载量有多少?

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

@happyvertical/smrt-assets-ergot 还在维护吗?

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