For AI agents: the documentation index is at /docs/interbox/llms.txt. A Markdown version of this page is available at /docs/interbox/reference/core.md or by requesting it with the Accept: text/markdown header.
Interbox Docs

/core

import type { ... } from "@health-samurai/interbox/core";

Pure stage contracts shared by the SDK (descriptors, authoring) and the engine (factories, runtime). It holds types and light pure helpers only, with no drizzle or pg, so a workspace's bundle stays lean.

A workspace author rarely imports from /core directly. Everything you use day to day (defineStep, StepContext, env(), the builtin config types) is exported from the package root, /chain or /builtins, and a step's parameter types are inferred for you. This subpath exists so the engine and the SDK share one set of type definitions and cannot drift.

The subpath holds these categories:

categorytypeswho cares
authoring valuesStr, Num, Resolvedyou, occasionally: see Env and config
terminologyConceptMapMatch, ConceptMapContextyou, occasionally: what a step's ctx.translate and ctx.translateFor take and answer, see Step context
1.x mapper contractsMapperDefinition, MapperContext, MapperBatchContext, MapperSource, ParserOutputMap, ParserType and their siblingsthe 1.x defineMapper, which the 2.0 engine does not run. MapperBatchContext is also the three terminology lookups a step's context carries
error taxonomydomainError, ERROR_GROUPS, ErrorGroupyou: re-exported from the root, see Errors
payloadsPayloadItem, PayloadBody, bodyFromBytes, bodyFromStream, concatChunks, PayloadBodyConsumed, ConfiguredPreprocessor, Preprocessor, PreprocessorDefinitionyou, on 1.x, when a source you define runs a preprocess chain or you declare a preprocessor. All but concatChunks and ConfiguredPreprocessor are re-exported from the root, the latter from /builtins. See Preprocessing what a source read and Defining a preprocessor
1.x stage runtime contractsSourceDefinition/SenderDefinition/ParserDefinition + their *Config/*Entry/*Factory/*Instance siblings, Runnerthe 1.x engine, except SourceDefinition, which a 1.x workspace implements through defineSource. See Sources
file-drop engine internalsresolveFeedOptions, checkFeedRules, orderKeyOf, the DEFAULT_*, MIN_* and MAX_* feed and timer limits, parseDuration, parseAge, transportTimeoutMs, isLeftBehindName, endpointProblem, azureAccountProblem, parseHostKeyPin, HOST_KEY_TYPES, HOST_KEY_FORM, ACCEPT_UNVERIFIED, STORAGE_ERROR_KINDS, STORAGE_ERROR_NAME, builtInStep, DELIVERY_END_STEP, DELIVERY_FILES_STATE, DELIVERY_UNITS_STATE, deliveryUnitsKey, tallyReads, and the types FeedRules, ResolvedFeedOptions, WaitFor, HostKeyPin, StorageErrorKind, FileUnits, ReadTally, DeliveryFilesthe engine's file-drop source, which shares its option rules with the SDK. A workspace uses /files
shared names and keyscheckPipelineName, defineInternalState, bridgeInto, byNumericId, resLeaseKey, RES_LEASE_PREFIX, ITEM_LEASE_PREFIX, the lease-key SQL helpers and SKIPPED_ATTRthe engine and the admin library, so both read a pipeline name, a sender's lease and a unit's skip counts the same way, and Interbox declares the state under the prefixes defineState reserves

Annotating a helper that takes a step's context needs no /core import. Take only what the helper uses, so a step's StepContext and a row function's RowContext both fit:

import type { StepContext } from "@health-samurai/interbox/chain";

async function resolveObservationCode(ctx: Pick<StepContext, "translate">, code: string) {
  return ctx.translate("obs-codes", code);
}

For the shapes of a step's context, see Step context. For the engine-side runtime contracts, read src/core/*.ts in the package. They are small, documented files, and implementing one means working on the engine, not a workspace.

Last updated: