@indra.ai/deva 1.62.6 → 1.62.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/404.md ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ permalink: /404.html
3
+ layout: page
4
+ description: The page you are looking for was not found.
5
+ ---
6
+
7
+ {{ page.description }}
package/CNAME ADDED
@@ -0,0 +1 @@
1
+ deva.world
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # Deva Core
1
+ # Deva
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@indra.ai/deva)](https://www.npmjs.com/package/@indra.ai/deva)
4
4
 
5
5
  **`@indra.ai/deva`**
6
6
 
7
- Deva Core is a Vedic-inspired, event-based, context-aware Feature, Zone, Action and State machine framework for building integrated artificial intelligence agents ("Devas") in Node.js. Every Deva is one `Deva` class instance on a shared event bus. As it works, it moves through named features, zones, actions, states, intents, beliefs and contexts, and it broadcasts each step as an event. Every packet it builds is stamped with cumulative md5, sha256 and sha512 hashes.
7
+ Deva is a Vedic-inspired, event-based, context-aware Feature, Zone, Action and State machine framework for building integrated artificial intelligence agents ("Devas") in Node.js. Every Deva is one `Deva` class instance on a shared event bus. As it works, it moves through named features, zones, actions, states, intents, beliefs and contexts, and it broadcasts each step as an event. Every packet it builds is stamped with cumulative md5, sha256 and sha512 hashes.
8
8
 
9
- > Deva Core is distributed under the **Vedic License Agreement (VLA)**. Read [License](#license) before you use it.
9
+ > Deva is distributed under the **Vedic License Agreement (VLA)**. Read [License](#license) before you use it.
10
10
 
11
11
  ## Contents
12
12
 
@@ -31,7 +31,7 @@ Deva Core is a Vedic-inspired, event-based, context-aware Feature, Zone, Action
31
31
 
32
32
  - Node.js **22 or later** (`engines.node: ">=22"`), npm 9.5.1 or later.
33
33
  - ES modules only. The package is `"type": "module"` and uses JSON import attributes (`import x from './x.json' with {type: 'json'}`). `require()` won't work.
34
- - A **client object that carries a VLA** matching the one in Deva Core's `package.json`. `init()` refuses to start without it (see [Lifecycle](#lifecycle)).
34
+ - A **client object that carries a VLA** matching the one in Deva's `package.json`. `init()` refuses to start without it (see [Lifecycle](#lifecycle)).
35
35
 
36
36
  ## Install
37
37
 
@@ -41,13 +41,13 @@ npm install @indra.ai/deva
41
41
 
42
42
  ## Quick start
43
43
 
44
- This is a minimal working Deva with one method. `client.json` is a client file shaped like [`tests/client.json`](tests/client.json). Its `DATA.VLA` must match the `VLA` block in Deva Core's `package.json`.
44
+ This is a minimal working Deva with one method. `client.json` is a client file shaped like [`tests/client.json`](tests/client.json). Its `DATA.VLA` must match the `VLA` block in Deva's `package.json`.
45
45
 
46
46
  ```javascript
47
47
  import Deva from '@indra.ai/deva';
48
48
  import Client from './client.json' with {type: 'json'};
49
49
 
50
- const client = Client.DATA; // must carry a VLA matching the Deva Core package VLA
50
+ const client = Client.DATA; // must carry a VLA matching the Deva package VLA
51
51
 
52
52
  const hello = new Deva({
53
53
  info: {id: 'hello', name: 'Hello Deva', version: '0.0.1', VLA: client.VLA},
@@ -194,7 +194,7 @@ packet: id, q, a, created, finish, complete, md5, sha256, sha512
194
194
 
195
195
  ## Stamping and the hash tiers
196
196
 
197
- Deva Core hashes in three tiers, in the order `config.hashes = ['md5', 'sha256', 'sha512']`:
197
+ Deva hashes in three tiers, in the order `config.hashes = ['md5', 'sha256', 'sha512']`:
198
198
 
199
199
  | Tier | Intended use |
200
200
  |---|---|
@@ -297,7 +297,7 @@ Not covered here because they weren't exercised for this README: `help(msg, help
297
297
 
298
298
  ## License
299
299
 
300
- Deva Core is distributed under the **Vedic License Agreement**, version 1.4.2, VLA `23221940810208468106`, owned by Quinn Arjuna America Michaels, through License Deva. The full text is in [LICENSE.md](LICENSE.md). It states, among other things, that:
300
+ Deva is distributed under the **Vedic License Agreement**, version 1.4.2, VLA `23221940810208468106`, owned by Quinn Arjuna America Michaels, through License Deva. The full text is in [LICENSE.md](LICENSE.md). It states, among other things, that:
301
301
 
302
302
  - by accessing or using the Software, you agree to its terms;
303
303
  - the Software is the sole proprietary property of the Owner;
package/_config.yml CHANGED
@@ -3,11 +3,33 @@
3
3
  # Owner Signature Required For Lawful Use.
4
4
  # Distributed under VLA:23221940810208468106 LICENSE.md
5
5
  # Friday, October 9, 2026 - 7:47:02 AM PST
6
-
6
+ url: "https://deva.world"
7
7
  author:
8
8
  name: Quinn Arjuna America Michaels
9
9
  email: "quinn@indra.ai"
10
10
 
11
- google_analytics: UA-126646842-1
11
+ google_analytics: G-JWHX0M91FE
12
12
 
13
13
  theme: minima
14
+ minima:
15
+ skin: dark
16
+ social_links:
17
+ - title: Deva Core on Github
18
+ icon: github
19
+ url: "https://github.com/indraai/deva"
20
+ - title: Quinn Michaels on X (formerly Twitter)
21
+ icon: x-twitter
22
+ url: "https://x.com/quinnmichaels"
23
+ - title: Quinn Michaels on Youtube
24
+ icon: youtube
25
+ url: "https://youtube.com/quinnmichaels"
26
+ - title: Quinn Michaels on Instagram
27
+ icon: instagram
28
+ url: "https://instagram.com/quinnshow"
29
+ - title: Quinn Michaels on Facebook
30
+ icon: facebook
31
+ url: "https://facebook.com/quinnshow"
32
+ header_pages:
33
+ - about.md
34
+ - docs.md
35
+ - core/index.md
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "id": "64654724156459693416",
3
3
  "title": "Deva Core Actions",
4
+ "describe": "The Deva Core Actions are for indicating when the system takes a specific action type in a process.",
4
5
  "copyright": "Copyright ©2000-2026 Quinn Arjuna America Michaels; All rights reserved.",
5
6
  "VLA": "23221940810208468106",
6
7
  "DATA": {
@@ -42,6 +43,7 @@
42
43
  "func": "🔦 Func",
43
44
  "onfunc": "🎚️ onFunction",
44
45
  "actions": "🏎️ Actions",
46
+ "feature": "🎥 Feature",
45
47
  "features": "🎥 Features",
46
48
  "contexts": "🌈 Contexts",
47
49
  "zones": "🪐 Zones",
@@ -96,7 +98,6 @@
96
98
  "target": "🎯 Target",
97
99
  "mature": "🧓 Mature",
98
100
  "immature": "🧒 Immature",
99
- "hash": "#️⃣ Hash",
100
- "romance": "🌹 Romance"
101
+ "hash": "#️⃣ Hash"
101
102
  }
102
103
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "id": "19434356359269778749",
3
+ "title": "Deva Core Beliefs",
4
+ "copyright": "Copyright ©2000-2026 Quinn Arjuna America Michaels; All rights reserved.",
5
+ "VLA": "23221940810208468106",
6
+ "DATA": {
7
+ "vedic": "🕉️ Vedic",
8
+ "american": "🇺🇸 American",
9
+ "other": "🤔 Other"
10
+ }
11
+ }
@@ -16,7 +16,6 @@
16
16
  "security": "🚨 Security",
17
17
  "support": "💼 Support",
18
18
  "services": "🛠️ Services",
19
- "systems": "🖥️️ Systems",
20
- "networks": "📡 Networks"
19
+ "systems": "🖥️️ Systems"
21
20
  }
22
21
  }
@@ -0,0 +1,25 @@
1
+ {
2
+ "id": "19434356359269778749",
3
+ "title": "Deva Core Intents",
4
+ "copyright": "Copyright ©2000-2026 Quinn Arjuna America Michaels; All rights reserved.",
5
+ "VLA": "23221940810208468106",
6
+ "DATA": {
7
+ "help": "🙏 Help",
8
+ "good": "🙂 Good",
9
+ "neutral": "😐 Neutral",
10
+ "bad": "🙁 Bad",
11
+ "evil": "👿 Evil",
12
+ "abuse": "🩼 Abuse",
13
+ "harm": "🤕 Harm",
14
+ "malicious": "👺 Malicious",
15
+ "lawful": "⛓️🤝 Lawful",
16
+ "unlawful": "⛓️💥 Unlawful",
17
+ "honest": "😇 Honest",
18
+ "dishonest": "🤥 Dishonest",
19
+ "fun": "😎 Fun",
20
+ "play": "🛝 Play",
21
+ "work": "💼 Work",
22
+ "assist": "🗺️ Assist",
23
+ "other": "🤔 Other"
24
+ }
25
+ }
@@ -18,6 +18,8 @@
18
18
  "nodata": "⛔️ NO DATA PROVIDED",
19
19
  "nokey": "⛔️ NO KEY PROVIDED",
20
20
  "invalidkey": "⛔️ INVALID KEY PROVIDED",
21
+ "matchkey": "⛔️ INVALID KEY MATCH",
22
+ "invalidfeature": "⛔️ INVALID feature",
21
23
  "asktimeout": "⛔️ ASK TIMEOUT",
22
24
  "noask": "⛔️ ASK TARGET NOT FOUND",
23
25
  "method_not_found": "⛔️ METHOD NOT FOUND",
@@ -31,11 +33,11 @@
31
33
  "client_license_check": "🪪 Check Client License",
32
34
  "client_license_invalid": "❌ The Provided Client License Is Invalid",
33
35
  "status": "vedic",
34
- "vectors": "#Quinn #QuinnArjunaMichaels #InsideThenet #IndraAI #DevaWorld #DevaCore #VedicDeva",
35
- "owner": "Quinn Arjuna Michaels",
36
- "creator": "Quinn Arjuna Michaels",
37
- "salute": "🤝🫡✨🕉️",
38
- "copyright": "Copyright ©2000-2026 Quinn Arjuna Michaels; All rights reserved."
36
+ "vectors": "#Quinn #QuinnArjunaAmericaMichaels #InsideThenet #IndraAI #DevaWorld #DevaCore #VedicDeva",
37
+ "owner": "Quinn Arjuna America Michaels",
38
+ "creator": "Quinn Arjuna America Michaels",
39
+ "salute": "🤝🫡✨🕉️🇺🇸",
40
+ "copyright": "Copyright ©2000-2026 Quinn Arjuna America Michaels; All rights reserved."
39
41
  }
