@indra.ai/deva 1.64.41 → 1.64.44

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/_data/tests.json CHANGED
@@ -56,6 +56,12 @@
56
56
  "title": "Help",
57
57
  "describe": "help() returns the right feecting section by file and part, answers help not found for a missing file or section as invalid and bad without an error or a good intent, and answers offline before init and after stop.",
58
58
  "count": 10
59
+ },
60
+ {
61
+ "file": "08-error.test.js",
62
+ "title": "Error",
63
+ "describe": "err() rejects or hands off to onError without calling context(), talks one stamped error packet, and context() and contexts() read each Deva's own vars.context, falling back safely when it is missing.",
64
+ "count": 6
59
65
  }
60
66
  ],
61
67
  "edgecases": [
@@ -1,9 +1,38 @@
1
- <div class="site-footer">
1
+ <footer class="site-footer" role="contentinfo">
2
2
  <div class="wrapper">
3
- <div class="footer-col-wrapper">
4
- <div class="footer-col footer-col-1">
5
- <p>Copyright &copy;2000-2026 Quinn Michaels; All rights reserved.</p>
3
+ <div class="footer-grid">
4
+ <div class="footer-brand">
5
+ <p class="footer-title">Deva Core</p>
6
+ <p>{{ site.tagline }}</p>
7
+ <p class="footer-small">Distributed under the <a href="{{ '/vla/' | relative_url }}">Vedic License Agreement</a>, VLA <code>31711622713594414221</code>.</p>
8
+ </div>
9
+ <div>
10
+ <p class="footer-title">Project</p>
11
+ <ul>
12
+ <li><a href="{{ '/docs/' | relative_url }}">Documentation</a></li>
13
+ <li><a href="{{ '/tests/' | relative_url }}">Tests</a></li>
14
+ <li><a href="https://github.com/indraai/deva">GitHub</a></li>
15
+ <li><a href="https://www.npmjs.com/package/@indra.ai/deva">npm</a></li>
16
+ </ul>
17
+ </div>
18
+ <div>
19
+ <p class="footer-title">Contact</p>
20
+ <ul>
21
+ <li><a href="mailto:{{ site.author.email }}">{{ site.author.email }}</a></li>
22
+ <li><a href="https://indra.ai">indra.ai</a></li>
23
+ {%- for link in site.social.links %}
24
+ {%- assign host = link | split: "//" | last | split: "/" | first | remove: "www." | split: "." | first -%}
25
+ {%- case host -%}
26
+ {%- when "github" -%}{%- assign label = "GitHub" -%}
27
+ {%- when "x" -%}{%- assign label = "X" -%}
28
+ {%- when "youtube" -%}{%- assign label = "YouTube" -%}
29
+ {%- else -%}{%- assign label = host | capitalize -%}
30
+ {%- endcase %}
31
+ <li><a href="{{ link }}" rel="me">{{ label }}</a></li>
32
+ {%- endfor %}
33
+ </ul>
6
34
  </div>
7
35
  </div>
36
+ <p class="footer-small footer-copy">Copyright &copy;2000-2026 Quinn Michaels; All rights reserved.</p>
8
37
  </div>
9
- </div>
38
+ </footer>
@@ -1,23 +1,25 @@
1
1
  <header class="site-header" role="banner">
2
2
  <div class="wrapper">
3
- <a class="site-title" rel="author" href="/">Deva</a>
4
- <nav class="site-nav">
3
+ <a class="site-title" rel="author" href="{{ '/' | relative_url }}">
4
+ <img class="site-logo" src="{{ '/assets/favicon.png' | relative_url }}" alt="" width="28" height="28">
5
+ <span>Deva Core</span>
6
+ </a>
7
+ <nav class="site-nav" aria-label="Main">
5
8
  <input type="checkbox" id="nav-trigger" class="nav-trigger">
6
- <label for="nav-trigger">
9
+ <label for="nav-trigger" aria-label="Menu">
7
10
  <span class="menu-icon">
8
- <svg viewBox="0 0 18 15" width="18px" height="15px">
9
- <path d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.032C17.335,0,18,0.665,18,1.484L18,1.484z M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.032C17.335,6.031,18,6.696,18,7.516L18,7.516z M18,13.516C18,14.335,17.335,15,16.516,15H1.484 C0.665,15,0,14.335,0,13.516l0,0c0-0.82,0.665-1.483,1.484-1.483h15.032C17.335,12.031,18,12.695,18,13.516L18,13.516z"></path>
10
- </svg>
11
+ <svg viewBox="0 0 18 15" width="18px" height="15px"><path d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.032C17.335,0,18,0.665,18,1.484L18,1.484z M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.032C17.335,6.031,18,6.696,18,7.516L18,7.516z M18,13.516C18,14.335,17.335,15,16.516,15H1.484 C0.665,15,0,14.335,0,13.516l0,0c0-0.82,0.665-1.483,1.484-1.483h15.032C17.335,12.031,18,12.695,18,13.516L18,13.516z"></path></svg>
11
12
  </span>
12
13
  </label>
13
-
14
14
  <div class="trigger">
15
- <a class="page-link" href="/core/">Core</a>
16
- <a class="page-link" href="/docs/">Docs</a>
17
- <a class="page-link" href="/tests/">Tests</a>
18
- <a class="page-link" href="/vibe/">Vibe</a>
19
- <a class="page-link" href="/vla/">VLA</a>
20
- <a class="page-link" href="/about/">About</a>
15
+ {%- assign nav = "Core:/core/,Docs:/docs/,Tests:/tests/,Vibe:/vibe/,VLA:/vla/,About:/about/" | split: "," -%}
16
+ {%- for item in nav -%}
17
+ {%- assign parts = item | split: ":" -%}
18
+ {%- assign href = parts[1] -%}
19
+ <a class="page-link{% if page.url contains href %} active{% endif %}" href="{{ href | relative_url }}"{% if page.url == href %} aria-current="page"{% endif %}>{{ parts[0] }}</a>
20
+ {%- endfor -%}
21
+ <a class="page-link nav-cta" href="https://github.com/indraai/deva">GitHub</a>
21
22
  </div>
22
23
  </nav>
23
- </header>
24
+ </div>
25
+ </header>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "31711622713594414221",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.64.41",
4
+ "version": "1.64.44",
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,98 @@
1
+ "use strict";
2
+ // Deva Core Test Suite: step 8, err() and the context lookups
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 {build, client, agent} from './_deva.js';
10
+
11
+ const TIERS = ['md5', 'sha256', 'sha512'];
12
+ const fresh = () => structuredClone(client);
13
+ // each test gets its own vars so a delete never reaches the shared agent.json data.
14
+ const vars = () => structuredClone(agent.vars);
15
+
16
+ test('err() rejects with the same error and never calls context()', async () => {
17
+ const deva = build({vars: vars()});
18
+ await deva.init(fresh());
19
+ let calls = 0;
20
+ const context = deva.context;
21
+ deva.context = (...args) => { calls++; return context.apply(deva, args); };
22
+ const before = deva._context;
23
+ const boom = new Error('boom');
24
+
25
+ await assert.rejects(deva.err(boom, {test: true}), e => e === boom);
26
+ assert.equal(calls, 0, 'err() does not call context()');
27
+ assert.equal(deva._context, before, 'err() leaves _context alone');
28
+ });
29
+
30
+ test('err() talks one stamped error packet on the error event', async () => {
31
+ const deva = build({vars: vars()});
32
+ await deva.init(fresh());
33
+ const heard = [];
34
+ deva.events.on(deva._events.error, packet => heard.push(packet));
35
+ const boom = new Error('boom');
36
+
37
+ await deva.err(boom, {test: true}).catch(() => {});
38
+ assert.equal(heard.length, 1, 'one error packet');
39
+ const data = heard[0];
40
+ assert.equal(data.key, 'error');
41
+ assert.equal(data.error.message, 'boom');
42
+ assert.deepEqual(data.packet, {test: true});
43
+ for (const t of TIERS) assert.equal(typeof data[t], 'string', `error data ${t}`);
44
+ });
45
+
46
+ test('err() hands err, packet and reject to onError and returns its result', async () => {
47
+ let seen;
48
+ const deva = build({
49
+ vars: vars(),
50
+ onError(err, packet, reject) {
51
+ seen = {err, packet, reject};
52
+ return 'handled';
53
+ },
54
+ });
55
+ await deva.init(fresh());
56
+ const boom = new Error('boom');
57
+ const reject = () => {};
58
+
59
+ assert.equal(await deva.err(boom, {test: true}, reject), 'handled');
60
+ assert.equal(seen.err, boom);
61
+ assert.deepEqual(seen.packet, {test: true});
62
+ assert.equal(seen.reject, reject);
63
+ });
64
+
65
+ test('context() without vars.context returns a stamped packet instead of overflowing', async () => {
66
+ const deva = build({vars: vars()});
67
+ await deva.init(fresh());
68
+ delete deva.vars.context;
69
+
70
+ const data = deva.context('hello', 'world');
71
+ assert.equal(data.key, 'context');
72
+ assert.equal(data.value, 'hello');
73
+ assert.equal(data.text, 'hello world', 'falls back to the raw value');
74
+ for (const t of TIERS) assert.equal(typeof data[t], 'string', `context data ${t}`);
75
+ });
76
+
77
+ test('context() looks the value up in this Deva\'s own vars.context', async () => {
78
+ const deva = build({vars: vars()});
79
+ await deva.init(fresh());
80
+ const [key, text] = Object.entries(agent.vars.context)[0];
81
+
82
+ const data = deva.context(key);
83
+ assert.equal(data.value, key);
84
+ assert.equal(data.text, text);
85
+ });
86
+
87
+ test('contexts() returns this Deva\'s vars.context, or false when it has none', async () => {
88
+ const deva = build({vars: vars()});
89
+ await deva.init(fresh());
90
+
91
+ const data = deva.contexts();
92
+ assert.equal(data.key, 'contexts');
93
+ assert.deepEqual(data.value, deva.vars.context);
94
+ for (const t of TIERS) assert.equal(typeof data[t], 'string', `contexts data ${t}`);
95
+
96
+ delete deva.vars.context;
97
+ assert.equal(deva.contexts().value, false);
98
+ });