ruvector/examples/edge-net/sim/dist/network.d.ts
rUv bc783c8fa9 feat(edge-net): add Pi-Key crypto, lifecycle simulation, optimizations
- Add Pi-Key WASM cryptographic module with mathematical constant sizing
  - Pi-sized (314 bits/40 bytes) identity keys
  - Euler-sized (271 bits/34 bytes) session keys
  - Phi-sized (161 bits/21 bytes) genesis keys
  - Ed25519 signing + AES-256-GCM encryption

- Add comprehensive TypeScript lifecycle simulation (sim/)
  - 6 source files, 1,420 lines
  - Validates all 4 phases: Genesis → Growth → Maturation → Independence
  - Economic sustainability and phase transition testing

- Performance optimizations
  - FxHashMap for 30-50% faster lookups in evolution/mod.rs
  - VecDeque for O(1) front removal
  - Batched Q-learning updates in security/mod.rs
  - Fixed borrow checker error in process_batch_updates()

- Add benchmarks and documentation
  - BENCHMARKS.md with performance metrics
  - PERFORMANCE_OPTIMIZATIONS.md with details
  - docs/FINAL_REPORT.md comprehensive summary

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 01:29:11 +00:00

104 lines
No EOL
2.5 KiB
TypeScript

/**
* Network State Management
* Manages the P2P network state and phase transitions
*/
import { Cell } from './cell.js';
export declare enum NetworkPhase {
GENESIS = "genesis",// 0 - 10K nodes
GROWTH = "growth",// 10K - 50K nodes
MATURATION = "maturation",// 50K - 100K nodes
INDEPENDENCE = "independence"
}
export interface NetworkConfig {
genesisNodeCount: number;
targetNodeCount: number;
nodesPerTick: number;
taskGenerationRate: number;
baseTaskReward: number;
connectionCost: number;
maxConnectionsPerNode: number;
}
export declare class Network {
cells: Map<string, Cell>;
currentPhase: NetworkPhase;
currentTick: number;
config: NetworkConfig;
genesisCells: Set<string>;
private taskQueue;
constructor(config?: Partial<NetworkConfig>);
/**
* Initialize network with genesis nodes
*/
initialize(): void;
/**
* Connect all genesis nodes to each other
*/
private connectGenesisNodes;
/**
* Add new regular nodes to the network
*/
spawnNodes(count: number): void;
/**
* Connect a new node to the network
*/
private connectNewNode;
/**
* Select targets using preferential attachment
*/
private selectPreferentialTargets;
/**
* Generate tasks for the network
*/
private generateTasks;
/**
* Distribute tasks to capable cells
*/
private distributeTasks;
/**
* Update network phase based on node count
*/
private updatePhase;
/**
* Handle phase transition events
*/
private onPhaseTransition;
/**
* Simulate one tick of the network
*/
tick(): void;
/**
* Get network statistics
*/
getStats(): {
tick: number;
phase: NetworkPhase;
nodeCount: number;
genesisNodes: {
count: number;
active: number;
readOnly: number;
retired: number;
avgMultiplier: number;
};
regularNodes: {
count: number;
};
economy: {
totalEnergy: number;
totalEarned: number;
totalSpent: number;
netEnergy: number;
avgEnergyPerNode: number;
};
tasks: {
completed: number;
queued: number;
avgPerNode: number;
};
network: {
avgConnections: number;
avgSuccessRate: number;
};
};
}
//# sourceMappingURL=network.d.ts.map