Data Models & Schemas
Shared type definitions live in packages/types/src. They are validated with Zod and compiled to TypeScript declarations.
CSL-JSON
CSLItemSchema– full CSL item withid, optionaltype, contributor arrays, date fields, identifiers (DOI, ISBN, ISSN,arxivId, etc.).CSLItemWithoutIdSchema– same structure withoutid(used for AnyStyle and LLM output).CSLVariableSchema– enum of all CSL keys, plus helpersCommonCSLVariableSchemaandCSLVariableWithoutIdSchema.- Utility functions (
packages/types/src/csl-utils.ts):stringifyCSLName,stringifyCSLDate,stringifyCSLValueextractYearFromCSLDate,formatCSLDateForDisplay,formatAuthorsCompact
The utilities are used by the matching engine and the UI to format or normalise CSL data.
AI & Extraction
ApiAIProviderSchema–openai,anthropic,google,deepseek.- Model enums –
ApiOpenAIModelSchema,ApiAnthropicModelSchema,ApiGoogleModelSchema,ApiDeepSeekModelSchema. ApiAISettingsSchema–{ provider, model }, default{ openai, gpt-4.1 }.ApiExtractRequestSchematsDefaults cover all CSL fields exceptinterface ApiExtractRequest { text: string extractionSettings?: { extractionConfig?: { variables: CSLVariableWithoutId[] } } aiSettings?: ApiAISettings }id.ApiExtractReferenceSchema–{ id: uuid, originalText: string, metadata: CSLItem }.
Dynamic JSON Schemas
createDynamicExtractionSchema generates a JSON schema tailored to the selected variables for response_format=json_schema. If the provider lacks support, the API falls back to json_object with schema hints embedded in the prompt.
Search
ApiSearchRequestSchema–references: ApiSearchReference[].ApiSearchSourceSchema–openalex | crossref | semanticscholar | europepmc | arxiv.ApiSearchCandidateSchema–{ id: uuid, source, metadata: CSLItem, url? }.ApiSearchDataSchema–{ results: { referenceId, candidates[] }[] }.
Matching
- Normalisation rules (
ApiMatchNormalizationRuleSchema):normalize-typography,normalize-lowercase,normalize-identifiers,normalize-characters,normalize-whitespace,normalize-accents,normalize-umlauts,normalize-punctuation,normalize-unicode,normalize-urls,match-structured-dates,match-author-initials,match-volume-issue-numeric,match-page-range-overlap,match-container-title-variants. ApiMatchFieldConfigSchema–enabled: boolean,weight: number (0–100).- Default configuration (
createDefaultFieldConfigurations):Field Weight title30 author25 issued15 container-title15 DOI10 volume3 page2 ApiMatchMatchingSettingsSchema–{ matchingStrategy, matchingConfig }, defaultbalancedplus the full normalisation set.- Response (
ApiMatchResponseSchema) –{ evaluations: [{ candidateId, matchDetails: { overallScore, fieldDetails[] } }] }.
See Matching & Scoring for heuristics.
AnyStyle
ApiAnystyleParseRequestSchema–{ input: string[] }→ returns token tuples.ApiAnystyleConvertRequestSchema–{ references: [{ id, tokens }] }→ returnsCSLItemWithoutId[].
User & UI
ApiUserAISecretsRequestSchema– stores an API key{ provider, apiKey }.ApiUserAISecretsInfoDataSchema–{ hasApiKey: boolean, provider?: ApiAIProvider }.
UI Settings (packages/types/src/frontend/settings.ts)
- General –
theme: light|dark|system(defaultsystem),locale: en|de(defaulten). - Search (
settings.search.databases) – list withenabled,priority. Defaults:- openalex (1)
- crossref (2)
- semanticscholar (3)
- europepmc (4, disabled)
- arxiv (5, disabled)
- Extraction (
settings.extract) –extractionConfig.variables(defaults to all fields). - Matching (
settings.matching) – strategy/config mirroring backend defaults, plus:earlyTermination:{ enabled: true, threshold: 95 }displayThresholds:{ strongMatchThreshold: 85, possibleMatchThreshold: 50 }
- AI (
settings.ai) –{ provider, model, canUseAI };canUseAIis true only when a key is stored.
Helpers & Services
NormalizationService(API) applies rules in a deterministic order (normalize-typography→ … →normalize-lowercase).MetadataComparatorfilters meaningful fields and respects enabled configuration.similarity.ts/similarityHelpers.tsprovide date parsing, name similarity, and Damerau-Levenshtein utilities.
TODOs
- TODO: Decide whether the new
deepseekprovider should surface in the UI selector. - TODO: Document how to migrate
DEFAULT_UI_SETTINGSwhen storage versions change.