@indra.ai/deva 1.63.4 → 1.64.0
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/README.md +1 -1
- package/package.json +3 -2
- package/tests/index.js +3 -5
- package/tests/suite/00-build.test.js +14 -0
- package/tests/suite/_deva.js +60 -0
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ Run it with `node examples/hello-world.js` and it prints `hello world`.
|
|
|
83
83
|
|
|
84
84
|
Three things to know from this example:
|
|
85
85
|
|
|
86
|
-
- Do your work from `onReady`, not after `await init()`. The `init()` promise
|
|
86
|
+
- Do your work from `onReady`, not after `await init()`. The `init()` promise resolves after `ready` has run.
|
|
87
87
|
|
|
88
88
|
- **`info`, `config: {hash: {}}` and `vars.context` are effectively required.** Without them `ready()` or `context()` throws. The error handler then calls `context()` again, and the process ends in a stack overflow.
|
|
89
89
|
- **Methods must return a Promise.** `answer()` calls `this.methods[method](packet).then(...)`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "31711622713594414221",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.64.0",
|
|
5
5
|
"description": "Deva Core a Vedic-inspired Event Based Context Aware Feature, Zone, Action, and State Machine integrated Artificial Intelligence Framework",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "VLA:31711622713594414221 LICENSE.md",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"copyright": "Copyright ©2000-2026 Quinn Michaels; All rights reserved.",
|
|
49
49
|
"type": "module",
|
|
50
50
|
"scripts": {
|
|
51
|
-
"test": "node tests"
|
|
51
|
+
"test": "node --test \"tests/suite/*.test.js\"",
|
|
52
|
+
"demo": "node tests"
|
|
52
53
|
},
|
|
53
54
|
"repository": {
|
|
54
55
|
"type": "git",
|
package/tests/index.js
CHANGED
|
@@ -120,7 +120,6 @@ const DevaTest = new Deva({
|
|
|
120
120
|
test(packet) {
|
|
121
121
|
const uid = this.uid();
|
|
122
122
|
const license_check = this.license_check(client.VLA, pkg.VLA);
|
|
123
|
-
const text = this._state
|
|
124
123
|
const core = this.core();
|
|
125
124
|
const info = this.info();
|
|
126
125
|
const sign_packet = {
|
|
@@ -164,7 +163,7 @@ const DevaTest = new Deva({
|
|
|
164
163
|
`::END:INFO:${info.id.uid}`,
|
|
165
164
|
'::::',
|
|
166
165
|
`::BEGIN:SIGN:${license_check.id.uid}`,
|
|
167
|
-
JSON.stringify(
|
|
166
|
+
JSON.stringify(sign,null,2),
|
|
168
167
|
`::END:SIGN:${license_check.id.uid}`,
|
|
169
168
|
'::::',
|
|
170
169
|
];
|
|
@@ -177,8 +176,7 @@ const DevaTest = new Deva({
|
|
|
177
176
|
methods: {
|
|
178
177
|
test(packet) {
|
|
179
178
|
this.context('test');
|
|
180
|
-
|
|
181
|
-
return test;
|
|
179
|
+
return this.func.test(packet);
|
|
182
180
|
},
|
|
183
181
|
},
|
|
184
182
|
onInit(data, resolve) {
|
|
@@ -194,7 +192,7 @@ const DevaTest = new Deva({
|
|
|
194
192
|
return this.ready(data, resolve);
|
|
195
193
|
},
|
|
196
194
|
onReady(data, resolve) {
|
|
197
|
-
|
|
195
|
+
this.methods.test(data);
|
|
198
196
|
this.prompt(this._messages.ready);
|
|
199
197
|
this.intent('good', `tests:ready`);
|
|
200
198
|
return resolve(data);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Deva Core Test Suite: step 0, the builder works
|
|
3
|
+
import test from 'node:test';
|
|
4
|
+
import assert from 'node:assert/strict';
|
|
5
|
+
import {build, client} from './_deva.js';
|
|
6
|
+
|
|
7
|
+
test('build() makes a Deva that reaches ready', async () => {
|
|
8
|
+
const deva = build();
|
|
9
|
+
const data = await deva.init(client);
|
|
10
|
+
for (const k of ['start', 'enter', 'done', 'ready']) {
|
|
11
|
+
assert.equal(typeof data[k], 'number', `${k} timestamp`);
|
|
12
|
+
}
|
|
13
|
+
await deva.stop();
|
|
14
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Deva Core Test Suite: shared builder
|
|
3
|
+
// Copyright ©2000-2026 Quinn Michaels; All rights reserved.
|
|
4
|
+
// Owner Signature Required For Lawful Use.
|
|
5
|
+
// Distributed under VLA:31711622713594414221 LICENSE.md
|
|
6
|
+
|
|
7
|
+
import Client from '../client.json' with {type:'json'};
|
|
8
|
+
import Agent from '../agent.json' with {type:'json'};
|
|
9
|
+
import Deva from '../../index.js';
|
|
10
|
+
import pkg from '../../package.json' with {type:'json'};
|
|
11
|
+
|
|
12
|
+
import {dirname} from 'node:path';
|
|
13
|
+
import {fileURLToPath} from 'node:url';
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
|
|
16
|
+
export const client = Client.DATA;
|
|
17
|
+
export const agent = Agent.DATA;
|
|
18
|
+
export {pkg};
|
|
19
|
+
|
|
20
|
+
export const info = {
|
|
21
|
+
id: pkg.id,
|
|
22
|
+
name: pkg.name,
|
|
23
|
+
describe: pkg.description,
|
|
24
|
+
version: pkg.version,
|
|
25
|
+
author: pkg.author.name,
|
|
26
|
+
email: pkg.author.email,
|
|
27
|
+
url: pkg.authorurl,
|
|
28
|
+
copyright: pkg.copyright,
|
|
29
|
+
dir: __dirname,
|
|
30
|
+
git: pkg.repository.url,
|
|
31
|
+
bugs: pkg.bugs.url,
|
|
32
|
+
VLA: pkg.VLA,
|
|
33
|
+
license: 'TESTING ONLY',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// build a fresh test Deva; each test passes only what it changes
|
|
37
|
+
export function build(opts = {}) {
|
|
38
|
+
return new Deva({
|
|
39
|
+
info,
|
|
40
|
+
agent: {
|
|
41
|
+
id: agent.id,
|
|
42
|
+
key: agent.key,
|
|
43
|
+
prompt: agent.prompt,
|
|
44
|
+
voice: agent.voice,
|
|
45
|
+
profile: agent.profile,
|
|
46
|
+
features: agent.features,
|
|
47
|
+
translate(input) { return input.trim(); },
|
|
48
|
+
parse(input) { return input.trim(); },
|
|
49
|
+
process(input) { return input.trim(); },
|
|
50
|
+
},
|
|
51
|
+
config: {hash: {}},
|
|
52
|
+
vars: agent.vars,
|
|
53
|
+
listeners: {},
|
|
54
|
+
devas: {},
|
|
55
|
+
modules: {},
|
|
56
|
+
func: {},
|
|
57
|
+
methods: {},
|
|
58
|
+
...opts,
|
|
59
|
+
});
|
|
60
|
+
}
|