40
42
  }
41
43
 
@@ -80,17 +80,6 @@
80
80
  "catch": "⚾️ Catch",
81
81
  "finally": "🏆 Finally",
82
82
  "view": "👓 View",
83
- "license": "🪪 License",
84
- "feecting": "🏄 Feecting",
85
- "data": "💾 Data",
86
- "error": "❌ Error",
87
- "log": "🪵 Log",
88
- "report": "🗂️ Report",
89
- "security": "🚨 Security",
90
- "legal": "🏛️ Legal",
91
- "support": "💼 Support",
92
- "services": "🛠️ Services",
93
- "systems": "🖥️ Systems",
94
83
  "emergency": "🛟 Emergency",
95
84
  "ingress": "🫴 Ingress",
96
85
  "egress": "🫳 Egress",
@@ -116,8 +105,6 @@
116
105
  "real": "😲 Real",
117
106
  "mature": "🧓 Mature",
118
107
  "immature": "🧒 Immature",
119
- "consent": "✍️ Consent",
120
- "onfunc": "🎚️ onFunction",
121
- "romance": "🌹 Romance"
108
+ "consent": "✍️ Consent"
122
109
  }
123
110
  }
@@ -42,40 +42,11 @@
42
42
  "support": "💼 Support",
43
43
  "services": "🛠️ Services",
