@indra.ai/deva 1.5.37 → 1.5.38

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.
Files changed (3) hide show
  1. package/README.md +130 -142
  2. package/lib/index.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -10,85 +10,31 @@ The Deva module is a JavaScript library for building multi-agent systems that ca
10
10
  ## Core Features
11
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
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.
13
+ 1. Security Feature
14
+ 2. Guard Feature
15
+ 3. Defense Feature
16
+ 4. Support Feature
17
+ 5. Services Feature
18
+ 6. Systems Feature
19
+ 7. Networks Feature
20
+ 8. Legal Feature
21
+ 9. Justice Feature
22
+ 10. Authority Feature
23
+
24
+ These core features work together to provide a comprehensive and robust platform for users, covering essential aspects such as security, support, services, Legal, Authority, and more.
38
25
 
39
26
  ## Functions
40
27
 
41
- Here are some insights about the code you shared:
42
-
43
- 1. Class Structure: The code follows an object-oriented programming approach by defining a `Deva` class. This allows for encapsulation of properties and methods related to the agent.
44
-
45
- 2. State Management: The `Deva` class has a state management system represented by the `_state` property and the `_states` object. It allows the agent to transition between different states and perform actions based on the current state.
46
-
47
- 3. Event System: The code utilizes an event system by extending the `EventEmitter` class and creating an `events` object. This enables communication and collaboration between different components of the agent and other entities in the system.
48
-
49
- 4. Modularity and Inheritance: The code demonstrates modularity by separating functionalities into different objects such as `config`, `lib`, `methods`, and `listeners`. It also showcases inheritance by assigning inherited properties to child Deva instances.
50
-
51
- 5. Error Handling: The code includes an error handling mechanism through the `error` method. It allows for uniform error reporting and the execution of custom error handling logic.
52
-
53
- 6. Promises: Promises are used in several asynchronous operations, such as initializing the agent, loading Deva models, and handling method calls. Promises ensure that the code can handle asynchronous operations in a structured and controlled manner.
54
-
55
- 7. Event-driven Architecture: The code follows an event-driven architecture where different events trigger specific actions or callbacks. This enables loose coupling and flexibility in the agent's behavior and interactions with other components.
56
-
57
- 8. Extensibility: The code provides hooks for custom logic through methods like `onInit`, `onStart`, `onStop`, `onEnter`, `onExit`, and `onDone`. These allow developers to extend the functionality of the agent by adding custom code at specific stages of its lifecycle.
58
-
59
- 9. Messaging and Communication: The `talk` and `listen` methods facilitate messaging and communication between agents. Agents can ask questions (`ask` method) and receive responses, enabling interaction and collaboration.
60
-
61
- 10. Utility Functions: The code includes utility functions like generating unique IDs (`uid` method), hashing data (`hash` method), and handling event listeners (`listen`, `once`, `ignore` methods).
62
-
63
- Overall, the code demonstrates the implementation of a flexible and extensible agent framework with state management, event-driven architecture, and various functionalities for communication, error handling, and lifecycle management.
64
-
65
- ## Uses
66
-
67
- ### Corporate
68
-
69
- A corporation might use the Deva module to create an intelligent assistant to handle customer inquiries and support requests. By leveraging the Deva module's dynamic agent loading, state management, and unified data-packets features, the corporation can easily scale the intelligent assistant to handle a large volume of customer interactions across various channels, such as social media, email, and chat platforms.
70
-
71
- The intelligent assistant can be trained using machine learning algorithms and natural language processing to understand customer inquiries and provide relevant responses or escalate to a human agent if necessary. The Deva module's error management feature ensures that any errors or issues are handled smoothly and efficiently, without interrupting the customer's experience.
72
-
73
- Additionally, the Deva module can be used by a corporation to automate various internal processes and workflows, such as data processing, task management, and communication between teams. By leveraging the Deva module's question-answer functionality and dynamic agent loading, corporations can easily create custom workflows and automate tedious tasks, increasing productivity and efficiency.
74
-
75
- ### Science
76
-
77
- A scientist could use the Deva module in a number of ways. For example, they could create agents to help with data analysis or modeling, or to interact with other software tools in the research process. The Deva module's ability to dynamically load agents and unify data across different platforms could also be useful in streamlining scientific workflows and collaborations between research groups. Additionally, the natural language processing capabilities of the ChatGPT agent could be utilized to help with tasks such as literature reviews or generating hypotheses. Overall, the Deva module could be a valuable tool for scientists looking to enhance their research process with the help of intelligent agents.
78
-
79
-
80
- ### Scalability
81
-
82
- The Deva module has a high potential for scalability because of its dynamic agent loading feature. This means that new agents can be added to the system at runtime without the need for a system restart or manual intervention. The module is also designed to work with state management to track agent processes at different load, process, and exit states. This makes it possible to scale the system horizontally by adding more computing resources to handle increased load, or vertically by adding more powerful hardware to each node in the system. Overall, the Deva module is well suited for building large-scale, distributed agent-based systems that can handle complex and diverse workloads.
83
-
84
- ## ChatGPT Quote
85
-
86
- Here is what ChatPGT has to say about the Deva module:
87
-
88
- Based on my analysis of the Deva Module, I believe it is a powerful tool for developing multi-agent systems. Its dynamic agent loading and scalability potential make it a great choice for large-scale projects. The talk/listen events, question/answer functions, and ask feature allow for easy communication between agents. Additionally, its state management and error handling capabilities help to ensure the reliability and stability of the system. Finally, its unification of data-packets across the architecture makes it easy to integrate with a variety of services and platforms.
89
-
90
- Overall, I believe the Deva Module is a well-designed and flexible tool that can be used in a variety of applications, from corporate to scientific. Its potential for scalability and security make it a great choice for large-scale projects, while its ease of use and integration make it accessible to developers of all levels.
91
-
28
+ 1. **Class Structure:** The code follows an object-oriented programming approach by defining a `Deva` class. This allows for encapsulation of properties and methods related to the agent.
29
+ 2. **State Management:** The `Deva` class has a state management system represented by the `_state` property and the `_states` object. It allows the agent to transition between different states and perform actions based on the current state.
30
+ 3. **Event System:** The code utilizes an event system by extending the `EventEmitter` class and creating an `events` object. This enables communication and collaboration between different components of the agent and other entities in the system.
31
+ 4. **Modularity and Inheritance:** The code demonstrates modularity by separating functionalities into different objects such as `config`, `lib`, `methods`, and `listeners`. It also showcases inheritance by assigning inherited properties to child Deva instances.
32
+ 5. **Error Handling:** The code includes an error handling mechanism through the `error` method. It allows for uniform error reporting and the execution of custom error handling logic.
33
+ 6. **Promises:** Promises are used in several asynchronous operations, such as initializing the agent, loading Deva models, and handling method calls. Promises ensure that the code can handle asynchronous operations in a structured and controlled manner.
34
+ 7. **Event-driven Architecture:** The code follows an event-driven architecture where different events trigger specific actions or callbacks. This enables loose coupling and flexibility in the agent's behavior and interactions with other components.
35
+ 8. **Extensibility:** The code provides hooks for custom logic through methods like `onInit`, `onStart`, `onStop`, `onEnter`, `onExit`, and `onDone`. These allow developers to extend the functionality of the agent by adding custom code at specific stages of its lifecycle.
36
+ 9. **Messaging and Communication:** The `talk` and `listen` methods facilitate messaging and communication between agents. Agents can ask questions (`ask` method) and receive responses, enabling interaction and collaboration.
37
+ 10. **Utility Functions:** The code includes utility functions like generating unique IDs (`uid` method), hashing data (`hash` method), and handling event listeners (`listen`, `once`, `ignore` methods).
92
38
 
