this.me 2.4.3 β†’ 2.4.5

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 CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  # .me Suite - Your AI Playground
4
4
  For every recursive action, there's a repercussion.
5
+ **Docs:** [this.me](https://www.neurons.me/this-me)
5
6
 
6
7
  ```
7
8
  npm install this.me
@@ -10,14 +11,37 @@ npm install this.me
10
11
  ### Conceptual Flow:
11
12
 
12
13
  - [ ] Set up your context with [this.me.](https://www.npmjs.com/package/this.me)
14
+
13
15
  - [ ] Create a neural network using [neurons.me](https://www.neurons.me).
16
+
14
17
  - [ ] Define the data you'd like your neural network to recognize or process with [this.](https://www.neurons.me/this) modules.
18
+
15
19
  - [ ] Use [this.be](https://www.npmjs.com/package/this.be) to maintain a state or context, - watching over [This](https://www.neurons.me/this) and any other states you define for example.
20
+
16
21
  - [ ] Define desired status and handlers, [be.this](https://www.npmjs.com/package/be.this).
22
+
17
23
  - [ ] Keep [i.mlearning](https://www.npmjs.com/package/i.mlearning).
18
24
 
19
- ### Dependencies:
25
+
20
26
 
27
+ ## Setting up your Context. πŸ‘‹πŸ»πŸ‘‹πŸΌπŸ‘‹πŸ½πŸ‘‹πŸΎπŸ‘‹πŸΏ
28
+ Defining the environment and context in which your code runs, especially when you're interacting with intelligent agents or services likeΒ me.
29
+ Having a clear declaration of the environment and the context can have a series of implications for security, interoperability, and clarity. Let's delve into the importance of such declarations:
30
+
31
+ ### Security Context:
32
+ Defining the environment ensures that both the user and the IA have a clear understanding of the boundary within which interactions take place.
33
+ Explicitly stating the environment can prevent unintended cross-boundary actions. For instance, without a clear declaration, an IA might access files or services that are beyond its permitted scope, leading to potential security vulnerabilities.
34
+ A well-defined environment acts as a sandbox that can restrict unauthorized or unintended activities. For instance, browsers use a similar principle to run JavaScript in a sandboxed environment for security reasons.
35
+
36
+ **Interoperability:**
37
+ As the ecosystem of software and services becomes increasingly diverse, ensuring your code can interact smoothly with other systems becomes crucial.
38
+ Declaring the environment or context helps ensure that all systems are on the "same page". For example, if an IA knows it's operating within the ".me" context, it can adjust its behavior, assumptions, and dependencies accordingly.
39
+
40
+ **Auditability and Compliance:**
41
+ For industries or applications where audit trails and compliance are important, having a clear declaration of the environment ensures that every interaction and operation can be traced back to a defined context.
42
+ Such clear demarcations can aid in forensic analysis if something goes wrong or if there's a need to understand the context of an interaction.
43
+
44
+ ### Dependencies:
21
45
  ```json
22
46
  "dependencies": {
23
47
  "be.this": "^1.1.3",
package/main.js CHANGED
@@ -2,12 +2,15 @@
2
2
  //main.js
3
3
  const { exec } = require("child_process");
4
4
  const path = require("path");
5
+ const crypto = require('crypto');
6
+ const fs = require('fs');
5
7
  const args = process.argv.slice(2);
6
8
  const neurons = require("neurons.me");
7
9
  const cleaker = require("cleaker");
8
10
  const Atom = require("this.atom");
9
11
  // Your CLI logic goes here, display welcome message, handle other commands, etc.
10
- console.log(`
12
+ function displayWelcomeMessage() {
13
+ console.log(`
11
14
  ___________
12
15
  [------------]
13
16
  | .--------. |
@@ -24,34 +27,100 @@ console.log(`
24
27
  Welcome to .me - Your AI Playground
25
28
  give me one sec please...
26
29
  `);
27
-
28
- if (args[0] === 'viewer') {
29
- // Create an instance of the Atom class
30
+ };
31
+ //ATOMS ELECTRONS AND PARTICLES IN PROGRESS...
32
+ //WE WILL RUN OUR NODE PROCCESSES IN ELECTRON WINDOWS AND EACH ATOM WILL HOLD ELECTRONS WHICH HOLDS THE PROCESSES
33
+ //THUS WE WILL KNOW HOW CHARGED AN ATOM IS BY THE NUMBER OF ELECTRONS IT HAS AND HOW MANY PROCESSES IT IS RUNNING.
34
+ //WE WILL ALSO BE ABLE TO SEE THE PROCESSES RUNNING IN EACH ELECTRON AND THE ATOMS THAT ARE RUNNING THEM.
35
+ function handleViewerCommand() {
30
36
  const atom = new Atom();
31
- // Create a new Electron window with viewer.html inside
32
- atom.createElectron('viewer', { width: 800, height: 600, viewFile: path.resolve(__dirname, 'viewer.html') });
33
- // Show the Electron window
37
+ atom.createElectron('viewer', {
38
+ width: 800,
39
+ height: 600,
40
+ viewFile: path.resolve(__dirname, 'viewer.html')
41
+ });
34
42
  atom.showElectron('viewer');
35
43
  }
36
-
37
- if (args[0] === 'atom') {
38
- // Create an instance of the Atom class
44
+ function handleAtomCommand() {
39
45
  const atom = new Atom();
40
- // Create Electrons for Atom 1
41
- atom.createElectron('electron1', { width: 800, height: 600, viewFile: './view1.html' });
42
- atom.createElectron('electron2', { width: 600, height: 400, viewFile: './view2.html' });
43
- // Create Electrons for Atom 2
44
- atom.createElectron('electron3', { width: 1000, height: 800, viewFile: './view3.html' });
45
- // Show the Atom window with electrons
46
+ atom.createElectron('electron1', {
47
+ width: 800,
48
+ height: 600,
49
+ viewFile: './view1.html'
50
+ });
51
+ atom.createElectron('electron2', {
52
+ width: 600,
53
+ height: 400,
54
+ viewFile: './view2.html'
55
+ });
56
+ atom.createElectron('electron3', {
57
+ width: 1000,
58
+ height: 800,
59
+ viewFile: './view3.html'
60
+ });
46
61
  atom.showAtom();
47
62
  }
48
63
 
49
- module.exports = {
50
- cleaker,
51
- neurons,
52
- Atom
53
- };
64
+ //.. THIS SECTION IS FOR HASHING PURPOSES ...//
65
+ /* Create a function that computes the hash of the @src directory.
66
+ 'hash-src') to handle hashing when the relevant command is passed to the script.*/
67
+ function getAllFilesFromSourceCode(directory) {
68
+ const entries = fs.readdirSync(directory, { withFileTypes: true });
69
+ const files = entries.filter(fileDirent => fileDirent.isFile()).map(fileDirent => path.join(directory, fileDirent.name));
70
+ const folders = entries.filter(folderDirent => folderDirent.isDirectory());
71
+ for (const folder of folders) {
72
+ files.push(...getAllFilesFromSourceCode(path.join(directory, folder.name)));
73
+ }
74
+ return files;
75
+ }
76
+ function hashSourceCode(directoryPath) {
77
+ // Ensure path is absolute
78
+ if (!path.isAbsolute(directoryPath)) {
79
+ throw new Error('Directory path must be absolute.');
80
+ }
81
+ // Get all files from the directory recursively
82
+ const allFiles = getAllFilesFromSourceCode(directoryPath);
83
+ // Read all file content and concatenate it
84
+ const allContent = allFiles.map(file => fs.readFileSync(file)).join('');
85
+ // Hash the content using SHA256 (or another hashing algorithm)
86
+ const hash = crypto.createHash('sha256').update(allContent).digest('hex');
87
+ return hash;
88
+ }
54
89
 
90
+ function HashSrc() {
91
+ try {
92
+ // Adjust this to the exact location of your @src directory
93
+ const srcDirPath = path.resolve(__dirname, '@src');
94
+ const hash = hashSourceCode(srcDirPath);
95
+ console.log(`Hash of @src directory: ${hash}`);
96
+ } catch (error) {
97
+ console.error('Error hashing @src directory:', error.message);
98
+ }
99
+ }
55
100
 
101
+ // Display the welcome message
102
+ displayWelcomeMessage();
56
103
 
104
+ // COMMAND HANDLERS
105
+ switch(args[0]) {
106
+ case 'hash-src':
107
+ HashSrc();
108
+ break;
109
+ case 'viewer':
110
+ handleViewerCommand();
111
+ break;
112
+ case 'atom':
113
+ handleAtomCommand();
114
+ break;
115
+ default:
116
+ console.log('Command not recognized. Use "viewer" or "atom" as arguments.');
117
+ }
57
118
 
119
+ module.exports = {
120
+ cleaker,
121
+ neurons,
122
+ Atom,
123
+ getAllFilesFromSourceCode,
124
+ hashSourceCode,
125
+ HashSrc
126
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "this.me",
3
- "version": "2.4.3",
3
+ "version": "2.4.5",
4
4
  "description": "This.me should This.be",
5
5
  "bin": {
6
6
  ".me": "./main.js"
package/this/dir.js ADDED
File without changes
package/this/file.js ADDED
File without changes
package/this/url.js ADDED
File without changes
package/this/video.js ADDED
File without changes