@0xintuition/pipeline-runtime
What it's for
Promise utilities for bounded concurrency, cancellation, circuit breaking, caching, and provider observation. It supplies shared execution contracts; it does not store a graph or start a processing service.
When to use it
Use it when a host needs ordered concurrent work or a consistent outcome vocabulary across providers. Use atom runtime to compose classification and enrichment engines. Effect services and retry layers belong to your application; these functions accept Promise callbacks.
Install
npm install @0xintuition/pipeline-runtime@0.1.1
Use ESM import or CommonJS require() on Node 20 or newer. On Node 20.19+ / 22.12+, both resolve to the same module instance, preserving shared error-class identity. Earlier supported runtimes load separate copies when formats are mixed. The documentation examples use Node 22.21.0. See module-format compatibility.
Entry points
All public modules
| Subpath | Purpose |
|---|---|
. | Shared errors, provider contracts, test helpers, and TMDB endpoint builder |
./bounded-text | Read streaming response text within a byte limit |
./cache | Cancellable cache contract and memory TTL adapter |
./errors | Shared pipeline error vocabulary |
./provider-observer | Provider observation events and contracts |
./provider-metrics-contract | Metric labels, normalization, and series contract |
./retry-after | Parse and bound retry delays |
./letterboxd | Letterboxd host policy and circuit state |
./letterboxd-page | Parse Letterboxd page identity |
./tmdb | TMDB endpoint policy |
./testing/prometheus-exposition | Validate Prometheus exposition; optional Node tool invocation |
./outcome | Outcome union, cancellation, and timeout helpers |
./circuit-breaker | Circuit breaker, snapshots, and admission errors |
./concurrency | Ordered bounded Promise execution |
./provider-metrics-contract.expected | Expected provider metric series counts |
./provider-registry | Provider definitions and operation contracts |
./provider-request-observation | Observe and record provider requests |
./request-slot | Provider request admission contracts |
./testing/provider-golden | Provider golden-fixture helpers |
./testing/held-request-slot | Controlled request-slot test helpers |
./testing/virtual-clock | Deterministic clock for tests |
./provider-metrics | Alias of the provider metrics contract |
Depends on and works with
Runtime package dependencies: none. Peer dependencies: none.
Classification, enrichment, and atom runtime consume these contracts. A memory cache is process-local; an adapter is not a provisioned database. Provider-specific host policies do not replace your application's complete egress policy.
Example
This fixed input needs no network or credentials. The result keeps input order even when callbacks finish in a different order.
import { forEachBounded } from '@0xintuition/pipeline-runtime/concurrency';
const controller = new AbortController();
export const outcomes = await forEachBounded(
['recording', 'artist', 'release'],
async (label, signal) => {
signal.throwIfAborted();
return label.toUpperCase();
},
{ concurrency: 2, signal: controller.signal },
);
for (const outcome of outcomes) {
if (outcome.kind === 'success') console.log(outcome.value);
else console.log(outcome.kind);
}
Successful outcomes carry value. The full outcome union also includes failure, defect, timeout, and interrupted. In forEachBounded, a synchronous callback throw is a defect and a returned Promise rejection is a failure. Parent cancellation rejects the batch with its abort reason, prevents queued work, and signals active callbacks; callbacks must honor that signal to stop I/O.
CircuitBreaker.execute admits one probe after its reset window. Its failure filter determines whether an admitted failure or cancellation counts toward opening the circuit; cancellation before admission starts no work. Inspect snapshot() without changing state.
Related concepts
See also How the pieces fit, Classify and enrich atoms.
Source
Package README, public exports, and concurrency implementation.
Applies to V2 · @0xintuition/pipeline-runtime 0.1.1