**feat: enhance threading compatibility and refactor module loading**

- Refactored `TextEncoder` and `TextDecoder` in `src/utils/tensorflowUtils.ts` to handle environments without global availability, logging warnings and providing fallback implementations.
- Enhanced threading utilities in `src/utils/environment.ts`:
  - Introduced `areWorkerThreadsAvailableSync()` and `isThreadingAvailableAsync()` for synchronous and asynchronous checks.
  - Improved compatibility across browser and Node.js environments.
- Migrated `fileSystemStorage.ts` to use dynamic imports for Node.js modules, removing synchronous loading mechanisms to align with ES module standards.
- Updated `cli-package/package.json` keywords to include `browser` and `container`, improving discoverability.
- Added `worker_threads` as an external dependency in `cli-package/rollup.config.js` and `rollup.config.js`.
- Updated `.gitignore` to ignore all `tgz` files dynamically under main and CLI package.

This update improves threading compatibility, enhances environment-specific support, and aligns with modern module loading practices.
This commit is contained in:
David Snelling 2025-07-02 16:52:44 -07:00
parent cf18cd99c4
commit 703fc9eda3
8 changed files with 89 additions and 104 deletions

View file

@ -1,16 +1,16 @@
{
"name": "@soulcraft/brainy-cli",
"version": "0.9.29",
"version": "0.9.30",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@soulcraft/brainy-cli",
"version": "0.9.29",
"version": "0.9.30",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"@soulcraft/brainy": "0.9.29",
"@soulcraft/brainy": "0.9.30",
"commander": "^14.0.0",
"omelette": "^0.4.17"
},
@ -2086,9 +2086,9 @@
}
},
"node_modules/@soulcraft/brainy": {
"version": "0.9.29",
"resolved": "https://registry.npmjs.org/@soulcraft/brainy/-/brainy-0.9.29.tgz",
"integrity": "sha512-t1kECxPqO7Y8dC6Vh2BoWQKYtiHCUPombz6ZGNfiyhADMEf8T3E1dd7XGmAX8qUver9/aXKk1I1pfIXA7RP5Cw==",
"version": "0.9.30",
"resolved": "https://registry.npmjs.org/@soulcraft/brainy/-/brainy-0.9.30.tgz",
"integrity": "sha512-CPI0XQLwp2KIy31dK6mzJfbW+F36dx1pG0ORmoY6tDRtRe7w39PaW+fj0Q/p8RpaBxAK5PaBgl/0rN+8bmsrsA==",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

View file

@ -21,7 +21,8 @@
"vector-database",
"hnsw",
"cli",
"command-line",
"browser",
"container",
"graph-database"
],
"author": "David Snelling (david@soulcraft.com)",

View file

@ -37,6 +37,7 @@ export default {
'fs',
'path',
'url',
'child_process'
'child_process',
'worker_threads'
]
}