@0xintuition/atom-runtime
What it's for
A server composition layer for classification and enrichment engines, shared caches, presets, and configuration fingerprints. It does not provide graph storage, worker scheduling, or an automatically offline pipeline.
When to use it
Use one runtime per intended configuration and application lifecycle to reuse engines and caches. Use the individual parser, classification, or enrichment packages for a single stage. Supplying no graph database removes a persistence prerequisite; it does not prevent selected providers from making requests.
Install
npm install @0xintuition/atom-runtime@0.1.1
Use ESM import or CommonJS require() and Promises on Node 20 or newer. See module-format compatibility.
Entry points
| Subpath | Purpose |
|---|---|
. | Runtime/cache factories, configuration, presets, and consumer adapters |
./presets | Classification plugins, enrichment factories, and default scopes |
./fingerprint | Compute configuration identity |
./consumers | Atom-services and local application composition adapters |
./config | Resolve configuration and select processing environment keys |
./adapters/upstash | Explicit HTTP cache integration |
Depends on and works with
Runtime package dependencies: atom-classification, atom-enrichment, atom-parser, iid-registry, and pipeline-runtime. Peer dependencies: none. zod is an additional ordinary dependency in the package manifest.
Your host supplies transport, credentials, clock, logging, and persistent storage. Cache providers are none, memory, and upstash; inspect cacheProvider and warnings after resolution. Consumer adapters have their own cache defaults and fallback policies.
Example
This runtime selects only deterministic text classifiers, an empty default enrichment set, a fixed clock, and memory caching. It performs one classification and proves that repeated engine lookup returns the same instance.
import {
createPlainTextPlugin,
createTypeProfilesPlugin,
} from '@0xintuition/atom-classification';
import { createProcessingRuntime } from '@0xintuition/atom-runtime';
export const runtime = createProcessingRuntime({
config: { env: {}, cache: { provider: 'memory', memoryMaxEntries: 100 } },
runtime: { now: () => '2026-01-01T00:00:00.000Z' },
overrides: {
classification: [createTypeProfilesPlugin(), createPlainTextPlugin()],
enrichment: { default: [] },
},
});
try {
const engine = runtime.classification.engine();
const result = await engine.classify({
input: 'A synthetic catalog idea',
mode: 'client-only',
classificationSessionId: 'runtime-reference',
});
console.log(engine === runtime.classification.engine());
console.log(result.resolved?.publishable[0]?.type);
console.log(runtime.cacheProvider, runtime.warnings);
} finally {
runtime.dispose();
}
runtime.fetch in the composition options configures HTTP cache access; it is not a universal override for provider requests. Configure provider transports in their own options, or inject selected plugins as shown. Enrichment engines are memoized by preset and identity capability, and their published plugin registries are immutable. Change plugin selection when constructing the runtime.
Fingerprints include secret presence rather than secret values. They identify configuration, not the resulting entity or a persisted atom. Pass an explicit env map; only named FromEnv helpers read the process environment when called.
After dispose(), new engine lookups throw. Disposal does not cancel requests already in flight or revoke engine references already obtained. Supply and abort request signals before disposing when shutting down active work. The host owns retries and queues.
Related concepts
See also How the pieces fit, Classify and enrich atoms, Write a classification plugin.
Source
Package README, runtime implementation, and public runtime tests.
Applies to V2 · @0xintuition/atom-runtime 0.1.1