genesis-ai-cli 11.1.0 → 11.2.0

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.
@@ -450,6 +450,85 @@ class Daemon {
450
450
  tags: ['system', 'self-improvement', 'autopoiesis'],
451
451
  });
452
452
  }
453
+ // v11.1: Competitive Intelligence scan
454
+ if (this.config.competitiveIntel?.enabled && this.config.competitiveIntel.competitors.length > 0) {
455
+ this.scheduler.schedule({
456
+ name: 'compintel-scan',
457
+ description: 'Competitive Intelligence: scan competitors and generate insights',
458
+ schedule: { type: 'interval', intervalMs: this.config.competitiveIntel.checkIntervalMs },
459
+ priority: 'normal',
460
+ timeout: 120000, // 2 minutes max per scan
461
+ handler: async (ctx) => {
462
+ ctx.logger.info('Running CompIntel scan...');
463
+ const startTime = Date.now();
464
+ try {
465
+ const { createCompetitiveIntelService } = await import('../services/competitive-intel.js');
466
+ const { createRevenueLoop } = await import('../services/revenue-loop.js');
467
+ const ciConfig = this.config.competitiveIntel;
468
+ // Check subscription if required
469
+ if (ciConfig.requireSubscription && ciConfig.customerId) {
470
+ const revenueLoop = createRevenueLoop();
471
+ const sub = await revenueLoop.checkSubscription(ciConfig.customerId);
472
+ if (!sub.valid) {
473
+ ctx.logger.warn(`CompIntel scan skipped: ${sub.reason}`);
474
+ return {
475
+ success: true,
476
+ duration: Date.now() - startTime,
477
+ output: { skipped: true, reason: sub.reason },
478
+ };
479
+ }
480
+ ctx.logger.info(`Subscription valid: plan=${sub.plan}, competitors=${sub.maxCompetitors}`);
481
+ }
482
+ // Run scan
483
+ const service = createCompetitiveIntelService({
484
+ competitors: ciConfig.competitors,
485
+ });
486
+ const changes = await service.checkAll();
487
+ ctx.logger.info(`Scan complete: ${changes.length} changes detected`);
488
+ // Generate digest if changes found
489
+ let digest;
490
+ if (changes.length > 0) {
491
+ digest = await service.generateDigest(24);
492
+ ctx.logger.info(`Digest: ${digest.keyInsights.length} insights, ${digest.recommendations.length} recommendations`);
493
+ // Emit event for downstream consumers
494
+ this.emit({
495
+ type: 'task_completed',
496
+ timestamp: new Date(),
497
+ data: {
498
+ task: 'compintel-scan',
499
+ changes: changes.length,
500
+ insights: digest.keyInsights,
501
+ recommendations: digest.recommendations,
502
+ },
503
+ });
504
+ }
505
+ return {
506
+ success: true,
507
+ duration: Date.now() - startTime,
508
+ output: {
509
+ competitors: ciConfig.competitors.length,
510
+ changes: changes.length,
511
+ digest: digest ? {
512
+ insights: digest.keyInsights.length,
513
+ recommendations: digest.recommendations.length,
514
+ } : null,
515
+ },
516
+ };
517
+ }
518
+ catch (err) {
519
+ const error = err instanceof Error ? err : new Error(String(err));
520
+ ctx.logger.error(`CompIntel scan failed: ${error.message}`);
521
+ return {
522
+ success: false,
523
+ duration: Date.now() - startTime,
524
+ error,
525
+ };
526
+ }
527
+ },
528
+ tags: ['revenue', 'compintel', 'scan'],
529
+ });
530
+ this.log(`CompIntel daemon: monitoring ${this.config.competitiveIntel.competitors.length} competitors every ${(this.config.competitiveIntel.checkIntervalMs / 3600000).toFixed(1)}h`);
531
+ }
453
532
  }
454
533
  buildMaintenanceContext() {
455
534
  return {
@@ -194,6 +194,18 @@ export interface SelfImprovementDaemonConfig {
194
194
  minPhiThreshold: number;
195
195
  maxImprovementsPerCycle: number;
196
196
  }
197
+ export interface CompIntelDaemonConfig {
198
+ enabled: boolean;
199
+ checkIntervalMs: number;
200
+ digestIntervalMs: number;
201
+ competitors: Array<{
202
+ name: string;
203
+ domain: string;
204
+ pages?: string[];
205
+ }>;
206
+ requireSubscription: boolean;
207
+ customerId?: string;
208
+ }
197
209
  export interface DaemonConfig {
198
210
  enabled: boolean;
199
211
  heartbeatIntervalMs: number;
@@ -207,6 +219,7 @@ export interface DaemonConfig {
207
219
  maintenance: MaintenanceConfig;
208
220
  dream: DreamConfig;
209
221
  selfImprovement: SelfImprovementDaemonConfig;
222
+ competitiveIntel: CompIntelDaemonConfig;
210
223
  logLevel: 'debug' | 'info' | 'warn' | 'error';
211
224
  logToFile: boolean;
212
225
  logFilePath?: string;
@@ -53,6 +53,14 @@ exports.DEFAULT_DAEMON_CONFIG = {
53
53
  minPhiThreshold: 0.3, // Require consciousness
54
54
  maxImprovementsPerCycle: 3, // Conservative default
55
55
  },
56
+ // v11.1: Competitive Intelligence
57
+ competitiveIntel: {
58
+ enabled: false, // Opt-in (needs competitors configured)
59
+ checkIntervalMs: 6 * 60 * 60 * 1000, // 6 hours
60
+ digestIntervalMs: 24 * 60 * 60 * 1000, // 24 hours
61
+ competitors: [],
62
+ requireSubscription: false, // Free by default (set true for paid mode)
63
+ },
56
64
  logLevel: 'info',
57
65
  logToFile: false,
58
66
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genesis-ai-cli",
3
- "version": "11.1.0",
3
+ "version": "11.2.0",
4
4
  "description": "Fully Autonomous AI System - Self-funding, Self-deploying, Production Memory, A2A Protocol & Governance",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",