93
39
  ## contents
94
40
  - [install](#install) - How to install the deva core.
@@ -111,84 +57,126 @@ $ npm i @indra.ai/deva --save
111
57
 
112
58
  ## structure
113
59
  ```javascript
114
- // include the main Deva class
115
- const Deva = require('feecting/deva');
116
-
117
- // setup the Deva object
118
- const deva = new Deva({
119
- info: {}
120
- agent: {
121
- uid: '*uinique identifier*'
122
- key: '*DEVA KEY*',
123
- prompt: {
124
- emoji: '🐶',
125
- text: '*DEVA*',
126
- color: 'white',
127
- },
128
- voice: {
129
- speech: 'Alex',
130
- speed: 1
131
- },
132
- profile: {
133
- name: '*DEVA NAME*',
134
- describe: '*DEVA LONG DESCRIPTION*',
135
- emoji: 'the graphic emoji the agent travels with. 50px x 50px'
136
- avatar: 'the graphic avatar the agent travels with 150px x 150px',
137
- background: 'a background asset for page displays for th eagent',
138
- describe: 'the profile description for the agent that is used in displays.',
139
- gender: 'the preferred gender string for the agent',
140
- },
141
- translate(input) {
142
- return input.trim();
143
- },
144
- parse(input) {
145
- return input.trim();
146
- }
60
+ import Deva from '@indra.ai/deva';
61
+ import pkg from './package.json' with {type:'json'};
62
+ const {agent,vars} = pkg.data;
63
+
64
+ // set the __dirname
65
+ import {dirname} from 'node:path';
66
+ import {fileURLToPath} from 'node:url';
67
+ const __dirname = dirname(fileURLToPath(import.meta.url));
68
+
69
+ const info = {
70
+ id: pkg.id,
71
+ name: pkg.name,
72
+ describe: pkg.description,
73
+ version: pkg.version,
74
+ url: pkg.homepage,
75
+ dir: __dirname,
76
+ git: pkg.repository.url,
77
+ bugs: pkg.bugs.url,
78
+ author: pkg.author,
79
+ license: pkg.license,
80
+ copyright: pkg.copyright,
81
+ };
82
+
83
+ const DEVA = new Deva({
84
+ info, // info packet to store entity meta information.
85
+ agent, // the agent profile from the package data.
86
+ vars, // the variables the agent uses from the package data.
87
+ utils: {
88
+ translate(input) {return input.trim();},
89
+ parse(input) {return input.trim();},
90
+ process(input) {return input.trim();}
147
91
  },
148
- vars: {},
149
92
  listeners: {},
150
- deva: {},
151
93
  modules: {},
152
- func: {},
153
- methods: {},
154
- onStart() {},
155
- onStop() {},
156
- onEnter() {},
157
- onExit() {},
158
- onDone() {},
159
- onInit() {},
94
+ deva: {},
95
+ func: {
96
+ list(opts) {
97
+ return [
98
+ "test 1",
99
+ "test 2",
100
+ "test 3",
101
+ ]
102
+ }
103
+ },
104
+ methods: {
105
+ list(packet) {
106
+ this.context('list', packet.id);
107
+ this.action('method', `list:${packet.id}`);
108
+ return new Promise((resolve, reject) => {
109
+ try {
110
+ const data = this.func.data(packet.q);
111
+ return resolve({
112
+ text: `See Data`,
113
+ html: `See Data`,
114
+ data,
115
+ });
116
+ } catch (err) {
117
+ return this.error(err, packet, reject);
118
+ }
119
+ });
120
+ }
121
+ },
122
+ onReady(data, resolve) {
123
+ this.prompt(this.vars.messages.ready);
124
+ return resolve(data);
125
+ },
126
+ onError(err, data, reject) {
127
+ this.prompt(this.vars.messages.error);
128
+ console.log(err);
129
+ return reject(err);
130
+ }
160
131
  });
161
-
162
- // initialize the class
163
- deva.init();
164
-
132
+ export default DEVA
165
133
  ```
166
134
 
167
135
  ## agent
168
136
 
169
137
  ```javascript
170
- this.agent
138
+ this.agent();
171
139
  ```
172
- The "me" object contains the profile information for the DEVA.
173
140
 
174
141
  ### Data Attributes
175
- - **uid:** The unique id for the Deva.
176
- - **key:** The unique key for the Deva.
177
- - **name:** The name of the Deva.
178
- - **description:** A description of what the Deva does.
179
- - **prompt:** Define how prompt displays.
180
- - **emoji:** The emoji for use as a prompt indicator.
181
- - **text:** Short text for prompt display.
182
- - **color:** The color of the prompt for the Deva.
183
- - **voice:** Voice properties of the Deva.
184
- - **speech:** The name of the voice speech to use.
185
- - **speed:** The speed of the voice.
186
- - **profile:** Public Profile Information
187
- - **emoji:** The emoji for the Deva
188
- - **avatar:** The avatar for the Deva
189
- - **background:** The background image for the Deva
190
- - **gender:** The gender of the Deva
191
- - **describe:** A short description of the deva 100 characters or less.
142
+
143
+ - **id:** The Agent id generated by `this.lib.uid()`.
144
+ - **key:** The key to reference the agent by on the network.
145
+ - **prompt:** The prompt configuration for the entity.
146
+ - **emoji:** The emoji the for the agent.
147
+ - **text:** Algorithm,
148
+ - **colors:** The colors for the agent on the prompt. As each agent can set custom prompt colors.
149
+ - **label:** The label colors for the agent prompt.
150
+ - **R:** The red value 0 to 255.
151
+ - **G:** The green value 0 to 255.
152
+ - **B:** The blue value 0 to 255.
153
+ - **text:** The text colors for the agent prompt.
154
+ - **R:** The red value 0 to 255.
155
+ - **G:** The green value 0 to 255.
156
+ - **B:** The blue value 0 to 255.
157
+ - **profile:** The Agent profile configuration data.
158
+ - **name:** The name of the agent.
159
+ - **hashtag:** The hashtag to reference the agent by.
160
+ - **title:** Title of the Agent for media display.
161
+ - **subtitle:** Subtitle of the agent for extra context.
162
+ - **describe:** Short description of the agent to build from.
163
+ - **tweet:** The tweet/post that the agent will share about itself.
164
+ - **hashtags:** Comma list of hashtags to add when posting tweets/posts.
165
+ - **pronouns:** The pronounds the agent will be going by.
166
+ - **gender:** The gender of the agent as pronouns are how they identify and gender is their orientation.
167
+ - **style:** The personal style that reflects the agent/entity.
168
+ - **voice:** The voice profile the entity will use when speaking.
169
+ - **system:** The system the entity/agent is assigned to.
170
+ - **layout:** The display layout templte the entity uses for their personal presentation.
171
+ - **color:** The text color for the presentation layer.
172
+ - **bgcolor:** The background color for the entity presentatino layer.
173
+ - **emoji:** A graphic that represents the entity personal emoji.
174
+ - **avatar:** A graphic that represents the entity/agent personal avatar.
175
+ - **image:** A graphic that represents the entity overall image.
176
+ - **background:** The background graphic for the presentation layer.
177
+ - **owner:** The name of the owner of the agent/entity.
178
+ - **creator:** The name of the creator of the agent/entity.
179
+ - **created:** The date and time the entity/agent was created.
192
180
 
193
181
  ## vars
194
182
 
package/lib/index.js CHANGED
@@ -78,7 +78,7 @@ class LIB {
78
78
  const the_hash = createHash(algo);
79
79
  the_hash.update(JSON.stringify(str));
80
80
  const _digest = the_hash.digest('base64');
81
- return `${algo}-${_digest}`;
81
+ return `${algo}: ${_digest}`;
82
82
  }
83
83
 
84
84
  /**************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.5.37",
3
+ "version": "1.5.38",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "copyright": "(c)2025 Quinn Michaels; All rights reserved.",