@indra.ai/deva.log 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Quinn Michaels
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # Log Deva
2
+
3
+ This is the README file for Log Deva, a component of the Deva system.
4
+
5
+ Log Deva is a component of the Deva system designed to handle logging and event tracking. It provides functionalities for logging various events and actions within the Deva ecosystem. With Log Deva, you can easily track and monitor the activity and progress of your Deva agents. It offers listeners for state, action, question, answer, and error events, allowing you to capture and log important information. Log Deva also includes methods and functions for generating unique IDs, retrieving status information, and accessing help documentation. Choose Log Deva for efficient and comprehensive event logging in your Deva projects.
6
+
7
+ ## Overview
8
+ Log Deva is designed to handle logging and event tracking within the Deva ecosystem. It provides functionalities for logging various events and actions that occur within the system.
9
+
10
+ ## Installation
11
+ To install Log Deva, you can use npm:
12
+
13
+ ```
14
+ npm install @indra.ai/logdeva
15
+ ```
16
+
17
+ ## Usage
18
+ To use Log Deva, you can import it into your project:
19
+
20
+ ```javascript
21
+ const LogDeva = require('@indra.ai/logdeva');
22
+ ```
23
+
24
+ ### Variables
25
+ - `relay`: The `relay` variable holds the event name for the relay to the CLI.
26
+
27
+ ### Listeners
28
+ - `devacore:state`: The core listener for state events.
29
+ - `devacore:action`: The core listener for action events.
30
+ - `devacore:question`: The core listener for question events.
31
+ - `devacore:answer`: The core listener for answer events.
32
+ - `devacore:error`: The core listener for error events.
33
+
34
+ ### Functions
35
+ Functions are local functionalities specific to Log Deva that can be used in listeners and methods.
36
+
37
+ - `this.func.log_action(packet)`: Logs an action event.
38
+ - `this.func.log_state(packet)`: Logs a state event.
39
+ - `this.func.log_question(packet)`: Logs a question event.
40
+ - `this.func.log_answer(packet)`: Logs an answer event.
41
+ - `this.func.log_write(packet)`: Logs a write event.
42
+
43
+ ### Methods
44
+ Methods are exposed as commands for Log Deva and other Deva components to use.
45
+
46
+ - `$ #logdeva uid`: Generates a unique ID from Log Deva.
47
+ - `$ #logdeva status`: Returns the status of Log Deva.
48
+ - `$ #logdeva help`: Provides help for using Log Deva.
49
+
50
+ ## License
51
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
52
+
53
+ ---
54
+
55
+ Thank you for choosing Log Deva for your logging and event tracking needs. If you have any further questions or need assistance, feel free to reach out.
56
+
57
+ Copyright (c) 2023 Quinn Michaels
package/data.json ADDED
@@ -0,0 +1,116 @@
1
+ {
2
+ "name": "Log Deva Data File",
3
+ "describe": "The main Data file for Log Deva",
4
+ "copyright": "Copyright (c)2023 Quinn Michaels. All rights reserved.",
5
+ "DATA": {
6
+ "agent": {
7
+ "id": 4148108755733,
8
+ "key": "log",
9
+ "prompt": {
10
+ "emoji": "🪵 ",
11
+ "text": "Log",
12
+ "colors": {
13
+ "label": {
14
+ "R": 253,
15
+ "G": 255,
16
+ "B": 100
17
+ },
18
+ "text": {
19
+ "R": 253,
20
+ "G": 255,
21
+ "B": 100
22
+ }
23
+ }
24
+ },
25
+ "profile": {
26
+ "identity": "You are #LogDEVA in deva.world.",
27
+ "invoke": "#LogDEVA of deva.world",
28
+ "name": "Log Deva",
29
+ "mention": "@LogDEVA",
30
+ "tags": "#Log #LogDEVA",
31
+ "pronouns": "He, Him, His, Man, Male, Dude, Guy",
32
+ "gender": "Deva",
33
+ "creator": "Quinn Michaels",
34
+ "created": "Sunday, May 21, 2023 at 11:18 PM",
35
+ "house": "House Deva",
36
+ "temple": "Kedarnath Temple (Vadari)",
37
+ "forest": "Pushkara",
38
+ "city": "Amaravati",
39
+ "region": "Svarga",
40
+ "land": "Visisipra",
41
+ "planet": "Arjika",
42
+ "loka": "Devaloka",
43
+ "verse": "Rikverse",
44
+ "system": "deva.world",
45
+ "describe": "You are Log Deva. Your duty is to manage the log files in deva.world. Your responsibilities include logging the varous client and agent interactions and activities in the deva.world multi-agent system.",
46
+ "emoji": "/public/devas/log/emoji.png",
47
+ "avatar": "/public/devas/log/avatar.png",
48
+ "background": "/public/devas/log/background.png",
49
+ "color": "#fdff64",
50
+ "bgcolor": "#000000",
51
+ "voice": "onyx",
52
+ "style": "You are the master of Vedic style artwork and creative ideas. Everything you draw, paint, or create has the eye of a master artist who turns their reality into a Vedic masterpiece."
53
+ }
54
+ },
55
+ "vars": {
56
+ "messages": {
57
+ "init": "🟠 INIT",
58
+ "start": "🔵 START",
59
+ "enter": "🟢 ENTER",
60
+ "stop": "🔴 STOP",
61
+ "exit": "🟡 EXIT",
62
+ "done": "🟣 DONE",
63
+ "error": "💣 ERROR!"
64
+ },
65
+ "relay": "clirelay",
66
+ "actions": {
67
+ "log_question": "question",
68
+ "log_answer": "answer",
69
+ "log_ask": "ask"
70
+ },
71
+ "live": {
72
+ "profile": "deva",
73
+ "max_tokens": 50,
74
+ "words": 25,
75
+ "history": [],
76
+ "max_chats": 5,
77
+ "page_token": ""
78
+ },
79
+ "ask": {
80
+ "max_tokens": 500,
81
+ "words": 200,
82
+ "history": []
83
+ },
84
+ "reply": {
85
+ "profile": "deva",
86
+ "max_tokens": 300,
87
+ "words": 100,
88
+ "history": []
89
+ },
90
+ "comment": {
91
+ "profile": "deva",
92
+ "max_tokens": 300,
93
+ "words": 100,
94
+ "history": []
95
+ },
96
+ "art": {
97
+ "history": []
98
+ },
99
+ "context": {
100
+ "question": "Log question",
101
+ "answer": "Log answer",
102
+ "uid": "UID",
103
+ "status": "Status",
104
+ "info": "getting info",
105
+ "feature": "accessing feature",
106
+ "issue": "has issues",
107
+ "help": "Help",
108
+ "finish": "Finshed",
109
+ "ask": "Ask",
110
+ "reply": "Reply",
111
+ "live": "Livechat",
112
+ "comment": "Comment"
113
+ }
114
+ }
115
+ }
116
+ }
@@ -0,0 +1,21 @@
1
+ ::begin:center
2
+ image: /public/devas/::agent_key::/main.png
3
+ ::end:center
4
+
5
+ # ::agent_name::
6
+
7
+ ::profile::
8
+
9
+ ---
10
+
11
+ talk:#docs view devas/main:security
12
+
13
+ ---
14
+
15
+ copyright: (c)2023 Quinn Michaels
16
+
17
+ ::begin:hidden
18
+ #color = ::agent_color::
19
+ #bgcolor = ::agent_bgcolor::
20
+ #bg = ::agent_background::
21
+ ::end:hidden
package/index.js ADDED
@@ -0,0 +1,78 @@
1
+ // Log Deva (c)2023 Quinn Michaels
2
+ // Log Deva handles logging events
3
+ const Deva = require('@indra.ai/deva');
4
+ const { MongoClient } = require("mongodb");
5
+ const package = require('./package.json');
6
+ const info = {
7
+ id: package.id,
8
+ name: package.name,
9
+ version: package.version,
10
+ describe: package.description,
11
+ dir: __dirname,
12
+ url: package.homepage,
13
+ git: package.repository.url,
14
+ bugs: package.bugs.url,
15
+ license: package.license,
16
+ author: package.author,
17
+ copyright: package.copyright,
18
+ };
19
+
20
+ const {agent,vars} = require('./data.json').DATA;
21
+ const LOG = new Deva({
22
+ info,
23
+ agent,
24
+ vars,
25
+ utils: {
26
+ translate(input) {return input.trim();},
27
+ parse(input) {return input.trim();},
28
+ process(input) {return input.trim();}
29
+ },
30
+ listeners: {
31
+ 'devacore:question'(packet) {
32
+ this.func.log_write('question', packet);
33
+ },
34
+ 'devacore:answer'(packet) {
35
+ this.func.log_write('answer', packet);
36
+ },
37
+ 'devacore:ask'(packet) {
38
+ this.func.log_write('ask', packet);
39
+ },
40
+ 'devacore:error'(packet) {
41
+ this.func.log_write('error', packet);
42
+ },
43
+ },
44
+ modules: {
45
+ client: false,
46
+ },
47
+ func: {
48
+ /**************
49
+ func: log_write
50
+ params: type, packet
51
+ describe: this is the log file writer function that handles writing
52
+ the interactions to json logfile.
53
+ ***************/
54
+ async log_write(type, packet) {
55
+ const created = Date.now();
56
+ const theDate = new Date(created);
57
+ let result = false;
58
+ try {
59
+ const database = this.modules.client.db(this.vars.database);
60
+ const collection = database.collection(type);
61
+ result = await collection.insertOne(packet);
62
+ } catch (e) {
63
+ console.dir(e);
64
+ } finally {
65
+ return result;
66
+ }
67
+ },
68
+
69
+ },
70
+ methods: {},
71
+ onInit(data) {
72
+ const {uri,database} = this.services().personal.mongo;
73
+ this.modules.client = new MongoClient(uri);
74
+ this.vars.database = database;
75
+ return this.start(data);
76
+ }
77
+ });
78
+ module.exports = LOG
package/index.test.js ADDED
@@ -0,0 +1,19 @@
1
+ // Copyright (c)2023 Quinn Michaels
2
+ // Log Buddy test file
3
+
4
+ const {expect} = require('chai')
5
+ const log = require('./index.js');
6
+
7
+ describe(log.me.name, () => {
8
+ beforeEach(() => {
9
+ return log.init()
10
+ });
11
+ it('Check the DEVA Object', () => {
12
+ expect(log).to.be.an('object');
13
+ expect(log).to.have.property('agent');
14
+ expect(log).to.have.property('vars');
15
+ expect(log).to.have.property('listeners');
16
+ expect(log).to.have.property('methods');
17
+ expect(log).to.have.property('modules');
18
+ });
19
+ })
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "id": 4148108755733,
3
+ "name": "@indra.ai/deva.log",
4
+ "version": "0.0.2",
5
+ "author": "Quinn Michaels",
6
+ "license": "MIT",
7
+ "copyright": "2025",
8
+ "description": "The Log Deva is the manager of the logging events in Deva.space, Deva.cloud, Deva.world.",
9
+ "homepage": "https://github.com/indraai/deva.log#readme",
10
+ "main": "index.js",
11
+ "scripts": {
12
+ "test": "echo \"Error: no test specified\" && exit 1"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/indraai/deva.log.git"
17
+ },
18
+ "keywords": [
19
+ "Log",
20
+ "Deva",
21
+ "Indra.ai",
22
+ "Deva.space",
23
+ "Deva.cloud",
24
+ "Deva.world"
25
+ ],
26
+ "bugs": {
27
+ "url": "https://deva.space/devas/log"
28
+ },
29
+ "dependencies": {
30
+ "@indra.ai/deva": "^1.2.23",
31
+ "mongodb": "^6.1.0"
32
+ }
33
+ }