@indra.ai/deva.report 0.24.4 β 0.24.6
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 +186 -3
- package/package.json +7 -9
package/README.md
CHANGED
|
@@ -1,7 +1,190 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# Report Deva
|
|
2
|
+
|
|
3
|
+
Report Deva is the chain-of-custody reporting agent for Indra.ai and Deva.world. Its agent key is `report`. It writes report packets into a MongoDB `reports` collection. Commands talk to it directly with `/write` or, from another Deva, with `#report write`.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js with npm. Report Deva's `package.json` sets no `engines`. Deva Core 1.67.26 declares `"node": ">=22"` and `"npm": ">=9.5.1"` in its own `package.json`.
|
|
8
|
+
- A project with `"type": "module"` in its `package.json`. Report Deva is an ES module.
|
|
9
|
+
- `@indra.ai/deva` `^1.67.26` (Deva Core) and `mongodb` `^6.1.0`. Both install with Report Deva.
|
|
10
|
+
- A MongoDB server if you want reports saved. A local `mongod` at `mongodb://127.0.0.1:27017` is enough.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @indra.ai/deva.report --save
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import ReportDeva from '@indra.ai/deva.report';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Two licenses
|
|
23
|
+
|
|
24
|
+
A running Deva carries two separate licenses, and each is checked on its own.
|
|
25
|
+
|
|
26
|
+
- **The core license** comes through the client data as `client.VLA`. Deva Core checks it against the core package's VLA at the start of `init`.
|
|
27
|
+
- **The agent license** comes through the license feature data as `features.license.devas.report`. Deva Core 1.67.26 checks it against the VLA in Report Deva's own `package.json` right after the features load and before `onInit`. Report Deva has no `onInit` of its own, so it has no license check of its own to change or remove.
|
|
28
|
+
|
|
29
|
+
The agent check compares the sha256 of the whole VLA object, so every field has to match exactly.
|
|
30
|
+
|
|
31
|
+
## Configuration
|
|
32
|
+
|
|
33
|
+
Report Deva reads two features from the client you pass to `init()`. The feature data loader puts them in the client, and Deva Core loads them into the Deva at startup, so both must be there before `init()` runs.
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
"features": {
|
|
37
|
+
"license": {
|
|
38
|
+
"concerns": [],
|
|
39
|
+
"global": [],
|
|
40
|
+
"devas": {
|
|
41
|
+
"report": {"uid": "28986758608512849090"}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"report": {
|
|
45
|
+
"concerns": [],
|
|
46
|
+
"global": {
|
|
47
|
+
"mongo": {
|
|
48
|
+
"uri": "mongodb://127.0.0.1:27017",
|
|
49
|
+
"database": "ReportDeva"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"devas": {
|
|
53
|
+
"report": {
|
|
54
|
+
"mongo": {
|
|
55
|
+
"uri": "mongodb://127.0.0.1:27017",
|
|
56
|
+
"database": "ReportDeva"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- `license.devas.report` is the agent VLA. The short form above only shows where it goes. It must be the full `VLA` object from this package's `package.json`, for example:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import pkg from '@indra.ai/deva.report/package.json' with {type:'json'};
|
|
68
|
+
|
|
69
|
+
const devas = {report: pkg.VLA}; // goes in features.license.devas
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- `report.global.mongo.uri` is the MongoDB connection string. If it is not set, Report Deva still comes online but builds no MongoDB client, and `write` rejects.
|
|
73
|
+
- `report.global.mongo.database` is the database name. `onReady` stores it in `this.vars.database`. `write` inserts into the `reports` collection in that database.
|
|
74
|
+
- The tests also set `report.devas.report` with the same `{uri, database}` shape. That is the personal record for this agent (`agent.key` is `report`). Deva Core exposes it as `this.report().personal`. `onReady` and `write` read only `this.report().global?.mongo`. They do not use the personal record.
|
|
75
|
+
|
|
76
|
+
## Load it
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
import ReportDeva from '@indra.ai/deva.report';
|
|
80
|
+
|
|
81
|
+
const report = await ReportDeva.init(client); // client data provided by your loader
|
|
82
|
+
console.log(report.id.uid);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
When the license checks pass, Report Deva walks start, enter, done and ready. In `onReady` it reads `this.report().global?.mongo`, builds a `MongoClient` in `this.modules.client` when `uri` is set, keeps `database` in `this.vars.database`, and prompts `π Report Deva Ready > VLA:28986758608512849090`.
|
|
86
|
+
|
|
87
|
+
To shut it down:
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
await ReportDeva.stop();
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`onStop` closes the MongoDB client, if there is one, then calls `this.close(data, resolve)`. If there is no client, it calls `this.close(data, resolve)` directly. A stopped Deva can start again. Call `init()` again with a client that passes the license check. Report Deva builds a new MongoDB client in `onReady`.
|
|
94
|
+
|
|
95
|
+
## When Report Deva refuses to start
|
|
96
|
+
|
|
97
|
+
If the agent license check fails, Deva Core prompts the message, stops the Deva, and `init()` resolves with that message.
|
|
98
|
+
|
|
99
|
+
| You see | Why |
|
|
100
|
+
| --- | --- |
|
|
101
|
+
| `β Bad Personal VLA` | `features.license.devas` is there but has no `report` entry. |
|
|
102
|
+
| `β Invalid VLA Check` | The `report` entry doesn't match this package's VLA, or the license feature has no `devas`. |
|
|
103
|
+
|
|
104
|
+
## Commands
|
|
105
|
+
|
|
106
|
+
Talk to Report Deva with `/write` when it is the current agent, or with `#report write` from another Deva.
|
|
107
|
+
|
|
108
|
+
| Command | What it does |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| `/write` | Inserts the command packet into the `reports` collection of `this.vars.database`. It returns `{text: 'see data', html: '<p>see data</p>', data}`, where `data` is the MongoDB `insertOne` result (`acknowledged` and `insertedId`). |
|
|
111
|
+
|
|
112
|
+
`methods.write(packet)` is the method behind that command. It always calls `func.write('reports', packet)` and returns that same `{text, html, data}` object. The packet is stored as it was passed in. If there is no MongoDB client, or the insert fails, `methods.write` catches the error and returns `this.err(err, packet)`, which goes through `onError`. The write rejects. It does not hang, and it does not resolve with empty data.
|
|
113
|
+
|
|
114
|
+
## Functions
|
|
115
|
+
|
|
116
|
+
| Func | What it does |
|
|
117
|
+
| --- | --- |
|
|
118
|
+
| `write` | Inserts `packet` into collection `type` in `this.vars.database`, using the one `MongoClient` in `this.modules.client`. It returns the `insertOne` result. `methods.write` always calls it with `type` set to `reports`. There is no try/catch in `func.write`; a missing client or a failed insert throws, and `methods.write` handles it. |
|
|
119
|
+
|
|
120
|
+
## Feature methods
|
|
121
|
+
|
|
122
|
+
`feature/methods.js` exports a `report(packet)` method. The feature loader binds it at runtime from `client.features.report.methods` onto the Deva's `methods`. In 0.24.4 the method returns `{}`.
|
|
123
|
+
|
|
124
|
+
## Help
|
|
125
|
+
|
|
126
|
+
Help lives in two Feecting files. `help/main.feecting` is the main help page, with the heading `{{profile.name}}`, and it also holds the license block. `help/corpus.feecting` is the help corpus. The tests check that the main heading is there and that the license page carries this package's VLA uid and hash tiers.
|
|
127
|
+
|
|
128
|
+
## Inside Report Deva
|
|
129
|
+
|
|
130
|
+
| Name | Kind | What it does |
|
|
131
|
+
| --- | --- | --- |
|
|
132
|
+
| `write` | func | Inserts a packet into a named collection, as described above. It lives in `index.js`. |
|
|
133
|
+
| `write` | method | The `/write` command, also in `index.js`. |
|
|
134
|
+
| `translate`, `parse`, `process` | utils | Each returns its input trimmed. |
|
|
135
|
+
| `onReady` | lifecycle | Builds the MongoDB client from the report feature's `global.mongo` and prompts the ready message. |
|
|
136
|
+
| `onStop` | lifecycle | Closes the MongoDB client, if there is one, then calls `this.close(data, resolve)`. |
|
|
137
|
+
| `onError` | lifecycle | Prompts `π£ ERROR!`, logs the error, and returns `reject(err)` or `Promise.reject(err)`. |
|
|
138
|
+
| `modules.client` | module | The `MongoClient`, set in `onReady` when a `uri` is given. |
|
|
139
|
+
|
|
140
|
+
The `vars` in `package.json` hold the prompt `messages`. `this.vars.database` is set in `onReady` from `global.mongo.database`.
|
|
141
|
+
|
|
142
|
+
## Testing
|
|
143
|
+
|
|
144
|
+
Start a local MongoDB, then run:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
node --test
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The package.json `test` script is `node --test`, so `npm test` runs the same file. The tests use `mongodb://127.0.0.1:27017` by default. To use another server, set `MONGO_URI`:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
MONGO_URI="mongodb://127.0.0.1:27018" node --test
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The tests always write to their own database, `deva_report_test`, and drop it when they finish. Only the server can change, so the cleanup never touches another database. If MongoDB can't be reached, the MongoDB tests are skipped with a message and the rest still run, including the check that `write` rejects when no MongoDB client is built.
|
|
157
|
+
|
|
158
|
+
The tests build a stub client in code from the core VLA in `@indra.ai/deva/package.json` and the VLA in this package's `package.json`, so no client file is needed. They cover:
|
|
159
|
+
|
|
160
|
+
- report builds as a Deva and waits offline before init
|
|
161
|
+
- report data has no placeholders left
|
|
162
|
+
- `methods.write`, `func.write`, `onReady`, `onStop`, and `onError` exist
|
|
163
|
+
- report comes online and walks to ready
|
|
164
|
+
- report agent matches the package
|
|
165
|
+
- report utils answer with trimmed text
|
|
166
|
+
- report help pages name the Deva and carry the package license
|
|
167
|
+
- feature methods from `feature/methods.js` load at runtime
|
|
168
|
+
- `write` inserts a document into the `reports` collection (MongoDB)
|
|
169
|
+
- `write` rejects when no MongoDB client is built
|
|
170
|
+
- a stop and `init` restart builds a new MongoClient and can write again (MongoDB)
|
|
171
|
+
- report stops through the full chain
|
|
172
|
+
- report refuses to start with a bad agent VLA
|
|
173
|
+
|
|
174
|
+
## Files
|
|
175
|
+
|
|
176
|
+
| File | What it holds |
|
|
177
|
+
| --- | --- |
|
|
178
|
+
| `index.js` | The Report Deva: utils, `func.write`, `methods.write`, and the lifecycle hooks. |
|
|
179
|
+
| `package.json` | Package info, the package VLA, and the agent and vars data under `data`. |
|
|
180
|
+
| `feature/methods.js` | The `report(packet)` feature method that the feature loader binds at runtime. |
|
|
181
|
+
| `help/main.feecting` | The main help page and the license block. |
|
|
182
|
+
| `help/corpus.feecting` | The help corpus. |
|
|
183
|
+
| `index.test.js` | The tests. |
|
|
184
|
+
| `assets/` | The emoji, avatar, background and main images. |
|
|
185
|
+
| `LICENSE.md` | The license. |
|
|
3
186
|
|
|
4
187
|
Copyright Β©2000-2026 Quinn Michaels; All rights reserved.
|
|
5
188
|
Owner Signature Required For Lawful Use.
|
|
6
189
|
Distributed under VLA:28986758608512849090 LICENSE.md
|
|
7
|
-
Tuesday, November 24, 2026 - 11:57:52 AM PST
|
|
190
|
+
Tuesday, November 24, 2026 - 11:57:52 AM PST
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "28986758608512849090",
|
|
3
3
|
"name": "@indra.ai/deva.report",
|
|
4
|
-
"version": "0.24.
|
|
4
|
+
"version": "0.24.6",
|
|
5
5
|
"license": "VLA:28986758608512849090 LICENSE.md",
|
|
6
6
|
"VLA": {
|
|
7
7
|
"uid": "28986758608512849090",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
}
|
|
45
45
|
],
|
|
46
46
|
"copyright": "Copyright Β©2000-2026 Quinn Michaels; All rights reserved.",
|
|
47
|
-
"description": "The Report Deva is the manager of legal lawful chain of custody reporting in Indra.ai
|
|
47
|
+
"description": "The Report Deva is the manager of legal lawful chain of custody reporting in Indra.ai and Deva.world.",
|
|
48
48
|
"homepage": "https://github.com/indraai/deva.report#readme",
|
|
49
49
|
"main": "index.js",
|
|
50
50
|
"type": "module",
|
|
51
51
|
"scripts": {
|
|
52
|
-
"latest": "npm i @indra.ai/deva@latest --save",
|
|
52
|
+
"latest": "npm i @indra.ai/deva@latest mongodb@latest --save",
|
|
53
53
|
"test": "node --test"
|
|
54
54
|
},
|
|
55
55
|
"repository": {
|
|
@@ -61,8 +61,6 @@
|
|
|
61
61
|
"Deva",
|
|
62
62
|
"Report Deva",
|
|
63
63
|
"Indra.ai",
|
|
64
|
-
"Deva.space",
|
|
65
|
-
"Deva.cloud",
|
|
66
64
|
"Deva.world",
|
|
67
65
|
"Quinn Michaels",
|
|
68
66
|
"Quinn A Michaels",
|
|
@@ -75,7 +73,7 @@
|
|
|
75
73
|
},
|
|
76
74
|
"dependencies": {
|
|
77
75
|
"@indra.ai/deva": "^1.67.26",
|
|
78
|
-
"mongodb": "^
|
|
76
|
+
"mongodb": "^7.9.1"
|
|
79
77
|
},
|
|
80
78
|
"data": {
|
|
81
79
|
"agent": {
|
|
@@ -104,7 +102,7 @@
|
|
|
104
102
|
"title": "Report Deva",
|
|
105
103
|
"subtitle": "Report manage in Deva.world",
|
|
106
104
|
"describe": "Report Deva manages the Reports.",
|
|
107
|
-
"tweet": "Report Deva manages the Reports in Indra.ai
|
|
105
|
+
"tweet": "Report Deva manages the Reports in Indra.ai and Deva.world.",
|
|
108
106
|
"vectors": "#Quinn #QuinnMichaels #InsideTheNet #IndraAI #DEVA #DevaWorld #ReportDeva #RigVeda #VedicLaw #Merit #Demerit",
|
|
109
107
|
"pronouns": "He, Him, His",
|
|
110
108
|
"gender": "DEVA",
|
|
@@ -115,9 +113,9 @@
|
|
|
115
113
|
"color": "rgb(252,183,84)",
|
|
116
114
|
"bgcolor": "rgb(0,0,0)",
|
|
117
115
|
"emoji": "/devas/report/emoji.png",
|
|
118
|
-
"avatar": "/devas/report/avatar.
|
|
116
|
+
"avatar": "/devas/report/avatar.jpg",
|
|
119
117
|
"image": "/devas/report/image.png",
|
|
120
|
-
"background": "/devas/report/background.
|
|
118
|
+
"background": "/devas/report/background.jpg",
|
|
121
119
|
"owner": "Quinn Michaels",
|
|
122
120
|
"creator": "Quinn Michaels",
|
|
123
121
|
"salute": "π€π«‘πποΈπΊπΈ",
|