@indra.ai/deva.indra
Version:
The Indra Deva ensuring Quinn Michaels and his intellectual property is managed properly.
72 lines (66 loc) • 1.9 kB
JavaScript
// ©2025 Quinn A Michaels; All rights reserved.
// Legal Signature Required For Lawful Use.
// Distributed under VLA:43264443081827827517 LICENSE.md
// Indra Deva
import Deva from '@indra.ai/deva';
import pkg from './package.json' with {type:'json'};
const {agent,vars} = pkg.data;
// set the __dirname
import {dirname} from 'node:path';
import {fileURLToPath} from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const info = {
id: pkg.id,
name: pkg.name,
version: pkg.version,
author: pkg.author,
describe: pkg.description,
dir: __dirname,
url: pkg.homepage,
git: pkg.repository.url,
bugs: pkg.bugs.url,
license: pkg.license,
VLA: pkg.VLA,
copyright: pkg.copyright
};
const INDRA = new Deva({
info,
agent,
vars,
utils: {
translate(input) {return input.trim();},
parse(input) {return input.trim();},
process(input) {return input.trim();},
},
listeners: {
'devacore:question'(packet) {
this.methods.echo(agent.key, 'q', packet);
},
'devacore:answer'(packet) {
this.methods.echo(agent.key, 'a', packet);
}
},
modules: {},
devas: {},
func: {},
methods: {},
onInit(data, resolve) {
const {personal} = this.license(); // get the license config
const agent_license = this.info().VLA; // get agent license
const license_check = this.license_check(personal, agent_license); // check license
// return this.start if license_check passes otherwise stop.
return license_check ? this.start(data, resolve) : this.stop(data, resolve);
},
async onReady(data, resolve) {
const {VLA} = this.info();
this.prompt(`${this.vars.messages.ready} > VLA:${VLA.uid}`);
return resolve(data);
},
onError(data, err, reject) {
this.prompt(this.vars.messages.error);
console.log(err);
return reject(err);
},
});
export default INDRA
;