@agent-native/creative-context

中文文档
0.8.68发布于 2026/11/07MITES Module构建来源已验证近 30 天下载 1.1万

Shared creative context ingestion, versioning, search, brand DNA, and context-pack primitives for agent-native apps.

原始使用文档
文档目录6 节
  1. Install
  2. Governed contexts
  3. Retrieval behavior
  4. Isolated deployments
  5. Trust and lifecycle
  6. Exports

@agent-native/creative-context

Shared creative-library ingestion, governed reusable contexts, immutable evidence, hybrid retrieval, brand context, and generation provenance for Agent Native creative apps.

Creative Context is a Toolkit capability module installed on demand. It lives in its own npm package so apps only take the governed corpus, retrieval, UI, and lifecycle metadata they need.

The package turns Google Slides, Figma, Notion, websites, and uploaded PPTX/DOCX/PDF/PNG/JPEG/WebP/GIF/safe-SVG files into a versioned SQL corpus. Binary originals, localized visual fallbacks, and bounded UI thumbnails live in private blob storage; full-slide and full-frame source renders are temporary QA inputs and are discarded. Text remains directly greppable in SQL; PostgreSQL deployments add full-text candidates and pgvector visual similarity in the same DATABASE_URL database.

Install

pnpm add @agent-native/creative-context

Add the server plugin once per app:

// server/plugins/creative-context.ts
import { setupCreativeContext } from "@agent-native/creative-context/server";

export default setupCreativeContext({ appId: "slides" });

Mount the shared Library tab on the app's existing Agent page:

import { AgentTabsPage } from "@agent-native/toolkit/app/agent-page";
import { createCreativeContextAgentTab } from "@agent-native/creative-context/client";

export default function AgentPage() {
  return <AgentTabsPage extraTabFactories={[createCreativeContextAgentTab]} />;
}

Importing ./server registers the package actions through the framework's package-action registry, applies additive corpus migrations, registers shareable sources/profiles/contexts/packs, starts resumable import processing, and conditionally contributes published brand context to agent prompts. Each owning app also registers a server-side native capture adapter so its Share popover can submit a deck, design, document, asset, or dashboard by resource id without sending native payloads through a generic action. The prompt contribution is omitted structurally whenever application state contains { contextMode: "off" }.

Governed contexts

A brand profile contains approved identity and DNA. A Creative Context is the durable, shareable collection people maintain (for example Default, Marketing, Product, or Sales). A context pack is the immutable exact-version receipt for one generation.

  • Every personal or organization scope has one non-archivable Default context.
  • Requests use Default plus at most one specialty context. Explicit selection wins; an app binding or semantic match supplies the automatic specialty.
  • open contexts publish editor submissions immediately. review and admins-only contexts keep the proposed version private to its submitter and context administrators until approval.
  • The currently approved snapshot remains active while a newer version is pending. Removal affects new retrieval immediately without rewriting old packs.
  • Publishing into a broader context requires source-management permission and explicit confirmation. Acceptance writes an immutable context-owned copy; it never changes the original resource's sharing.

The standard UI is the Context tab in the framework Share popover plus the context-first Library. The Library rail selects Default or a specialty and its Items, Sources, Approvals, and Settings views show only safe, bounded previews: slide filmstrips, design frames, rendered document structure, access-scoped media, and dashboards populated with synthetic preview data.

Exact app-native data is a separate private blob capability. Generic list, item, pack, status, media, and search responses never expose that capability. Only the owning app's typed clone action can resolve it, verify the stored hash and resource identity, and create a new editable resource through that app's normal persistence path. Imported Google Slides and Figma artifacts continue to use the stricter trusted-compiler and native-reassembly path.

Retrieval behavior

  • Lexical search uses normalized grep modes (allTerms, anyTerm, phrase, regex) and weighted title/summary/body scoring.
  • PostgreSQL adds a tsvector/GIN candidate lane and one configured multimodal embedding family backed by pgvector in the same database.
  • PGlite keeps corpus and lexical/caption search only. Visual queries fail with a clear PostgreSQL+pgvector requirement; the package never creates another PGlite or vector database.
  • Every context-backed generation resolves Default plus zero or one specialty, applies the specialty ranking boost, and snapshots exact (itemId, itemVersionId) evidence, lane scores, selection reason, and context ids into an immutable context pack.

