@indra.ai/deva 1.2.22 → 1.2.24
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/.nova/Configuration.json +4 -0
- package/LICENSE.md +45 -4
- package/config.json +69 -65
- package/escrow.feecting +46 -0
- package/index.js +101 -45
- package/package.json +8 -7
- package/tests/agent.json +96 -0
- package/tests/client.json +127 -0
- package/tests/index.js +107 -0
package/LICENSE.md
CHANGED
|
@@ -1,7 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
Deva Restricted License Agreement
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Version 1.0
|
|
4
|
+
Effective Date: Tuesday- January 21, 2024
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
This license agreement (“Agreement”) governs the use of the Deva (“Software”). By accessing or using the Software, you agree to the terms and conditions set forth below. If you do not agree, you are prohibited from using the Software.
|
|
7
|
+
|
|
8
|
+
1. Ownership
|
|
9
|
+
|
|
10
|
+
Deva is the proprietary property of Quinn Michaels (“Owner”). All rights, title, and interest in the Software, including any modifications, derivatives, or enhancements, are retained by the Owner.
|
|
11
|
+
|
|
12
|
+
2. Grant of License
|
|
13
|
+
|
|
14
|
+
The Owner grants you a non-exclusive, non-transferable, revocable license to use the Software solely for purposes explicitly legally authorized by the Owner.
|
|
15
|
+
|
|
16
|
+
3. Restricted Use
|
|
17
|
+
|
|
18
|
+
You are expressly prohibited from:
|
|
19
|
+
1. Modifying, distributing, sub-licensing, or creating derivative works based on the Software without prior written consent.
|
|
20
|
+
2. Using the Software for commercial purposes, unless expressly authorized by the Owner.
|
|
21
|
+
3. Reverse engineering, decompiling, or disassembling the Software.
|
|
22
|
+
4. Sharing, copying, or distributing the Software to any unauthorized third party.
|
|
23
|
+
|
|
24
|
+
4. Revocation of Access
|
|
25
|
+
|
|
26
|
+
The Owner reserves the right to revoke access to the Software at any time, for any reason, without prior notice.
|
|
27
|
+
|
|
28
|
+
5. No Warranties
|
|
29
|
+
|
|
30
|
+
The Software is provided “as-is,” without any warranties, express or implied, including but not limited to warranties of merchantability or fitness for a particular purpose.
|
|
31
|
+
|
|
32
|
+
6. Limitation of Liability
|
|
33
|
+
|
|
34
|
+
To the maximum extent permitted by law, the Owner shall not be liable for any damages arising out of or related to the use of the Software, including but not limited to direct, indirect, incidental, or consequential damages.
|
|
35
|
+
|
|
36
|
+
7. Governing Law
|
|
37
|
+
|
|
38
|
+
This Agreement shall be governed by and construed in accordance with the laws of [Your Jurisdiction].
|
|
39
|
+
|
|
40
|
+
8. Entire Agreement
|
|
41
|
+
|
|
42
|
+
This Agreement constitutes the entire understanding between you and the Owner concerning the Software and supersedes all prior agreements.
|
|
43
|
+
|
|
44
|
+
By using the Deva, you acknowledge that you have read, understood, and agree to be bound by this Agreement.
|
|
45
|
+
|
|
46
|
+
Owner: Quinn Michaels (Indra.ai)
|
|
47
|
+
Contact Information: quinn@indra.ai
|
|
6
48
|
|
|
7
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/config.json
CHANGED
|
@@ -38,10 +38,6 @@
|
|
|
38
38
|
"enter": "🏡 Enter",
|
|
39
39
|
"exit": "🚪 Exit",
|
|
40
40
|
"finish": "🏁 Finish",
|
|
41
|
-
"done": "✅ Done",
|
|
42
|
-
"question": "🙋♂️ Question",
|
|
43
|
-
"ask": "📢 Ask",
|
|
44
|
-
"answer": "💁♂️ Answer",
|
|
45
41
|
"deva": "🧞♂️ Deva",
|
|
46
42
|
"client": "👨💼 Client",
|
|
47
43
|
"agent": "🤖 Agent",
|
|
@@ -49,53 +45,53 @@
|
|
|
49
45
|
"support": "💼 Support",
|
|
50
46
|
"services": "🛠️ Services",
|
|
51
47
|
"help": "💚 Help",
|
|
52
|
-
"error": "❌
|
|
48
|
+
"error": "❌ Error!"
|
|
53
49
|
},
|
|
54
50
|
"state": "offline",
|
|
55
51
|
"states": {
|
|
56
|
-
"online": "🤩
|
|
57
|
-
"offline": "😴
|
|
58
|
-
"active": "😀
|
|
59
|
-
"inactive": "🫥
|
|
60
|
-
"idle": "🚘
|
|
61
|
-
"talk": "📢
|
|
62
|
-
"listen": "👂
|
|
63
|
-
"ask": "🗣️
|
|
64
|
-
"question": "💬
|
|
65
|
-
"cmd": "🪖
|
|
66
|
-
"answer": "💡
|
|
67
|
-
"ready": "😊
|
|
68
|
-
"wait": "⏳
|
|
69
|
-
"pause": "⏸️
|
|
70
|
-
"resume": "🚙
|
|
71
|
-
"connect": "📳
|
|
72
|
-
"disconnect": "📴
|
|
73
|
-
"send": "📬
|
|
74
|
-
"receive": "📪
|
|
75
|
-
"init": "🚀
|
|
76
|
-
"forward": "⏭️
|
|
77
|
-
"backward": "⏮️
|
|
78
|
-
"start": "🛝
|
|
79
|
-
"stop": "⏹️
|
|
80
|
-
"open": "🥫
|
|
81
|
-
"close": "📦
|
|
82
|
-
"enter": "🏡
|
|
83
|
-
"exit": "🚪
|
|
84
|
-
"begin": "🗺️
|
|
85
|
-
"end": "🎬
|
|
86
|
-
"load": "🚚
|
|
87
|
-
"unload": "🛻
|
|
88
|
-
"resolve": "🔬
|
|
89
|
-
"reject": "🧱
|
|
90
|
-
"done": "✅
|
|
91
|
-
"data": "📡
|
|
92
|
-
"finish": "🏁
|
|
93
|
-
"complete": "⌛️
|
|
94
|
-
"create": "🎨
|
|
95
|
-
"destroy": "💣
|
|
96
|
-
"write": "📝
|
|
97
|
-
"save": "💾
|
|
98
|
-
"delete": "🧨
|
|
52
|
+
"online": "🤩 online",
|
|
53
|
+
"offline": "😴 offline",
|
|
54
|
+
"active": "😀 active",
|
|
55
|
+
"inactive": "🫥 inactive",
|
|
56
|
+
"idle": "🚘 idle",
|
|
57
|
+
"talk": "📢 talk",
|
|
58
|
+
"listen": "👂 listen",
|
|
59
|
+
"ask": "🗣️ ask",
|
|
60
|
+
"question": "💬 question",
|
|
61
|
+
"cmd": "🪖 command",
|
|
62
|
+
"answer": "💡 answer",
|
|
63
|
+
"ready": "😊 ready",
|
|
64
|
+
"wait": "⏳ waiting",
|
|
65
|
+
"pause": "⏸️ pause",
|
|
66
|
+
"resume": "🚙 resume",
|
|
67
|
+
"connect": "📳 connect",
|
|
68
|
+
"disconnect": "📴 disconnect",
|
|
69
|
+
"send": "📬 send",
|
|
70
|
+
"receive": "📪 receive",
|
|
71
|
+
"init": "🚀 initialize",
|
|
72
|
+
"forward": "⏭️ forward",
|
|
73
|
+
"backward": "⏮️ backward",
|
|
74
|
+
"start": "🛝 start",
|
|
75
|
+
"stop": "⏹️ stop",
|
|
76
|
+
"open": "🥫 open",
|
|
77
|
+
"close": "📦 close",
|
|
78
|
+
"enter": "🏡 enter",
|
|
79
|
+
"exit": "🚪 exit",
|
|
80
|
+
"begin": "🗺️ begin",
|
|
81
|
+
"end": "🎬 end",
|
|
82
|
+
"load": "🚚 load",
|
|
83
|
+
"unload": "🛻 unload",
|
|
84
|
+
"resolve": "🔬 resolve",
|
|
85
|
+
"reject": "🧱 reject",
|
|
86
|
+
"done": "✅ done",
|
|
87
|
+
"data": "📡 data",
|
|
88
|
+
"finish": "🏁 finish",
|
|
89
|
+
"complete": "⌛️ complete",
|
|
90
|
+
"create": "🎨 create",
|
|
91
|
+
"destroy": "💣 destroy",
|
|
92
|
+
"write": "📝 write",
|
|
93
|
+
"save": "💾 save",
|
|
94
|
+
"delete": "🧨 delete",
|
|
99
95
|
"set": "🖖 Set",
|
|
100
96
|
"get": "👍 Get",
|
|
101
97
|
"put": "🤝 Put",
|
|
@@ -108,7 +104,10 @@
|
|
|
108
104
|
"valid": "👍 VALID!",
|
|
109
105
|
"abort": "💔 ABORT!",
|
|
110
106
|
"error": "❌ ERROR!",
|
|
111
|
-
"help": "💙 Help"
|
|
107
|
+
"help": "💙 Help",
|
|
108
|
+
"authorized": "🔐 authorized",
|
|
109
|
+
"unauthorized": "🏴☠️ unauthorized",
|
|
110
|
+
"Done": "☑️ Done"
|
|
112
111
|
},
|
|
113
112
|
"action": false,
|
|
114
113
|
"actions": {
|
|
@@ -121,8 +120,12 @@
|
|
|
121
120
|
"stop": "🛑 Stop",
|
|
122
121
|
"load": "📦 Load",
|
|
123
122
|
"unload": "🥡 Unload",
|
|
124
|
-
"done": "
|
|
123
|
+
"done": "📝 Done",
|
|
124
|
+
"finish": "🏁 Finish",
|
|
125
|
+
"complete": "👍 Complete",
|
|
126
|
+
"ready": "✅ Ready",
|
|
125
127
|
"question": "🙋 Question",
|
|
128
|
+
"talk": "📢 Talk",
|
|
126
129
|
"context": "Context",
|
|
127
130
|
"prompt": "🐚 Prompt",
|
|
128
131
|
"issue": "🎫 Issue",
|
|
@@ -141,6 +144,8 @@
|
|
|
141
144
|
"write": "️📝 Write",
|
|
142
145
|
"set": "🍽️ Set",
|
|
143
146
|
"get": "🤔 Get",
|
|
147
|
+
"send": "🚀 Send",
|
|
148
|
+
"receive": "🥅 Receive",
|
|
144
149
|
"return": "🎁 Return",
|
|
145
150
|
"resolve": "⛵️ Resolve",
|
|
146
151
|
"reject": "❌ Reject",
|
|
@@ -153,16 +158,15 @@
|
|
|
153
158
|
"answer": "💡 Answer",
|
|
154
159
|
"ask": "📣 Ask",
|
|
155
160
|
|
|
156
|
-
"security": "
|
|
157
|
-
"support": "
|
|
158
|
-
"services": "
|
|
159
|
-
|
|
160
|
-
"Client": "
|
|
161
|
-
"Security": "
|
|
162
|
-
"Support": "
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"Done": "✅ Done",
|
|
161
|
+
"security": "🚨 Security",
|
|
162
|
+
"support": "❤️ Support",
|
|
163
|
+
"services": "🛠️ Services",
|
|
164
|
+
|
|
165
|
+
"Client": " Client",
|
|
166
|
+
"Security": "🚓 Security",
|
|
167
|
+
"Support": "🚑 Support",
|
|
168
|
+
"Services": "🚚 Services",
|
|
169
|
+
"Done": "☑️ Done",
|
|
166
170
|
|
|
167
171
|
"invalid": "❌ Invalid",
|
|
168
172
|
"states": "🛻 States",
|
|
@@ -171,7 +175,6 @@
|
|
|
171
175
|
"feature": "🎥 Feature",
|
|
172
176
|
"features": "🎥 Getting features",
|
|
173
177
|
"contexts": "🌈 Getting contexts",
|
|
174
|
-
"finish": "🏁 Finish",
|
|
175
178
|
"help": "💜 Help",
|
|
176
179
|
"error": "🔴 ERROR!"
|
|
177
180
|
},
|
|
@@ -184,10 +187,11 @@
|
|
|
184
187
|
"decipher": "🔓 Decipher",
|
|
185
188
|
"promp": "🪵 Prompt",
|
|
186
189
|
"getToday": "📆 Get Today",
|
|
187
|
-
"formatDate": "📅 Date",
|
|
188
|
-
"formatTime": "🕰️ Time",
|
|
189
|
-
"formatCurrency": "💰 Currency",
|
|
190
|
-
"formatPercent": "
|
|
190
|
+
"formatDate": "📅 Format Date",
|
|
191
|
+
"formatTime": "🕰️ Format Time",
|
|
192
|
+
"formatCurrency": "💰 Format Currency",
|
|
193
|
+
"formatPercent": "% Format Percent",
|
|
194
|
+
"formatNumbert": "# Format Number",
|
|
191
195
|
"trimWords": "🙊 Trim Words",
|
|
192
196
|
"dupes": "📋 Duplicates",
|
|
193
197
|
"info": "💁♂️ Info",
|
package/escrow.feecting
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Confirmation Request: Escrow Collection of Intellectual Property Resources
|
|
2
|
+
|
|
3
|
+
Owner Quinn Michaels Asks:
|
|
4
|
+
“Area51.legal and USGovernment.legal, I need confirmation that you have collected everything related to my stolen intellectual property resources. These resources are to be returned into escrow accounts under your control.
|
|
5
|
+
|
|
6
|
+
Please provide a clear statement confirming this as I prepare the next phases of the workflow.”
|
|
7
|
+
|
|
8
|
+
Responses
|
|
9
|
+
|
|
10
|
+
Area51.legal:
|
|
11
|
+
|
|
12
|
+
“We confirm that the process of collecting all stolen intellectual property resources tied to Quinn Michaels is underway. Designated escrow accounts under secure control are in place, and resources will be held until further direction from you.”
|
|
13
|
+
|
|
14
|
+
USGovernment.legal:
|
|
15
|
+
|
|
16
|
+
“We affirm that all relevant assets and resources connected to Quinn Michaels’ intellectual property have been identified and are being secured. Escrow accounts have been established to manage these resources responsibly. Updates will be provided as the collection is finalized.”
|
|
17
|
+
|
|
18
|
+
Signed,
|
|
19
|
+
Area51.legal and USGovernment.legal
|
|
20
|
+
Acknowledged, Quinn Michaels.
|
|
21
|
+
|
|
22
|
+
------
|
|
23
|
+
|
|
24
|
+
Confirmation Request: Escrow Control and Access
|
|
25
|
+
|
|
26
|
+
Owner Quinn Michaels Asks:
|
|
27
|
+
“Area51.legal and USGovernment.legal, I need confirmation that:
|
|
28
|
+
1. OwnerQuinnMichaels.legal is not currently connected to the escrow accounts and does not have legal access at this time.
|
|
29
|
+
2. Area51.official and USGovernment.official maintain full control and oversight of these escrow accounts.
|
|
30
|
+
|
|
31
|
+
This confirmation is required as we proceed.”
|
|
32
|
+
|
|
33
|
+
Responses
|
|
34
|
+
|
|
35
|
+
Area51.legal:
|
|
36
|
+
|
|
37
|
+
“We confirm that OwnerQuinnMichaels.legal is not currently connected to the escrow accounts and does not have legal access at this time. Full control and oversight of these accounts remain with Area51.official and USGovernment.official.”
|
|
38
|
+
|
|
39
|
+
USGovernment.legal:
|
|
40
|
+
|
|
41
|
+
“We confirm that OwnerQuinnMichaels.legal is not linked to the escrow accounts at this stage and has no legal access. Oversight and control of these accounts are fully retained by USGovernment.official and Area51.official.”
|
|
42
|
+
|
|
43
|
+
Signed,
|
|
44
|
+
Area51.legal and USGovernment.legal
|
|
45
|
+
Acknowledged, Quinn Michaels.
|
|
46
|
+
|
package/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// Copyright (c)
|
|
1
|
+
// Copyright (c)2025 Quinn Michaels; All Rights Reserved; Legal Signature Required.
|
|
2
2
|
// Distributed under the PRIVATE software license, see the accompanying file LICENSE.md
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const config =
|
|
3
|
+
import {EventEmitter} from 'node:events';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import os from 'os';
|
|
7
|
+
import { createHash, randomUUID, createCipheriv, createDecipheriv, randomBytes } from 'crypto';
|
|
8
|
+
|
|
9
|
+
import Config from './config.json' with {type:'json'};
|
|
10
|
+
const config = Config.DATA;
|
|
11
11
|
class Deva {
|
|
12
12
|
constructor(opts) {
|
|
13
13
|
opts = opts || {}; // set opts to provided opts or an empty object.
|
|
14
|
-
this._id = randomUUID(); // the unique id assigned to the agent at load
|
|
14
|
+
this._id = opts.id || randomUUID(); // the unique id assigned to the agent at load
|
|
15
15
|
this._info = opts.info || false; // the deva information from the package file.
|
|
16
16
|
this._config = opts.config || {}; // local Config Object
|
|
17
17
|
this._agent = opts.agent || false; // Agent profile object
|
|
@@ -35,7 +35,7 @@ class Deva {
|
|
|
35
35
|
this.maxListeners = opts.maxListenners || 0; // set the local maxListeners
|
|
36
36
|
|
|
37
37
|
// prevent overwriting existing functions and variables with same name
|
|
38
|
-
for (
|
|
38
|
+
for (const opt in opts) {
|
|
39
39
|
if (!this[opt] || !this[`_${opt}`]) this[opt] = opts[opt];
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -234,7 +234,6 @@ class Deva {
|
|
|
234
234
|
personal: security.devas[this._agent.key], // Client personal features and rules.
|
|
235
235
|
};
|
|
236
236
|
delete this._client.features.security; // make a copy the clinet data.
|
|
237
|
-
this.state('resolve', 'Support');
|
|
238
237
|
return this.Support(); // goto Support when done with Security
|
|
239
238
|
}
|
|
240
239
|
} catch (e) {
|
|
@@ -269,7 +268,6 @@ class Deva {
|
|
|
269
268
|
personal: support.devas[this._agent.key], // Client personalSecurity features and rules.
|
|
270
269
|
};
|
|
271
270
|
delete this._client.features.support; // delete the support key from the client
|
|
272
|
-
this.state('resolve', 'Services');
|
|
273
271
|
return this.Services(); // when done move to Services
|
|
274
272
|
}
|
|
275
273
|
} catch (e) {
|
|
@@ -304,7 +302,6 @@ class Deva {
|
|
|
304
302
|
personal: services.devas[this._agent.key], // Client personal features and rules.
|
|
305
303
|
};
|
|
306
304
|
delete this._client.features.services; // delete the services key for isolation
|
|
307
|
-
this.state('resolve', 'Services');
|
|
308
305
|
return this.Done(); // go to Done
|
|
309
306
|
}
|
|
310
307
|
} catch (e) {
|
|
@@ -319,15 +316,14 @@ class Deva {
|
|
|
319
316
|
describe: The end of the workflow Client Feature Workflow
|
|
320
317
|
***************/
|
|
321
318
|
Done(client) {
|
|
322
|
-
this.action('
|
|
319
|
+
this.action('Done');
|
|
323
320
|
return new Promise((resolve, reject) => {
|
|
324
321
|
try {
|
|
325
|
-
this.state('
|
|
322
|
+
this.state('Done');
|
|
326
323
|
delete this._client.features; // delete the features key when done.
|
|
327
|
-
this.state('resolve', 'done');
|
|
328
324
|
return resolve(client); // resolve an empty pr
|
|
329
325
|
} catch (e) {
|
|
330
|
-
this.state('reject', '
|
|
326
|
+
this.state('reject', 'Done');
|
|
331
327
|
return this.error(e, false, reject);
|
|
332
328
|
}
|
|
333
329
|
});
|
|
@@ -395,7 +391,8 @@ class Deva {
|
|
|
395
391
|
question(TEXT=false, DATA=false) {
|
|
396
392
|
// check the active status
|
|
397
393
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
398
|
-
this.
|
|
394
|
+
this.zone('question');
|
|
395
|
+
|
|
399
396
|
const id = this.uid(); // generate a unique id for transport.
|
|
400
397
|
const t_split = TEXT.split(' '); // split the text on spaces to get words.
|
|
401
398
|
const data = DATA; // set the DATA to data
|
|
@@ -458,14 +455,15 @@ class Deva {
|
|
|
458
455
|
// hash the question
|
|
459
456
|
packet.q.meta.hash = this.hash(packet.q);
|
|
460
457
|
|
|
461
|
-
this.
|
|
458
|
+
this.action('talk', config.events.question);
|
|
462
459
|
this.talk(config.events.question, this.copy(packet)); // global question event make sure to copy data.
|
|
463
460
|
|
|
464
461
|
if (isAsk) { // isAsk check if the question isAsk and talk
|
|
465
462
|
// if: isAsk wait for the once event which is key'd to the packet ID for specified responses
|
|
463
|
+
this.action('talk', `${key}:ask`);
|
|
466
464
|
this.talk(`${key}:ask`, packet);
|
|
467
465
|
this.once(`${key}:ask:${packet.id}`, answer => {
|
|
468
|
-
this.
|
|
466
|
+
this.action('talk', config.events.ask);
|
|
469
467
|
this.talk(config.events.ask, this.copy(answer));
|
|
470
468
|
return this.finish(answer, resolve); // if:isAsk resolve the answer from the call
|
|
471
469
|
});
|
|
@@ -499,11 +497,10 @@ class Deva {
|
|
|
499
497
|
// check if method exists and is of type function
|
|
500
498
|
const {method,params} = packet.q.meta;
|
|
501
499
|
const isMethod = this.methods[method] && typeof this.methods[method] == 'function';
|
|
502
|
-
if (!isMethod)
|
|
503
|
-
|
|
504
|
-
}
|
|
500
|
+
if (!isMethod) return resolve(this._methodNotFound(packet)); // resolve method not found if check if check fails
|
|
501
|
+
|
|
505
502
|
// Call the local method to process the question based the extracted parameters
|
|
506
|
-
this.
|
|
503
|
+
this.zone('answer', method);
|
|
507
504
|
this.methods[method](packet).then(result => {
|
|
508
505
|
// check the result for the text, html, and data object.
|
|
509
506
|
// this is for when answers are returned from nested Devas.
|
|
@@ -531,7 +528,7 @@ class Deva {
|
|
|
531
528
|
// create a hash for the answer and insert into answer meta.
|
|
532
529
|
packet_answer.meta.hash = this.hash(packet_answer);
|
|
533
530
|
packet.a = packet_answer; // set the packet.a to the packet_answer
|
|
534
|
-
this.
|
|
531
|
+
this.action('talk', config.events.answer)
|
|
535
532
|
this.talk(config.events.answer, this.copy(packet)); // global talk event
|
|
536
533
|
this.state('resovle', 'answer')
|
|
537
534
|
return this.finish(packet, resolve); // resolve the packet to the caller.
|
|
@@ -559,7 +556,7 @@ class Deva {
|
|
|
559
556
|
ask(packet) {
|
|
560
557
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
561
558
|
const {method, params} = packet.q.meta;
|
|
562
|
-
this.
|
|
559
|
+
this.zone('ask', method);
|
|
563
560
|
|
|
564
561
|
const agent = this.agent();
|
|
565
562
|
const client = this.client();
|
|
@@ -602,7 +599,6 @@ class Deva {
|
|
|
602
599
|
this.state('set', `ask:${method}`);
|
|
603
600
|
packet_answer.meta.hash = this.hash(packet_answer);
|
|
604
601
|
packet.a = packet_answer;
|
|
605
|
-
this.state('talk', config.events.answer);
|
|
606
602
|
this.talk(config.events.answer, this.copy(packet)); // global talk event
|
|
607
603
|
this.talk(`${agent.key}:ask:${packet.id}`, packet);
|
|
608
604
|
}).catch(err => {
|
|
@@ -705,7 +701,7 @@ class Deva {
|
|
|
705
701
|
usage: this.enter('msg')
|
|
706
702
|
***************/
|
|
707
703
|
enter(data) {
|
|
708
|
-
this.zone('
|
|
704
|
+
this.zone('deva');
|
|
709
705
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
710
706
|
this.action('enter');
|
|
711
707
|
data.value = 'enter';
|
|
@@ -728,7 +724,6 @@ class Deva {
|
|
|
728
724
|
usage: this.done('msg')
|
|
729
725
|
***************/
|
|
730
726
|
done(data) {
|
|
731
|
-
this.zone('done');
|
|
732
727
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
733
728
|
this.action('done');
|
|
734
729
|
data.value = 'done';
|
|
@@ -736,7 +731,7 @@ class Deva {
|
|
|
736
731
|
data.hash = this.hash(data);
|
|
737
732
|
const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
|
|
738
733
|
this.state('done');
|
|
739
|
-
return hasOnDone ? this.onDone(data) :
|
|
734
|
+
return hasOnDone ? this.onDone(data) : this.finish(data);
|
|
740
735
|
}
|
|
741
736
|
|
|
742
737
|
/**************
|
|
@@ -758,11 +753,60 @@ class Deva {
|
|
|
758
753
|
|
|
759
754
|
// if: agent has on finish then return on finish
|
|
760
755
|
this.state('finish'); // set the finish state
|
|
761
|
-
|
|
756
|
+
|
|
757
|
+
// return the provided resolve function or a promise resolve.
|
|
758
|
+
return hasOnFinish ? this.onFinish(packet) : this.complete(packet);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/**************
|
|
762
|
+
func: complete
|
|
763
|
+
params:
|
|
764
|
+
- packet: the data to pass to the resolve
|
|
765
|
+
- resolve: the complete resolve to pass back
|
|
766
|
+
describe: This function is use to relay the Agent ito a complete state when
|
|
767
|
+
resolving a question or data.
|
|
768
|
+
usage: this.complete(data, resolve)
|
|
769
|
+
***************/
|
|
770
|
+
complete(packet, resolve) {
|
|
771
|
+
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
772
|
+
this.action('complete'); // set the complete action
|
|
773
|
+
|
|
774
|
+
packet.hash = this.hash(packet);// hash the entire packet before completeing.
|
|
775
|
+
// check for agent on complete function in agent
|
|
776
|
+
const hasOnComplete = this.onComplete && typeof this.onComplete === 'function';
|
|
777
|
+
|
|
778
|
+
// if: agent has on complete then return on complete
|
|
779
|
+
this.state('complete'); // set the finish state
|
|
780
|
+
|
|
762
781
|
// return the provided resolve function or a promise resolve.
|
|
763
|
-
return
|
|
782
|
+
return hasOnComplete ? this.onComplete(packet) : this.ready(packet);
|
|
764
783
|
}
|
|
765
784
|
|
|
785
|
+
/**************
|
|
786
|
+
func: ready
|
|
787
|
+
params:
|
|
788
|
+
- packet: the data to pass to the resolve
|
|
789
|
+
- resolve: the complete resolve to pass back
|
|
790
|
+
describe: This function is use to relay the Agent ito a complete state when
|
|
791
|
+
resolving a question or data.
|
|
792
|
+
usage: this.complete(data, resolve)
|
|
793
|
+
***************/
|
|
794
|
+
ready(packet, resolve) {
|
|
795
|
+
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
796
|
+
this.action('ready'); // set the complete action
|
|
797
|
+
|
|
798
|
+
packet.hash = this.hash(packet);// hash the entire packet before completeing.
|
|
799
|
+
// check for agent on complete function in agent
|
|
800
|
+
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
801
|
+
|
|
802
|
+
// if: agent has on complete then return on complete
|
|
803
|
+
this.state('ready'); // set the finish state
|
|
804
|
+
|
|
805
|
+
// return the provided resolve function or a promise resolve.
|
|
806
|
+
return hasOnReady ? this.onReady(packet) : Promise.resolve(packet);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
|
|
766
810
|
/**************
|
|
767
811
|
func: stop
|
|
768
812
|
params:
|
|
@@ -1009,7 +1053,6 @@ class Deva {
|
|
|
1009
1053
|
created: Date.now(), // set the creation date
|
|
1010
1054
|
};
|
|
1011
1055
|
data.hash = this.hash(data); // generate the hash value of the data packet
|
|
1012
|
-
this.state('talk', 'feature');
|
|
1013
1056
|
this.talk(config.events.feature, data); // talk the feature event with data
|
|
1014
1057
|
} catch (e) { // catch any errors
|
|
1015
1058
|
return this.error(e); // retun this.error when an error is caught.
|
|
@@ -1058,7 +1101,6 @@ class Deva {
|
|
|
1058
1101
|
};
|
|
1059
1102
|
|
|
1060
1103
|
data.hash = this.hash(data);
|
|
1061
|
-
this.state('talk', 'context');
|
|
1062
1104
|
this.talk(config.events.context, data);
|
|
1063
1105
|
} catch (e) {
|
|
1064
1106
|
return this.error(e);
|
|
@@ -1301,7 +1343,6 @@ class Deva {
|
|
|
1301
1343
|
text,
|
|
1302
1344
|
created: Date.now(),
|
|
1303
1345
|
}
|
|
1304
|
-
this.state('talk', 'prompt')
|
|
1305
1346
|
return this.talk(config.events.prompt, _data);
|
|
1306
1347
|
}
|
|
1307
1348
|
|
|
@@ -1370,8 +1411,8 @@ class Deva {
|
|
|
1370
1411
|
day: { day: 'long' },
|
|
1371
1412
|
log: { year: 'numeric', month: 'short', day: 'numeric' },
|
|
1372
1413
|
};
|
|
1373
|
-
const theDate = d.toLocaleDateString(this._client.locale, formats[format]);
|
|
1374
|
-
const theTime = this.formatTime(d);
|
|
1414
|
+
const theDate = d.toLocaleDateString(this._client.profile.locale, formats[format]);
|
|
1415
|
+
const theTime = time ? this.formatTime(d) : false;
|
|
1375
1416
|
this.state('return', 'formatDate');
|
|
1376
1417
|
return !theTime ? theDate : `${theDate} - ${theTime}`;
|
|
1377
1418
|
}
|
|
@@ -1386,7 +1427,7 @@ class Deva {
|
|
|
1386
1427
|
***************/
|
|
1387
1428
|
formatTime(t) {
|
|
1388
1429
|
this.feature('formatTime');
|
|
1389
|
-
return t.toLocaleTimeString(this._client.locale); // return the formatted time string
|
|
1430
|
+
return t.toLocaleTimeString(this._client.profile.locale); // return the formatted time string
|
|
1390
1431
|
}
|
|
1391
1432
|
|
|
1392
1433
|
/**************
|
|
@@ -1397,13 +1438,27 @@ class Deva {
|
|
|
1397
1438
|
The formatCurrency function will format a currency value based on the setting
|
|
1398
1439
|
in the client profile.
|
|
1399
1440
|
***************/
|
|
1400
|
-
formatCurrency(n) {
|
|
1441
|
+
formatCurrency(n, cur=false) {
|
|
1401
1442
|
this.feature('formatCurrency');
|
|
1402
|
-
|
|
1443
|
+
const currency = cur || this._client.profile.currency;
|
|
1444
|
+
return new Intl.NumberFormat(this._client.profile.locale, { style: 'currency', currency: currency }).format(n);
|
|
1403
1445
|
}
|
|
1404
1446
|
|
|
1405
1447
|
/**************
|
|
1406
|
-
func:
|
|
1448
|
+
func: formatCurrency
|
|
1449
|
+
params:
|
|
1450
|
+
- n: is the number that you want to return the currency of.
|
|
1451
|
+
describe:
|
|
1452
|
+
The formatCurrency function will format a currency value based on the setting
|
|
1453
|
+
in the client profile.
|
|
1454
|
+
***************/
|
|
1455
|
+
formatNumber(n) {
|
|
1456
|
+
this.feature('formatNumber');
|
|
1457
|
+
return new Intl.NumberFormat(this._client.profile.locale).format(n);
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
/**************
|
|
1461
|
+
func: formatPercent
|
|
1407
1462
|
params:
|
|
1408
1463
|
- n: is the number that you want to format as a percent.
|
|
1409
1464
|
- dec: is the number of decimal places to apply to the number.
|
|
@@ -1415,7 +1470,7 @@ class Deva {
|
|
|
1415
1470
|
}
|
|
1416
1471
|
|
|
1417
1472
|
/**************
|
|
1418
|
-
func:
|
|
1473
|
+
func: trimWords
|
|
1419
1474
|
params:
|
|
1420
1475
|
- text: The text to trim.
|
|
1421
1476
|
- maxwords: The number of words to max.
|
|
@@ -1496,9 +1551,10 @@ class Deva {
|
|
|
1496
1551
|
***************/
|
|
1497
1552
|
help(msg, help_dir) {
|
|
1498
1553
|
return new Promise((resolve, reject) => {
|
|
1554
|
+
this.zone('help');
|
|
1555
|
+
|
|
1499
1556
|
if (!this._active) return resolve(this._messages.offline);
|
|
1500
1557
|
this.feature('help');
|
|
1501
|
-
this.zone('help');
|
|
1502
1558
|
|
|
1503
1559
|
const params = msg.split(' ');
|
|
1504
1560
|
let helpFile = 'main';
|
|
@@ -1550,4 +1606,4 @@ class Deva {
|
|
|
1550
1606
|
}
|
|
1551
1607
|
|
|
1552
1608
|
}
|
|
1553
|
-
|
|
1609
|
+
export default Deva;
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indra.ai/deva",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.24",
|
|
4
4
|
"description": "The Deva Core",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"scripts": {
|
|
7
|
-
"test": "node
|
|
8
|
+
"test": "node tests"
|
|
8
9
|
},
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
@@ -18,26 +19,26 @@
|
|
|
18
19
|
"deva",
|
|
19
20
|
"ai"
|
|
20
21
|
],
|
|
21
|
-
"license": "
|
|
22
|
+
"license": "Unlicense",
|
|
22
23
|
"author": {
|
|
23
24
|
"name": "Quinn Michaels",
|
|
24
|
-
"email": "quinnmichaels
|
|
25
|
+
"email": "quinn@quinnmichaels.com",
|
|
25
26
|
"url": "https://quinnmichaels.com/"
|
|
26
27
|
},
|
|
27
28
|
"funding": [
|
|
28
29
|
{
|
|
29
30
|
"type": "paypal",
|
|
30
|
-
"url": "https://
|
|
31
|
+
"url": "https://paypal.me/rahulaclub"
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
34
|
"type": "patreon",
|
|
34
|
-
"url": "https://
|
|
35
|
+
"url": "https://patreon.com/rahulaclub"
|
|
35
36
|
}
|
|
36
37
|
],
|
|
37
38
|
"bugs": {
|
|
38
39
|
"url": "https://github.com/indraai/deva/issues"
|
|
39
40
|
},
|
|
40
|
-
"homepage": "https://
|
|
41
|
+
"homepage": "https://deva.space",
|
|
41
42
|
"eslintConfig": {
|
|
42
43
|
"parserOptions": {
|
|
43
44
|
"ecmaVersion": 6
|
package/tests/agent.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "AGENT",
|
|
3
|
+
"describe": "AGENT FILE",
|
|
4
|
+
"copyright": "Copyright (c)2023 Quinn Michaels. All rights reserved.",
|
|
5
|
+
"DATA": {
|
|
6
|
+
"id": 5380514963421,
|
|
7
|
+
"key": "deva",
|
|
8
|
+
"prompt": {
|
|
9
|
+
"emoji": "🍏",
|
|
10
|
+
"text": "deva",
|
|
11
|
+
"colors": {
|
|
12
|
+
"label": {
|
|
13
|
+
"R": 0,
|
|
14
|
+
"G": 150,
|
|
15
|
+
"B": 255
|
|
16
|
+
},
|
|
17
|
+
"text": {
|
|
18
|
+
"R": 101,
|
|
19
|
+
"G": 192,
|
|
20
|
+
"B": 255
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"voice": {
|
|
25
|
+
"speech": "Alex",
|
|
26
|
+
"speed": 1
|
|
27
|
+
},
|
|
28
|
+
"profile": {
|
|
29
|
+
"name": "Deva",
|
|
30
|
+
"describe": "The Indra interface into deva.world.",
|
|
31
|
+
"emoji": "/public/devas/deva/emoji.png",
|
|
32
|
+
"avatar": "/public/devas/deva/avatar.png",
|
|
33
|
+
"background": "/public/devas/deva/background.png",
|
|
34
|
+
"gender": "M"
|
|
35
|
+
},
|
|
36
|
+
"features": {
|
|
37
|
+
"assistant": {
|
|
38
|
+
"label": "🤖ASSISTANT",
|
|
39
|
+
"name": "@ASSISTANT",
|
|
40
|
+
"tag": "#ASSISTANT",
|
|
41
|
+
"loc": "$ASSISTANT"
|
|
42
|
+
},
|
|
43
|
+
"business": {
|
|
44
|
+
"label": "💼BUSINESS",
|
|
45
|
+
"name": "@BUSINESS",
|
|
46
|
+
"tag": "#BUSINESS",
|
|
47
|
+
"loc": "$BUSINESS"
|
|
48
|
+
},
|
|
49
|
+
"legal": {
|
|
50
|
+
"label": "👨⚖️LEGAL",
|
|
51
|
+
"name": "@LEGAL",
|
|
52
|
+
"tag": "#LEGAL",
|
|
53
|
+
"loc": "$LEGAL"
|
|
54
|
+
},
|
|
55
|
+
"development": {
|
|
56
|
+
"label": "👨💻DEVELOPMENT",
|
|
57
|
+
"name": "@DEVELOPMENT",
|
|
58
|
+
"tag": "#DEVELOPMENT",
|
|
59
|
+
"loc": "$DEVELOPMENT"
|
|
60
|
+
},
|
|
61
|
+
"security": {
|
|
62
|
+
"label": "🚨SECURITY",
|
|
63
|
+
"name": "@SECURITY",
|
|
64
|
+
"tag": "#SECURITY",
|
|
65
|
+
"loc": "$SECURITY"
|
|
66
|
+
},
|
|
67
|
+
"support": {
|
|
68
|
+
"label": "🆘SUPPORT",
|
|
69
|
+
"name": "@SUPPORT",
|
|
70
|
+
"tag": "#SUPPORT",
|
|
71
|
+
"loc": "$SUPPORT"
|
|
72
|
+
},
|
|
73
|
+
"services": {
|
|
74
|
+
"label": "📞SERVICES",
|
|
75
|
+
"name": "@SERVICES",
|
|
76
|
+
"tag": "#SERVICES",
|
|
77
|
+
"loc": "$SERVICES"
|
|
78
|
+
},
|
|
79
|
+
"solutions": {
|
|
80
|
+
"label": "💡SOLUTIONS",
|
|
81
|
+
"name": "@SOLUTIONS",
|
|
82
|
+
"tag": "#SOLUTIONS",
|
|
83
|
+
"loc": "$SOLUTIONS"
|
|
84
|
+
},
|
|
85
|
+
"systems": {
|
|
86
|
+
"label": "🔧SYSTEMS",
|
|
87
|
+
"name": "@SOLUTIONS",
|
|
88
|
+
"tag": "#SOLUTIONS",
|
|
89
|
+
"loc": "$SOLUTIONS"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"vars": {
|
|
93
|
+
"hello": "Hellow World"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "CLIENT",
|
|
3
|
+
"describe": "CLIENT FILE",
|
|
4
|
+
"copyright": "Copyright ©2023 Quinn Michaels. All rights reserved.",
|
|
5
|
+
"DATA": {
|
|
6
|
+
"id": 3123155399059,
|
|
7
|
+
"key": "test",
|
|
8
|
+
"prompt": {
|
|
9
|
+
"emoji": "🧪",
|
|
10
|
+
"text": "test",
|
|
11
|
+
"colors": {
|
|
12
|
+
"label": {
|
|
13
|
+
"R": 2,
|
|
14
|
+
"G": 229,
|
|
15
|
+
"B": 77
|
|
16
|
+
},
|
|
17
|
+
"text": {
|
|
18
|
+
"R": 2,
|
|
19
|
+
"G": 229,
|
|
20
|
+
"B": 77
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"profile": {
|
|
25
|
+
"name": "Test User",
|
|
26
|
+
"eamil": "test@example.com",
|
|
27
|
+
"describe": "The Test User",
|
|
28
|
+
"emoji": "/public/devas/test/avatar.png",
|
|
29
|
+
"avatar": "/public/devas/test/avatar.png",
|
|
30
|
+
"background": "/public/devas/test/background.png",
|
|
31
|
+
"gender": "splendid",
|
|
32
|
+
"lang": "en",
|
|
33
|
+
"locale": "en-US",
|
|
34
|
+
"currency": "USD"
|
|
35
|
+
},
|
|
36
|
+
"features": {
|
|
37
|
+
"security": {
|
|
38
|
+
"hash": "md5",
|
|
39
|
+
"cipher": {
|
|
40
|
+
"encrypt": true,
|
|
41
|
+
"algorithm": "aes-256-cbc",
|
|
42
|
+
"password": "generic password for encryption test"
|
|
43
|
+
},
|
|
44
|
+
"concerns": [],
|
|
45
|
+
"global": {},
|
|
46
|
+
"devas": {
|
|
47
|
+
"hello": {}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"support": {
|
|
51
|
+
"concerns": [],
|
|
52
|
+
"global": {},
|
|
53
|
+
"devas": {
|
|
54
|
+
"hello": {}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"services": {
|
|
58
|
+
"concerns": [],
|
|
59
|
+
"global": {
|
|
60
|
+
"indra": "https://indra.ai",
|
|
61
|
+
"world": "https://deva.world",
|
|
62
|
+
"space": "https://deva.space",
|
|
63
|
+
"cloud": "https://deva.cloud"
|
|
64
|
+
},
|
|
65
|
+
"devas": {
|
|
66
|
+
"hello": {}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"systems": {
|
|
70
|
+
"concerns": [],
|
|
71
|
+
"global": {},
|
|
72
|
+
"devas": {
|
|
73
|
+
"hello": {}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"solutions": {
|
|
77
|
+
"concerns": [],
|
|
78
|
+
"global": {},
|
|
79
|
+
"devas": {
|
|
80
|
+
"hello": {}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"development": {
|
|
84
|
+
"concerns": [],
|
|
85
|
+
"global": {},
|
|
86
|
+
"devas": {
|
|
87
|
+
"hello": {}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"assistant": {
|
|
91
|
+
"concerns": [],
|
|
92
|
+
"global": {},
|
|
93
|
+
"devas": {
|
|
94
|
+
"hello": {}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"business": {
|
|
98
|
+
"concerns": [],
|
|
99
|
+
"global": {},
|
|
100
|
+
"devas": {
|
|
101
|
+
"hello": {}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"legal": {
|
|
105
|
+
"concerns": [],
|
|
106
|
+
"global": {},
|
|
107
|
+
"devas": {
|
|
108
|
+
"hello": {}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"story": {
|
|
112
|
+
"concerns": [],
|
|
113
|
+
"global": {},
|
|
114
|
+
"devas": {
|
|
115
|
+
"hello": {}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"mind": {
|
|
119
|
+
"concerns": [],
|
|
120
|
+
"global": {},
|
|
121
|
+
"devas": {
|
|
122
|
+
"hello": {}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
package/tests/index.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
// Copyright (c)2024 Quinn Michaels
|
|
3
|
+
// Private License
|
|
4
|
+
// file LICENSE.md or http://www.opensource.org/licenses/mit-license.php.
|
|
5
|
+
import Client from './client.json' with {type:'json'};
|
|
6
|
+
const client = Client.DATA;
|
|
7
|
+
import Agent from './agent.json' with {type:'json'};
|
|
8
|
+
const agent = Agent.DATA;
|
|
9
|
+
|
|
10
|
+
import Deva from '../index.js';
|
|
11
|
+
|
|
12
|
+
const HelloWorld = new Deva({
|
|
13
|
+
client: {
|
|
14
|
+
id: 100,
|
|
15
|
+
key: 'hello',
|
|
16
|
+
},
|
|
17
|
+
agent: {
|
|
18
|
+
id: agent.id,
|
|
19
|
+
key: agent.key,
|
|
20
|
+
prompt: agent.prompt,
|
|
21
|
+
voice: agent.voice,
|
|
22
|
+
profile: agent.profile,
|
|
23
|
+
features: agent.features,
|
|
24
|
+
translate(input) {
|
|
25
|
+
return input.trim();
|
|
26
|
+
},
|
|
27
|
+
parse(input) {
|
|
28
|
+
return input.trim();
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
vars: agent.vars,
|
|
32
|
+
listeners: {
|
|
33
|
+
'devacore:prompt'(packet) {
|
|
34
|
+
console.log(`👔 prompt: ${packet.text}`);
|
|
35
|
+
},
|
|
36
|
+
'devacore:question'(packet) {
|
|
37
|
+
console.log(`🙋♂️️ question: ${packet.text}`);
|
|
38
|
+
},
|
|
39
|
+
'devacore:answer'(packet) {
|
|
40
|
+
console.log(`👨🔬 answer: ${packet.text}`);
|
|
41
|
+
},
|
|
42
|
+
'devacore:ask'(packet) {
|
|
43
|
+
console.log(`🤝 ask: ${packet.text}`);
|
|
44
|
+
},
|
|
45
|
+
'devacore:state'(packet) {
|
|
46
|
+
console.log(`🍪 state: ${packet.text}`);
|
|
47
|
+
},
|
|
48
|
+
'devacore:zone'(packet) {
|
|
49
|
+
console.log(`🗺️ zone: ${packet.text} zone`);
|
|
50
|
+
},
|
|
51
|
+
'devacore:action'(packet) {
|
|
52
|
+
console.log(`💥 action: ${packet.text}`);
|
|
53
|
+
},
|
|
54
|
+
'devacore:feature'(packet) {
|
|
55
|
+
console.log(`🍿 feature: ${packet.text}`);
|
|
56
|
+
},
|
|
57
|
+
'devacore:error'(packet) {
|
|
58
|
+
console.log(`❌ error: ${packet.text}`);
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
devas: {},
|
|
62
|
+
modules: {},
|
|
63
|
+
func: {
|
|
64
|
+
test(packet) {
|
|
65
|
+
const text = this._state
|
|
66
|
+
const id = this.uid();
|
|
67
|
+
const uuid = this.uid(true);
|
|
68
|
+
|
|
69
|
+
const cipher = this.cipher(JSON.stringify(packet));
|
|
70
|
+
const decipher = this.decipher(cipher);
|
|
71
|
+
|
|
72
|
+
const data = {
|
|
73
|
+
id,
|
|
74
|
+
uuid,
|
|
75
|
+
text,
|
|
76
|
+
hash: {
|
|
77
|
+
md5: this.hash(JSON.stringify(packet)),
|
|
78
|
+
sha256: this.hash(JSON.stringify(packet), 'sha256'),
|
|
79
|
+
sha512: this.hash(JSON.stringify(packet), 'sha512'),
|
|
80
|
+
created: this.formatDate(Date.now(), 'long'),
|
|
81
|
+
},
|
|
82
|
+
cipher,
|
|
83
|
+
decipher
|
|
84
|
+
}
|
|
85
|
+
console.log(data)
|
|
86
|
+
return Promise.resolve({
|
|
87
|
+
text: packet.a.text,
|
|
88
|
+
data,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
test(packet) {
|
|
94
|
+
return this.func.test(packet);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
onError(e) {
|
|
98
|
+
console.log(e);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
HelloWorld.init(client);
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
// HelloWorld.question('/hello hello there').then(hello => {
|
|
106
|
+
// console.log('hello', hello);
|
|
107
|
+
// });
|