totem-llm 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/totem.features.json +158 -0
- package/lib/setup.js +14 -2
- package/package.json +2 -1
- package/server/public/assets/{index-a29a8c19.js → index-6adfbee1.js} +1 -1
- package/server/public/assets/{index-9ab52cfb.js → index-cf613bb3.js} +2 -2
- package/server/public/assets/{index-c453ccc8.js → index-e9761a1b.js} +1 -1
- package/server/public/index.js +2 -2
- package/totem.features.cjs +21 -1
package/totem.features.cjs
CHANGED
|
@@ -19,7 +19,27 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
const path = require('path');
|
|
22
|
-
const
|
|
22
|
+
const fs = require('fs');
|
|
23
|
+
const os = require('os');
|
|
24
|
+
|
|
25
|
+
// User-editable config lives in the storage dir (~/totem-llm by default).
|
|
26
|
+
// Falls back to the bundled default shipped with the package.
|
|
27
|
+
const storageDir = process.env.TOTEM_STORAGE_DIR ?? path.join(os.homedir(), 'totem-llm');
|
|
28
|
+
const USER_CONFIG_PATH = path.join(storageDir, 'totem.features.json');
|
|
29
|
+
const DEFAULT_CONFIG_PATH = path.resolve(__dirname, 'config', 'totem.features.json');
|
|
30
|
+
const CONFIG_PATH = fs.existsSync(USER_CONFIG_PATH) ? USER_CONFIG_PATH : DEFAULT_CONFIG_PATH;
|
|
31
|
+
|
|
32
|
+
let FEATURE_DEFINITIONS, PROFILES;
|
|
33
|
+
try {
|
|
34
|
+
const config = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));
|
|
35
|
+
FEATURE_DEFINITIONS = config.FEATURE_DEFINITIONS;
|
|
36
|
+
PROFILES = config.PROFILES;
|
|
37
|
+
} catch (e) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
`[totem.features] Could not load config file at ${CONFIG_PATH}.\n` +
|
|
40
|
+
`Original error: ${e.message}`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
23
43
|
|
|
24
44
|
/**
|
|
25
45
|
* Resolves the active feature map for the current TOTEM_BUILD_PROFILE.
|