@indra.ai/deva 1.64.108 → 1.65.21
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/buddy.json +114 -0
- package/_data/index.js +2 -0
- package/buddy/index.js +226 -0
- package/buddy/template/assets/avatar.png +0 -0
- package/buddy/template/assets/background.png +0 -0
- package/buddy/template/assets/emoji.png +0 -0
- package/buddy/template/assets/image.png +0 -0
- package/buddy/template/data/client.json +27 -0
- package/buddy/template/data/index.json +69 -0
- package/buddy/template/help/corpus.feecting +13 -0
- package/buddy/template/help/main.feecting +25 -0
- package/buddy/template/index.js +52 -0
- package/buddy/template/index.test.js +57 -0
- package/devas/index.js +14 -0
- package/devas/test/assets/avatar.png +0 -0
- package/devas/test/assets/background.png +0 -0
- package/devas/test/assets/emoji.png +0 -0
- package/devas/test/assets/image.png +0 -0
- package/devas/test/data/index.json +68 -0
- package/devas/test/help/corpus.feecting +13 -0
- package/devas/test/help/main.feecting +25 -0
- package/devas/test/index.js +58 -0
- package/devas/test/index.test.js +5 -0
- package/index.js +2 -0
- package/package.json +10 -2
package/_data/buddy.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": 41314822285864353682,
|
|
3
|
+
"name": "Deva Buddy Data File",
|
|
4
|
+
"describe": "The main Data Buddy Data file for building New Devas",
|
|
5
|
+
"copyright": "Copyright ©2000-2026 Quinn Michaels. All rights reserved.",
|
|
6
|
+
"DATA": {
|
|
7
|
+
"agent": {
|
|
8
|
+
"id": 6047734400443,
|
|
9
|
+
"key": "buddy",
|
|
10
|
+
"prompt": {
|
|
11
|
+
"emoji": "⊙",
|
|
12
|
+
"text": "buddy",
|
|
13
|
+
"colors": {
|
|
14
|
+
"label": {
|
|
15
|
+
"R": 0,
|
|
16
|
+
"G": 150,
|
|
17
|
+
"B": 255
|
|
18
|
+
},
|
|
19
|
+
"text": {
|
|
20
|
+
"R": 101,
|
|
21
|
+
"G": 192,
|
|
22
|
+
"B": 255
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"voice": {
|
|
27
|
+
"speech": "Alex",
|
|
28
|
+
"speed": 1
|
|
29
|
+
},
|
|
30
|
+
"profile": {
|
|
31
|
+
"name": "Deva Buddy",
|
|
32
|
+
"describe": "Deva Buddy creator.",
|
|
33
|
+
"emoji": "",
|
|
34
|
+
"avatar": "",
|
|
35
|
+
"background": "",
|
|
36
|
+
"gender": "N"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"vars": {
|
|
40
|
+
"options": false,
|
|
41
|
+
"cmd": false,
|
|
42
|
+
"comp": {},
|
|
43
|
+
"template": "deva",
|
|
44
|
+
"paths": {
|
|
45
|
+
"copy_index": "",
|
|
46
|
+
"copy_from": "",
|
|
47
|
+
"copy_to": "",
|
|
48
|
+
"copy_to_base": ""
|
|
49
|
+
},
|
|
50
|
+
"messages": {
|
|
51
|
+
"heading": "👽 DEVA",
|
|
52
|
+
"que_heading": "📁 QUE FILES",
|
|
53
|
+
"success": "Holla!!! A NEW DEVA WAS CREATED",
|
|
54
|
+
"que_complete": "✅ QUE FILES COMPLETE",
|
|
55
|
+
"index_updated": "✅ INDEX UPDATED:",
|
|
56
|
+
"folder": "📁",
|
|
57
|
+
"file": "📝",
|
|
58
|
+
"deva_created": "✅ DEVA CREATED:",
|
|
59
|
+
"incomplete": "🛑 KEY AND NAME ARE REQUIRED. NO DEVA CREATED.",
|
|
60
|
+
"exists": "🛑 A DEVA ALREADY EXISTS HERE. NO DEVA CREATED:"
|
|
61
|
+
},
|
|
62
|
+
"create": {
|
|
63
|
+
"files": [],
|
|
64
|
+
"directories": []
|
|
65
|
+
},
|
|
66
|
+
"items": [],
|
|
67
|
+
"answers": false,
|
|
68
|
+
"questions": [
|
|
69
|
+
{
|
|
70
|
+
"type": "input",
|
|
71
|
+
"name": "key",
|
|
72
|
+
"message": "Key",
|
|
73
|
+
"default": ""
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"type": "input",
|
|
77
|
+
"name": "vector",
|
|
78
|
+
"message": "Vector",
|
|
79
|
+
"default": ""
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"type": "input",
|
|
83
|
+
"name": "name",
|
|
84
|
+
"message": "Name",
|
|
85
|
+
"default": ""
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"type": "input",
|
|
89
|
+
"name": "describe",
|
|
90
|
+
"message": "Describe",
|
|
91
|
+
"default": ""
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"type": "input",
|
|
95
|
+
"name": "pronouns",
|
|
96
|
+
"message": "Pronouns",
|
|
97
|
+
"default": "they/them"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"type": "list",
|
|
101
|
+
"name": "gender",
|
|
102
|
+
"message": "Gender",
|
|
103
|
+
"default": "DEVA"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"type": "input",
|
|
107
|
+
"name": "owner",
|
|
108
|
+
"message": "Owner",
|
|
109
|
+
"default": "Quinn Michaels"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
package/_data/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import states from './states.json' with {type:'json'};
|
|
|
13
13
|
import intents from './intents.json' with {type:'json'};
|
|
14
14
|
import beliefs from './beliefs.json' with {type:'json'};
|
|
15
15
|
import msgs from './msgs.json' with {type:'json'};
|
|
16
|
+
import buddy from './buddy.json' with {type:'json'};
|
|
16
17
|
|
|
17
18
|
export default {
|
|
18
19
|
cmdChr: '/',
|
|
@@ -153,4 +154,5 @@ export default {
|
|
|
153
154
|
belief: 'vedic',
|
|
154
155
|
beliefs: beliefs.DATA,
|
|
155
156
|
messages: msgs.DATA,
|
|
157
|
+
buddy: buddy.DATA,
|
|
156
158
|
}
|
package/buddy/index.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Copyright (c)2025 Quinn Michaels
|
|
5
|
+
// Distributed under the MIT software license, see the accompanying
|
|
6
|
+
// file LICENSE.md or http://www.opensource.org/licenses/mit-license.php.
|
|
7
|
+
import Deva from '../index.js';
|
|
8
|
+
import pkg from '../package.json' with {type: 'json'};
|
|
9
|
+
const {version} = pkg;
|
|
10
|
+
|
|
11
|
+
import Buddy from '../_data/buddy.json' with {type: 'json'};
|
|
12
|
+
const buddy = Buddy.DATA;
|
|
13
|
+
const {agent, vars} = buddy;
|
|
14
|
+
|
|
15
|
+
import Client from '../tests/client.json' with {type: 'json'};
|
|
16
|
+
const client = Client.DATA;
|
|
17
|
+
|
|
18
|
+
import readline from 'node:readline/promises';
|
|
19
|
+
|
|
20
|
+
import process from 'node:process';
|
|
21
|
+
import {dirname} from 'node:path';
|
|
22
|
+
import {fileURLToPath} from 'node:url';
|
|
23
|
+
|
|
24
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
|
|
26
|
+
const flash = `
|
|
27
|
+
::::::::::::::::::::::::::::::::::
|
|
28
|
+
|
|
29
|
+
██████╗ ███████╗██╗ ██╗ █████╗
|
|
30
|
+
██╔══██╗██╔════╝██║ ██║██╔══██╗
|
|
31
|
+
██║ ██║█████╗ ╚██╗ ██╔╝███████║
|
|
32
|
+
██║ ██║██╔══╝ ╚████╔╝ ██╔══██║
|
|
33
|
+
██████╔╝███████╗ ╚██╔╝ ██║ ██║
|
|
34
|
+
╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝
|
|
35
|
+
|
|
36
|
+
::::::::::::::::::::::::::::::::::
|
|
37
|
+
version: ${version}
|
|
38
|
+
::::::::::::::::::::::::::::::::::
|
|
39
|
+
`
|
|
40
|
+
|
|
41
|
+
// Creates a new DEVA Buddy.
|
|
42
|
+
const DevaBuddy = new Deva({
|
|
43
|
+
info: {
|
|
44
|
+
id: pkg.id,
|
|
45
|
+
name: pkg.name,
|
|
46
|
+
version: pkg.version,
|
|
47
|
+
VLA: pkg.VLA,
|
|
48
|
+
},
|
|
49
|
+
agent,
|
|
50
|
+
utils: {
|
|
51
|
+
translate(input) {
|
|
52
|
+
return input.trim();
|
|
53
|
+
},
|
|
54
|
+
parse(input) {
|
|
55
|
+
return input.trim();
|
|
56
|
+
},
|
|
57
|
+
process(input) {
|
|
58
|
+
return input.trim();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
vars,
|
|
62
|
+
devas: {},
|
|
63
|
+
listeners: {
|
|
64
|
+
'devacore:prompt'(packet) {
|
|
65
|
+
console.log(packet.text);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
modules: {},
|
|
69
|
+
func: {
|
|
70
|
+
|
|
71
|
+
baseDevaDirectory() {
|
|
72
|
+
const { copy_to_base } = this.vars.paths;
|
|
73
|
+
const dir_exists = this.lib.fs.existsSync(copy_to_base);
|
|
74
|
+
if (!dir_exists) {
|
|
75
|
+
this.lib.fs.mkdirSync(copy_to_base);
|
|
76
|
+
}
|
|
77
|
+
return dir_exists;
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
queFiles(copy_from, copy_to) {
|
|
81
|
+
const { answers, create } = this.vars;
|
|
82
|
+
this.vars.create.directories.push(copy_to);
|
|
83
|
+
|
|
84
|
+
return new Promise((resolve, reject) => {
|
|
85
|
+
|
|
86
|
+
const items = this.lib.fs.readdirSync(copy_from);
|
|
87
|
+
if (!items) return reject('NO ITEMS');
|
|
88
|
+
|
|
89
|
+
items.forEach(item => {
|
|
90
|
+
const copy_from_file = this.lib.path.resolve(copy_from, item);
|
|
91
|
+
const copy_to_file = this.lib.path.join(copy_to, item);
|
|
92
|
+
|
|
93
|
+
const filestat = this.lib.fs.statSync(copy_from_file);
|
|
94
|
+
|
|
95
|
+
if (filestat.isDirectory()) this.func.queFiles(copy_from_file, copy_to_file);
|
|
96
|
+
|
|
97
|
+
else if (this.lib.path.extname(item) === '.png') {
|
|
98
|
+
this.vars.create.files.push({copy_to_file, content: this.lib.fs.readFileSync(copy_from_file)});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
else {
|
|
102
|
+
const theyear = new Date().getFullYear();
|
|
103
|
+
const content = this.lib.fs.readFileSync(copy_from_file, 'utf8')
|
|
104
|
+
.replace(/::id::/g, this.uid().uid)
|
|
105
|
+
.replace(/::owner::/g, answers.owner)
|
|
106
|
+
.replace(/::key::/g, answers.key)
|
|
107
|
+
.replace(/::year::/g, theyear)
|
|
108
|
+
.replace(/::key-upper::/g, answers.key.toUpperCase())
|
|
109
|
+
.replace(/::name::/g, answers.name)
|
|
110
|
+
.replace(/::describe::/g, answers.describe)
|
|
111
|
+
.replace(/::gender::/g, answers.gender)
|
|
112
|
+
.replace(/::pronouns::/g, answers.pronouns)
|
|
113
|
+
.replace(/::vector::/g, answers.vector)
|
|
114
|
+
.replace(/::vla::/g, this.info().VLA.uid)
|
|
115
|
+
.replace(/::vla-data::/g, JSON.stringify(this.info().VLA))
|
|
116
|
+
.replace(/::date::/g, this.lib.formatDate(Date.now(), 'long', true));
|
|
117
|
+
|
|
118
|
+
// PUSH THE NEWLY CREATED FILE TO THE CREATE FILES ARRAY VARIABLE
|
|
119
|
+
this.vars.create.files.push({copy_to_file, content});
|
|
120
|
+
|
|
121
|
+
return resolve(this.vars.messages.que_complete);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
que() {
|
|
128
|
+
const { copy_from, copy_to } = this.vars.paths;
|
|
129
|
+
if (!copy_from) return console.log('no files to copy from');
|
|
130
|
+
if (!copy_to) return console.log('no files to copy to');
|
|
131
|
+
|
|
132
|
+
// stop when the Deva folder is already there so Buddy never writes over existing work
|
|
133
|
+
if (this.lib.fs.existsSync(copy_to)) return this.prompt(`${this.vars.messages.exists} ${copy_to}`);
|
|
134
|
+
|
|
135
|
+
console.log(this.vars.messages.que_heading);
|
|
136
|
+
console.log(`↪ fr: ${copy_from}`);
|
|
137
|
+
console.log(`↪ to: ${copy_to}`);
|
|
138
|
+
this.func.queFiles(copy_from, copy_to).then(filesQued => {
|
|
139
|
+
this.prompt(filesQued);
|
|
140
|
+
return this.func.createDeva();
|
|
141
|
+
}).then(devaCreated => {
|
|
142
|
+
this.prompt(devaCreated);
|
|
143
|
+
const {key} = this.vars.answers;
|
|
144
|
+
this.prompt(`👉 Add ${key} to your Deva loader: import ${key} from './${key}/index.js';`);
|
|
145
|
+
}).catch(err => {
|
|
146
|
+
console.error('🛑 ERROR', err);
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
createDeva() {
|
|
151
|
+
this.func.baseDevaDirectory();
|
|
152
|
+
const {files,directories} = this.vars.create;
|
|
153
|
+
directories.forEach(dir => {
|
|
154
|
+
console.log(`${this.vars.messages.folder} ${dir}`);
|
|
155
|
+
this.lib.fs.mkdirSync(dir);
|
|
156
|
+
});
|
|
157
|
+
files.forEach(file => {
|
|
158
|
+
this.lib.fs.writeFileSync(file.copy_to_file, file.content)
|
|
159
|
+
console.log(`${this.vars.messages.file} ${file.copy_to_file}`);
|
|
160
|
+
});
|
|
161
|
+
return Promise.resolve(`${this.vars.messages.deva_created} ${this.vars.answers.key} (${this.vars.answers.name}) `);
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
methods: {
|
|
167
|
+
async inquire() {
|
|
168
|
+
// this sets up a custom directory question for the user which is not in the json data
|
|
169
|
+
this.vars.questions.push({ // append directory to questions because of __dirname
|
|
170
|
+
type: 'input', // set the input type
|
|
171
|
+
name: 'directory', // set the name
|
|
172
|
+
message: 'DIRECTORY', // set the MESSAGE
|
|
173
|
+
default: this.lib.path.join(process.cwd(), 'devas'), // set the default path for the question
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// ask each question and keep the default when the answer is blank
|
|
177
|
+
// lines from a pipe wait in the line queue so bots can send all answers at once
|
|
178
|
+
const piped = !process.stdin.isTTY;
|
|
179
|
+
const rl = readline.createInterface({input: process.stdin, output: process.stdout, terminal: !piped});
|
|
180
|
+
const lines = rl[Symbol.asyncIterator]();
|
|
181
|
+
const answers = {};
|
|
182
|
+
for (const question of this.vars.questions) {
|
|
183
|
+
const def = question.default ? ` (${question.default})` : '';
|
|
184
|
+
process.stdout.write(`${question.message}${def}: `);
|
|
185
|
+
const {value, done} = await lines.next();
|
|
186
|
+
const answer = done ? '' : value;
|
|
187
|
+
if (piped) process.stdout.write(`${answer}\n`);
|
|
188
|
+
answers[question.name] = answer.trim() || question.default || '';
|
|
189
|
+
}
|
|
190
|
+
rl.close();
|
|
191
|
+
// stop when the key or name is missing so incomplete pipes do not build a Deva
|
|
192
|
+
if (!answers.key || !answers.name) return this.prompt(this.vars.messages.incomplete);
|
|
193
|
+
|
|
194
|
+
// set the options variable to load what the BUDDY was configured with.
|
|
195
|
+
this.vars.paths = {
|
|
196
|
+
copy_from: this.lib.path.join(__dirname, 'template'),
|
|
197
|
+
copy_to: this.lib.path.join(answers.directory, answers.key),
|
|
198
|
+
copy_to_base: answers.directory,
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
this.prompt('::::::::::::::::::::::::::::');
|
|
202
|
+
this.prompt(this.vars.messages.heading);
|
|
203
|
+
|
|
204
|
+
for (let answer in answers) {
|
|
205
|
+
this.prompt(`↪ ${answer.toUpperCase()}: ${answers[answer]}`);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
this.prompt('::::::::::::::::::::::::::::');
|
|
209
|
+
|
|
210
|
+
// now this is where we take the
|
|
211
|
+
this.vars.answers = answers;
|
|
212
|
+
return this.func.que();
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
onInit(data, resolve) {
|
|
216
|
+
this.prompt(flash);
|
|
217
|
+
return this.start(data, resolve);
|
|
218
|
+
},
|
|
219
|
+
onReady(data, resolve) {
|
|
220
|
+
this.prompt(this._messages.ready);
|
|
221
|
+
this.methods.inquire(); // when buddy inits then run the inquire method.
|
|
222
|
+
return resolve(data);
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
DevaBuddy.init(client);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "::name:: Client File",
|
|
3
|
+
"describe": "Stub client for testing ::name::. Replace with your own client file and add it to .gitignore.",
|
|
4
|
+
"copyright": "Copyright ©::year:: ::owner::. All rights reserved.",
|
|
5
|
+
"DATA": {
|
|
6
|
+
"id": "::id::",
|
|
7
|
+
"key": "client",
|
|
8
|
+
"VLA": ::vla-data::,
|
|
9
|
+
"prompt": {
|
|
10
|
+
"emoji": "🧪",
|
|
11
|
+
"text": "client",
|
|
12
|
+
"colors": {
|
|
13
|
+
"label": {"R": 2, "G": 229, "B": 77},
|
|
14
|
+
"text": {"R": 2, "G": 229, "B": 77}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"profile": {
|
|
18
|
+
"id": "::id::",
|
|
19
|
+
"name": "::owner::",
|
|
20
|
+
"describe": "Test client for ::name::",
|
|
21
|
+
"lang": "en",
|
|
22
|
+
"locale": "en-US",
|
|
23
|
+
"currency": "USD"
|
|
24
|
+
},
|
|
25
|
+
"features": {}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "::name:: Data File",
|
|
3
|
+
"describe": "The main Data file for ::name::",
|
|
4
|
+
"copyright": "Copyright ©::year:: ::owner::. All rights reserved.",
|
|
5
|
+
"DATA": {
|
|
6
|
+
"agent": {
|
|
7
|
+
"id": "::id::",
|
|
8
|
+
"key": "::key::",
|
|
9
|
+
"prompt": {
|
|
10
|
+
"emoji": "⊙",
|
|
11
|
+
"text": "::key::",
|
|
12
|
+
"colors": {
|
|
13
|
+
"label": {
|
|
14
|
+
"R": 0,
|
|
15
|
+
"G": 150,
|
|
16
|
+
"B": 255
|
|
17
|
+
},
|
|
18
|
+
"text": {
|
|
19
|
+
"R": 101,
|
|
20
|
+
"G": 192,
|
|
21
|
+
"B": 255
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"profile": {
|
|
26
|
+
"id": "::id::",
|
|
27
|
+
"name": "::name::",
|
|
28
|
+
"title": "",
|
|
29
|
+
"subtitle": "",
|
|
30
|
+
"describe": "::describe::",
|
|
31
|
+
"vector": "::vector::",
|
|
32
|
+
"vectors": "",
|
|
33
|
+
"pronouns": "::pronouns::",
|
|
34
|
+
"gender": "::gender::",
|
|
35
|
+
"style": "",
|
|
36
|
+
"voice": "alloy",
|
|
37
|
+
"system": "Deva.world",
|
|
38
|
+
"layout": "default",
|
|
39
|
+
"tweet": "",
|
|
40
|
+
"color": "#000000",
|
|
41
|
+
"bgcolor": "#ffffff",
|
|
42
|
+
"emoji": "/assets/emoji.png",
|
|
43
|
+
"avatar": "/assets/avatar.png",
|
|
44
|
+
"image": "/assets/image.png",
|
|
45
|
+
"background": "/assets/background.png",
|
|
46
|
+
"owner": "::owner::",
|
|
47
|
+
"creator": "::owner::",
|
|
48
|
+
"created": "::date::"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"vars": {
|
|
52
|
+
"messages": {
|
|
53
|
+
"init": "🟠 INIT",
|
|
54
|
+
"start": "🔵 START",
|
|
55
|
+
"enter": "🟢 ENTER",
|
|
56
|
+
"stop": "🔴 STOP",
|
|
57
|
+
"exit": "🟡 EXIT",
|
|
58
|
+
"done": "🟣 DONE",
|
|
59
|
+
"error": "💣 ERROR!",
|
|
60
|
+
"ready": "⭐️ READY!"
|
|
61
|
+
},
|
|
62
|
+
"context": {
|
|
63
|
+
"uid": "::name:: is creating a uid",
|
|
64
|
+
"status": "::name:: is viewing the status",
|
|
65
|
+
"help": "::name:: is viewing the help"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// ::name:: Corpus
|
|
2
|
+
// Copyright ©::year:: ::owner::; All rights reserved.
|
|
3
|
+
// Owner Signature Required For Lawful Use.
|
|
4
|
+
// Distributed under VLA:::vla:: LICENSE.md
|
|
5
|
+
// ::date::
|
|
6
|
+
|
|
7
|
+
::BEGIN:MAIN
|
|
8
|
+
# {{profile.name}}
|
|
9
|
+
|
|
10
|
+
p: {{profile.describe}}
|
|
11
|
+
|
|
12
|
+
copyright: {{profile.copyright}}
|
|
13
|
+
::END:MAIN
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// ::name:: Help
|
|
2
|
+
// Copyright ©::year:: ::owner::; All rights reserved.
|
|
3
|
+
// Owner Signature Required For Lawful Use.
|
|
4
|
+
// Distributed under VLA:::vla:: LICENSE.md
|
|
5
|
+
// ::date::
|
|
6
|
+
|
|
7
|
+
::BEGIN:MAIN
|
|
8
|
+
# {{profile.name}}
|
|
9
|
+
|
|
10
|
+
img: {{profile.image}}
|
|
11
|
+
|
|
12
|
+
{{profile}}
|
|
13
|
+
|
|
14
|
+
talk: #::key:: help main:license
|
|
15
|
+
|
|
16
|
+
::begin:hidden
|
|
17
|
+
#color = {{profile.color}}
|
|
18
|
+
#bgcolor = {{profile.bgcolor}}
|
|
19
|
+
#bg = {{profile.background}}
|
|
20
|
+
copyright: {{profile.copyright}}
|
|
21
|
+
::end:hidden
|
|
22
|
+
::END:MAIN
|
|
23
|
+
|
|
24
|
+
::BEGIN:LICENSE
|
|
25
|
+
::END:LICENSE
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// ::name::
|
|
2
|
+
// Copyright ©::year:: ::owner::; All rights reserved.
|
|
3
|
+
// Owner Signature Required For Lawful Use.
|
|
4
|
+
// Distributed under VLA:::vla:: LICENSE.md
|
|
5
|
+
// ::date::
|
|
6
|
+
|
|
7
|
+
import Deva from '@indra.ai/deva';
|
|
8
|
+
// make sure to correct for package location to match
|
|
9
|
+
import pkg from '../../package.json' with {type:'json'};
|
|
10
|
+
|
|
11
|
+
import data from './data/index.json' with {type:'json'};
|
|
12
|
+
const {agent,vars} = data.DATA;
|
|
13
|
+
|
|
14
|
+
// set the __dirname
|
|
15
|
+
import {dirname} from 'node:path';
|
|
16
|
+
import {fileURLToPath} from 'node:url';
|
|
17
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
|
|
19
|
+
const info = {
|
|
20
|
+
id: pkg.id,
|
|
21
|
+
name: pkg.name,
|
|
22
|
+
version: pkg.version,
|
|
23
|
+
author: pkg.author,
|
|
24
|
+
dir: __dirname,
|
|
25
|
+
VLA: pkg.VLA,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const ::key-upper:: = new Deva({
|
|
29
|
+
info,
|
|
30
|
+
agent,
|
|
31
|
+
vars,
|
|
32
|
+
utils: {
|
|
33
|
+
translate(input) {return input.trim();},
|
|
34
|
+
parse(input) {return input.trim();},
|
|
35
|
+
process(input) {return input.trim();},
|
|
36
|
+
},
|
|
37
|
+
listeners: {},
|
|
38
|
+
modules: {},
|
|
39
|
+
devas: {},
|
|
40
|
+
func: {},
|
|
41
|
+
methods: {},
|
|
42
|
+
onReady(data, resolve) {
|
|
43
|
+
this.prompt(this.vars.messages.ready);
|
|
44
|
+
return resolve(data);
|
|
45
|
+
},
|
|
46
|
+
onError(data, err, reject) {
|
|
47
|
+
this.prompt(this.vars.messages.error);
|
|
48
|
+
console.log(err);
|
|
49
|
+
return reject(err);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
export default ::key-upper::
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// ::name:: Test File
|
|
2
|
+
// Copyright ©::year:: ::owner::; All rights reserved.
|
|
3
|
+
// Owner Signature Required For Lawful Use.
|
|
4
|
+
// Distributed under VLA:::vla:: LICENSE.md
|
|
5
|
+
// ::date::
|
|
6
|
+
|
|
7
|
+
// run these right after Deva Buddy builds ::name:: to make sure it is clean before you start building
|
|
8
|
+
import test from 'node:test';
|
|
9
|
+
import assert from 'node:assert/strict';
|
|
10
|
+
import Deva from '@indra.ai/deva';
|
|
11
|
+
import ::key-upper:: from './index.js';
|
|
12
|
+
import Client from './data/client.json' with {type:'json'};
|
|
13
|
+
import Data from './data/index.json' with {type:'json'};
|
|
14
|
+
|
|
15
|
+
const STAGES = ['start', 'enter', 'done', 'ready'];
|
|
16
|
+
const TIERS = ['md5', 'sha256', 'sha512'];
|
|
17
|
+
const PLACEHOLDER = /::[a-z-]+::/;
|
|
18
|
+
const client = () => structuredClone(Client.DATA);
|
|
19
|
+
|
|
20
|
+
test('::key:: builds as a Deva and waits offline before init', async () => {
|
|
21
|
+
assert.ok(::key-upper:: instanceof Deva, 'the export is a Deva');
|
|
22
|
+
assert.equal(await ::key-upper::.stop(), ::key-upper::._messages.offline, 'stop before init answers offline');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('::key:: data has no placeholders left from the build', () => {
|
|
26
|
+
assert.doesNotMatch(JSON.stringify(Data), PLACEHOLDER, 'data/index.json');
|
|
27
|
+
assert.doesNotMatch(JSON.stringify(Client), PLACEHOLDER, 'data/client.json');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('::key:: comes online and walks to ready', async () => {
|
|
31
|
+
const prompts = [];
|
|
32
|
+
::key-upper::.listen('devacore:prompt', packet => prompts.push(packet.text));
|
|
33
|
+
const data = await ::key-upper::.init(client());
|
|
34
|
+
for (const k of STAGES) assert.equal(typeof data[k], 'number', `${k} timestamp`);
|
|
35
|
+
assert.ok(data.start <= data.enter && data.enter <= data.done && data.done <= data.ready, 'stages in order');
|
|
36
|
+
assert.equal(typeof data.id.uid, 'string', 'uid');
|
|
37
|
+
for (const t of TIERS) assert.equal(typeof data[t], 'string', `${t} hash`);
|
|
38
|
+
assert.ok(prompts.includes(::key-upper::.vars.messages.ready), 'onReady prompts the ready message');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('::key:: agent matches the build', () => {
|
|
42
|
+
const agent = ::key-upper::.agent();
|
|
43
|
+
assert.equal(agent.key, '::key::');
|
|
44
|
+
assert.equal(agent.profile.name, '::name::');
|
|
45
|
+
assert.equal(agent.profile.owner, '::owner::');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('::key:: utils answer with trimmed text', () => {
|
|
49
|
+
const {translate, parse, process} = ::key-upper::.utils;
|
|
50
|
+
for (const util of [translate, parse, process]) assert.equal(util(' hello '), 'hello');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('::key:: stops through the full chain', async () => {
|
|
54
|
+
const data = await ::key-upper::.stop();
|
|
55
|
+
assert.equal(data.key, 'shutdown', 'the chain ends on shutdown');
|
|
56
|
+
assert.equal(data.value, '::key::');
|
|
57
|
+
});
|
package/devas/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Deva Loader
|
|
3
|
+
// Copyright ©2000-2026 Quinn Michaels; All rights reserved.
|
|
4
|
+
// Owner Signature Required For Lawful Use.
|
|
5
|
+
// Distributed under VLA:31711622713594414221 LICENSE.md
|
|
6
|
+
// Sunday, November 1, 2026 - 10:04:59 PM PST
|
|
7
|
+
|
|
8
|
+
import test from './test/index.js';
|
|
9
|
+
|
|
10
|
+
const DEVAS = {
|
|
11
|
+
test,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default DEVAS;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "test Data File",
|
|
3
|
+
"describe": "The main Data file for test",
|
|
4
|
+
"copyright": "Copyright ©2026 Quinn Michaels. All rights reserved.",
|
|
5
|
+
"DATA": {
|
|
6
|
+
"agent": {
|
|
7
|
+
"id": "52016091124527523410",
|
|
8
|
+
"key": "test",
|
|
9
|
+
"prompt": {
|
|
10
|
+
"emoji": "⊙",
|
|
11
|
+
"text": "test",
|
|
12
|
+
"colors": {
|
|
13
|
+
"label": {
|
|
14
|
+
"R": 0,
|
|
15
|
+
"G": 150,
|
|
16
|
+
"B": 255
|
|
17
|
+
},
|
|
18
|
+
"text": {
|
|
19
|
+
"R": 101,
|
|
20
|
+
"G": 192,
|
|
21
|
+
"B": 255
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"profile": {
|
|
26
|
+
"id": "52016091124527523410",
|
|
27
|
+
"name": "test",
|
|
28
|
+
"title": "",
|
|
29
|
+
"subtitle": "",
|
|
30
|
+
"describe": "test",
|
|
31
|
+
"vectors": "::vectors::",
|
|
32
|
+
"pronouns": "test",
|
|
33
|
+
"gender": "DEVA",
|
|
34
|
+
"style": "",
|
|
35
|
+
"voice": "alloy",
|
|
36
|
+
"system": "Deva.world",
|
|
37
|
+
"layout": "default",
|
|
38
|
+
"tweet": "",
|
|
39
|
+
"color": "#000000",
|
|
40
|
+
"bgcolor": "#ffffff",
|
|
41
|
+
"emoji": "/assets/emoji.png",
|
|
42
|
+
"avatar": "/assets/avatar.png",
|
|
43
|
+
"image": "/assets/imgae.png",
|
|
44
|
+
"background": "/assets/background.png",
|
|
45
|
+
"owner": "Quinn Michaels",
|
|
46
|
+
"creator": "Quinn Michaels",
|
|
47
|
+
"created": "Monday, November 16, 2026 - 11:42:26 AM"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"vars": {
|
|
51
|
+
"messages": {
|
|
52
|
+
"init": "🟠 INIT",
|
|
53
|
+
"start": "🔵 START",
|
|
54
|
+
"enter": "🟢 ENTER",
|
|
55
|
+
"stop": "🔴 STOP",
|
|
56
|
+
"exit": "🟡 EXIT",
|
|
57
|
+
"done": "🟣 DONE",
|
|
58
|
+
"error": "💣 ERROR!",
|
|
59
|
+
"ready": "⭐️ READY!"
|
|
60
|
+
},
|
|
61
|
+
"context": {
|
|
62
|
+
"uid": "test is creating a uid",
|
|
63
|
+
"status": "test is viewing the status",
|
|
64
|
+
"help": "test is viewing the help"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// test Corpus
|
|
2
|
+
// Copyright ©2026 Quinn Michaels; All rights reserved.
|
|
3
|
+
// Owner Signature Required For Lawful Use.
|
|
4
|
+
// Distributed under VLA:31711622713594414221 LICENSE.md
|
|
5
|
+
// Monday, November 16, 2026 - 11:42:26 AM
|
|
6
|
+
|
|
7
|
+
::BEGIN:MAIN
|
|
8
|
+
# {{profile.name}}
|
|
9
|
+
|
|
10
|
+
p: {{profile.describe}}
|
|
11
|
+
|
|
12
|
+
copyright: {{profile.copyright}}
|
|
13
|
+
::END:MAIN
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// test Help
|
|
2
|
+
// Copyright ©2026 Quinn Michaels; All rights reserved.
|
|
3
|
+
// Owner Signature Required For Lawful Use.
|
|
4
|
+
// Distributed under VLA:31711622713594414221 LICENSE.md
|
|
5
|
+
// Monday, November 16, 2026 - 11:42:26 AM
|
|
6
|
+
|
|
7
|
+
::BEGIN:MAIN
|
|
8
|
+
# {{profile.name}}
|
|
9
|
+
|
|
10
|
+
img: {{profile.image}}
|
|
11
|
+
|
|
12
|
+
{{profile}}
|
|
13
|
+
|
|
14
|
+
talk: #test help main:license
|
|
15
|
+
|
|
16
|
+
::begin:hidden
|
|
17
|
+
#color = {{profile.color}}
|
|
18
|
+
#bgcolor = {{profile.bgcolor}}
|
|
19
|
+
#bg = {{profile.background}}
|
|
20
|
+
copyright: {{profile.copyright}}
|
|
21
|
+
::end:hidden
|
|
22
|
+
::END:MAIN
|
|
23
|
+
|
|
24
|
+
::BEGIN:LICENSE
|
|
25
|
+
::END:LICENSE
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// test
|
|
2
|
+
// Copyright ©2026 Quinn Michaels; All rights reserved.
|
|
3
|
+
// Owner Signature Required For Lawful Use.
|
|
4
|
+
// Distributed under VLA:31711622713594414221 LICENSE.md
|
|
5
|
+
// Monday, November 16, 2026 - 11:42:26 AM
|
|
6
|
+
|
|
7
|
+
import Deva from '@indra.ai/deva';
|
|
8
|
+
// make sure to correct for package location to match
|
|
9
|
+
import pkg from '../../package.json' with {type:'json'};
|
|
10
|
+
|
|
11
|
+
import data from './data/index.json' with {type:'json'};
|
|
12
|
+
const {agent,vars} = data.DATA;
|
|
13
|
+
|
|
14
|
+
// set the __dirname
|
|
15
|
+
import {dirname} from 'node:path';
|
|
16
|
+
import {fileURLToPath} from 'node:url';
|
|
17
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
|
|
19
|
+
const info = {
|
|
20
|
+
id: pkg.id,
|
|
21
|
+
name: pkg.name,
|
|
22
|
+
version: pkg.version,
|
|
23
|
+
author: pkg.author,
|
|
24
|
+
describe: pkg.description,
|
|
25
|
+
dir: __dirname,
|
|
26
|
+
url: pkg.homepage,
|
|
27
|
+
git: pkg.repository.url,
|
|
28
|
+
bugs: pkg.bugs.url,
|
|
29
|
+
license: pkg.license,
|
|
30
|
+
copyright: pkg.copyright,
|
|
31
|
+
VLA: pkg.VLA,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const TEST = new Deva({
|
|
35
|
+
info,
|
|
36
|
+
agent,
|
|
37
|
+
vars,
|
|
38
|
+
utils: {
|
|
39
|
+
translate(input) {return input.trim();},
|
|
40
|
+
parse(input) {return input.trim();},
|
|
41
|
+
process(input) {return input.trim();},
|
|
42
|
+
},
|
|
43
|
+
listeners: {},
|
|
44
|
+
modules: {},
|
|
45
|
+
devas: {},
|
|
46
|
+
func: {},
|
|
47
|
+
methods: {},
|
|
48
|
+
onReady(data, resolve) {
|
|
49
|
+
this.prompt(this.vars.messages.ready);
|
|
50
|
+
return resolve(data);
|
|
51
|
+
},
|
|
52
|
+
onError(data, err, reject) {
|
|
53
|
+
this.prompt(this.vars.messages.error);
|
|
54
|
+
console.log(err);
|
|
55
|
+
return reject(err);
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
export default TEST
|
package/index.js
CHANGED
|
@@ -187,6 +187,8 @@ class Deva {
|
|
|
187
187
|
|
|
188
188
|
// set the assigned listeners for the agent.
|
|
189
189
|
for (let listener in this.listeners) { // loop over the listeners
|
|
190
|
+
const existing = this._bound.get(listener); // already on the bus from an earlier listen
|
|
191
|
+
if (existing) this.events.removeListener(listener, existing); // take the old wrapper off first
|
|
190
192
|
const handler = packet => this.listeners[listener](packet);
|
|
191
193
|
this._bound.set(listener, handler);
|
|
192
194
|
this.events.on(listener, handler);
|
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.65.21",
|
|
5
5
|
"description": "Deva Core a Vedic-based Event Driven Context Aware Feature, Zone, Action, and State Machine integrated Artificial Intelligence Framework",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "VLA:31711622713594414221 LICENSE.md",
|
|
@@ -49,7 +49,15 @@
|
|
|
49
49
|
"type": "module",
|
|
50
50
|
"scripts": {
|
|
51
51
|
"test": "node --test \"tests/suite/*.test.js\"",
|
|
52
|
-
"demo": "node tests"
|
|
52
|
+
"demo": "node tests",
|
|
53
|
+
"buddy": "node buddy/index.js"
|
|
54
|
+
},
|
|
55
|
+
"bin": {
|
|
56
|
+
"deva-buddy": "buddy/index.js"
|
|
57
|
+
},
|
|
58
|
+
"exports": {
|
|
59
|
+
".": "./index.js",
|
|
60
|
+
"./*": "./*"
|
|
53
61
|
},
|
|
54
62
|
"repository": {
|
|
55
63
|
"type": "git",
|