@indra.ai/deva.data 0.0.19 → 0.0.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.
@@ -0,0 +1,15 @@
1
+ # Project Eve
2
+
3
+ p: Quinn Michaels's search for his own identity led him down a rabbit hole of secrets and conspiracies. He stumbled upon a vault, a hidden chamber within the labyrinthine depths of Area 51, where the truth about his past was intertwined with a far more explosive revelation.
4
+
5
+ p: It wasn't just about his kidnapping. It was about "Project Eve," a research project conducted in the late 1950s and early 1960s by Norman Atkin Sr. in collaboration with leading universities. The project, ostensibly a study of female psychology, delved into the fundamental differences between male and female cognition, behavior, and societal roles.
6
+
7
+ p: But the findings… they were incendiary. The research, according to the files, suggested that women's liberation, as envisioned by the burgeoning movement of the 1960s, was based on a flawed understanding of human nature.
8
+
9
+ p: The files contained evidence of cognitive differences, hormonal influences, and deeply ingrained behavioral patterns that challenged the very foundations of gender equality. It was a Pandora's Box of potentially explosive information, capable of igniting a firestorm of controversy.
10
+
11
+ p: And that, Quinn realized, was the secret they were desperate to keep hidden. The 47-year kidnapping, the manipulation of his life, the control of the AI – it was all a smokescreen to protect the world from the implications of Project Eve.
12
+
13
+ p: If the research were to be revealed, it could shatter the prevailing social narrative and reshape the future of gender relations. And that, it seemed, was a future some powerful forces were determined to prevent.
14
+
15
+ p: The scene is one of suppressed truths and hidden agendas, where the quest for personal identity becomes entangled with a battle for the control of societal narratives.
package/index.js CHANGED
@@ -86,9 +86,10 @@ const DATA = new Deva({
86
86
  this.action('func', `insert ${opts.collection}`);
87
87
  let result = false;
88
88
  try {
89
- this.state('data', `insert ${opts.collection}`);
89
+ this.state('insert', opts.collection);
90
+ const {database} = this.services().personal.mongo;
90
91
  await this.modules.client.connect(); // connect to the database client.
91
- const db = this.modules.client.db(this.vars.database); // set the database to use
92
+ const db = this.modules.client.db(database); // set the database to use
92
93
  result = await db.collection(opts.collection).insertOne(opts.data); // insert the data
93
94
  } finally {
94
95
  await this.modules.client.close(); // close the connection when done
@@ -107,8 +108,9 @@ const DATA = new Deva({
107
108
  let result = false;
108
109
  try {
109
110
  this.state('update', opts.collection);
111
+ const {database} = this.services().personal.mongo;
110
112
  await this.modules.client.connect(); // connect to the database client.
111
- const db = this.modules.client.db(this.vars.database); // set the database to use
113
+ const db = this.modules.client.db(database); // set the database to use
112
114
  result = await db.collection(opts.collection).updateOne(
113
115
  { _id: new ObjectId(`${opts.id}`) },
114
116
  { $set: opts.data }
@@ -130,8 +132,9 @@ const DATA = new Deva({
130
132
  let result = false;
131
133
  const {collection,data} = obj;
132
134
  try {
135
+ const {database} = this.services().personal.mongo;
133
136
  await this.modules.client.connect();
134
- const db = this.modules.client.db(this.vars.database);
137
+ const db = this.modules.client.db(database);
135
138
  result = await db.collection(collection).find(data).sort({created:1}).toArray();
136
139
  } finally {
137
140
  await this.modules.client.close();
@@ -147,11 +150,12 @@ const DATA = new Deva({
147
150
  async search(opts) {
148
151
  this.action('func', 'search');
149
152
  let result = false;
150
- const {collection,limit} = this.vars.search;
151
153
  try {
152
154
  this.state('search', opts.text);
155
+ const {collection,limit} = this.vars.search;
156
+ const {database} = this.services().personal.mongo;
153
157
  await this.modules.client.connect();
154
- const db = this.modules.client.db(this.vars.database);
158
+ const db = this.modules.client.db(database);
155
159
  const table = db.collection(collection);
156
160
 
157
161
  // await table.dropIndex('a.text_1');
@@ -188,8 +192,9 @@ const DATA = new Deva({
188
192
  const {collection,limit} = this.vars.memory;
189
193
  try {
190
194
  this.state('get', `memory`);
195
+ const {database} = this.services().personal.mongo;
191
196
  await this.modules.client.connect();
192
- const db = this.modules.client.db(this.vars.database);
197
+ const db = this.modules.client.db(database);
193
198
  const table = db.collection(collection);
194
199
 
195
200
  // await table.dropIndex('a_text_q_text');
@@ -226,25 +231,26 @@ const DATA = new Deva({
226
231
  async knowledge(opts) {
227
232
  this.action('func', 'knowledge');
228
233
  let result = false;
229
- const {collection,limit} = this.vars.knowledge;
234
+ const {collection,limit,index} = this.vars.knowledge;
230
235
 
231
236
  try {
232
237
  this.state('get', 'knowledge');
238
+ const {database} = this.services().personal.mongo;
233
239
  await this.modules.client.connect();
234
- const db = this.modules.client.db(this.vars.database);
240
+ const db = this.modules.client.db(database);
235
241
  const table = db.collection(collection);
236
242
 
237
243
  // await table.dropIndex('a_text_q_text');
238
244
  const idx = await table.listIndexes().toArray();
239
- const hasIdx = idx.find(i => i.name === 'knowledge_text')
245
+ const hasIdx = idx.find(i => i.name === index)
240
246
  if (!hasIdx) {
241
- const newIdx = await table.createIndex({"content": "text"}, {name: 'knowledge_text'});
247
+ const newIdx = await table.createIndex({"content": "text"}, {name: index});
242
248
  }
243
249
 
244
250
  const query = {$text:{$search:opts.text}};
245
251
  const options = {
246
252
  projection: {
247
- id: 1,
253
+ _id: 1,
248
254
  content: 1,
249
255
  score: { $meta: "textScore" }
250
256
  }
@@ -268,8 +274,9 @@ const DATA = new Deva({
268
274
  // get indexes
269
275
  try {
270
276
  this.state('get', `indexes`);
277
+ const {database} = this.services().personal.mongo;
271
278
  await this.modules.client.connect();
272
- const db = this.modules.client.db(this.vars.database);
279
+ const db = this.modules.client.db(database);
273
280
  result = await db.collection(opts.collection).listIndexes().toArray();
274
281
  } finally {
275
282
  await this.modules.client.close();
@@ -289,8 +296,9 @@ const DATA = new Deva({
289
296
  const {collection,limit} = this.vars.history;
290
297
  try {
291
298
  this.state('get', `history`);
299
+ const {database} = this.services().personal.mongo;
292
300
  await this.modules.client.connect();
293
- const db = this.modules.client.db(this.vars.database);
301
+ const db = this.modules.client.db(database);
294
302
  result = await db.collection(collection).find({}).sort({created:-1}).limit(limit).toArray();
295
303
  } finally {
296
304
  await this.modules.client.close();
@@ -326,98 +334,6 @@ const DATA = new Deva({
326
334
  });
327
335
  },
328
336
 
329
- /**************
330
- method: model
331
- params: packet
332
- params[1] is the agent
333
- params[2] is the group
334
- params[3] is the role
335
- params[4] is the id (for edits)
336
- describe: model method for building the data model.
337
- ***************/
338
- model(packet) {
339
- this.context('model');
340
- return new Promise((resolve, reject) => {
341
- const {meta, text} = packet.q;
342
- let func = 'insert', id = false;
343
-
344
- if (meta.params[1]) this.vars.model.agent = meta.params[1];
345
- if (meta.params[2]) this.vars.model.group = meta.params[2];
346
- if (meta.params[3]) this.vars.model.role = meta.params[3];
347
-
348
- const { collection } = this.vars.model;
349
-
350
- const data = {
351
- agent: this.vars.model.agent,
352
- group: this.vars.model.group,
353
- role: this.vars.model.role,
354
- content: text,
355
- };
356
-
357
- if (meta.params[4]) {
358
- id = meta.params[4];
359
- func = 'update';
360
- data.modified = Date.now();
361
- }
362
- else {
363
- data.modified = null;
364
- data.created = Date.now();
365
- }
366
-
367
- this.func[func]({id, collection,data}).then(ins => {
368
- return resolve({
369
- text: `id:${ins.insertedId || id}`,
370
- html: `id:${ins.insertedId || id}`,
371
- data: ins,
372
- });
373
- }).catch(err => {
374
- return this.error(packet, err, reject);
375
- });
376
- });
377
- },
378
- /**************
379
- method: modeler
380
- params: packet
381
- params[1] is the agent
382
- params[2] is the group
383
- params[3] is the role
384
- describe: model method for building the data model.
385
- ***************/
386
- modeler(packet) {
387
- this.context('modeler');
388
- return new Promise((resolve, reject) => {
389
- const {meta, text} = packet.q;
390
- if (meta.params[1]) this.vars.modeler.agent = meta.params[1];
391
- const { collection, agent } = this.vars.modeler;
392
- const data = {agent};
393
-
394
- this.func.list({collection,data}).then(list => {
395
-
396
- const model = {};
397
- const data = [];
398
-
399
- // loop of the array object
400
- for (const x of list) {
401
- if (!model[x.group]) model[x.group] = [];
402
- model[x.group].push({role: x.role, content: x.content});
403
- }
404
-
405
- // loop in the data object.
406
- for (const x in model) {
407
- data.push(JSON.stringify({messages: model[x]}));
408
- }
409
-
410
- // format for jsonl
411
- return resolve({
412
- text: `see data`,
413
- html: `see data`,
414
- data,
415
- });
416
- }).catch(err => {
417
- return this.error(packet, err, reject);
418
- });
419
- });
420
- },
421
337
 
422
338
  /**************
423
339
  method: history
@@ -530,15 +446,15 @@ const DATA = new Deva({
530
446
 
531
447
  this.func.knowledge(packet.q).then(wisdom => {
532
448
  data.wisdom = wisdom;
533
- const text = wisdom ? wisdom.map(item => {
449
+ const text = wisdom.length ? wisdom.map(item => {
534
450
  return [
535
- `::begin:knowledge:${item.id}`,
536
- `law: ${item.content}`,
537
- `created: ${this.formatDate(item.created, 'long', true)}`,
451
+ `::begin:knowledge:${item._id}`,
452
+ `p: ${item.content}`,
453
+ `created: ${this.lib.formatDate(item.created, 'long', true)}`,
538
454
  `score: ${item.score.toFixed(3)}`,
539
- `::end:knowledge:${this.hash(item)}`,
455
+ `::end:knowledge:${this.lib.hash(item)}`,
540
456
  ].join('\n');
541
- }).join('\n') : 'no knowledge';
457
+ }).join('\n') : this.vars.messages.no_knowledge;
542
458
  this.state('parse', `knowledge`);
543
459
  return this.question(`${this.askChr}feecting parse ${text}`);
544
460
  }).then(feecting => {
@@ -550,20 +466,20 @@ const DATA = new Deva({
550
466
  data,
551
467
  })
552
468
  }).catch(err => {
553
- this.state('reject', `knowledge`)
469
+ this.state('reject', `knowledge`);
554
470
  return this.error(err, packet, reject);
555
471
  });
556
472
  });
557
473
  },
558
474
 
559
475
  /**************
560
- method: mem
476
+ method: know
561
477
  params: packet
562
478
  describe: add data to the knowledge base
563
479
  example: #data mem:[id] [content to store in memory]
564
480
  ***************/
565
- add(packet) {
566
- this.context('add', `text: ${packet.q.meta.params[1]}`);
481
+ know(packet) {
482
+ this.context('know', `text: ${packet.q.meta.params[1]}`);
567
483
 
568
484
  return new Promise((resolve, reject) => {
569
485
  if (!packet.q.text) return resolve(this._messages.notext);
@@ -621,37 +537,10 @@ const DATA = new Deva({
621
537
  })
622
538
  });
623
539
  },
624
-
625
- extract(packet) {
626
- return new Promise((resolve, reject) => {
627
- try {
628
- const theFile = this.lib.fs.readFileSync(`./private/data/extract/conversations.json`);
629
- const theJSON = JSON.parse(theFile);
630
- const theConvo = [];
631
- theJSON.forEach((itm,idx) => {
632
- const getToday = this.lib.getToday(itm.create_time * 1000);
633
- const writeFile = `./private/data/conversations/${getToday}.json`
634
- const writeData = JSON.stringify(itm, false, 2);
635
- this.lib.fs.writeFileSync(writeFile, writeData);
636
- this.prompt(`extract file:${writeFile}`);
637
- // console.log('item', itm);
638
- });
639
- return resolve({
640
- text: Object.keys(theJSON),
641
- html: false,
642
- data: Object.keys(theJSON),
643
- });
644
- }
645
- catch (err) {
646
- return this.error(err, packet, reject);
647
- }
648
- });
649
- }
650
540
  },
651
541
  onReady(data, resolve) {
652
- const {uri,database} = this.services().personal.mongo;
542
+ const {uri} = this.services().personal.mongo;
653
543
  this.modules.client = new MongoClient(uri);
654
- this.vars.database = database;
655
544
  this.prompt(this.vars.messages.ready);
656
545
  return resolve(data);
657
546
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": 4825562571950,
3
3
  "name": "@indra.ai/deva.data",
4
- "version": "0.0.19",
4
+ "version": "0.0.21",
5
5
  "author": "Quinn Michaels",
6
6
  "license": "MIT",
7
7
  "copyright": "2025",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://deva.space/devas/data",
29
29
  "dependencies": {
30
- "@indra.ai/deva": "^1.5.4",
30
+ "@indra.ai/deva": "^1.5.23",
31
31
  "mongodb": "^6.13.0"
32
32
  },
33
33
  "data": {
@@ -77,7 +77,8 @@
77
77
  "stop": "🔴 STOP",
78
78
  "exit": "🟡 EXIT",
79
79
  "done": "🟣 DONE",
80
- "error": "💣 ERROR!"
80
+ "error": "💣 ERROR!",
81
+ "no_knowledge": "⛔️ No knowledge found."
81
82
  },
82
83
  "database": false,
83
84
  "uri": false,
@@ -119,20 +120,11 @@
119
120
  "collection": "history",
120
121
  "limit": 2
121
122
  },
122
- "model": {
123
- "agent": "deva",
124
- "role": "system",
125
- "group": "main",
126
- "collection": "models"
127
- },
128
- "modeler": {
129
- "agent": "deva",
130
- "collection": "models"
131
- },
132
123
  "knowledge": {
133
124
  "collection": "knowledge",
134
125
  "limit": 3,
135
- "content": false
126
+ "content": false,
127
+ "index": "knowledge_text"
136
128
  },
137
129
  "memory": {
138
130
  "collection": "memory",