@indra.ai/deva 1.1.72 → 1.1.74
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/README.md +33 -3
- package/config.json +2 -1
- package/index.js +95 -93
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,6 +7,35 @@ Deva is a Node.js module designed to simplify the development of multi-agent sys
|
|
|
7
7
|
|
|
8
8
|
The Deva module is a JavaScript library for building multi-agent systems that can communicate with each other and with external services. It provides a unified API for creating agents and defining their behaviors, and includes tools for handling communication between agents and for integrating with third-party APIs. The Deva module is designed to be flexible and customizable, allowing developers to easily create complex systems that can perform a wide range of tasks, from data collection and analysis to chatbot interactions and image generation. The module is written in JavaScript and can be used with Node.js, making it easy to integrate with other JavaScript libraries and tools.
|
|
9
9
|
|
|
10
|
+
## Core Features
|
|
11
|
+
The core features in the @indra.ai deva.core encompass a wide range of functionalities and capabilities. Here's a brief overview of each feature:
|
|
12
|
+
|
|
13
|
+
1. Security Feature: This feature focuses on ensuring the security and privacy of the system, monitoring and responding to security-related issues.
|
|
14
|
+
|
|
15
|
+
2. Support Feature: The support feature is responsible for addressing user queries, providing assistance, and resolving any issues or concerns raised by users.
|
|
16
|
+
|
|
17
|
+
3. Services Feature: This feature pertains to the various services offered by the @indra.ai platform, such as cloud computing, data storage, networking, and more.
|
|
18
|
+
|
|
19
|
+
4. Systems Feature: The systems feature deals with the management and operation of the underlying infrastructure and resources that power the @indra.ai platform.
|
|
20
|
+
|
|
21
|
+
5. Solutions Feature: This feature is geared towards providing solutions to specific problems or challenges faced by users, offering guidance and recommendations.
|
|
22
|
+
|
|
23
|
+
6. Research Feature: The research feature focuses on exploring and advancing cutting-edge technologies, innovations, and methodologies within the domain of AI and related fields.
|
|
24
|
+
|
|
25
|
+
7. Development Feature: The development feature encompasses the creation, improvement, and maintenance of software and applications within the @indra.ai ecosystem.
|
|
26
|
+
|
|
27
|
+
8. Business Feature: This feature caters to the needs and requirements of businesses, offering tools, insights, and strategies to drive growth, efficiency, and success.
|
|
28
|
+
|
|
29
|
+
9. Legal Feature: The legal feature ensures compliance with legal and regulatory frameworks, addressing legal matters and providing guidance on legal aspects related to the @indra.ai platform.
|
|
30
|
+
|
|
31
|
+
10. Assistant Feature: This feature involves an AI-powered assistant that assists users with various tasks, answering questions, providing information, and offering support.
|
|
32
|
+
|
|
33
|
+
11. Story Feature: The story feature enables the generation of engaging and interactive stories, leveraging AI capabilities to create captivating narratives.
|
|
34
|
+
|
|
35
|
+
12. Mind Feature: The mind feature pertains to cognitive abilities and intelligence, encompassing aspects such as learning, reasoning, and decision-making within the @indra.ai platform.
|
|
36
|
+
|
|
37
|
+
These core features work together to provide a comprehensive and robust platform for users, covering essential aspects such as security, support, services, research, development, and more.
|
|
38
|
+
|
|
10
39
|
## Functions
|
|
11
40
|
|
|
12
41
|
Here are some insights about the code you shared:
|
|
@@ -87,11 +116,10 @@ const Deva = require('feecting/deva');
|
|
|
87
116
|
|
|
88
117
|
// setup the Deva object
|
|
89
118
|
const deva = new Deva({
|
|
119
|
+
info: {}
|
|
90
120
|
agent: {
|
|
91
121
|
uid: '*uinique identifier*'
|
|
92
122
|
key: '*DEVA KEY*',
|
|
93
|
-
name: '*DEVA NAME*',
|
|
94
|
-
describe: '*DEVA LONG DESCRIPTION*',
|
|
95
123
|
prompt: {
|
|
96
124
|
emoji: '🐶',
|
|
97
125
|
text: '*DEVA*',
|
|
@@ -102,6 +130,8 @@ const deva = new Deva({
|
|
|
102
130
|
speed: 1
|
|
103
131
|
},
|
|
104
132
|
profile: {
|
|
133
|
+
name: '*DEVA NAME*',
|
|
134
|
+
describe: '*DEVA LONG DESCRIPTION*',
|
|
105
135
|
emoji: 'the graphic emoji the agent travels with. 50px x 50px'
|
|
106
136
|
avatar: 'the graphic avatar the agent travels with 150px x 150px',
|
|
107
137
|
background: 'a background asset for page displays for th eagent',
|
|
@@ -117,10 +147,10 @@ const deva = new Deva({
|
|
|
117
147
|
},
|
|
118
148
|
vars: {},
|
|
119
149
|
listeners: {},
|
|
150
|
+
deva: {},
|
|
120
151
|
modules: {},
|
|
121
152
|
func: {},
|
|
122
153
|
methods: {},
|
|
123
|
-
deva: {},
|
|
124
154
|
onStart() {},
|
|
125
155
|
onStop() {},
|
|
126
156
|
onEnter() {},
|
package/config.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"DATA": {
|
|
6
6
|
"cmdChr": "/",
|
|
7
7
|
"askChr": "#",
|
|
8
|
-
"inherit": ["events", "lib"],
|
|
8
|
+
"inherit": ["events", "lib", "config"],
|
|
9
9
|
"bind": [
|
|
10
10
|
"listeners",
|
|
11
11
|
"methods",
|
|
@@ -124,6 +124,7 @@
|
|
|
124
124
|
"error": "Feature Error",
|
|
125
125
|
"done": "Features Done"
|
|
126
126
|
},
|
|
127
|
+
"message": "offline",
|
|
127
128
|
"messages": {
|
|
128
129
|
"states": {
|
|
129
130
|
"offline": "🛌 ::agent.name:: offline state",
|
package/index.js
CHANGED
|
@@ -7,30 +7,32 @@ const config = require('./config.json').DATA // load the deva core configuration
|
|
|
7
7
|
class Deva {
|
|
8
8
|
constructor(opts) {
|
|
9
9
|
opts = opts || {};
|
|
10
|
-
this._id = randomUUID();
|
|
11
|
-
this._info = opts.info || false;
|
|
12
|
-
this._config = opts.config || {};
|
|
13
|
-
this._agent = opts.agent || false;
|
|
14
|
-
this._client = {};
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
10
|
+
this._id = randomUUID(); // the unique id assigned to the agent at load
|
|
11
|
+
this._info = opts.info || false; // the deva information from the package file.
|
|
12
|
+
this._config = opts.config || {}; // local Config Object
|
|
13
|
+
this._agent = opts.agent || false; // Agent profile object
|
|
14
|
+
this._client = {}; // this will be set on init.
|
|
15
|
+
this._active = false; // the active/birth date.
|
|
16
|
+
this._security = false; // inherited Security features.
|
|
17
|
+
this._support = false; // inherited Support features.
|
|
18
|
+
this._services = false; // inherited Service features.
|
|
19
|
+
this._systems = false; // inherited Systems features.
|
|
20
|
+
this._solutions = false; // inherited Solutions features.
|
|
21
|
+
this._research = false; // inherited Research features.
|
|
22
|
+
this._development = false; // inherited Development features.
|
|
23
|
+
this._business = false; // inherited Business features.
|
|
24
|
+
this._legal = false; // inherited Legal features.
|
|
25
|
+
this._assistant = false; // inherited Assistant features.
|
|
26
|
+
this._story = false; // inherited Story features.
|
|
27
|
+
this.events = opts.events || new EventEmitter({}); // Event Bus
|
|
28
|
+
this.lib = opts.lib || {}; // used for loading library functions
|
|
29
|
+
this.devas = opts.devas || {}; // Devas which are loaded
|
|
30
|
+
this.vars = opts.vars || {}; // Variables object
|
|
31
|
+
this.listeners = opts.listeners || {}; // local Listeners
|
|
32
|
+
this.modules = opts.modules || {}; // 3rd Party Modules
|
|
33
|
+
this.func = opts.func || {}; // local Functions
|
|
34
|
+
this.methods = opts.methods || {}; // local Methods
|
|
35
|
+
this.maxListeners = opts.maxListenners || 0; // set the local maxListeners
|
|
34
36
|
|
|
35
37
|
// prevent overwriting existing functions and variables with same name
|
|
36
38
|
for (var opt in opts) {
|
|
@@ -55,7 +57,9 @@ class Deva {
|
|
|
55
57
|
this._feature = config.feature; // set the feature from config
|
|
56
58
|
this._features = config.features; // set the features from config
|
|
57
59
|
|
|
60
|
+
this._message = config.message; // current state of agent.
|
|
58
61
|
this._messages = {}; // set the messages from config
|
|
62
|
+
|
|
59
63
|
// then here we are going to loop the messages config to make sure custom values are set
|
|
60
64
|
for (let x in config.messages) {
|
|
61
65
|
this._messages[x] = {};
|
|
@@ -65,7 +69,6 @@ class Deva {
|
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
|
|
68
|
-
|
|
69
72
|
/**************
|
|
70
73
|
func: Client
|
|
71
74
|
params: client - client provided data.
|
|
@@ -91,31 +94,31 @@ class Deva {
|
|
|
91
94
|
client presented data.
|
|
92
95
|
***************/
|
|
93
96
|
Security() {
|
|
94
|
-
this.feature('Security');
|
|
95
|
-
const _cl = this.client();
|
|
97
|
+
this.feature('Security'); // set feature to Security
|
|
98
|
+
const _cl = this.client(); // set local copy of client data
|
|
96
99
|
try {
|
|
97
|
-
if (!_cl.features.security) return this.Support();
|
|
100
|
+
if (!_cl.features.security) return this.Support(); // if no security feature goto Support
|
|
98
101
|
else {
|
|
99
|
-
this.action('Security');
|
|
100
|
-
const {id, profile, features} = _cl;
|
|
101
|
-
const {security} = features;
|
|
102
|
-
this._security = {
|
|
103
|
-
id: this.uid(true),
|
|
104
|
-
client_id: id,
|
|
105
|
-
client_name: profile.name,
|
|
106
|
-
hash: security.hash,
|
|
107
|
-
cipher: security.cipher,
|
|
108
|
-
concerns: security.concerns,
|
|
109
|
-
global: security.global,
|
|
110
|
-
personal: security.devas[this._agent.key]
|
|
102
|
+
this.action('Security'); // set action to Security
|
|
103
|
+
const {id, profile, features} = _cl; // make a copy the clinet data.
|
|
104
|
+
const {security} = features; // make a copy the clinet data.
|
|
105
|
+
this._security = { // set this_security with data
|
|
106
|
+
id: this.uid(true), // uuid of the security feature
|
|
107
|
+
client_id: id, // client id for reference
|
|
108
|
+
client_name: profile.name, // client name for personalization
|
|
109
|
+
hash: security.hash, // client preferred hash algorithm
|
|
110
|
+
cipher: security.cipher, // client preferred cipher settings
|
|
111
|
+
concerns: security.concerns, // any concerns for client
|
|
112
|
+
global: security.global, // the global policies for client
|
|
113
|
+
personal: security.devas[this._agent.key], // Client personal features and rules.
|
|
111
114
|
};
|
|
112
|
-
delete this._client.features.security
|
|
113
|
-
return this.Support();
|
|
115
|
+
delete this._client.features.security; // make a copy the clinet data.
|
|
116
|
+
return this.Support(); // goto Support when done with Security
|
|
114
117
|
}
|
|
115
118
|
} catch (e) {
|
|
116
|
-
this.action('error');
|
|
117
|
-
this.feature('error');
|
|
118
|
-
return this.error(e)
|
|
119
|
+
this.action('error'); // set the action to error
|
|
120
|
+
this.feature('error'); // set the feature to error
|
|
121
|
+
return this.error(e); // run error handling if an error is caught
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
|
|
@@ -147,9 +150,9 @@ class Deva {
|
|
|
147
150
|
return this.Services();
|
|
148
151
|
}
|
|
149
152
|
} catch (e) {
|
|
150
|
-
this.action('error');
|
|
151
|
-
this.feature('error');
|
|
152
|
-
return this.error(e)
|
|
153
|
+
this.action('error'); // set the action to error
|
|
154
|
+
this.feature('error'); // set the feature to error
|
|
155
|
+
return this.error(e); // run error handling if an error is caught
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
158
|
|
|
@@ -181,9 +184,9 @@ class Deva {
|
|
|
181
184
|
return this.Systems()
|
|
182
185
|
}
|
|
183
186
|
} catch (e) {
|
|
184
|
-
this.action('error');
|
|
185
|
-
this.feature('error');
|
|
186
|
-
return this.error(e)
|
|
187
|
+
this.action('error'); // set the action to error
|
|
188
|
+
this.feature('error'); // set the feature to error
|
|
189
|
+
return this.error(e); // run error handling if an error is caught
|
|
187
190
|
}
|
|
188
191
|
}
|
|
189
192
|
|
|
@@ -215,10 +218,9 @@ class Deva {
|
|
|
215
218
|
return this.Solutions()
|
|
216
219
|
}
|
|
217
220
|
} catch (e) {
|
|
218
|
-
//
|
|
219
|
-
this.
|
|
220
|
-
this.
|
|
221
|
-
return this.error(e)
|
|
221
|
+
this.action('error'); // set the action to error
|
|
222
|
+
this.feature('error'); // set the feature to error
|
|
223
|
+
return this.error(e); // run error handling if an error is caught
|
|
222
224
|
}
|
|
223
225
|
}
|
|
224
226
|
|
|
@@ -236,23 +238,23 @@ class Deva {
|
|
|
236
238
|
if (!_cl.features.solutions) return this.Research();
|
|
237
239
|
else {
|
|
238
240
|
this.action('Solutions');
|
|
239
|
-
const {id, features, profile} = _cl;
|
|
240
|
-
const {solutions} = features;
|
|
241
|
-
this._solutions = {
|
|
242
|
-
id: this.uid(true),
|
|
243
|
-
client_id: id,
|
|
244
|
-
client_name: profile.name,
|
|
245
|
-
concerns: solutions.concerns,
|
|
246
|
-
global: solutions.global,
|
|
247
|
-
personal: solutions.devas[this._agent.key]
|
|
241
|
+
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
242
|
+
const {solutions} = features; // set solutions from features const
|
|
243
|
+
this._solutions = { // set this_solutions with data
|
|
244
|
+
id: this.uid(true), // uuid of the solutions feature
|
|
245
|
+
client_id: id, // client id for reference
|
|
246
|
+
client_name: profile.name, // client name for personalization
|
|
247
|
+
concerns: solutions.concerns, // any concerns for client
|
|
248
|
+
global: solutions.global, // the global policies for client
|
|
249
|
+
personal: solutions.devas[this._agent.key], // Client personal features and rules.
|
|
248
250
|
};
|
|
249
251
|
delete this._client.features.solutions
|
|
250
252
|
return this.Research()
|
|
251
253
|
}
|
|
252
254
|
} catch (e) {
|
|
253
|
-
this.action('error');
|
|
254
|
-
this.feature('error');
|
|
255
|
-
return this.error(e)
|
|
255
|
+
this.action('error'); // set the action to error
|
|
256
|
+
this.feature('error'); // set the feature to error
|
|
257
|
+
return this.error(e); // run error handling if an error is caught
|
|
256
258
|
}
|
|
257
259
|
}
|
|
258
260
|
|
|
@@ -264,8 +266,8 @@ class Deva {
|
|
|
264
266
|
client presented data.
|
|
265
267
|
***************/
|
|
266
268
|
Research() {
|
|
267
|
-
this.feature('Research');
|
|
268
|
-
const _cl = this.client();
|
|
269
|
+
this.feature('Research'); // set state to development setting
|
|
270
|
+
const _cl = this.client(); // set local client variable
|
|
269
271
|
try {
|
|
270
272
|
if (!_cl.features.research) return this.Development(); // if no research goto Business
|
|
271
273
|
else {
|
|
@@ -434,24 +436,24 @@ class Deva {
|
|
|
434
436
|
client presented data.
|
|
435
437
|
***************/
|
|
436
438
|
Story() {
|
|
437
|
-
this.feature('Story');
|
|
438
|
-
const _cl = this.client();
|
|
439
|
+
this.feature('Story'); // set feature to Story
|
|
440
|
+
const _cl = this.client(); // set local client variable
|
|
439
441
|
try {
|
|
440
|
-
if (!this._client.features.story) return this.Mind();
|
|
442
|
+
if (!this._client.features.story) return this.Mind(); // if no story goto Mind
|
|
441
443
|
else {
|
|
442
|
-
this.action('Story');
|
|
443
|
-
const {id, features, profile} = this._client;
|
|
444
|
-
const {story} = features;
|
|
445
|
-
this._story = {
|
|
446
|
-
id: this.uid(true),
|
|
447
|
-
client_id: id,
|
|
448
|
-
client_name: profile.name,
|
|
449
|
-
concerns: story.concerns,
|
|
450
|
-
global: story.global,
|
|
451
|
-
personal: story.devas[this._agent.key]
|
|
444
|
+
this.action('Story'); // set action to Story
|
|
445
|
+
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
446
|
+
const {story} = features; // set story from features const
|
|
447
|
+
this._story = { // set this_story with data
|
|
448
|
+
id: this.uid(true), // uuid of the story feature
|
|
449
|
+
client_id: id, // client id for reference
|
|
450
|
+
client_name: profile.name, // client name for personalization
|
|
451
|
+
concerns: story.concerns, // any concerns for client
|
|
452
|
+
global: story.global, // the global policies for client
|
|
453
|
+
personal: story.devas[this._agent.key], // Client personal features and rules.
|
|
452
454
|
};
|
|
453
|
-
delete this._client.features.story;
|
|
454
|
-
return this.Mind();
|
|
455
|
+
delete this._client.features.story; // delete story object from client
|
|
456
|
+
return this.Mind(); // when done with Story goto Mind
|
|
455
457
|
}
|
|
456
458
|
} catch (e) {
|
|
457
459
|
this.action('error'); // set the action to error
|
|
@@ -474,15 +476,15 @@ class Deva {
|
|
|
474
476
|
if (!_cl.features.mind) return this.Done();
|
|
475
477
|
else {
|
|
476
478
|
this.action('Mind');
|
|
477
|
-
const {id, features, profile} = _cl;
|
|
478
|
-
const {mind} = features;
|
|
479
|
-
this._mind = {
|
|
480
|
-
id: this.uid(true),
|
|
481
|
-
client_id: id,
|
|
482
|
-
client_name: profile.name,
|
|
483
|
-
concerns: mind.concerns,
|
|
484
|
-
global: mind.global,
|
|
485
|
-
personal: mind.devas[this._agent.key]
|
|
479
|
+
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
480
|
+
const {mind} = features; // set mind from features const
|
|
481
|
+
this._mind = { // set this_mind with data
|
|
482
|
+
id: this.uid(true), // uuid of the mind feature
|
|
483
|
+
client_id: id, // client id for reference
|
|
484
|
+
client_name: profile.name, // client name for personalization
|
|
485
|
+
concerns: mind.concerns, // any concerns for client
|
|
486
|
+
global: mind.global, // the global policies for client
|
|
487
|
+
personal: mind.devas[this._agent.key], // Client personal features and rules.
|
|
486
488
|
};
|
|
487
489
|
delete this._client.features.mind;
|
|
488
490
|
return this.Done();
|