feat: support cortex.cpp engine variants #4022
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe Your Changes
This PR aims to integrate the engine management update from cortex.cpp and engine variants.
Where:
The cortex.cpp file now requires the client to set a default variant for engines to run, such as llama-cpp for the mac-arm64 or mac-amd64 platforms.
The folder is structured as follows:
Cortex extension life-cycle
janhq/cortex.cpp#1660
Related Issues
Code changes
Download Script Modifications:
download.sh
to use a new directory structure for macOS engine locations, specifically including the versionv0.1.35
in the path.Rollup Configurations:
CORTEX_ENGINE_VERSION
set to'v0.1.35'
inrollup.config.ts
.TypeScript Definitions:
CORTEX_ENGINE_VERSION
inglobal.d.ts
.Main Application Logic Enhancements:
setDefaultEngine
inindex.ts
to set the default engine variant on launch.index.ts
to private methods for better encapsulation (healthz
,clean
,subscribeToEvents
).Testing Improvements:
engineVariant
function inexecute.test.ts
.enginePath
expectations in tests to reflect changes in directory structure.Execution Logic Adjustments:
binPath
field fromCortexExecutableOptions
inexecute.ts
.engineVariant
based on GPU settings and architecture inexecute.ts
.Node Module Exports and Utility Functions:
engineVariant
in bothindex.ts
andengine-executable
logic.These changes seem to focus on organizing engine binaries by version, improving modularity, and enhancing the setup for different system configurations.