@indra.ai/deva 1.6.71 → 1.6.73
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 +21 -11
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -941,7 +941,7 @@ class Deva {
|
|
|
941
941
|
|
|
942
942
|
const license_check = this.license_check(client.VLA, pkg.VLA);
|
|
943
943
|
if (!license_check) {
|
|
944
|
-
|
|
944
|
+
this.prompt(config.messages.client_license_invalid);
|
|
945
945
|
return resolve(config.messages.client_license_invalid); // return if} license check fails
|
|
946
946
|
}
|
|
947
947
|
|
|
@@ -1937,26 +1937,36 @@ class Deva {
|
|
|
1937
1937
|
usage: this.prompt('text')
|
|
1938
1938
|
***************/
|
|
1939
1939
|
prompt(text) {
|
|
1940
|
-
if (!this._active) return this._messages.offline;
|
|
1941
|
-
const id = this.uid();
|
|
1942
|
-
|
|
1943
|
-
const
|
|
1944
|
-
const
|
|
1940
|
+
if (!this._active) return this._messages.offline; // return offline message if inactive.
|
|
1941
|
+
const id = this.uid(); // generate the id for the prompt
|
|
1942
|
+
const agent = this.agent(); // set the agent for the prompt
|
|
1943
|
+
const client = this.client(); // set the client for the prompt
|
|
1944
|
+
const {key} = agent; // set the key from agent
|
|
1945
|
+
const value = 'prompt'; // set the value of the key.
|
|
1946
|
+
// create data packet to generate prompt
|
|
1947
|
+
|
|
1948
|
+
this.state('data', `${key}:${value}:${id.uid}`)
|
|
1945
1949
|
const data = {
|
|
1946
1950
|
id,
|
|
1947
|
-
key
|
|
1948
|
-
value
|
|
1951
|
+
key,
|
|
1952
|
+
value,
|
|
1949
1953
|
agent,
|
|
1950
1954
|
client,
|
|
1951
1955
|
text,
|
|
1952
1956
|
created: Date.now(),
|
|
1953
1957
|
}
|
|
1954
1958
|
|
|
1955
|
-
|
|
1956
|
-
data.
|
|
1957
|
-
|
|
1959
|
+
this.state('hash', `${key}:${value}:md5:${id.uid}`)
|
|
1960
|
+
data.md5 = this.lib.hash(data); // md5 the data packet
|
|
1961
|
+
this.state('hash', `${key}:${value}:sha256:${id.uid}`)
|
|
1962
|
+
data.sha256 = this.lib.hash(data, 'sha256'); // sha256 the data packet
|
|
1963
|
+
this.state('hash', `${key}:${value}:sha512:${id.uid}`)
|
|
1964
|
+
data.sha512 = this.lib.hash(data, 'sha512'); // sha512 the data packet
|
|
1958
1965
|
|
|
1966
|
+
this.action('talk', `${key}:${value}:${id.uid}`);
|
|
1959
1967
|
this.talk(config.events.prompt, data);
|
|
1968
|
+
|
|
1969
|
+
this.action('return', `${key}:${value}:${id.uid}`);
|
|
1960
1970
|
return data;
|
|
1961
1971
|
}
|
|
1962
1972
|
|