Skip to main content

@0xintuition/atom-enrichment

Version: V2
View Markdown

What it's for​

Run provider plugins against classified input and collect typed artifacts with provenance. Extraction can turn those artifacts into classification fields; neither operation changes an existing atom's identity bytes.

When to use it​

Use it when you need provider metadata, a selected provider plan, or normalized fields with missing-field diagnostics. Use the IID registry to plan providers before execution. A plan is not a completed lookup, and an artifact is not evidence that every required classification field was extracted.

Install​

npm install @0xintuition/atom-enrichment@0.1.1

Use typed ESM or CommonJS on Node 20+; Bun is also supported. Real providers may require HTTP access, credentials, and server-compatible execution; inject those deliberately. See module-format compatibility.

Entry points​

All public modules
SubpathPurpose
.Engine, providers, registries, presets, handoff, and public types
./typesInputs, artifacts, results, and request schemas
./handoffAdapt classification results into enrichment input
./provider-dataNormalized provider payload types
./pluginsPlugin manifests, contracts, and validation
./providersProvider factories and request helpers
./presetsProvider bundles and explicit environment mapping
./engineEnrichment execution engine
./plugin-registryRegister and resolve plugins
./cacheCache contracts and memory or HTTP adapters
./testingDeterministic fixtures and plugin conformance helpers
./classificationsProvider artifact classification registry
./classifications/defaultsBuilt-in artifact definitions
./classifications/registryArtifact registration and validation
./classifications/schemasArtifact payload schemas
./provider-external-dataExternal provider response schemas
./provider-planMatch desired providers against installed capabilities
./slug-aliasesCanonicalize provider slug aliases
./extractionExtract normalized classification fields and provenance
./data-resolved-schemaNormalized resolved-data boundary
./spotify-clientShared Spotify client
./tmdb-request-observerObserve TMDB requests
./provider-fetchProvider transport helpers
./plugin-apiPublic plugin authoring API
./outcomePromise outcome wrapper for enrichment
./adapters/upstashExplicit HTTP cache adapter
./ssrfPinned transport and destination policy helpers
./identifier-rung-projectionProject admissible identifier rungs
./url-hygieneURL normalization policy

Depends on and works with​

Runtime package dependencies: classifications, iid, iid-ladder, iid-registry, pipeline-runtime, protocol, and schema-org. Peer dependencies: none. zod is an additional ordinary dependency in the package manifest.

Canonical entity requirements belong to classifications. This package's artifact registry validates provider payloads. toClassifiedAtomInput returns usable input or null; handle that boundary before calling enrich. createIdentifierProviderPlan records scheduled, unavailable, and unsupported providers instead of silently treating a missing plugin as completed work.

Example​

These two synthetic plugins exercise the real engine without network access. One returns a valid Open Graph artifact; the other rejects. The example preserves the successful artifact alongside the failure.

import {
createEnrichmentEngine,
type EnrichmentPlugin,
} from '@0xintuition/atom-enrichment';

// Synthetic fixtures: no HTTP provider, credentials, or fetched page.
const fixture: EnrichmentPlugin = {
id: 'catalog-fixture',
version: '1.0.0',
runtime: 'universal',
artifactTypes: ['opengraph'],
supports: (request) => request.input.atomType === 'thing',
enrich: async (_request, { now }) => [
{
artifact_type: 'opengraph',
data: { title: 'Synthetic catalog' },
meta: {
pluginId: 'catalog-fixture',
provider: 'offline-fixture',
fetchedAt: now(),
},
},
],
};
const unavailable: EnrichmentPlugin = {
...fixture,
id: 'unavailable-fixture',
enrich: async () => {
throw new Error('Fixture provider unavailable');
},
};

const engine = createEnrichmentEngine({
plugins: [fixture, unavailable],
now: () => '2026-01-01T00:00:00.000Z',
});
export const enriched = await engine.enrich({
runtime: 'server',
input: {
atomType: 'thing',
jsonLd: { '@context': 'https://schema.org/', '@type': 'Thing' },
source: {
classificationEngine: 'offline-fixture',
classifiedAt: '2026-01-01T00:00:00.000Z',
},
},
});
console.log(enriched.status, enriched.artifacts.length, enriched.errors.length);

The result is partial with one artifact and one error. Inspect status, artifacts, errors, skipped, and timings; do not discard useful artifacts because a provider failed. Invalid request schemas can still reject before provider execution. Runtime mismatches and unsupported inputs can produce skipped providers.

Preserve each artifact's meta.pluginId, provider, fetchedAt, and optional sourceUrl. Here the provider is explicitly an offline fixture, not a scraped page. For real providers, select a small preset and supply approved transports, credentials, timeouts, and cache policy. A keyless service can still make network calls. Spotify's URL-derived fallback, for example, is distinct from a credentialed Web API artifact.

extractClassificationFields reports values, provenance, missing required fields, and dropped-field reasons; it may perform additional lookups. The pinned MusicBrainz artifact does not automatically supply extracted music-recording fields. The processing guide demonstrates that partial boundary with a fixed fixture. Your application owns retries, queues, persistence, and access control.

See also Classify and enrich atoms.

Source​

Package README, provider payload documentation, plugin contract, and partial-result tests.

Applies to V2 · @0xintuition/atom-enrichment 0.1.1