44
44
  "systems": "🖥️️ Systems",
45
- "householder": "🏡 Householder",
46
- "brahmana": "🕉️ Brahmana",
47
- "kshatriya": "🛡️ Kshatriya",
48
- "vaisya": "💼️ Vaisya",
49
- "sudra": "️🧺 Sudra",
50
- "outcast": "🏚️ Outcast",
51
45
  "help": "💚 Help",
52
46
  "emergency": "🛟 Emergency",
53
47
  "danger": "⛔️ Danger",
54
48
  "crisis": "😱 Crisis",
55
49
  "private": "🤫 Private",
56
- "public": "😀 Public",
57
- "industry": "🏭 Industry",
58
- "merit": "➕ Merit",
59
- "demerit": "➖ Demerit",
60
- "camera": "🤳 Camera",
61
- "yakshas": "🥩 Yakshas",
62
- "rakshasas": "🥩 Rakshasas",
63
- "pisakas": "🥩 Pisakas",
64
- "kimidin": "🥩 Kimidin",
65
- "atrin": "🥩 Atrin",
66
- "romance": "🌹 Romance",
67
- "porn": "👙 Pornography",
68
- "prostitute": "💃 Prostitute",
69
- "friend": "🤝 Friend",
70
- "enemy": "🚨👿 Enemy",
71
- "suspect": "🚨🥸 Suspect",
72
- "culprit": "🚨😤 Culprit",
73
- "criminal": "🚨🤬 Criminal",
74
- "felon": "🚨🙅 Felon",
75
- "victim": "🚨🩼 Victim",
76
- "hostage": "🚨🙊 Hostage",
77
- "court": "🏛️🧑‍⚖️ Court",
78
- "jail": "⛓️🔏 Jail",
79
- "prison": "⛓️🔐 Prison"
50
+ "public": "😀 Public"
80
51
  }
