@indra.ai/deva 1.3.6 โ 1.3.8
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/config.json +71 -63
- package/index.js +62 -170
- package/package.json +1 -1
- package/tests/agent.json +6 -0
- package/tests/client.json +17 -12
- package/tests/index.js +8 -7
package/config.json
CHANGED
|
@@ -32,70 +32,71 @@
|
|
|
32
32
|
"zones": {
|
|
33
33
|
"load": "๐ Load",
|
|
34
34
|
"unload": "๐ป Unload",
|
|
35
|
-
"init": "๐
|
|
35
|
+
"init": "๐ Init",
|
|
36
36
|
"start": "๐๏ธ Start",
|
|
37
37
|
"stop": "๐ Stop",
|
|
38
38
|
"enter": "๐ก Enter",
|
|
39
39
|
"exit": "๐ช Exit",
|
|
40
40
|
"finish": "๐ Finish",
|
|
41
41
|
"deva": "โก๏ธ Deva",
|
|
42
|
-
"client": "
|
|
42
|
+
"client": "๐จ Client",
|
|
43
43
|
"agent": "๐ค Agent",
|
|
44
44
|
"security": "๐ Security",
|
|
45
45
|
"support": "๐ Support",
|
|
46
46
|
"services": "๐ Services",
|
|
47
47
|
"systems": "๐ Systems",
|
|
48
|
+
"networks": "๐ฐ๏ธ Networks",
|
|
48
49
|
"legal": "๐๏ธ Legal",
|
|
49
50
|
"authority": "๐ Authority",
|
|
50
|
-
"justice": "โ๏ธ
|
|
51
|
+
"justice": "โ๏ธ Justice",
|
|
51
52
|
"help": "๐ Help",
|
|
52
53
|
"error": "โ Error!"
|
|
53
54
|
},
|
|
54
55
|
"state": "offline",
|
|
55
56
|
"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": "๐งจ
|
|
57
|
+
"online": "๐คฉ Online",
|
|
58
|
+
"offline": "๐ด Offline",
|
|
59
|
+
"active": "๐ Active",
|
|
60
|
+
"inactive": "๐ซฅ Inactive",
|
|
61
|
+
"idle": "๐ Idle",
|
|
62
|
+
"talk": "๐ข Talk",
|
|
63
|
+
"listen": "๐ Listen",
|
|
64
|
+
"ask": "๐ฃ๏ธ Ask",
|
|
65
|
+
"question": "๐ฌ Question",
|
|
66
|
+
"cmd": "๐ช Command",
|
|
67
|
+
"answer": "๐ก Answer",
|
|
68
|
+
"ready": "๐ Ready",
|
|
69
|
+
"wait": "โณ Waiting",
|
|
70
|
+
"pause": "โธ๏ธ Pause",
|
|
71
|
+
"resume": "๐ Resume",
|
|
72
|
+
"connect": "๐ณ Connect",
|
|
73
|
+
"disconnect": "๐ด Disconnect",
|
|
74
|
+
"send": "๐ฌ Send",
|
|
75
|
+
"receive": "๐ช Receive",
|
|
76
|
+
"init": "๐ Init",
|
|
77
|
+
"forward": "โญ๏ธ Forward",
|
|
78
|
+
"backward": "โฎ๏ธ Backward",
|
|
79
|
+
"start": "๐ Start",
|
|
80
|
+
"stop": "โน๏ธ Stop",
|
|
81
|
+
"open": "๐ฅซ Open",
|
|
82
|
+
"close": "๐ฆ Close",
|
|
83
|
+
"enter": "๐ก Enter",
|
|
84
|
+
"exit": "๐ช Exit",
|
|
85
|
+
"begin": "๐บ๏ธ Begin",
|
|
86
|
+
"end": "๐ฌ End",
|
|
87
|
+
"load": "๐ Load",
|
|
88
|
+
"unload": "๐ป Unload",
|
|
89
|
+
"resolve": "๐ค Resolve",
|
|
90
|
+
"reject": "๐งฑ Reject",
|
|
91
|
+
"done": "๐ Done",
|
|
92
|
+
"data": "๐ก Data",
|
|
93
|
+
"finish": "๐ Finish",
|
|
94
|
+
"complete": "โ
Complete",
|
|
95
|
+
"create": "๐จ Create",
|
|
96
|
+
"destroy": "๐ฃ Destroy",
|
|
97
|
+
"write": "๐ Write",
|
|
98
|
+
"save": "๐พ Save",
|
|
99
|
+
"delete": "๐งจ Delete",
|
|
99
100
|
"set": "๐ Set",
|
|
100
101
|
"get": "๐ซด Get",
|
|
101
102
|
"put": "๐ค Put",
|
|
@@ -109,8 +110,8 @@
|
|
|
109
110
|
"abort": "๐ ABORT!",
|
|
110
111
|
"error": "โ ERROR!",
|
|
111
112
|
"help": "๐ Help",
|
|
112
|
-
"authorized": "๐
|
|
113
|
-
"unauthorized": "๐ดโโ ๏ธ
|
|
113
|
+
"authorized": "๐ Authorized",
|
|
114
|
+
"unauthorized": "๐ดโโ ๏ธ Unauthorized",
|
|
114
115
|
"Done": "โ๏ธ Done",
|
|
115
116
|
"glitch": "๐ก Glitch",
|
|
116
117
|
"intruder": "๐ฆนโโ๏ธ Intruder",
|
|
@@ -125,20 +126,19 @@
|
|
|
125
126
|
},
|
|
126
127
|
"action": false,
|
|
127
128
|
"actions": {
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"question": "๐ question",
|
|
129
|
+
"init": "๐ Init",
|
|
130
|
+
"wait": "โณ Waiting",
|
|
131
|
+
"start": "๐ฌ Start",
|
|
132
|
+
"enter": "๐ก Enter",
|
|
133
|
+
"exit": "๐ช Exit",
|
|
134
|
+
"stop": "๐ Stop",
|
|
135
|
+
"load": "๐ฆ Load",
|
|
136
|
+
"unload": "๐ฅก Unload",
|
|
137
|
+
"finish": "๐ Finish",
|
|
138
|
+
"complete": "โ
Complete",
|
|
139
|
+
"done": "โ๏ธ Done",
|
|
140
|
+
"ready": "๐ข Ready",
|
|
141
|
+
"question": "๐ Question",
|
|
142
142
|
"talk": "๐ข talk",
|
|
143
143
|
"context": "๐ context",
|
|
144
144
|
"prompt": "๐ prompt",
|
|
@@ -173,10 +173,12 @@
|
|
|
173
173
|
"ask": "๐ฃ Ask",
|
|
174
174
|
|
|
175
175
|
"client": "๐จ Client",
|
|
176
|
+
"agent": "๐ต๏ธโโ๏ธ Agent",
|
|
176
177
|
"security": "๐ Security",
|
|
177
178
|
"support": "๐ฉน Support",
|
|
178
179
|
"services": "๐ ๏ธ Services",
|
|
179
|
-
"systems": "
|
|
180
|
+
"systems": "๐ฅ๏ธ Systems",
|
|
181
|
+
"networks": "๐ก Networks",
|
|
180
182
|
"legal": "๐๏ธ Legal",
|
|
181
183
|
"justice": "๐๏ธ Justice",
|
|
182
184
|
"authority": "๐ฎ Authority",
|
|
@@ -203,10 +205,16 @@
|
|
|
203
205
|
},
|
|
204
206
|
"feature": false,
|
|
205
207
|
"features": {
|
|
208
|
+
"client": "๐จ Client",
|
|
209
|
+
"init": "๐ Init",
|
|
206
210
|
"security": "๐ Security",
|
|
207
211
|
"support": "๐ผ Support",
|
|
208
212
|
"services": "๐ ๏ธ Services",
|
|
209
213
|
"systems": "๐ฅ๏ธ๏ธ Systems",
|
|
214
|
+
"networks": "๐๏ธ๏ธ Networks",
|
|
215
|
+
"legal": "๐๏ธ๏ธ๏ธ Legal",
|
|
216
|
+
"justice": "๐๏ธ๏ธ Justice",
|
|
217
|
+
"authority": "๐๏ธ๏ธ Authority",
|
|
210
218
|
"cipher": "๐ Cipher",
|
|
211
219
|
"decipher": "๐ Decipher",
|
|
212
220
|
"promp": "๐ชต Prompt",
|
package/index.js
CHANGED
|
@@ -21,6 +21,7 @@ class Deva {
|
|
|
21
21
|
this._support = false; // inherited Support features.
|
|
22
22
|
this._services = false; // inherited Service features.
|
|
23
23
|
this._systems = false; // inherited Systems features.
|
|
24
|
+
this._networks = false; // inherited Systems features.
|
|
24
25
|
this._legal = false; // inherited Legal features.
|
|
25
26
|
this._justice = false; // inherited Justice features.
|
|
26
27
|
this._authority = false; // inherited Justice features.
|
|
@@ -192,6 +193,8 @@ class Deva {
|
|
|
192
193
|
this.Client = {data}
|
|
193
194
|
***************/
|
|
194
195
|
Client(client, resolve, reject) {
|
|
196
|
+
this.feature('client');
|
|
197
|
+
this.zone('client');
|
|
195
198
|
this.action('client');
|
|
196
199
|
// setup any custom methods for the features
|
|
197
200
|
try {
|
|
@@ -205,7 +208,9 @@ class Deva {
|
|
|
205
208
|
}
|
|
206
209
|
}
|
|
207
210
|
const _client = this.lib.copy(client); // copy the client parameter
|
|
211
|
+
this.state('set', 'client');
|
|
208
212
|
this._client = _client; // set local _client to this scope
|
|
213
|
+
this.state('resolve', 'client');
|
|
209
214
|
return resolve();
|
|
210
215
|
} catch (e) {
|
|
211
216
|
return this.error(e, false, reject);
|
|
@@ -213,41 +218,53 @@ class Deva {
|
|
|
213
218
|
}
|
|
214
219
|
|
|
215
220
|
/**************
|
|
216
|
-
func:
|
|
221
|
+
func: Feature
|
|
217
222
|
params: client: false
|
|
218
223
|
describe:
|
|
219
224
|
The Security feature sets the correct variables and necessary rules for the
|
|
220
225
|
client presented data.
|
|
221
226
|
***************/
|
|
222
|
-
|
|
223
|
-
this.
|
|
224
|
-
this.
|
|
227
|
+
Feature(feature, resolve, reject) {
|
|
228
|
+
this.feature(feature);
|
|
229
|
+
this.zone(feature);
|
|
225
230
|
const _cl = this.client(); // set local copy of client data
|
|
226
231
|
try {
|
|
227
|
-
if (!_cl.features
|
|
232
|
+
if (!_cl.features[feature]) return resolve(); // if no security feature goto Support
|
|
228
233
|
else {
|
|
229
|
-
this.
|
|
234
|
+
this.action(feature); // set action to feature
|
|
235
|
+
const _fe = `_${feature}`;
|
|
230
236
|
const {id, profile, features} = _cl; // make a copy the clinet data.
|
|
231
|
-
const
|
|
232
|
-
this.
|
|
237
|
+
const data = features[feature]; // make a copy the clinet data.
|
|
238
|
+
this.state('set', feature);
|
|
239
|
+
this[_fe] = { // set this_security with data
|
|
233
240
|
id: this.lib.uid(true), // uuid of the security feature
|
|
234
241
|
client_id: id, // client id for reference
|
|
235
242
|
client_name: profile.name, // client name for personalization
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
global: security.global, // the global policies for client
|
|
240
|
-
personal: security.devas[this._agent.key], // Client personal features and rules.
|
|
243
|
+
concerns: data.concerns, // any concerns for client
|
|
244
|
+
global: data.global, // the global policies for client
|
|
245
|
+
personal: data.devas[this._agent.key], // Client personal features and rules.
|
|
241
246
|
};
|
|
242
|
-
delete this._client.features
|
|
243
|
-
|
|
247
|
+
delete this._client.features[feature]; // make a copy the clinet data.
|
|
248
|
+
this.state('resolve', feature);
|
|
249
|
+
return resolve(feature); // resolve when done
|
|
244
250
|
}
|
|
245
251
|
} catch (e) {
|
|
246
|
-
this.state('reject',
|
|
247
|
-
return this.error(e); // run error handling if an error is caught
|
|
252
|
+
this.state('reject', feature);
|
|
253
|
+
return this.error(e, feature, reject); // run error handling if an error is caught
|
|
248
254
|
}
|
|
249
255
|
}
|
|
250
256
|
|
|
257
|
+
/**************
|
|
258
|
+
func: Security
|
|
259
|
+
params: client: false
|
|
260
|
+
describe:
|
|
261
|
+
The Security feature sets the correct variables and necessary rules for the
|
|
262
|
+
client presented data.
|
|
263
|
+
***************/
|
|
264
|
+
Security(resolve, reject) {
|
|
265
|
+
return this.Feature('security', resolve, reject);
|
|
266
|
+
}
|
|
267
|
+
|
|
251
268
|
/**************
|
|
252
269
|
func: Support
|
|
253
270
|
params: client: false
|
|
@@ -256,30 +273,7 @@ class Deva {
|
|
|
256
273
|
client presented data.
|
|
257
274
|
***************/
|
|
258
275
|
Support(resolve, reject) {
|
|
259
|
-
this.
|
|
260
|
-
this.action('support');
|
|
261
|
-
const _cl = this.client(); // set the local client variable
|
|
262
|
-
try {
|
|
263
|
-
if (!_cl.features.support) return resolve() // move to Services if no support feature
|
|
264
|
-
else {
|
|
265
|
-
this.state('set', 'Support');
|
|
266
|
-
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
267
|
-
const {support} = features; // set support from features const
|
|
268
|
-
this._support = { // set this_support with data
|
|
269
|
-
id: this.lib.uid(true), // uuid of the support feature
|
|
270
|
-
client_id: id, // client id for reference
|
|
271
|
-
client_name: profile.name, // client name for personalization
|
|
272
|
-
concerns: support.concerns, // any concerns for client
|
|
273
|
-
global: support.global, // the global policies for client
|
|
274
|
-
personal: support.devas[this._agent.key], // Client personalSecurity features and rules.
|
|
275
|
-
};
|
|
276
|
-
delete this._client.features.support; // delete the support key from the client
|
|
277
|
-
return resolve(); // when done move to Services
|
|
278
|
-
}
|
|
279
|
-
} catch (e) {
|
|
280
|
-
this.state('reject', 'Services');
|
|
281
|
-
return this.error(e, false, reject); // run error handling if an error is caught
|
|
282
|
-
}
|
|
276
|
+
return this.Feature('support', resolve, reject);
|
|
283
277
|
}
|
|
284
278
|
|
|
285
279
|
/**************
|
|
@@ -290,30 +284,7 @@ class Deva {
|
|
|
290
284
|
client presented data.
|
|
291
285
|
***************/
|
|
292
286
|
Services(resolve, reject) {
|
|
293
|
-
this.
|
|
294
|
-
this.action('services');
|
|
295
|
-
const _cl = this.client(); // set local client
|
|
296
|
-
try {
|
|
297
|
-
if (!_cl.features.services) return resolve(); // move to Done if no Services feature
|
|
298
|
-
else {
|
|
299
|
-
this.state('set', 'Services');
|
|
300
|
-
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
301
|
-
const {services} = features; // set services from features const
|
|
302
|
-
this._services = { // set this_services with data
|
|
303
|
-
id: this.lib.uid(true), // uuid of the services feature
|
|
304
|
-
client_id: id, // client id for reference
|
|
305
|
-
client_name: profile.name, // client name for personalization
|
|
306
|
-
concerns: services.concerns, // any concerns for client
|
|
307
|
-
global: services.global, // the global policies for client
|
|
308
|
-
personal: services.devas[this._agent.key], // Client personal features and rules.
|
|
309
|
-
};
|
|
310
|
-
delete this._client.features.services; // delete the services key for isolation
|
|
311
|
-
return resolve(); // go to Done
|
|
312
|
-
}
|
|
313
|
-
} catch (e) {
|
|
314
|
-
this.state('reject', 'Services');
|
|
315
|
-
return this.error(e, false, reject); // run error handling if an error is caught
|
|
316
|
-
}
|
|
287
|
+
return this.Feature('services', resolve, reject);
|
|
317
288
|
}
|
|
318
289
|
|
|
319
290
|
/**************
|
|
@@ -324,30 +295,18 @@ class Deva {
|
|
|
324
295
|
client presented data.
|
|
325
296
|
***************/
|
|
326
297
|
Systems(resolve, reject) {
|
|
327
|
-
this.
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
client_name: profile.name, // client name for personalization
|
|
340
|
-
concerns: systems.concerns, // any concerns for client
|
|
341
|
-
global: systems.global, // the global policies for client
|
|
342
|
-
personal: systems.devas[this._agent.key], // Client personal features and rules.
|
|
343
|
-
};
|
|
344
|
-
delete this._client.features.systems; // delete the services key for isolation
|
|
345
|
-
return resolve(); // go to Done
|
|
346
|
-
}
|
|
347
|
-
} catch (e) {
|
|
348
|
-
this.state('reject', 'Systems');
|
|
349
|
-
return this.error(e, false, reject); // run error handling if an error is caught
|
|
350
|
-
}
|
|
298
|
+
return this.Feature('systems', resolve, reject);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**************
|
|
302
|
+
func: Networks
|
|
303
|
+
params: resolve, reject
|
|
304
|
+
describe:
|
|
305
|
+
The Networks feature sets the correct variables and necessary rules for the
|
|
306
|
+
client presented data.
|
|
307
|
+
***************/
|
|
308
|
+
Networks(resolve, reject) {
|
|
309
|
+
return this.Feature('networks', resolve, reject);
|
|
351
310
|
}
|
|
352
311
|
|
|
353
312
|
/**************
|
|
@@ -358,30 +317,7 @@ class Deva {
|
|
|
358
317
|
client presented data.
|
|
359
318
|
***************/
|
|
360
319
|
Legal(resolve, reject) {
|
|
361
|
-
this.
|
|
362
|
-
this.action('legal');
|
|
363
|
-
const _cl = this.client(); // set local client
|
|
364
|
-
try {
|
|
365
|
-
if (!_cl.features.legal) return resolve(); // move to Done if no Systems feature
|
|
366
|
-
else {
|
|
367
|
-
this.state('set', 'Legal');
|
|
368
|
-
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
369
|
-
const {legal} = features; // set services from features const
|
|
370
|
-
this._legal = { // set this_services with data
|
|
371
|
-
id: this.lib.uid(true), // uuid of the services feature
|
|
372
|
-
client_id: id, // client id for reference
|
|
373
|
-
client_name: profile.name, // client name for personalization
|
|
374
|
-
concerns: legal.concerns, // any concerns for client
|
|
375
|
-
global: legal.global, // the global policies for client
|
|
376
|
-
personal: legal.devas[this._agent.key], // Client personal features and rules.
|
|
377
|
-
};
|
|
378
|
-
delete this._client.features.legal; // delete the services key for isolation
|
|
379
|
-
return resolve(); // go to Done
|
|
380
|
-
}
|
|
381
|
-
} catch (e) {
|
|
382
|
-
this.state('reject', 'Legal');
|
|
383
|
-
return this.error(e, false, reject); // run error handling if an error is caught
|
|
384
|
-
}
|
|
320
|
+
return this.Feature('legal', resolve, reject);
|
|
385
321
|
}
|
|
386
322
|
|
|
387
323
|
/**************
|
|
@@ -392,30 +328,7 @@ class Deva {
|
|
|
392
328
|
client presented data.
|
|
393
329
|
***************/
|
|
394
330
|
Justice(resolve, reject) {
|
|
395
|
-
this.
|
|
396
|
-
this.action('justice');
|
|
397
|
-
const _cl = this.client(); // set local client
|
|
398
|
-
try {
|
|
399
|
-
if (!_cl.features.justice) return resolve(); // move to Done if no Systems feature
|
|
400
|
-
else {
|
|
401
|
-
this.state('set', 'Justice');
|
|
402
|
-
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
403
|
-
const {justice} = features; // set services from features const
|
|
404
|
-
this._justice = { // set this_services with data
|
|
405
|
-
id: this.lib.uid(true), // uuid of the services feature
|
|
406
|
-
client_id: id, // client id for reference
|
|
407
|
-
client_name: profile.name, // client name for personalization
|
|
408
|
-
concerns: justice.concerns, // any concerns for client
|
|
409
|
-
global: justice.global, // the global policies for client
|
|
410
|
-
personal: justice.devas[this._agent.key], // Client personal features and rules.
|
|
411
|
-
};
|
|
412
|
-
delete this._client.features.justice; // delete the services key for isolation
|
|
413
|
-
return resolve(); // go to Done
|
|
414
|
-
}
|
|
415
|
-
} catch (e) {
|
|
416
|
-
this.state('reject', 'Justice');
|
|
417
|
-
return this.error(e, false, reject); // run error handling if an error is caught
|
|
418
|
-
}
|
|
331
|
+
return this.Feature('justice', resolve, reject);
|
|
419
332
|
}
|
|
420
333
|
|
|
421
334
|
/**************
|
|
@@ -426,30 +339,7 @@ class Deva {
|
|
|
426
339
|
client presented data.
|
|
427
340
|
***************/
|
|
428
341
|
Authority(resolve, reject) {
|
|
429
|
-
this.
|
|
430
|
-
this.action('authority');
|
|
431
|
-
const _cl = this.client(); // set local client
|
|
432
|
-
try {
|
|
433
|
-
if (!_cl.features.authority) return resolve(); // move to Done if no Systems feature
|
|
434
|
-
else {
|
|
435
|
-
this.state('set', 'Authority');
|
|
436
|
-
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
437
|
-
const {authority} = features; // set services from features const
|
|
438
|
-
this._authority = { // set this_services with data
|
|
439
|
-
id: this.lib.uid(true), // uuid of the services feature
|
|
440
|
-
client_id: id, // client id for reference
|
|
441
|
-
client_name: profile.name, // client name for personalization
|
|
442
|
-
concerns: authority.concerns, // any concerns for client
|
|
443
|
-
global: authority.global, // the global policies for client
|
|
444
|
-
personal: authority.devas[this._agent.key], // Client personal features and rules.
|
|
445
|
-
};
|
|
446
|
-
delete this._client.features.authority; // delete the services key for isolation
|
|
447
|
-
return resolve(); // go to Done
|
|
448
|
-
}
|
|
449
|
-
} catch (e) {
|
|
450
|
-
this.state('reject', 'Authority');
|
|
451
|
-
return this.error(e, false, reject); // run error handling if an error is caught
|
|
452
|
-
}
|
|
342
|
+
return this.Feature('authority', resolve, reject);
|
|
453
343
|
}
|
|
454
344
|
|
|
455
345
|
/**************
|
|
@@ -791,15 +681,21 @@ class Deva {
|
|
|
791
681
|
}).then(() => {
|
|
792
682
|
return this._assignListeners();
|
|
793
683
|
}).then(() => {
|
|
684
|
+
this.feature('init');
|
|
685
|
+
this.zone('init');
|
|
686
|
+
this.action('init');
|
|
687
|
+
this.state('init');
|
|
794
688
|
return this.Client(client, resolve, reject);
|
|
795
689
|
}).then(() => {
|
|
796
690
|
return this.Security(resolve, reject);
|
|
797
|
-
}).then(() => {
|
|
798
|
-
return this.Services(resolve, reject);
|
|
799
691
|
}).then(() => {
|
|
800
692
|
return this.Support(resolve, reject);
|
|
693
|
+
}).then(() => {
|
|
694
|
+
return this.Services(resolve, reject);
|
|
801
695
|
}).then(() => {
|
|
802
696
|
return this.Systems(resolve, reject);
|
|
697
|
+
}).then(() => {
|
|
698
|
+
return this.Networks(resolve, reject);
|
|
803
699
|
}).then(() => {
|
|
804
700
|
return this.Legal(resolve, reject);
|
|
805
701
|
}).then(() => {
|
|
@@ -809,7 +705,6 @@ class Deva {
|
|
|
809
705
|
}).then(() => {
|
|
810
706
|
return this.Done(resolve, reject);
|
|
811
707
|
}).then(() => {
|
|
812
|
-
this.zone('init');
|
|
813
708
|
const hasOnInit = this.onInit && typeof this.onInit === 'function';
|
|
814
709
|
return hasOnInit ? this.onInit(_data, resolve) : this.start(_data, resolve);
|
|
815
710
|
}).catch(err => {
|
|
@@ -1191,7 +1086,6 @@ class Deva {
|
|
|
1191
1086
|
feature(value=false, extra=false) {
|
|
1192
1087
|
try {
|
|
1193
1088
|
if (!value || !this._features[value]) return; // check feature value
|
|
1194
|
-
this._feature = value; // set local feature variable
|
|
1195
1089
|
|
|
1196
1090
|
const lookup = this._features[value]; // set the lookup value
|
|
1197
1091
|
const text = extra ? `${lookup} ${extra}` : lookup; // set the text value
|
|
@@ -1312,7 +1206,9 @@ class Deva {
|
|
|
1312
1206
|
try {
|
|
1313
1207
|
this.state('return', 'security'); // set the security state
|
|
1314
1208
|
return this.lib.copy(this._security); // return the security feature
|
|
1315
|
-
} catch (e) {
|
|
1209
|
+
} catch (e) {
|
|
1210
|
+
return this.error(e);
|
|
1211
|
+
}
|
|
1316
1212
|
}
|
|
1317
1213
|
|
|
1318
1214
|
/**************
|
|
@@ -1470,7 +1366,6 @@ class Deva {
|
|
|
1470
1366
|
usage: this.prompt('text')
|
|
1471
1367
|
***************/
|
|
1472
1368
|
prompt(text) {
|
|
1473
|
-
this.feature('prompt');
|
|
1474
1369
|
// Talk a global prompt event for the client
|
|
1475
1370
|
const agent = this.agent();
|
|
1476
1371
|
const client = this.client();
|
|
@@ -1499,7 +1394,6 @@ class Deva {
|
|
|
1499
1394
|
info() {
|
|
1500
1395
|
// check the active status
|
|
1501
1396
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1502
|
-
this.feature('info');
|
|
1503
1397
|
return this._info;
|
|
1504
1398
|
}
|
|
1505
1399
|
|
|
@@ -1517,7 +1411,6 @@ class Deva {
|
|
|
1517
1411
|
status() {
|
|
1518
1412
|
// check the active status
|
|
1519
1413
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1520
|
-
this.feature('status');
|
|
1521
1414
|
|
|
1522
1415
|
// format the date since active for output.
|
|
1523
1416
|
const dateFormat = this.lib.formatDate(this._active, 'long', true);
|
|
@@ -1540,7 +1433,6 @@ class Deva {
|
|
|
1540
1433
|
this.zone('help');
|
|
1541
1434
|
|
|
1542
1435
|
if (!this._active) return resolve(this._messages.offline);
|
|
1543
|
-
this.feature('help');
|
|
1544
1436
|
|
|
1545
1437
|
const params = msg.split(' ');
|
|
1546
1438
|
let helpFile = 'main';
|
package/package.json
CHANGED
package/tests/agent.json
CHANGED
package/tests/client.json
CHANGED
|
@@ -42,44 +42,49 @@
|
|
|
42
42
|
"password": "generic password for encryption test"
|
|
43
43
|
},
|
|
44
44
|
"concerns": [],
|
|
45
|
-
"global":
|
|
45
|
+
"global": [],
|
|
46
46
|
"devas": {}
|
|
47
47
|
},
|
|
48
48
|
"support": {
|
|
49
49
|
"concerns": [],
|
|
50
|
-
"global":
|
|
50
|
+
"global": [],
|
|
51
51
|
"devas": {}
|
|
52
52
|
},
|
|
53
53
|
"services": {
|
|
54
54
|
"concerns": [],
|
|
55
|
-
"global":
|
|
56
|
-
"indra": "https://indra.ai",
|
|
57
|
-
"world": "https://deva.world",
|
|
58
|
-
"space": "https://deva.space",
|
|
59
|
-
"cloud": "https://deva.cloud"
|
|
60
|
-
|
|
55
|
+
"global": [
|
|
56
|
+
{"indra": "https://indra.ai"},
|
|
57
|
+
{"world": "https://deva.world"},
|
|
58
|
+
{"space": "https://deva.space"},
|
|
59
|
+
{"cloud": "https://deva.cloud"}
|
|
60
|
+
],
|
|
61
61
|
"devas": {
|
|
62
62
|
"hello": {}
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"systems": {
|
|
66
66
|
"concerns": [],
|
|
67
|
-
"global":
|
|
67
|
+
"global": [],
|
|
68
|
+
"devas": {}
|
|
69
|
+
},
|
|
70
|
+
"networks": {
|
|
71
|
+
"concerns": [],
|
|
72
|
+
"global": [],
|
|
68
73
|
"devas": {}
|
|
69
74
|
},
|
|
70
75
|
"legal": {
|
|
71
76
|
"concerns": [],
|
|
72
|
-
"global":
|
|
77
|
+
"global": [],
|
|
73
78
|
"devas": {}
|
|
74
79
|
},
|
|
75
80
|
"justice": {
|
|
76
81
|
"concerns": [],
|
|
77
|
-
"global":
|
|
82
|
+
"global": [],
|
|
78
83
|
"devas": {}
|
|
79
84
|
},
|
|
80
85
|
"authority": {
|
|
81
86
|
"concerns": [],
|
|
82
|
-
"global":
|
|
87
|
+
"global": [],
|
|
83
88
|
"devas": {}
|
|
84
89
|
}
|
|
85
90
|
}
|
package/tests/index.js
CHANGED
|
@@ -31,27 +31,28 @@ const HelloWorld = new Deva({
|
|
|
31
31
|
vars: agent.vars,
|
|
32
32
|
listeners: {
|
|
33
33
|
'devacore:prompt'(packet) {
|
|
34
|
-
console.log(`๐
|
|
34
|
+
console.log(`๐ prompt: ${packet.text}`);
|
|
35
35
|
},
|
|
36
36
|
'devacore:question'(packet) {
|
|
37
|
-
console.log(`๐โโ๏ธ๏ธ
|
|
37
|
+
console.log(`๐โโ๏ธ๏ธ question: ${packet.text}`);
|
|
38
38
|
},
|
|
39
39
|
'devacore:answer'(packet) {
|
|
40
|
-
console.log(`๐จโ๐ฌ
|
|
40
|
+
console.log(`๐จโ๐ฌ answer: ${packet.text}`);
|
|
41
41
|
},
|
|
42
42
|
'devacore:ask'(packet) {
|
|
43
|
-
console.log(`๐ค
|
|
43
|
+
console.log(`๐ค ask: ${packet.text}`);
|
|
44
44
|
},
|
|
45
45
|
'devacore:state'(packet) {
|
|
46
|
-
console.log(`๐ช
|
|
46
|
+
console.log(`๐ช state: ${packet.text}`);
|
|
47
47
|
},
|
|
48
48
|
'devacore:zone'(packet) {
|
|
49
|
-
console.log(`๐บ๏ธ
|
|
49
|
+
console.log(`๐บ๏ธ zone: ${packet.text}`);
|
|
50
50
|
},
|
|
51
51
|
'devacore:action'(packet) {
|
|
52
|
-
console.log(`๐ฅ
|
|
52
|
+
console.log(`๐ฅ action: ${packet.text}`);
|
|
53
53
|
},
|
|
54
54
|
'devacore:feature'(packet) {
|
|
55
|
+
console.log(`---`);
|
|
55
56
|
console.log(`๐ฟ feature: ${packet.text}`);
|
|
56
57
|
},
|
|
57
58
|
'devacore:error'(packet) {
|