genesis-ai-cli 13.3.1 → 13.4.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.
|
@@ -80,6 +80,8 @@ export interface CycleResult {
|
|
|
80
80
|
costsIncurred: number;
|
|
81
81
|
nessDeviation: number;
|
|
82
82
|
phaseChanged: boolean;
|
|
83
|
+
contractionStable: boolean;
|
|
84
|
+
dampingApplied: number;
|
|
83
85
|
errors: string[];
|
|
84
86
|
}
|
|
85
87
|
export declare class AutonomousController {
|
|
@@ -131,13 +133,23 @@ export declare class AutonomousController {
|
|
|
131
133
|
* Get monthly revenue estimate (extrapolated from recent data).
|
|
132
134
|
*/
|
|
133
135
|
estimateMonthlyRevenue(): number;
|
|
136
|
+
/**
|
|
137
|
+
* Get monthly cost estimate (extrapolated from recent data).
|
|
138
|
+
*/
|
|
139
|
+
private estimateMonthlyCosts;
|
|
140
|
+
/**
|
|
141
|
+
* Get allocation vector for contraction monitoring.
|
|
142
|
+
*/
|
|
143
|
+
private getAllocationVector;
|
|
144
|
+
/**
|
|
145
|
+
* Get ROI vector for contraction monitoring.
|
|
146
|
+
*/
|
|
147
|
+
private getROIVector;
|
|
134
148
|
private executeActivities;
|
|
135
149
|
private executeActivity;
|
|
136
150
|
private maintenance;
|
|
137
151
|
private checkPhaseTransition;
|
|
138
152
|
private unlockPhaseActivities;
|
|
139
|
-
private buildNESSObservation;
|
|
140
|
-
private computeQuality;
|
|
141
153
|
private getActivityStatuses;
|
|
142
154
|
}
|
|
143
155
|
export declare function getAutonomousController(config?: Partial<AutonomousConfig>): AutonomousController;
|
|
@@ -33,6 +33,7 @@ exports.resetAutonomousController = resetAutonomousController;
|
|
|
33
33
|
const fiber_js_1 = require("./fiber.js");
|
|
34
34
|
const ness_js_1 = require("./ness.js");
|
|
35
35
|
const capital_allocator_js_1 = require("./capital-allocator.js");
|
|
36
|
+
const economic_intelligence_js_1 = require("./economic-intelligence.js");
|
|
36
37
|
const keeper_js_1 = require("./generators/keeper.js");
|
|
37
38
|
const bounty_hunter_js_1 = require("./generators/bounty-hunter.js");
|
|
38
39
|
const mcp_marketplace_js_1 = require("./infrastructure/mcp-marketplace.js");
|
|
@@ -332,30 +333,54 @@ class AutonomousController {
|
|
|
332
333
|
costsIncurred: 0,
|
|
333
334
|
nessDeviation: 0,
|
|
334
335
|
phaseChanged: false,
|
|
336
|
+
contractionStable: true,
|
|
337
|
+
dampingApplied: 1.0,
|
|
335
338
|
errors: [],
|
|
336
339
|
};
|
|
337
340
|
try {
|
|
338
341
|
// 1. OBSERVE: Gather current state
|
|
339
342
|
const fiber = (0, fiber_js_1.getEconomicFiber)();
|
|
340
|
-
const global = fiber.getGlobalSection();
|
|
341
|
-
// 2. ALLOCATE: Rebalance portfolio
|
|
342
343
|
const allocator = (0, capital_allocator_js_1.getCapitalAllocator)();
|
|
343
|
-
|
|
344
|
+
const contraction = (0, economic_intelligence_js_1.getEconomicContraction)();
|
|
345
|
+
// 2. CONTRACTION CHECK: Feed damping from previous cycle's stability
|
|
346
|
+
const currentAllocations = this.getAllocationVector(allocator);
|
|
347
|
+
const currentROIs = this.getROIVector(allocator);
|
|
348
|
+
const contractionState = contraction.observe(currentAllocations, currentROIs);
|
|
349
|
+
result.contractionStable = contractionState.stable;
|
|
350
|
+
result.dampingApplied = contractionState.dampingRecommended;
|
|
351
|
+
// Apply contraction-informed damping to allocator
|
|
352
|
+
allocator.setDamping(contractionState.dampingRecommended);
|
|
353
|
+
// 3. ALLOCATE: Leapfrog step with stability-adjusted damping
|
|
344
354
|
if (allocator.needsRebalance()) {
|
|
345
|
-
|
|
355
|
+
allocator.step();
|
|
346
356
|
}
|
|
347
|
-
//
|
|
357
|
+
// 4. EXECUTE: EFE-based action selection (Active Inference)
|
|
348
358
|
const executed = await this.executeActivities();
|
|
349
359
|
result.activitiesExecuted = executed.map(e => e.id);
|
|
350
360
|
result.revenueGenerated = executed.reduce((s, e) => s + e.revenue, 0);
|
|
351
361
|
result.costsIncurred = executed.reduce((s, e) => s + e.cost, 0);
|
|
352
362
|
this.totalRevenue += result.revenueGenerated;
|
|
353
363
|
this.totalCosts += result.costsIncurred;
|
|
354
|
-
//
|
|
355
|
-
const
|
|
356
|
-
|
|
364
|
+
// 5. NESS MONITOR: Activity-based steady state (not customer-based)
|
|
365
|
+
const autonomousNESS = (0, economic_intelligence_js_1.getAutonomousNESS)({
|
|
366
|
+
targetMonthlyRevenue: this.config.nessTarget.monthlyRevenue,
|
|
367
|
+
targetMonthlyCosts: this.config.nessTarget.monthlyCosts,
|
|
368
|
+
activityCount: allocator.getActivities().filter(a => a.active).length,
|
|
369
|
+
});
|
|
370
|
+
const nessState = autonomousNESS.observe({
|
|
371
|
+
monthlyRevenue: this.estimateMonthlyRevenue(),
|
|
372
|
+
monthlyCosts: this.estimateMonthlyCosts(),
|
|
373
|
+
roiPerActivity: currentROIs,
|
|
374
|
+
allocations: currentAllocations,
|
|
375
|
+
});
|
|
357
376
|
result.nessDeviation = nessState.deviation;
|
|
358
|
-
//
|
|
377
|
+
// 6. RECORD EFE RESULTS: Update intelligence history
|
|
378
|
+
const efe = (0, economic_intelligence_js_1.getEconomicEFE)();
|
|
379
|
+
for (const exec of executed) {
|
|
380
|
+
const roi = exec.cost > 0 ? exec.revenue / exec.cost : exec.revenue > 0 ? 10 : 0;
|
|
381
|
+
efe.recordExecution(exec.id, roi);
|
|
382
|
+
}
|
|
383
|
+
// 7. PHASE CHECK: Upgrade if threshold met
|
|
359
384
|
const monthlyRevenue = this.estimateMonthlyRevenue();
|
|
360
385
|
const newPhase = this.checkPhaseTransition(monthlyRevenue);
|
|
361
386
|
if (newPhase !== this.currentPhase) {
|
|
@@ -363,8 +388,12 @@ class AutonomousController {
|
|
|
363
388
|
this.unlockPhaseActivities(newPhase);
|
|
364
389
|
result.phaseChanged = true;
|
|
365
390
|
}
|
|
366
|
-
//
|
|
391
|
+
// 8. MAINTENANCE: Process escrows, check bounty payouts
|
|
367
392
|
await this.maintenance();
|
|
393
|
+
// Log contraction warnings
|
|
394
|
+
if (contractionState.warnings.length > 0) {
|
|
395
|
+
result.errors.push(...contractionState.warnings);
|
|
396
|
+
}
|
|
368
397
|
}
|
|
369
398
|
catch (error) {
|
|
370
399
|
result.errors.push(String(error));
|
|
@@ -397,12 +426,33 @@ class AutonomousController {
|
|
|
397
426
|
*/
|
|
398
427
|
getState() {
|
|
399
428
|
const fiber = (0, fiber_js_1.getEconomicFiber)();
|
|
400
|
-
const ness = (0, ness_js_1.getNESSMonitor)();
|
|
401
429
|
const allocator = (0, capital_allocator_js_1.getCapitalAllocator)();
|
|
430
|
+
const autonomousNESS = (0, economic_intelligence_js_1.getAutonomousNESS)();
|
|
402
431
|
const global = fiber.getGlobalSection();
|
|
403
|
-
const
|
|
432
|
+
const currentAllocations = this.getAllocationVector(allocator);
|
|
433
|
+
const currentROIs = this.getROIVector(allocator);
|
|
434
|
+
const autonomousState = autonomousNESS.observe({
|
|
435
|
+
monthlyRevenue: this.estimateMonthlyRevenue(),
|
|
436
|
+
monthlyCosts: this.estimateMonthlyCosts(),
|
|
437
|
+
roiPerActivity: currentROIs,
|
|
438
|
+
allocations: currentAllocations,
|
|
439
|
+
});
|
|
440
|
+
// Map AutonomousNESSState to legacy NESSState interface
|
|
441
|
+
const balance = this.config.seedCapital + this.totalRevenue - this.totalCosts;
|
|
442
|
+
const monthlyCosts = this.estimateMonthlyCosts();
|
|
443
|
+
const runway = monthlyCosts > 0 ? balance / (monthlyCosts / 30) : Infinity;
|
|
444
|
+
const nessState = {
|
|
445
|
+
deviation: autonomousState.deviation,
|
|
446
|
+
solenoidalMagnitude: autonomousState.qGammaRatio,
|
|
447
|
+
dissipativeMagnitude: 1.0 / Math.max(autonomousState.qGammaRatio, 0.01),
|
|
448
|
+
qGammaRatio: autonomousState.qGammaRatio,
|
|
449
|
+
convergenceRate: autonomousState.convergenceRate,
|
|
450
|
+
estimatedCyclesToNESS: autonomousState.estimatedCyclesToNESS,
|
|
451
|
+
atSteadyState: autonomousState.atSteadyState,
|
|
452
|
+
runway,
|
|
453
|
+
};
|
|
404
454
|
const allocation = {
|
|
405
|
-
hamiltonian: { q:
|
|
455
|
+
hamiltonian: { q: currentAllocations, p: currentAllocations.map(() => 0) },
|
|
406
456
|
allocations: allocator.getAllocations(),
|
|
407
457
|
rois: new Map(),
|
|
408
458
|
totalBudget: allocator.getTotalBudget(),
|
|
@@ -436,8 +486,15 @@ class AutonomousController {
|
|
|
436
486
|
* Check if the system is at NESS (self-sustaining).
|
|
437
487
|
*/
|
|
438
488
|
isAtNESS() {
|
|
439
|
-
const
|
|
440
|
-
|
|
489
|
+
const allocator = (0, capital_allocator_js_1.getCapitalAllocator)();
|
|
490
|
+
const autonomousNESS = (0, economic_intelligence_js_1.getAutonomousNESS)();
|
|
491
|
+
const state = autonomousNESS.observe({
|
|
492
|
+
monthlyRevenue: this.estimateMonthlyRevenue(),
|
|
493
|
+
monthlyCosts: this.estimateMonthlyCosts(),
|
|
494
|
+
roiPerActivity: this.getROIVector(allocator),
|
|
495
|
+
allocations: this.getAllocationVector(allocator),
|
|
496
|
+
});
|
|
497
|
+
return state.atSteadyState;
|
|
441
498
|
}
|
|
442
499
|
/**
|
|
443
500
|
* Get monthly revenue estimate (extrapolated from recent data).
|
|
@@ -446,33 +503,60 @@ class AutonomousController {
|
|
|
446
503
|
const uptimeMonths = Math.max((Date.now() - this.startedAt) / (30 * 86400000), 0.001);
|
|
447
504
|
return this.totalRevenue / uptimeMonths;
|
|
448
505
|
}
|
|
506
|
+
/**
|
|
507
|
+
* Get monthly cost estimate (extrapolated from recent data).
|
|
508
|
+
*/
|
|
509
|
+
estimateMonthlyCosts() {
|
|
510
|
+
const uptimeMonths = Math.max((Date.now() - this.startedAt) / (30 * 86400000), 0.001);
|
|
511
|
+
return this.totalCosts / uptimeMonths;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Get allocation vector for contraction monitoring.
|
|
515
|
+
*/
|
|
516
|
+
getAllocationVector(allocator) {
|
|
517
|
+
const activities = allocator.getActivities().filter(a => a.active);
|
|
518
|
+
const allocMap = allocator.getAllocations();
|
|
519
|
+
return activities.map(a => allocMap.get(a.id) ?? 0);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Get ROI vector for contraction monitoring.
|
|
523
|
+
*/
|
|
524
|
+
getROIVector(allocator) {
|
|
525
|
+
const activities = allocator.getActivities().filter(a => a.active);
|
|
526
|
+
const fiber = (0, fiber_js_1.getEconomicFiber)();
|
|
527
|
+
return activities.map(a => fiber.getFiber(a.id)?.roi ?? a.estimatedROI);
|
|
528
|
+
}
|
|
449
529
|
// ============================================================================
|
|
450
530
|
// Private
|
|
451
531
|
// ============================================================================
|
|
452
532
|
async executeActivities() {
|
|
453
533
|
const results = [];
|
|
454
534
|
const allocator = (0, capital_allocator_js_1.getCapitalAllocator)();
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
});
|
|
535
|
+
const efe = (0, economic_intelligence_js_1.getEconomicEFE)();
|
|
536
|
+
const activeActivities = allocator.getActivities().filter(a => a.active);
|
|
537
|
+
const allocations = allocator.getAllocations();
|
|
538
|
+
// Score all activities using Expected Free Energy
|
|
539
|
+
const scores = efe.scoreActivities(activeActivities, allocations);
|
|
540
|
+
// Select activities via Boltzmann sampling (Active Inference)
|
|
541
|
+
const selected = new Set();
|
|
463
542
|
let executed = 0;
|
|
464
|
-
|
|
465
|
-
|
|
543
|
+
while (executed < this.config.maxConcurrentActivities && selected.size < activeActivities.length) {
|
|
544
|
+
const remainingScores = scores.filter(s => !selected.has(s.activityId));
|
|
545
|
+
if (remainingScores.length === 0)
|
|
546
|
+
break;
|
|
547
|
+
const activityId = efe.selectAction(remainingScores);
|
|
548
|
+
if (!activityId || selected.has(activityId))
|
|
466
549
|
break;
|
|
550
|
+
selected.add(activityId);
|
|
467
551
|
try {
|
|
468
|
-
const result = await this.executeActivity(
|
|
552
|
+
const result = await this.executeActivity(activityId);
|
|
469
553
|
if (result) {
|
|
470
554
|
results.push(result);
|
|
471
555
|
executed++;
|
|
472
556
|
}
|
|
473
557
|
}
|
|
474
558
|
catch (error) {
|
|
475
|
-
this.errors.push(`${
|
|
559
|
+
this.errors.push(`${activityId}: ${error}`);
|
|
476
560
|
}
|
|
477
561
|
}
|
|
478
562
|
return results;
|
|
@@ -663,29 +747,6 @@ class AutonomousController {
|
|
|
663
747
|
allocator.setActivityActive(activityId, true);
|
|
664
748
|
}
|
|
665
749
|
}
|
|
666
|
-
buildNESSObservation() {
|
|
667
|
-
const monthlyRevenue = this.estimateMonthlyRevenue();
|
|
668
|
-
const uptimeMonths = Math.max((Date.now() - this.startedAt) / (30 * 86400000), 0.001);
|
|
669
|
-
const monthlyCosts = this.totalCosts / uptimeMonths;
|
|
670
|
-
const balance = this.config.seedCapital + this.totalRevenue - this.totalCosts;
|
|
671
|
-
return {
|
|
672
|
-
revenue: monthlyRevenue,
|
|
673
|
-
costs: monthlyCosts,
|
|
674
|
-
customers: 0, // Autonomous: no customers
|
|
675
|
-
quality: this.computeQuality(),
|
|
676
|
-
balance,
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
computeQuality() {
|
|
680
|
-
// Quality = success rate across all activities
|
|
681
|
-
const keeper = (0, keeper_js_1.getKeeperExecutor)();
|
|
682
|
-
const hunter = (0, bounty_hunter_js_1.getBountyHunter)();
|
|
683
|
-
const keeperStats = keeper.getStats();
|
|
684
|
-
const hunterStats = hunter.getStats();
|
|
685
|
-
const totalOps = keeperStats.totalExecutions + hunterStats.bountiesSubmitted;
|
|
686
|
-
const successOps = keeperStats.successfulExecutions + hunterStats.bountiesAccepted;
|
|
687
|
-
return totalOps > 0 ? successOps / totalOps : 0.8; // Default to 0.8 before data
|
|
688
|
-
}
|
|
689
750
|
getActivityStatuses() {
|
|
690
751
|
const allocator = (0, capital_allocator_js_1.getCapitalAllocator)();
|
|
691
752
|
const fiber = (0, fiber_js_1.getEconomicFiber)();
|
|
@@ -128,6 +128,7 @@ export { EconomicFiber, getEconomicFiber, resetEconomicFiber, type ModuleFiber,
|
|
|
128
128
|
export { NESSMonitor, getNESSMonitor, resetNESSMonitor, type NESSConfig, type NESSState, type NESSObservation, } from './ness.js';
|
|
129
129
|
export { AutonomousController, getAutonomousController, resetAutonomousController, type AutonomousConfig, type ControllerState, type ActivityStatus, type CycleResult, type PhaseConfig, } from './autonomous.js';
|
|
130
130
|
export { CapitalAllocator, getCapitalAllocator, resetCapitalAllocator, type ActivityProfile, type AllocationState, type AllocatorConfig, } from './capital-allocator.js';
|
|
131
|
+
export { AutonomousNESS, getAutonomousNESS, EconomicEFE, getEconomicEFE, EconomicContraction, getEconomicContraction, resetEconomicIntelligence, type AutonomousNESSConfig, type AutonomousNESSState, type EFEScore, type EFEConfig, type EconomicContractionState, } from './economic-intelligence.js';
|
|
131
132
|
export { KeeperExecutor, getKeeperExecutor, resetKeeperExecutor, BountyHunter, getBountyHunter, resetBountyHunter, ContentEngine, getContentEngine, resetContentEngine, SmartContractAuditor, getSmartContractAuditor, resetSmartContractAuditor, } from './generators/index.js';
|
|
132
133
|
export { MCPMarketplace, getMCPMarketplace, resetMCPMarketplace, X402Facilitator, getX402Facilitator, resetX402Facilitator, MemoryService, getMemoryService, resetMemoryService, MetaOrchestrator, getMetaOrchestrator, resetMetaOrchestrator, } from './infrastructure/index.js';
|
|
133
134
|
export { YieldOptimizer, getYieldOptimizer, resetYieldOptimizer, ComputeProvider, getComputeProvider, resetComputeProvider, } from './assets/index.js';
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* All MCP interactions are mocked until real servers are connected.
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.
|
|
14
|
-
exports.resetCrossL2Arbitrageur = exports.getCrossL2Arbitrageur = exports.CrossL2Arbitrageur = void 0;
|
|
13
|
+
exports.getYieldOptimizer = exports.YieldOptimizer = exports.resetMetaOrchestrator = exports.getMetaOrchestrator = exports.MetaOrchestrator = exports.resetMemoryService = exports.getMemoryService = exports.MemoryService = exports.resetX402Facilitator = exports.getX402Facilitator = exports.X402Facilitator = exports.resetMCPMarketplace = exports.getMCPMarketplace = exports.MCPMarketplace = exports.resetSmartContractAuditor = exports.getSmartContractAuditor = exports.SmartContractAuditor = exports.resetContentEngine = exports.getContentEngine = exports.ContentEngine = exports.resetBountyHunter = exports.getBountyHunter = exports.BountyHunter = exports.resetKeeperExecutor = exports.getKeeperExecutor = exports.KeeperExecutor = exports.resetEconomicIntelligence = exports.getEconomicContraction = exports.EconomicContraction = exports.getEconomicEFE = exports.EconomicEFE = exports.getAutonomousNESS = exports.AutonomousNESS = exports.resetCapitalAllocator = exports.getCapitalAllocator = exports.CapitalAllocator = exports.resetAutonomousController = exports.getAutonomousController = exports.AutonomousController = exports.resetNESSMonitor = exports.getNESSMonitor = exports.NESSMonitor = exports.resetEconomicFiber = exports.getEconomicFiber = exports.EconomicFiber = exports.EconomicSystem = exports.BudgetManager = exports.X402Protocol = exports.CryptoWallet = exports.StripeTreasury = void 0;
|
|
14
|
+
exports.resetCrossL2Arbitrageur = exports.getCrossL2Arbitrageur = exports.CrossL2Arbitrageur = exports.resetGrantsManager = exports.getGrantsManager = exports.GrantsManager = exports.resetComputeProvider = exports.getComputeProvider = exports.ComputeProvider = exports.resetYieldOptimizer = void 0;
|
|
15
15
|
exports.getEconomicSystem = getEconomicSystem;
|
|
16
16
|
const index_js_1 = require("../mcp/index.js");
|
|
17
17
|
// ============================================================================
|
|
@@ -384,6 +384,15 @@ var capital_allocator_js_1 = require("./capital-allocator.js");
|
|
|
384
384
|
Object.defineProperty(exports, "CapitalAllocator", { enumerable: true, get: function () { return capital_allocator_js_1.CapitalAllocator; } });
|
|
385
385
|
Object.defineProperty(exports, "getCapitalAllocator", { enumerable: true, get: function () { return capital_allocator_js_1.getCapitalAllocator; } });
|
|
386
386
|
Object.defineProperty(exports, "resetCapitalAllocator", { enumerable: true, get: function () { return capital_allocator_js_1.resetCapitalAllocator; } });
|
|
387
|
+
// Economic Intelligence (Active Inference, v15.0)
|
|
388
|
+
var economic_intelligence_js_1 = require("./economic-intelligence.js");
|
|
389
|
+
Object.defineProperty(exports, "AutonomousNESS", { enumerable: true, get: function () { return economic_intelligence_js_1.AutonomousNESS; } });
|
|
390
|
+
Object.defineProperty(exports, "getAutonomousNESS", { enumerable: true, get: function () { return economic_intelligence_js_1.getAutonomousNESS; } });
|
|
391
|
+
Object.defineProperty(exports, "EconomicEFE", { enumerable: true, get: function () { return economic_intelligence_js_1.EconomicEFE; } });
|
|
392
|
+
Object.defineProperty(exports, "getEconomicEFE", { enumerable: true, get: function () { return economic_intelligence_js_1.getEconomicEFE; } });
|
|
393
|
+
Object.defineProperty(exports, "EconomicContraction", { enumerable: true, get: function () { return economic_intelligence_js_1.EconomicContraction; } });
|
|
394
|
+
Object.defineProperty(exports, "getEconomicContraction", { enumerable: true, get: function () { return economic_intelligence_js_1.getEconomicContraction; } });
|
|
395
|
+
Object.defineProperty(exports, "resetEconomicIntelligence", { enumerable: true, get: function () { return economic_intelligence_js_1.resetEconomicIntelligence; } });
|
|
387
396
|
// Generators
|
|
388
397
|
var index_js_2 = require("./generators/index.js");
|
|
389
398
|
Object.defineProperty(exports, "KeeperExecutor", { enumerable: true, get: function () { return index_js_2.KeeperExecutor; } });
|
package/dist/src/genesis.d.ts
CHANGED
|
@@ -84,6 +84,20 @@ export interface GenesisStatus {
|
|
|
84
84
|
netFlow: number;
|
|
85
85
|
sustainable: boolean;
|
|
86
86
|
} | null;
|
|
87
|
+
dashboard: {
|
|
88
|
+
running: boolean;
|
|
89
|
+
url: string;
|
|
90
|
+
} | null;
|
|
91
|
+
memorySync: {
|
|
92
|
+
syncCount: number;
|
|
93
|
+
isRunning: boolean;
|
|
94
|
+
} | null;
|
|
95
|
+
sensorimotor: {
|
|
96
|
+
running: boolean;
|
|
97
|
+
cycles: number;
|
|
98
|
+
avgPredictionError: number;
|
|
99
|
+
} | null;
|
|
100
|
+
calibrationError: number;
|
|
87
101
|
uptime: number;
|
|
88
102
|
cycleCount: number;
|
|
89
103
|
}
|
package/dist/src/genesis.js
CHANGED
|
@@ -274,6 +274,12 @@ class Genesis {
|
|
|
274
274
|
(0, dashboard_js_1.broadcastToDashboard)(`consciousness:${event.type}`, event.data);
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
|
+
// Wire FEK mode changes → dashboard SSE stream
|
|
278
|
+
if (this.fek) {
|
|
279
|
+
this.fek.onModeChange((mode, prev) => {
|
|
280
|
+
(0, dashboard_js_1.broadcastToDashboard)('kernel:mode', { mode, prev, cycle: this.cycleCount });
|
|
281
|
+
});
|
|
282
|
+
}
|
|
277
283
|
}
|
|
278
284
|
if (this.config.memorySync) {
|
|
279
285
|
this.memorySync = (0, mcp_memory_sync_js_1.getMCPMemorySync)();
|
|
@@ -388,13 +394,16 @@ class Genesis {
|
|
|
388
394
|
const startTime = Date.now();
|
|
389
395
|
let confidence = null;
|
|
390
396
|
let audit = null;
|
|
391
|
-
// Step 0: Shift consciousness attention
|
|
397
|
+
// Step 0: Shift consciousness attention + assess processing depth
|
|
398
|
+
const currentPhi = this.consciousness?.getSnapshot()?.level?.rawPhi ?? 1.0;
|
|
392
399
|
if (this.consciousness) {
|
|
393
400
|
const domain = this.inferDomain(input);
|
|
394
401
|
this.consciousness.attend(`process:${domain}`, 'internal');
|
|
395
402
|
}
|
|
403
|
+
// φ-gated processing: when consciousness is low, skip expensive auditing
|
|
404
|
+
const deepProcessing = currentPhi > 0.2;
|
|
396
405
|
// Step 1: Metacognitive pre-check
|
|
397
|
-
if (this.metacognition) {
|
|
406
|
+
if (this.metacognition && deepProcessing) {
|
|
398
407
|
const domain = this.inferDomain(input);
|
|
399
408
|
if (this.metacognition.shouldDefer(domain)) {
|
|
400
409
|
// Low competence — still process but flag it
|
|
@@ -406,8 +415,8 @@ class Genesis {
|
|
|
406
415
|
if (this.brain) {
|
|
407
416
|
response = await this.brain.process(input);
|
|
408
417
|
}
|
|
409
|
-
// Step 3: Metacognitive audit
|
|
410
|
-
if (this.metacognition && this.config.auditResponses && response) {
|
|
418
|
+
// Step 3: Metacognitive audit (skipped if φ too low)
|
|
419
|
+
if (this.metacognition && this.config.auditResponses && response && deepProcessing) {
|
|
411
420
|
audit = this.metacognition.auditThought(response);
|
|
412
421
|
// Get calibrated confidence
|
|
413
422
|
const domain = this.inferDomain(input);
|
|
@@ -480,6 +489,13 @@ class Genesis {
|
|
|
480
489
|
sustainable: this.fiber?.getGlobalSection().sustainable,
|
|
481
490
|
});
|
|
482
491
|
}
|
|
492
|
+
// Step 7: Feed causal model with outcome data (only in deep processing)
|
|
493
|
+
if (this.causal && confidence && deepProcessing) {
|
|
494
|
+
// Each process() cycle is a data point: observation → belief → action → outcome
|
|
495
|
+
this.causal.setData('observation', [confidence.value]);
|
|
496
|
+
this.causal.setData('outcome', [confidence.value > this.config.deferThreshold ? 1 : 0]);
|
|
497
|
+
this.causal.setData('reward', [1 - cost]); // Higher reward = lower cost
|
|
498
|
+
}
|
|
483
499
|
// Release attention focus after processing
|
|
484
500
|
if (this.consciousness) {
|
|
485
501
|
const domain = this.inferDomain(input);
|
|
@@ -676,6 +692,8 @@ class Genesis {
|
|
|
676
692
|
const nessState = this.lastNESSState;
|
|
677
693
|
const causalGraph = this.causal?.getGraph();
|
|
678
694
|
const curriculum = this.metaRL?.getCurriculum();
|
|
695
|
+
const sensorStats = this.sensorimotor?.stats();
|
|
696
|
+
const syncStats = this.memorySync?.getStats();
|
|
679
697
|
return {
|
|
680
698
|
booted: this.booted,
|
|
681
699
|
levels: { ...this.levels },
|
|
@@ -696,6 +714,14 @@ class Genesis {
|
|
|
696
714
|
selfImprovement: this.selfImprovement !== null,
|
|
697
715
|
ness: nessState,
|
|
698
716
|
fiber: fiberSection ? { netFlow: fiberSection.netFlow, sustainable: fiberSection.sustainable } : null,
|
|
717
|
+
dashboard: this.dashboard ? { running: this.dashboard.isRunning(), url: this.dashboard.getUrl() } : null,
|
|
718
|
+
memorySync: syncStats ? { syncCount: syncStats.syncCount, isRunning: syncStats.isRunning } : null,
|
|
719
|
+
sensorimotor: sensorStats ? {
|
|
720
|
+
running: sensorStats.running,
|
|
721
|
+
cycles: sensorStats.cycles,
|
|
722
|
+
avgPredictionError: sensorStats.avgPredictionError,
|
|
723
|
+
} : null,
|
|
724
|
+
calibrationError: this.getCalibrationError(),
|
|
699
725
|
uptime: this.bootTime > 0 ? Date.now() - this.bootTime : 0,
|
|
700
726
|
cycleCount: this.cycleCount,
|
|
701
727
|
};
|
|
@@ -714,6 +740,9 @@ class Genesis {
|
|
|
714
740
|
if (this.consciousness) {
|
|
715
741
|
this.consciousness.stop();
|
|
716
742
|
}
|
|
743
|
+
if (this.cognitiveWorkspace) {
|
|
744
|
+
this.cognitiveWorkspace.shutdown();
|
|
745
|
+
}
|
|
717
746
|
if (this.memorySync) {
|
|
718
747
|
this.memorySync.stopAutoSync();
|
|
719
748
|
}
|
package/package.json
CHANGED