@indra.ai/deva 1.1.74 → 1.1.76
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/index.js +28 -25
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -58,7 +58,9 @@ class Deva {
|
|
|
58
58
|
this._features = config.features; // set the features from config
|
|
59
59
|
|
|
60
60
|
this._message = config.message; // current state of agent.
|
|
61
|
-
this._messages = {
|
|
61
|
+
this._messages = {
|
|
62
|
+
notext: 'NO TEXT WAS PROVIDED',
|
|
63
|
+
}; // set the messages from config
|
|
62
64
|
|
|
63
65
|
// then here we are going to loop the messages config to make sure custom values are set
|
|
64
66
|
for (let x in config.messages) {
|
|
@@ -486,8 +488,8 @@ class Deva {
|
|
|
486
488
|
global: mind.global, // the global policies for client
|
|
487
489
|
personal: mind.devas[this._agent.key], // Client personal features and rules.
|
|
488
490
|
};
|
|
489
|
-
delete this._client.features.mind;
|
|
490
|
-
return this.Done();
|
|
491
|
+
delete this._client.features.mind; // delete the mind feature from client data
|
|
492
|
+
return this.Done(); // when complete then move to the done feature.
|
|
491
493
|
}
|
|
492
494
|
} catch (e) {
|
|
493
495
|
this.action('error'); // set the action to error
|
|
@@ -929,6 +931,26 @@ class Deva {
|
|
|
929
931
|
// now when we ask the meta params[0] should be the method
|
|
930
932
|
}
|
|
931
933
|
|
|
934
|
+
info(id=false) {
|
|
935
|
+
id = id || this._id;
|
|
936
|
+
const agent = this.agent();
|
|
937
|
+
if (this._info) {
|
|
938
|
+
const _info = [
|
|
939
|
+
`::begin:info:${id}`,
|
|
940
|
+
`## ${this._agent.profile.name} (#${agent.key})`,
|
|
941
|
+
];
|
|
942
|
+
for (let x in this._info) {
|
|
943
|
+
_info.push(`- ${x}: ${this._info[x]}`);
|
|
944
|
+
}
|
|
945
|
+
_info.push(`::end:info:${this.hash(this._info)}`);
|
|
946
|
+
return _info.join('\n');
|
|
947
|
+
}
|
|
948
|
+
else {
|
|
949
|
+
return '';
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
|
|
932
954
|
|
|
933
955
|
/**************
|
|
934
956
|
func: init
|
|
@@ -983,25 +1005,6 @@ class Deva {
|
|
|
983
1005
|
});
|
|
984
1006
|
}
|
|
985
1007
|
|
|
986
|
-
info(id=false) {
|
|
987
|
-
id = id || this._id;
|
|
988
|
-
const agent = this.agent();
|
|
989
|
-
if (this._info) {
|
|
990
|
-
const _info = [
|
|
991
|
-
`::begin:info:${id}`,
|
|
992
|
-
`## ${this._agent.profile.name} (#${agent.key})`,
|
|
993
|
-
];
|
|
994
|
-
for (let x in this._info) {
|
|
995
|
-
_info.push(`- ${x}: ${this._info[x]}`);
|
|
996
|
-
}
|
|
997
|
-
_info.push(`::end:info:${this.hash(this._info)}`);
|
|
998
|
-
return _info.join('\n');
|
|
999
|
-
}
|
|
1000
|
-
else {
|
|
1001
|
-
return '';
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
1008
|
/**************
|
|
1006
1009
|
func: start
|
|
1007
1010
|
params:
|
|
@@ -1012,7 +1015,7 @@ class Deva {
|
|
|
1012
1015
|
function or running the system enter function.
|
|
1013
1016
|
usage: this.start('msg')
|
|
1014
1017
|
***************/
|
|
1015
|
-
start(data
|
|
1018
|
+
start(data) {
|
|
1016
1019
|
this.state('start');
|
|
1017
1020
|
if (!this._active) return Promise.resolve(this._messages.states.offline);
|
|
1018
1021
|
data.value = 'start';
|
|
@@ -1039,14 +1042,14 @@ class Deva {
|
|
|
1039
1042
|
If the Deva is offline it will return the offline message.
|
|
1040
1043
|
usage: this.enter('msg')
|
|
1041
1044
|
***************/
|
|
1042
|
-
enter(data
|
|
1045
|
+
enter(data) {
|
|
1043
1046
|
this.state('enter');
|
|
1044
1047
|
if (!this._active) return Promise.resolve(this._messages.states.offline);
|
|
1045
1048
|
data.value = 'enter';
|
|
1046
1049
|
delete data.hash;
|
|
1047
1050
|
data.hash = this.hash(data);
|
|
1048
1051
|
const hasOnEnter = this.onEnter && typeof this.onEnter === 'function' ? true : false;
|
|
1049
|
-
return hasOnEnter ? this.onEnter(
|
|
1052
|
+
return hasOnEnter ? this.onEnter(data) : this.done(data)
|
|
1050
1053
|
}
|
|
1051
1054
|
|
|
1052
1055
|
/**************
|