@samesake/core
@samesake/core (the workspace directory is packages/sdk) is the authoring and
type vocabulary. It owns no database, model client, queue, or retrieval implementation.
Public surface
Section titled “Public surface”collection(name, def)declares fields, indexing surfaces, enrichment, embeddings, search channels, ranking policy, and optional resolution configuration.entity(name, def)declares fields, scopes, embeddings, phonetic fields, parsing, and typed resolution channels.fieldsandfcreate entity and collection fields;ScorersandChannelscreate type-checked resolution and retrieval channels.stageandpipelinecompose ordered enrichment stages;sourcesdescribes catalog connectors without implementing their I/O.normalizeSchema,imageVersionToken,getByPath, identity validation, and theClientErrorsurface are shared pure helpers.
The package also exports the shared closure contracts: EmbedFn, GenerateFn,
RerankFn, GroundImageFn, and their request/result types. model is an opaque
identifier passed to the consumer’s closure; dim is the declared size of that
consumer-owned embedding space.
Type-safety boundary
Section titled “Type-safety boundary”The collection and entity factories preserve literal keys so a cosine channel
cannot silently reference an undeclared embedding, a variant group cannot reference
an absent field, and an evidence embedding cannot omit its extractor. Runtime checks
cover identifiers and structural invariants; the model and backend remain injected.
import { Channels, collection, f } from '@samesake/core';
const catalog = collection('catalog', { fields: { title: f.text({ searchable: true }), category: f.text({ filterable: true, facet: true }), }, embeddings: { document: { model: 'consumer-model', dim: 1024 }, }, search: { channels: [ Channels.fts({ fields: ['title'], weight: 1 }), Channels.cosine({ embedding: 'document', weight: 1 }), ], },});The config is data. @samesake/core does not decide where it is stored or which
provider implements the declared model.