@props-labs/mesh-os 0.2.3 → 0.2.4
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/dist/core/client.d.ts +1 -0
- package/dist/core/client.js +11 -22
- package/package.json +1 -1
package/dist/core/client.d.ts
CHANGED
package/dist/core/client.js
CHANGED
@@ -8,8 +8,6 @@ exports.MeshOS = exports.InvalidSlugError = exports.GraphQLError = void 0;
|
|
8
8
|
* Core functionality for MeshOS.
|
9
9
|
*/
|
10
10
|
const openai_1 = __importDefault(require("openai"));
|
11
|
-
const chalk_1 = __importDefault(require("chalk"));
|
12
|
-
const boxen_1 = __importDefault(require("boxen"));
|
13
11
|
const taxonomy_1 = require("./taxonomy");
|
14
12
|
const workflows_1 = require("./workflows");
|
15
13
|
const memories_1 = require("./memories");
|
@@ -41,28 +39,19 @@ exports.InvalidSlugError = InvalidSlugError;
|
|
41
39
|
*/
|
42
40
|
class MeshOS {
|
43
41
|
constructor(config = {}) {
|
44
|
-
|
45
|
-
this.headers = {
|
46
|
-
'Content-Type': 'application/json',
|
47
|
-
'x-hasura-admin-secret': config.apiKey || 'meshos'
|
48
|
-
};
|
49
|
-
// Set up OpenAI
|
50
|
-
const openaiApiKey = config.openaiApiKey || process.env.OPENAI_API_KEY;
|
42
|
+
const { url = 'http://localhost:8080/v1/graphql', apiKey = 'meshos', openaiApiKey = process.env.OPENAI_API_KEY, dangerouslyAllowBrowser = false } = config;
|
51
43
|
if (!openaiApiKey) {
|
52
|
-
|
53
|
-
title: 'Missing API Key',
|
54
|
-
titleAlignment: 'center',
|
55
|
-
padding: 1,
|
56
|
-
borderColor: 'yellow',
|
57
|
-
borderStyle: 'round'
|
58
|
-
};
|
59
|
-
console.error((0, boxen_1.default)(chalk_1.default.yellow('⚠️ OpenAI API key not found!\n\n') +
|
60
|
-
'Please set your OpenAI API key in the environment:\n' +
|
61
|
-
chalk_1.default.green('OPENAI_API_KEY=your-key-here') + '\n\n' +
|
62
|
-
'You can get an API key at: ' + chalk_1.default.blue('https://platform.openai.com/api-keys'), boxOptions));
|
63
|
-
throw new Error('OpenAI API key is required');
|
44
|
+
throw new Error('OpenAI API key is required. Please provide it in the config or set OPENAI_API_KEY environment variable.');
|
64
45
|
}
|
65
|
-
this.
|
46
|
+
this.url = url;
|
47
|
+
this.headers = {
|
48
|
+
'x-hasura-admin-secret': apiKey,
|
49
|
+
'Content-Type': 'application/json'
|
50
|
+
};
|
51
|
+
this.openai = new openai_1.default({
|
52
|
+
apiKey: openaiApiKey,
|
53
|
+
dangerouslyAllowBrowser
|
54
|
+
});
|
66
55
|
// Initialize managers
|
67
56
|
this.workflows = new workflows_1.WorkflowManager(this.url, this.headers);
|
68
57
|
this.memories = new memories_1.MemoryManager(this.url, this.headers, this.createEmbedding.bind(this));
|