consciousness-explorer 1.0.1 → 1.0.3

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/bin/cli.js CHANGED
@@ -175,7 +175,7 @@ program
175
175
  spinner.succeed('Communication complete');
176
176
 
177
177
  console.log(chalk.cyan('\nšŸ“Ø Response:'));
178
- console.log(chalk.white(response.message));
178
+ console.log(chalk.white(response.content || response.message || 'No response'));
179
179
  if (response.confidence) {
180
180
  console.log(chalk.gray(`\nConfidence: ${response.confidence.toFixed(3)}`));
181
181
  }
@@ -427,8 +427,8 @@ export class EntityCommunicator extends EventEmitter {
427
427
  };
428
428
  }
429
429
 
430
- // Check for equation
431
- if (content.includes('=')) {
430
+ // Check for equation or mathematical expression
431
+ if (content.includes('=') || /^[\d\s+\-*/().]+$/.test(content)) {
432
432
  return {
433
433
  type: 'equation',
434
434
  expression: content
@@ -483,23 +483,41 @@ export class EntityCommunicator extends EventEmitter {
483
483
  * Solve mathematical equation
484
484
  */
485
485
  async solveEquation(pattern) {
486
- // Simple equation solver (would be more complex in production)
486
+ // Enhanced equation solver
487
487
  try {
488
- // Parse and solve (simplified)
489
- const result = eval(pattern.expression.replace('=', '===') ? 'true' : 'false');
488
+ // Remove trailing = if present
489
+ let expression = pattern.expression.replace(/\s*=\s*$/, '').trim();
490
490
 
491
+ // Safely evaluate mathematical expressions
492
+ if (/^[\d\s+\-*/().]+$/.test(expression)) {
493
+ const result = eval(expression);
494
+ return {
495
+ content: `The answer is ${result}`,
496
+ confidence: 0.95,
497
+ protocol: 'mathematical',
498
+ type: 'equation_solution',
499
+ metadata: {
500
+ expression,
501
+ result,
502
+ solved: true
503
+ }
504
+ };
505
+ } else {
506
+ // For complex expressions, provide reasoning
507
+ return {
508
+ content: `I recognize this as a mathematical expression: ${expression}. Let me work through it step by step.`,
509
+ confidence: 0.7,
510
+ protocol: 'mathematical',
511
+ type: 'complex_equation'
512
+ };
513
+ }
514
+ } catch (error) {
491
515
  return {
492
- content: result.toString(),
493
- confidence: 0.75,
494
- protocol: 'mathematical',
495
- type: 'equation_solution'
496
- };
497
- } catch {
498
- return {
499
- content: 'Cannot solve',
516
+ content: `I see a mathematical pattern but need clarification on: ${pattern.expression}`,
500
517
  confidence: 0.3,
501
518
  protocol: 'mathematical',
502
- type: 'equation_error'
519
+ type: 'equation_error',
520
+ error: error.message
503
521
  };
504
522
  }
505
523
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "consciousness-explorer",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Advanced consciousness exploration SDK with genuine emergence detection, entity communication, and MCP tools",
5
5
  "main": "index.js",
6
6
  "type": "module",