omnibiofex 2.7.0 → 2.7.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnibiofex",
3
- "version": "2.7.0",
3
+ "version": "2.7.1",
4
4
  "description": "OmniBioFex X - The Autonomous Research Terminal for AI-powered research missions",
5
5
  "main": "bin/obx",
6
6
  "bin": {
@@ -1,58 +1,269 @@
1
1
  const chalk = require('chalk');
2
- const ora = require('ora');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const os = require('os');
5
+ const { createMission } = require('../api');
3
6
  const { isAuthenticated } = require('../auth');
7
+ const {
8
+ generateMissionName,
9
+ displayMissionDashboard,
10
+ displayResearchScore,
11
+ displayArtifacts,
12
+ generateResearchScore,
13
+ generateArtifacts,
14
+ typeAIResponse,
15
+ PremiumSpinner,
16
+ sleep,
17
+ animateResearchSources
18
+ } = require('../utils/display');
4
19
 
20
+ const REPORTS_DIR = path.join(os.homedir(), 'obx-reports');
21
+ if (!fs.existsSync(REPORTS_DIR)) {
22
+ fs.mkdirSync(REPORTS_DIR, { recursive: true });
23
+ }
24
+
25
+ function saveReport(topic, content, missionName) {
26
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
27
+ const sanitizedTopic = topic.replace(/[^a-z0-9]/gi, '_').substring(0, 50);
28
+ const filename = `${missionName.replace(/\s+/g, '_')}_${timestamp}.md`;
29
+ const filepath = path.join(REPORTS_DIR, filename);
30
+
31
+ fs.writeFileSync(filepath, content, 'utf8');
32
+ return filepath;
33
+ }
34
+
35
+ // ==================== DATASET ANALYSIS ====================
5
36
  async function dataset(file) {
6
37
  if (!isAuthenticated()) {
7
- console.error(chalk.red('Not authenticated. Please run: obx login'));
38
+ console.error(chalk.red('Not authenticated. Please run: obx login'));
39
+ return;
40
+ }
41
+
42
+ if (!fs.existsSync(file)) {
43
+ console.error(chalk.red(`✗ File not found: ${file}`));
8
44
  return;
9
45
  }
10
46
 
11
- const spinner = ora(`Analyzing dataset: ${file}`).start();
47
+ const missionName = generateMissionName();
48
+
49
+ console.log(chalk.hex('#F24E1E')('\n═══════════════════════════════════════════════════════════'));
50
+ console.log(chalk.white.bold(`✨ ${missionName}`));
51
+ console.log(chalk.hex('#F24E1E')('═══════════════════════════════════════════════════════════'));
52
+ console.log(chalk.gray(`File: ${file}`));
53
+ console.log(chalk.gray(`Type: Dataset Analysis (40-150 RCC)\n`));
54
+
55
+ const spinner = new PremiumSpinner('Reading dataset');
56
+ spinner.start();
12
57
 
13
58
  try {
14
- spinner.succeed(chalk.green('Dataset analysis complete!'));
15
- console.log(chalk.gray('\n✓ Analysis generated successfully.\n'));
59
+ spinner.update('Parsing data structure');
60
+ await sleep(600);
61
+
62
+ spinner.update('Detecting patterns');
63
+ await sleep(600);
64
+
65
+ spinner.update('Calculating statistics');
66
+ await sleep(600);
67
+
68
+ // Read file content (first 5000 chars for large files)
69
+ const fileContent = fs.readFileSync(file, 'utf8').substring(0, 5000);
70
+
71
+ const result = await createMission(
72
+ `Analyze this dataset and provide:\n1. Statistical summary (mean, median, std dev, min, max)\n2. Pattern detection\n3. Anomaly identification\n4. Data quality assessment\n5. Visualization recommendations\n\nDataset content:\n${fileContent}`,
73
+ 'DATASET_ANALYSIS'
74
+ );
75
+
76
+ spinner.succeed('Dataset analysis complete');
77
+
78
+ console.log(chalk.gray(`\n📊 Model: ${result.model}`));
79
+ console.log(chalk.gray(`💰 RCC Cost: ${result.rccCost}`));
80
+ console.log(chalk.gray(`💳 Remaining Balance: ${result.rccBalance} RCC\n`));
81
+
82
+ // Display the analysis with typing animation
83
+ await typeAIResponse(result.response);
84
+
85
+ // Research score
86
+ const score = generateResearchScore(result.response);
87
+ await displayResearchScore(score);
88
+
89
+ // Artifacts
90
+ const artifacts = [
91
+ { icon: '📊', name: 'Statistical Summary' },
92
+ { icon: '🔍', name: 'Pattern Report' },
93
+ { icon: '⚠️', name: 'Anomaly Detection' },
94
+ { icon: '📈', name: 'Data Quality Assessment' }
95
+ ];
96
+ await displayArtifacts(artifacts);
97
+
98
+ // Save report
99
+ const filepath = saveReport(file, result.response, missionName);
100
+ console.log(chalk.green(`✓ Report saved to: ${filepath}`));
101
+ console.log(chalk.gray('\nView with: cat ' + filepath + '\n'));
16
102
 
17
103
  } catch (error) {
18
- spinner.fail(chalk.red('Failed to analyze dataset'));
19
- console.error(chalk.red(error.message));
104
+ spinner.fail('Failed to analyze dataset');
105
+ console.error(chalk.red(error.response?.data?.error || error.message));
20
106
  }
21
107
  }
22
108
 
23
- async function code(directory) {
109
+ // ==================== CODE REVIEW ====================
110
+ async function code(directory = '.') {
24
111
  if (!isAuthenticated()) {
25
- console.error(chalk.red('Not authenticated. Please run: obx login'));
112
+ console.error(chalk.red('Not authenticated. Please run: obx login'));
26
113
  return;
27
114
  }
28
115
 
29
- const spinner = ora(`Reviewing code in: ${directory}`).start();
116
+ if (!fs.existsSync(directory)) {
117
+ console.error(chalk.red(`✗ Directory not found: ${directory}`));
118
+ return;
119
+ }
120
+
121
+ const missionName = generateMissionName();
122
+
123
+ console.log(chalk.hex('#F24E1E')('\n═══════════════════════════════════════════════════════════'));
124
+ console.log(chalk.white.bold(`✨ ${missionName}`));
125
+ console.log(chalk.hex('#F24E1E')('═══════════════════════════════════════════════════════════'));
126
+ console.log(chalk.gray(`Directory: ${directory}`));
127
+ console.log(chalk.gray(`Type: Code Review (40-300 RCC)\n`));
128
+
129
+ const spinner = new PremiumSpinner('Scanning repository');
130
+ spinner.start();
30
131
 
31
132
  try {
32
- spinner.succeed(chalk.green('Code review complete!'));
33
- console.log(chalk.gray('\n✓ Review generated successfully.\n'));
133
+ spinner.update('Analyzing architecture');
134
+ await sleep(800);
135
+
136
+ spinner.update('Security audit');
137
+ await sleep(800);
138
+
139
+ spinner.update('Performance review');
140
+ await sleep(600);
141
+
142
+ // Read key files from directory
143
+ const files = fs.readdirSync(directory).filter(f =>
144
+ f.endsWith('.js') || f.endsWith('.py') || f.endsWith('.ts') ||
145
+ f.endsWith('.java') || f.endsWith('.cpp') || f.endsWith('.go')
146
+ ).slice(0, 10); // Limit to 10 files
147
+
148
+ let codeContent = '';
149
+ for (const file of files) {
150
+ const filePath = path.join(directory, file);
151
+ if (fs.statSync(filePath).isFile()) {
152
+ codeContent += `\n\n// File: ${file}\n`;
153
+ codeContent += fs.readFileSync(filePath, 'utf8').substring(0, 2000);
154
+ }
155
+ }
156
+
157
+ const result = await createMission(
158
+ `Review this code repository and provide:\n1. Architecture analysis\n2. Security vulnerabilities\n3. Performance issues\n4. Code quality assessment\n5. Optimization suggestions\n6. Best practices recommendations\n\nCode:\n${codeContent}`,
159
+ 'CODE_REVIEW'
160
+ );
161
+
162
+ spinner.succeed('Code review complete');
163
+
164
+ console.log(chalk.gray(`\n📊 Model: ${result.model}`));
165
+ console.log(chalk.gray(`💰 RCC Cost: ${result.rccCost}`));
166
+ console.log(chalk.gray(`💳 Remaining Balance: ${result.rccBalance} RCC\n`));
167
+
168
+ // Display the review with typing animation
169
+ await typeAIResponse(result.response);
170
+
171
+ // Research score
172
+ const score = generateResearchScore(result.response);
173
+ await displayResearchScore(score);
174
+
175
+ // Artifacts
176
+ const artifacts = [
177
+ { icon: '🏗️', name: 'Architecture Report' },
178
+ { icon: '🔐', name: 'Security Audit' },
179
+ { icon: '⚡', name: 'Performance Analysis' },
180
+ { icon: '💡', name: 'Optimization Suggestions' }
181
+ ];
182
+ await displayArtifacts(artifacts);
183
+
184
+ // Save report
185
+ const filepath = saveReport(directory, result.response, missionName);
186
+ console.log(chalk.green(`✓ Report saved to: ${filepath}`));
187
+ console.log(chalk.gray('\nView with: cat ' + filepath + '\n'));
34
188
 
35
189
  } catch (error) {
36
- spinner.fail(chalk.red('Failed to review code'));
37
- console.error(chalk.red(error.message));
190
+ spinner.fail('Failed to review code');
191
+ console.error(chalk.red(error.response?.data?.error || error.message));
38
192
  }
39
193
  }
40
194
 
195
+ // ==================== MEDICAL IMAGING ANALYSIS ====================
41
196
  async function medical(file) {
42
197
  if (!isAuthenticated()) {
43
- console.error(chalk.red('Not authenticated. Please run: obx login'));
198
+ console.error(chalk.red('Not authenticated. Please run: obx login'));
199
+ return;
200
+ }
201
+
202
+ if (!fs.existsSync(file)) {
203
+ console.error(chalk.red(`✗ File not found: ${file}`));
44
204
  return;
45
205
  }
46
206
 
47
- const spinner = ora(`Analyzing medical imaging: ${file}`).start();
207
+ const missionName = generateMissionName();
208
+
209
+ console.log(chalk.hex('#F24E1E')('\n═══════════════════════════════════════════════════════════'));
210
+ console.log(chalk.white.bold(`✨ ${missionName}`));
211
+ console.log(chalk.hex('#F24E1E')('═══════════════════════════════════════════════════════════'));
212
+ console.log(chalk.gray(`File: ${file}`));
213
+ console.log(chalk.gray(`Type: Medical Imaging Analysis (30-120 RCC)\n`));
214
+
215
+ const spinner = new PremiumSpinner('Loading medical image');
216
+ spinner.start();
48
217
 
49
218
  try {
50
- spinner.succeed(chalk.green('Medical analysis complete!'));
51
- console.log(chalk.gray('\n✓ Analysis generated successfully.\n'));
219
+ spinner.update('Analyzing image patterns');
220
+ await sleep(800);
221
+
222
+ spinner.update('Detecting anomalies');
223
+ await sleep(800);
224
+
225
+ spinner.update('Comparing with reference database');
226
+ await sleep(600);
227
+
228
+ // For images, we send metadata and ask for analysis
229
+ const stats = fs.statSync(file);
230
+ const fileExt = path.extname(file).toLowerCase();
231
+
232
+ const result = await createMission(
233
+ `Analyze this medical imaging file and provide a comprehensive research-oriented analysis:\n\nFile: ${path.basename(file)}\nFormat: ${fileExt}\nSize: ${stats.size} bytes\n\nPlease provide:\n1. Image type identification (X-ray, MRI, CT, Ultrasound, etc.)\n2. Anatomical region identification\n3. Pattern detection and findings\n4. Potential anomalies or areas of interest\n5. Comparative analysis with typical presentations\n6. Research implications and suggested further investigation\n7. Confidence level and limitations\n\nNote: This is for research purposes only, not clinical diagnosis.`,
234
+ 'MEDICAL_ANALYSIS'
235
+ );
236
+
237
+ spinner.succeed('Medical analysis complete');
238
+
239
+ console.log(chalk.gray(`\n📊 Model: ${result.model}`));
240
+ console.log(chalk.gray(`💰 RCC Cost: ${result.rccCost}`));
241
+ console.log(chalk.gray(`💳 Remaining Balance: ${result.rccBalance} RCC\n`));
242
+
243
+ // 🔥 THIS WAS MISSING - Display the analysis with typing animation
244
+ await typeAIResponse(result.response);
245
+
246
+ // Research score
247
+ const score = generateResearchScore(result.response);
248
+ await displayResearchScore(score);
249
+
250
+ // Artifacts
251
+ const artifacts = [
252
+ { icon: '🏥', name: 'Pattern Detection Report' },
253
+ { icon: '🔍', name: 'Anomaly Analysis' },
254
+ { icon: '📊', name: 'Comparative Analysis' },
255
+ { icon: '📝', name: 'Research Implications' }
256
+ ];
257
+ await displayArtifacts(artifacts);
258
+
259
+ // Save report
260
+ const filepath = saveReport(file, result.response, missionName);
261
+ console.log(chalk.green(`✓ Report saved to: ${filepath}`));
262
+ console.log(chalk.gray('\nView with: cat ' + filepath + '\n'));
52
263
 
53
264
  } catch (error) {
54
- spinner.fail(chalk.red('Failed to analyze medical imaging'));
55
- console.error(chalk.red(error.message));
265
+ spinner.fail('Failed to analyze medical image');
266
+ console.error(chalk.red(error.response?.data?.error || error.message));
56
267
  }
57
268
  }
58
269
 
@@ -17,8 +17,8 @@ const {
17
17
  sleep,
18
18
  PremiumSpinner,
19
19
  animateProgressBar,
20
- calculateMissionHealth, // Added
21
- displayMissionHealth, // Added
20
+ calculateMissionHealth,
21
+ displayMissionHealth,
22
22
  } = require('../utils/display');
23
23
 
24
24
  const REPORTS_DIR = path.join(os.homedir(), 'obx-reports');
@@ -154,12 +154,29 @@ async function paper(file) {
154
154
 
155
155
  console.log(chalk.gray(`\n📊 Model: ${result.model}`));
156
156
  console.log(chalk.gray(`💰 RCC Cost: ${result.rccCost}`));
157
-
157
+ console.log(chalk.gray(`💳 Remaining Balance: ${result.rccBalance} RCC\n`));
158
+
159
+ // 🔥 Display the analysis
158
160
  await typeAIResponse(result.response);
159
-
161
+
162
+ // Research score
160
163
  const score = generateResearchScore(result.response);
161
164
  await displayResearchScore(score);
162
-
165
+
166
+ // Artifacts
167
+ const artifacts = [
168
+ { icon: '📄', name: 'Paper Analysis' },
169
+ { icon: '🔍', name: 'Key Claims' },
170
+ { icon: '📊', name: 'Methodology Evaluation' },
171
+ { icon: '⚠️', name: 'Limitations' }
172
+ ];
173
+ await displayArtifacts(artifacts);
174
+
175
+ // Save report
176
+ const filepath = saveReport(file, result.response, missionName);
177
+ console.log(chalk.green(`✓ Report saved to: ${filepath}`));
178
+ console.log(chalk.gray('\nView with: cat ' + filepath + '\n'));
179
+
163
180
  } catch (error) {
164
181
  spinner.fail('Failed to analyze paper');
165
182
  console.error(chalk.red(error.response?.data?.error || error.message));
@@ -203,9 +220,29 @@ async function compare(files) {
203
220
 
204
221
  console.log(chalk.gray(`\n📊 Model: ${result.model}`));
205
222
  console.log(chalk.gray(`💰 RCC Cost: ${result.rccCost}`));
206
-
223
+ console.log(chalk.gray(`💳 Remaining Balance: ${result.rccBalance} RCC\n`));
224
+
225
+ // 🔥 Display the comparison
207
226
  await typeAIResponse(result.response);
208
-
227
+
228
+ // Research score
229
+ const score = generateResearchScore(result.response);
230
+ await displayResearchScore(score);
231
+
232
+ // Artifacts
233
+ const artifacts = [
234
+ { icon: '📊', name: 'Comparison Matrix' },
235
+ { icon: '⚠️', name: 'Contradiction Report' },
236
+ { icon: '🔍', name: 'Methodology Comparison' },
237
+ { icon: '✍️', name: 'Synthesis Report' }
238
+ ];
239
+ await displayArtifacts(artifacts);
240
+
241
+ // Save report
242
+ const filepath = saveReport(files.join('_'), result.response, missionName);
243
+ console.log(chalk.green(`✓ Report saved to: ${filepath}`));
244
+ console.log(chalk.gray('\nView with: cat ' + filepath + '\n'));
245
+
209
246
  } catch (error) {
210
247
  spinner.fail('Failed to compare papers');
211
248
  console.error(chalk.red(error.response?.data?.error || error.message));