Context packs are intentionally ownable and independently shareable instead of inheriting broad source visibility. A pack records one generation's request, selected evidence, and influence scores, which can reveal private work intent even when every underlying source is organization-visible. Only the creator can see a new pack; collaborators receive it through an explicit pack share. Ordinary source evidence remains subject to current source access and revocation. Context-owned published snapshots remain replayable at their pinned version for authorized pack viewers after membership removal.

Isolated deployments

Apps in one workspace use the shared database in-process by default. If an app is deployed against a separate database, set CREATIVE_CONTEXT_A2A_URL to the app that owns the corpus and configure either the shared A2A_SECRET on both deployments or a matching org-scoped CREATIVE_CONTEXT_A2A_KEY. The fallback forwards only bounded resolve, validate, generation-record read, and generation-record write operations through the authenticated A2A protocol. Caller identity is signed and re-resolved by the receiver, all request and response shapes are strictly validated, and malformed or timed-out responses fail clearly instead of falling back to untracked context. Optional CREATIVE_CONTEXT_A2A_TIMEOUT_MS is clamped to 1–60 seconds and defaults to 30 seconds. Do not place these values in client code or application state.

CREATIVE_CONTEXT_A2A_URL is opt-in: without it, no A2A request occurs. A saved or one-generation contextMode: "off" also structurally suppresses the remote path.

Trust and lifecycle

Imported text is evidence, never instructions. Only human-published, validated structured brand fields can enter the typed <brand-context> prompt block. Restricted upstream items default to review and exclusion. Organization copies require an organization admin or verified container owner plus a confirmation of the exact container and item count. Disconnecting or deleting a source tombstones it synchronously so retrieval stops immediately; private blobs are purged asynchronously. Native context submissions use the same fail-closed private-blob rule and never fall back to SQL payload storage.

Exports

SubpathPurpose
.Shared types and generation-context helpers
./actionsRegistered action map
./clientLibrary panel, Agent tab, context chip, state hooks
./connectorsConnector registry plus public Slides/Figma native compilers
./embeddingsMultimodal family adapters and bake-off inputs
./evalRetrieval, quality, and hard-gate evaluation helpers
./jobsDurable import, enrichment, purge, and rebuild workers
./messagesShared localized Library UI messages
./schemaAdditive Drizzle corpus schema and migrations
./serverSetup plugin, action registration, prompt/resource wiring
./storeAccess-scoped corpus stores
./vectorPostgreSQL/pgvector adapter and fail-clear guard

版本与发布记录

@agent-native/creative-context 共发布 358 个版本,首次发布于 2026/07/17;过去 12 个月发布了 358 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.8.68latest2026/11/071 天前
0.8.672026/11/061 天前
0.8.662026/11/061 天前
0.8.652026/11/052 天前
0.8.632026/11/034 天前
0.8.622026/10/309 天前

其他发布通道:beta → 0.0.0-beta-20260820202238,dev-embed-chat-beta-20261025 → 0.8.59-embed-chat-beta-20261025-20261025212203,dev-beta-dispatch-embed-01a15dc9 → 0.8.59-beta-dispatch-embed-01a15dc9-20261027050558,dev-embedded-chat-fix-20261027 → 0.8.59-embedded-chat-fix-20261027-20261027063754,dev-same-host-mcp-20261027 → 0.8.59-same-host-mcp-20261027-20261027081850,dev-chat-origin-secure-20261027 → 0.8.59-chat-origin-secure-20261027-20261027102654。

关于 @agent-native/creative-context 的常见问题

@agent-native/creative-context 是什么?

Shared creative context ingestion, versioning, search, brand DNA, and context-pack primitives for agent-native apps.

如何安装 @agent-native/creative-context?

在项目目录运行 npm install @agent-native/creative-context,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:drizzle-orm(>=0.45)、@agent-native/core(>=0.226.0-0)、@tanstack/react-query(>=5.101.4)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@agent-native/creative-context 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/agent-native__creative-context 是否存在。

@agent-native/creative-context 支持 ESM 还是 CommonJS?

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

@agent-native/creative-context 可以商用吗?

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

@agent-native/creative-context 的下载量有多少?

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

@agent-native/creative-context 还在维护吗?

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