@indra.ai/deva 1.64.4 → 1.64.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "31711622713594414221",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.64.4",
4
+ "version": "1.64.5",
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",
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ // Deva Core Test Suite: step 4, the VLA license check
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 test from 'node:test';
8
+ import assert from 'node:assert/strict';
9
+ import {createHash} from 'node:crypto';
10
+ import {build, client, pkg} from './_deva.js';
11
+
12
+ const TIERS = ['md5', 'sha256', 'sha512'];
13
+ const digest = (data, algo) => createHash(algo).update(JSON.stringify(data)).digest('base64');
14
+ const fresh = (changes = {}) => ({...structuredClone(client), ...changes});
15
+ const wait = ms => new Promise(res => setTimeout(res, ms));
16
+
17
+ test('the test client carries the same VLA as the package', () => {
18
+ assert.deepEqual(client.VLA, pkg.VLA);
19
+ assert.equal(pkg.VLA.uid, '31711622713594414221');
20
+ });
21
+
22
+ test('a good VLA activates the Deva and init() reaches ready', async () => {
23
+ const deva = build();
24
+ const data = await deva.init(fresh());
25
+ assert.ok(deva._active, 'Deva is active');
26
+ assert.equal(typeof data.ready, 'number');
27
+ await deva.stop();
28
+ });
29
+
30
+ test('license_check() approves a matching VLA with stamped hashes', async () => {
31
+ const deva = build();
32
+ await deva.init(fresh());
33
+ const approved = deva.license_check(client.VLA, deva._core.VLA);
34
+ const vla_hash = digest(pkg.VLA, 'sha256');
35
+ assert.equal(typeof approved.id.uid, 'string');
36
+ assert.equal(approved.personal, vla_hash, 'personal is the sha256 of the client VLA');
37
+ assert.equal(approved.package, vla_hash, 'package is the sha256 of the package VLA');
38
+
39
+ // each tier covers the approval plus the tiers before it
40
+ const walk = {...approved};
41
+ for (const t of TIERS) delete walk[t];
42
+ for (const t of TIERS) {
43
+ assert.equal(approved[t], digest(walk, t), t);
44
+ walk[t] = approved[t];
45
+ }
46
+ await deva.stop();
47
+ });
48
+
49
+ test('a changed VLA resolves with the invalid check message and stays inactive', async () => {
50
+ const deva = build();
51
+ const seen = [];
52
+ deva.events.on('devacore:ready', () => seen.push('ready'));
53
+ const VLA = {...structuredClone(client.VLA), uid: '00000000000000000000'};
54
+ const result = await deva.init(fresh({VLA}));
55
+ await wait(100);
56
+ assert.equal(result, deva._messages.checkVLA);
57
+ assert.equal(deva._active, false);
58
+ assert.deepEqual(seen, [], 'no ready event');
59
+ assert.equal(deva.license(), deva._messages.offline, 'getters stay offline');
60
+ });
61
+
62
+ test('a missing client VLA resolves with the personal VLA message and stays inactive', async () => {
63
+ const deva = build();
64
+ const c = fresh();
65
+ delete c.VLA;
66
+ const result = await deva.init(c);
67
+ assert.equal(result, deva._messages.personalVLA);
68
+ assert.equal(deva._active, false);
69
+ });
70
+
71
+ test('license_check() with no package VLA returns the package VLA message', () => {
72
+ const deva = build();
73
+ assert.equal(deva.license_check(client.VLA), deva._messages.packageVLA);
74
+ });