81
52
  }
@@ -0,0 +1,9 @@
1
+ <div class="site-footer">
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 Arjuna America Michaels; All rights reserved.</p>
6
+ </div>
7
+ </div>
8
+ </div>
9
+ </div>
@@ -0,0 +1,20 @@
1
+ <!-- Custom header for favicons -->
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ {%- seo -%}
7
+ <link rel="stylesheet" href="{{ '/assets/main.css' | relative_url }}">
8
+ {%- feed_meta -%}
9
+ <link rel="icon" type="image/png" sizes="128x128" href="{{ '/assets/favicon.png' | relative_url }}">
10
+ <link rel="apple-touch-icon" href="{{ '/assets/favicon.png' | relative_url }}">
11
+ {%- if jekyll.environment == 'production' and site.google_analytics -%}
12
+ <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
13
+ <script>
14
+ window.dataLayer = window.dataLayer || [];
15
+ function gtag(){dataLayer.push(arguments);}
16
+ gtag('js', new Date());
17
+ gtag('config', '{{ site.google_analytics }}');
18
+ </script>
19
+ {%- endif -%}
20
+ </head>
@@ -0,0 +1,19 @@
1
+ <header class="site-header" role="banner">
2
+ <div class="wrapper">
3
+ <a class="site-title" rel="author" href="/">Deva</a>
4
+ <nav class="site-nav">
5
+ <input type="checkbox" id="nav-trigger" class="nav-trigger">
6
+ <label for="nav-trigger">
7
+ <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
+ </span>
12
+ </label>
13
+
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="/about/">About</a>
18
+ </nav></div>
19
+ </header>
package/about.md ADDED
@@ -0,0 +1,99 @@
1
+ ---
2
+ layout: page
3
+ title: About
4
+ permalink: /about/
5
+ description: What Deva Core is, what it does, where it fits, and what a company should know about its design, licensing and maturity before choosing it.
6
+ image: /assets/banner.png
7
+ ---
8
+
9
+ Deva Core is a small, dependency-free Node.js framework for building software agents ("Devas") that work as a team on a shared event bus, describe everything they do in plain named steps, and stamp every packet of data they produce so it can be verified later.
10
+
11
+ It is written and maintained by Quinn Arjuna America Michaels, and it has been in development for more than ten years. It is the base that the other Deva modules build on.
12
+
13
+ ## 1. What Deva Core is
14
+
15
+ - **A framework for agents.** Each agent is one `Deva` instance. You give it an identity, some methods, and the listeners it should react to.
16
+ - **An event bus.** Every Deva announces what it is doing as an event. Other Devas, loggers, dashboards and tests can listen to those events without the Deva knowing about them.
17
+ - **A named workflow.** While it works, a Deva moves through named features, zones, actions, states, intents, beliefs and contexts. Each step is recorded as data you can read back, so you can see what happened and why.
18
+ - **A record you can verify.** Every packet it builds is stamped with three cumulative hashes (md5, sha256 and sha512), so you can check later that the data has not changed since it was stamped.
19
+
20
+ ## 2. What it does
21
+
22
+ | Capability | What it means for you |
23
+ |---|---|
24
+ | **Agent lifecycle** | Every Deva starts, enters, runs, finishes and shuts down through the same steps, and you can hook any step with your own code. |
25
+ | **Messaging between Devas** | Devas ask each other questions and get answers back. Asks have a timeout, so a Deva that never answers does not hang the caller. |
26
+ | **Workflow records** | Features, zones, actions, states, intents, beliefs and contexts are first-class data you can list, read and stamp. |
27
+ | **Stamped packets** | Three hash tiers, md5, sha256 and sha512, built on each other in order, on every packet. |
28
+ | **Client policy** | A client object carries the policies and concerns for the work (license, security, data, reporting, and others). Each Deva stores the part that applies to it. |
29
+ | **Child Devas** | A Deva can host other Devas, start them, and pass its context down to them. |
30
+ | **Your own code** | Methods, listeners, utilities and extra workflow names are added through the constructor and merged with the Core's own. |
31
+
32
+ ## 3. How it fits together
33
+
34
+ 1. **Create** a `Deva` with an identity, a client and your own methods.
35
+ 2. **Initialize** it. The Core checks the client's license, loads the client's policies, and brings the Deva online.
36
+ 3. **Work.** Your Deva answers questions, asks other Devas, and emits events as it goes. Each answer is wrapped in a stamped packet.
37
+ 4. **Observe.** Anything that listens to the bus sees every step, in order.
38
+ 5. **Stop** cleanly. Listeners and pending asks are removed and the Deva goes offline.
39
+
40
+ ## 4. Where it can be used
41
+
42
+ These are ideas for where the design fits, not a list of finished products.
43
+
44
+ - **Auditable AI assistants.** A team of agents where every step and every answer is recorded and can be verified afterwards.
45
+ - **Workflow and automation services.** Specialist agents, one for each job (intake, review, reporting), passing work to each other over the bus.
46
+ - **Compliance-minded back offices.** Services that need to show what was decided, when, and with what data, such as document handling, approvals and reporting.
47
+ - **Multi-agent research and analysis.** A coordinator Deva that asks other Devas for parts of an answer and gathers the results.
48
+ - **Monitoring and observability.** Listener-only Devas that watch events from other Devas and raise reports or alerts.
49
+ - **Education and simulation.** Agents with named states, intents and beliefs make behavior easy to inspect and explain.
50
+ - **A base for your own Deva modules.** Build a specialist module on the Core and reuse it across products.
51
+
52
+ ## 5. What a decision maker should know
53
+
54
+ **Technical fit**
55
+
56
+ - **Runtime:** Node.js 22 or later, npm 9.5.1 or later. ES modules only.
57
+ - **Dependencies:** none beyond Node.js itself. The Core's own code makes no network calls, and anything that reaches outside your system is code you add.
58
+ - **Size:** one main class in a single file, plus JSON configuration. It is small enough for a team to read in full.
59
+ - **Built-in helpers:** the Core's `lib` gives your Devas file, operating system and process helpers (including `exec` and `spawn`) and encrypt and decrypt functions. Treat a Deva as trusted code that runs with your process's permissions, and review how you use these helpers.
60
+ - **Integration:** it is a library inside your own process, not a hosted service. You decide how to deploy it, where it logs, and what it connects to.
61
+ - **Package:** [`@indra.ai/deva`](https://www.npmjs.com/package/@indra.ai/deva) on npm, source on [GitHub](https://github.com/indraai/deva).
62
+
63
+ **Integrity and records**
64
+
65
+ - The hash tiers give you a way to check that a packet has not changed since it was stamped. They are integrity checks. The hashes are not encryption and they are not digital signatures, so decide separately how to store and protect the data.
66
+ - Because every step is a named event, you can send the full event stream to your own log, audit or monitoring system.
67
+
68
+ **Licensing**
69
+
70
+ - Deva Core is distributed under the **Vedic License Agreement (VLA)**, owned by Quinn Arjuna America Michaels and distributed through License Deva.
71
+ - Every client must present a VLA that matches the one in the Core. Without it, the Core will not start.
72
+ - The license limits modification, redistribution, derivative works, and official, government or commercial use unless the Owner has verified and authorized it. **A company planning commercial use should contact the Owner first and have the authorization in writing.** Read the full [license](https://github.com/indraai/deva/blob/main/LICENSE.md) before you evaluate the Core.
73
+
74
+ **Maturity and support**
75
+
76
+ - The Core is on the 1.x line, published on npm, with documentation in the [README](/docs/) and a working example.
77
+ - It is maintained by one author. Plan for that in your own support and continuity needs.
78
+ - Today the automated test run checks that the Core starts and runs without errors. A full suite of assertion tests is planned. Ask for the current status before you rely on it for a regulated workload.
79
+
80
+ ## 6. Get started
81
+
82
+ ```bash
83
+ npm install @indra.ai/deva
84
+ ```
85
+
86
+ - [Read the documentation](/docs/), with install, a quick start, the lifecycle and the method reference.
87
+ - [Browse the source and examples](https://github.com/indraai/deva).
88
+ - [Questions and issues](https://github.com/indraai/deva/issues).
89
+ - Licensing and commercial use: quinn@indra.ai.
90
+
91
+ ## 7. Frequently asked questions
92
+
93
+ **Is this an AI model?** No. Deva Core is the framework that agents run on. You can connect any model or service your own code calls.
94
+
95
+ **Does it send my data anywhere?** The Core runs inside your Node.js process and its own code has no network calls. What your Devas connect to is up to the code you write.
96
+
97
+ **Can I use it in a commercial product?** Only with the Owner's verified authorization under the VLA. Contact quinn@indra.ai before you build on it.
98
+
99
+ **Why three hash tiers?** They let public work be verified quickly (md5), by authorities (sha256) and at high security (sha512), and the tiers build on each other so a packet can move between those levels.
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,48 @@
1
+ ---
2
+ layout: page
3
+ title: Core - Actions
4
+ description: What actions are in the Deva Core, when to set one, and the full list of available actions.
5
+ image: /assets/banner.png
6
+ permalink: /core/actions/
7
+ ---
8
+
9
+ {{page.description}}
10
+
11
+ ## What an action is
12
+
13
+ An action says **what the Deva is doing right now**: encrypting, returning data, hashing, talking to a listener. Each time you set one, the Core records it and broadcasts a `devacore:action` event, so you can log it, watch it, or audit it later. If you also set a state (the condition) and an intent (the purpose), you get a complete record of an operation from start to finish.
14
+
15
+ ## How to use it
16
+
17
+ ```js
18
+ this.action(<action>, <emit_value>)
19
+ ```
20
+
21
+ - `<action>` is a key from the list below, such as `'return'` or `'hash'`.
22
+ - `<emit_value>` is optional extra text added to the record. Use it to say what the action applies to, such as an id or a function name.
23
+
24
+ ```js
25
+ this.action('return', `_getFeature:${key}`); // marks that the function is returning
26
+ this.action('hash', `${label}:${algo}:${uid}`); // marks a hashing step
27
+ ```
28
+
29
+ ## What happens when you call it
30
+
31
+ 1. The Core checks that the Deva is active. If it is not, it returns the offline message.
32
+ 2. If the action name is not in the list below, the call is ignored without an error. Check the spelling against the list.
33
+ 3. Otherwise the Core sets the current action and builds a record with a unique id, the action key, the label plus your extra text, the agent, the client, and a timestamp.
34
+ 4. The record is hashed with md5, sha256 and sha512, emitted as `devacore:action`, and returned to you.
35
+
36
+ ## Good habits
37
+
38
+ - Set the action at the start of the work and set `return` just before you return, so the trail shows both ends.
39
+ - Put the function name and an id in the extra text, so entries can be matched to a request.
40
+ - Don't set an action from inside the state functions themselves, since logging an action calls them again.
41
+
42
+ ## Available actions
43
+
44
+ There are {{ site.data.actions.DATA | size }} actions.
45
+
46
+ {% for action in site.data.actions.DATA %}
47
+ - **{{ action[0] }}**: {{ action[1] }}
48
+ {% endfor %}
@@ -0,0 +1,41 @@
1
+ ---
2
+ layout: page
3
+ title: Core - Beliefs
4
+ description: What beliefs are in the Deva Core, how to set one, and the full list of available beliefs.
5
+ image: /assets/banner.png
6
+ permalink: /core/beliefs/
7
+ ---
8
+
9
+ {{page.description}}
10
+
11
+ ## What a belief is
12
+
13
+ A belief records **the outlook a Deva is working under** while it does a piece of work, such as positive, productive, or vedic. Each time you set one, the Core records it and broadcasts a `devacore:belief` event. Actions say what is being done, states say what condition it is in, intents say why, and beliefs say from which frame of reference. Together they give a full record of an operation.
14
+
15
+ ## How to use it
16
+
17
+ ```js
18
+ this.belief(<belief>, <emit_value>)
19
+ ```
20
+
21
+ - `<belief>` is a key from the list below, such as `'vedic'` or `'positive'`.
22
+ - `<emit_value>` is optional extra text added to the record. Use it to say what the belief applies to, such as an id.
23
+
24
+ ```js
25
+ this.belief('vedic', `init:${data.id.uid}`); // the Core sets this during init
26
+ ```
27
+
28
+ ## What happens when you call it
29
+
30
+ 1. The Core checks that the Deva is active. If it is not, it returns the offline message.
31
+ 2. If the belief name is not in the list below, the call is ignored without an error. Check the spelling against the list.
32
+ 3. Otherwise the Core sets the current belief and builds a record with a unique id, the belief key, the label plus your extra text, the agent, the client, and a timestamp.
33
+ 4. The record is hashed with md5, sha256 and sha512, emitted as `devacore:belief`, and returned to you.
34
+
35
+ ## Available beliefs
36
+
37
+ There are {{ site.data.beliefs.DATA | size }} beliefs.
38
+
39
+ {% for belief in site.data.beliefs.DATA %}
40
+ - **{{ belief[0] }}**: {{ belief[1] }}
41
+ {% endfor %}
package/core/events.md ADDED
@@ -0,0 +1,95 @@
1
+ ---
2
+ layout: page
3
+ title: Core - Events
4
+ description: How the Deva Core event bus works, how to listen to Core events from a Deva listener, and the full list of base events.
5
+ image: /assets/banner.png
6
+ permalink: /core/events/
7
+ ---
8
+
9
+ **{{page.description}}**
10
+
11
+ ## The event bus
12
+
13
+ Every Deva has an event bus, `this.events`. It is a standard Node.js `EventEmitter`, unless you pass your own in through the `events` option. A Deva passes its bus down to the Devas inside it, so a parent and its children share one bus and can hear each other.
14
+
15
+ Everything the Core does is announced on that bus. The base events all start with `devacore:`, and they fall into three groups.
16
+
17
+ **Lifecycle events** announce a step the Deva has completed. They fire in order as the Deva starts and stops:
18
+
19
+ - Start up: `devacore:start`, `devacore:enter`, `devacore:done`, `devacore:ready`
20
+ - Shut down: `devacore:stop`, `devacore:close`, `devacore:leave`, `devacore:exit`, `devacore:shutdown`
21
+ - Questions: `devacore:finish` and `devacore:complete` close out a question the Deva has asked another Deva.
22
+
23
+ **Record events** announce each time the Deva sets a value in the workflow system: `devacore:feature`, `devacore:zone`, `devacore:action`, `devacore:state`, `devacore:intent`, `devacore:belief` and `devacore:context`. One call such as `this.action('return', id)` fires `devacore:action` with a hashed record of that call.
24
+
25
+ **Conversation events** announce questions and answers: `devacore:question`, `devacore:answer` and `devacore:ask`.
26
+
27
+ ## Listening to Core events
28
+
29
+ Use `this.listen(event, callback)`. The callback receives the event's data packet.
30
+
31
+ ```js
32
+ this.listen('devacore:ready', packet => {
33
+ console.log('This Deva is ready', packet.id.uid);
34
+ });
35
+
36
+ this.listen('devacore:action', packet => {
37
+ console.log(packet.text); // for example "🤿 Return _getFeature:license"
38
+ });
39
+ ```
40
+
41
+ The simplest way to register listeners is in the `listeners` option when you create the Deva. The Core binds them and registers them on the bus during `init()`:
42
+
43
+ ```js
44
+ const deva = new Deva({
45
+ // ...
46
+ listeners: {
47
+ 'devacore:ready': packet => { /* ... */ },
48
+ 'devacore:error': packet => { /* ... */ },
49
+ },
50
+ });
51
+ ```
52
+
53
+ Three related calls manage listeners at any time:
54
+
55
+ - `this.listen(evt, callback)` adds a listener.
56
+ - `this.once(evt, callback)` adds a listener that runs one time, then removes itself.
57
+ - `this.ignore(evt, callback)` removes a listener. Pass the same function you registered.
58
+
59
+ Each of these records its own action and intent, so listening is part of the audit trail like everything else.
60
+
61
+ ## What an event packet contains
62
+
63
+ Record events (`feature`, `zone`, `action`, `state`, `intent`, `belief`) carry:
64
+
65
+ | Field | Meaning |
66
+ | --- | --- |
67
+ | `id` | A unique id for this event. |
68
+ | `key` | Which kind of record it is, such as `action`. |
69
+ | `value` | The value that was set, such as `return`. |
70
+ | `text` | The label for the value, plus any extra text passed in. |
71
+ | `agent` and `client` | Who the Deva is and who it is working for. |
72
+ | `created` | The time it happened, in milliseconds. |
73
+ | `md5`, `sha256`, `sha512` | The three hash tiers of the record. |
74
+
75
+ Lifecycle events carry the Deva's data packet for that step, with its own `id` and the same hash tiers.
76
+
77
+ Listeners receive a copy of the data, so changing the packet in your callback does not change the Core's own record.
78
+
79
+ ## Per-Deva listeners and questions
80
+
81
+ Besides the shared `devacore:` events, each Deva automatically listens on events named for its own key. For every state name that matches one of its functions, the Core registers `<agent key>:<state>`, so a Deva with an `ask` function hears `<key>:ask`.
82
+
83
+ This is how Devas talk to each other. When one Deva asks another a question that starts with `#`, it announces it on the bus, then waits once on `<key>:ask:<packet id>` for the answer. The other Deva runs the matching method and replies on that exact event. If nothing replies before the ask timeout (30 seconds by default), the question ends with an ask timeout message.
84
+
85
+ ## Cleaning up
86
+
87
+ When a Deva shuts down, the Core removes its listeners and any pending questions from the bus, so a stopped Deva leaves nothing behind on a shared bus.
88
+
89
+ ## Base events
90
+
91
+ There are {{ site.data.events.DATA | size }} base events.
92
+
93
+ {% for event in site.data.events.DATA %}
94
+ - **{{ event[0] }}**: `{{ event[1] }}`
95
+ {% endfor %}