Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
0.2.3 - 2026-03-10
Fixed
NOTICEfile now included in published npm package
0.2.2 - 2026-03-10
Changed
- Renamed package from
afm-ts-sdktotsfm-sdk - Renamed GitHub repository from
codybrom/afm-ts-sdktocodybrom/tsfm
0.2.1 - 2026-03-09
Added
- Branded
NativePointertype for compile-time C pointer type safety unregisterCallback()utility to centralize callback cleanup logic- Discriminated union for
GenerationGuidedata, enabling exhaustive type checking - Comprehensive JSDoc comments on public APIs (
SystemLanguageModel,LanguageModelSession,Tool,Transcript,SamplingMode) stripInternalin tsconfig to exclude@internalsymbols from.d.tsoutput- Unit tests for error hierarchy and
statusToError()mapping - Integration test suite covering basic responses, streaming, structured output, tools, and transcripts
- GitHub Actions CI workflow (macOS, Node.js 20/22, lint + format + unit tests)
- Organized examples directory with individual READMEs for each example
Changed
- Renamed all internal pointer variables from abbreviations (
ptr,cbPtr) to full names (pointer,callbackPointer,_nativeSession,_nativeTool,_nativeSchema, etc.) InvalidGenerationSchemaErrornow extendsGenerationErrorinstead ofFoundationModelsError- All error-throwing paths now use
FoundationModelsErrororGenerationErrorsubclasses instead of genericError - Replaced
GenerationGuideseparateguideType/valuefields with a singledatadiscriminated union
Removed
- Monolithic
example.tsfile (replaced by organizedexamples/directory)
0.2.0 - 2026-03-08
Added
decodeAndFreeString()utility in bindings to safely decode C string pointers and free memory viaFMFreeString- ESLint (flat config) and Prettier for code linting and formatting
tsxdev dependency for TypeScript execution
Changed
- C function signatures for string-returning functions now declare return type as
void *instead ofstrto retain the pointer for proper memory management - Tool callback error handling now wraps errors in
ToolCallErrorwith proper context - Updated README import paths
Fixed
- Critical memory leak in all string-returning C functions —
koffi'sstrreturn type was copying strings but discarding the original pointer before it could be freed
Removed
- Unused
FMLanguageModelSessionCreateDefaultbinding (sessions always route throughCreateFromSystemLanguageModel) - Unused
FMRetainbinding (all Swift-to-JS transfers usepassRetained, onlyFMReleaseis needed)
0.1.0 - 2026-03-08
Added
- TypeScript/Node.js bindings for Apple's Foundation Models framework via koffi FFI
SystemLanguageModelclass with availability checks andwaitUntilAvailable()LanguageModelSessionwithrespond(),streamResponse(), andrespondWithJsonSchema()for text, streaming, and structured generationGenerationSchemaandGenerationSchemaPropertyfor typed structured output with generation guidesGenerationOptionsandSamplingModefor controlling temperature, token limits, and sampling strategies- Abstract
Toolbase class for function calling with schema-driven arguments Transcriptclass for session history export and import- Error hierarchy matching Python SDK status codes (11 specific error types)
- Prebuilt
libFoundationModels.dylibbundled for npm distribution (no Xcode required) build-native.shscript for building the dylib from vendored Swift sourceverify-native.jspostinstall script for SHA256 verification with automatic rebuild