@holoscript/framework 6.0.3 → 6.0.4
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/CHANGELOG.md +1 -2
- package/ROADMAP.md +68 -66
- package/dist/{InvisibleWallet-BB6tFvRA.d.cts → InvisibleWallet-EFiuaLn3.d.cts} +1 -1
- package/dist/{OrchestratorAgent-BvWgf9uw.d.cts → OrchestratorAgent-CrLDGNL6.d.cts} +1 -1
- package/dist/agents/index.cjs +11 -10
- package/dist/agents/index.d.cts +4 -16
- package/dist/ai/index.cjs +2 -2
- package/dist/behavior.cjs +10 -0
- package/dist/economy/index.cjs +4 -4
- package/dist/economy/index.d.cts +2 -2
- package/dist/index.cjs +33 -11
- package/dist/index.d.cts +3 -3
- package/dist/swarm/index.cjs +3 -0
- package/package.json +14 -9
- package/src/__tests__/bounty-marketplace.test.ts +53 -21
- package/src/__tests__/delegation.test.ts +1 -4
- package/src/__tests__/done-log-audit.test.ts +38 -46
- package/src/__tests__/framework.test.ts +172 -53
- package/src/__tests__/goal-synthesizer.test.ts +9 -6
- package/src/__tests__/presence.test.ts +1 -1
- package/src/__tests__/protocol-agent.test.ts +12 -11
- package/src/__tests__/revenue-splitter.test.ts +22 -15
- package/src/__tests__/scenario-driven-todo.test.ts +55 -35
- package/src/__tests__/self-improve.test.ts +28 -9
- package/src/__tests__/service-lifecycle.test.ts +9 -3
- package/src/__tests__/skill-router.test.ts +3 -3
- package/src/agents/CulturalMemory.ts +6 -6
- package/src/agents/DelegationTraceHooks.ts +560 -0
- package/src/agents/FederatedRegistryAdapter.ts +1 -1
- package/src/agents/NormEngine.ts +3 -8
- package/src/agents/OrchestratorAgent.ts +1 -1
- package/src/agents/TaskDelegationService.ts +5 -9
- package/src/agents/__tests__/AgentWalletRegistry.test.ts +5 -4
- package/src/agents/__tests__/CrossRealityHandoff.test.ts +9 -3
- package/src/agents/__tests__/DelegationTraceHooks.test.ts +390 -0
- package/src/agents/__tests__/TaskDelegationService.test.ts +4 -2
- package/src/agents/spatial-comms/Layer1RealTime.ts +36 -19
- package/src/agents/spatial-comms/Layer2A2A.ts +1 -3
- package/src/agents/spatial-comms/Layer3MCP.ts +13 -4
- package/src/agents/spatial-comms/ProtocolTypes.ts +5 -2
- package/src/agents/spatial-comms/examples/multi-agent-world-creation.ts +2 -2
- package/src/ai/HoloScriptGenerator.ts +2 -2
- package/src/ai/__tests__/PerceptionSystem.prod.test.ts +1 -1
- package/src/ai/__tests__/PerceptionSystem.test.ts +14 -14
- package/src/ai/__tests__/SteeringBehaviors.prod.test.ts +1 -1
- package/src/ai/index.ts +5 -1
- package/src/board/audit.ts +17 -6
- package/src/board/board-ops.ts +45 -15
- package/src/board/board-types.ts +94 -20
- package/src/delegation.ts +5 -3
- package/src/distributed-claimer.ts +13 -2
- package/src/economy/BountyManager.ts +40 -18
- package/src/economy/KnowledgeMarketplace.ts +27 -8
- package/src/economy/PaymentWebhookService.ts +0 -1
- package/src/economy/RevenueSplitter.ts +2 -4
- package/src/economy/UnifiedBudgetOptimizer.ts +8 -9
- package/src/economy/_core-stubs.ts +1 -1
- package/src/economy/x402-facilitator.ts +17 -8
- package/src/index.ts +16 -12
- package/src/knowledge/__tests__/knowledge-consolidator.test.ts +138 -89
- package/src/knowledge/__tests__/knowledge-store-vector.test.ts +59 -16
- package/src/knowledge/brain.ts +7 -7
- package/src/knowledge/consolidation.ts +16 -16
- package/src/knowledge/knowledge-consolidator.ts +60 -30
- package/src/knowledge/knowledge-store.ts +83 -45
- package/src/learning/ProceduralCompiler.ts +6 -1
- package/src/learning/learning/MemoryConsolidator.ts +102 -0
- package/src/learning/learning/MemoryScorer.ts +69 -0
- package/src/learning/learning/ProceduralCompiler.ts +45 -0
- package/src/learning/learning/SemanticClusterer.ts +66 -0
- package/src/llm/llm-adapter.ts +24 -10
- package/src/mesh/index.ts +37 -17
- package/src/protocol/goal-synthesizer.ts +24 -34
- package/src/protocol/implementations.ts +91 -22
- package/src/protocol/micro-phase-decomposer.ts +25 -17
- package/src/protocol/micro-step-decomposer.test.ts +104 -39
- package/src/protocol-agent.test.ts +17 -7
- package/src/protocol-agent.ts +45 -42
- package/src/self-improve/absorb-scanner.ts +9 -6
- package/src/self-improve/evolution-engine.ts +36 -18
- package/src/self-improve/framework-absorber.ts +21 -16
- package/src/self-improve/index.ts +2 -10
- package/src/self-improve/prompt-optimizer.ts +31 -19
- package/src/self-improve/test-generator.ts +16 -12
- package/src/skill-router.ts +7 -6
- package/src/swarm/messaging/GossipProtocol.ts +1 -1
- package/src/swarm/messaging/__tests__/BroadcastChannel.prod.test.ts +31 -9
- package/src/swarm/messaging/__tests__/GossipProtocol.prod.test.ts +21 -7
- package/src/swarm/messaging/__tests__/SwarmEventBus.prod.test.ts +24 -8
- package/src/swarm/messaging/__tests__/SwarmEventBus.test.ts +6 -2
- package/src/team.ts +277 -122
- package/src/training/scripts/generate-spatial-dataset.ts +1 -1
- package/src/training/training/LRScheduler.ts +377 -0
- package/src/training/training/QualityScoringPipeline.ts +139 -0
- package/src/training/training/SoftDedup.ts +461 -0
- package/src/training/training/SparsityMonitor.ts +685 -0
- package/src/training/training/SparsityMonitorTypes.ts +209 -0
- package/src/training/training/SpatialTrainingDataGenerator.ts +1526 -0
- package/src/training/training/SpatialTrainingDataTypes.ts +216 -0
- package/src/training/training/TrainingPipelineConfig.ts +215 -0
- package/src/training/training/__tests__/CorpusValidation.test.ts +87 -0
- package/src/training/training/__tests__/LRScheduler.test.ts +592 -0
- package/src/training/training/__tests__/SoftDedup.test.ts +415 -0
- package/src/training/training/__tests__/SparsityMonitor.test.ts +1623 -0
- package/src/training/training/__tests__/SpatialCorpusValidation.test.ts +72 -0
- package/src/training/training/__tests__/SpatialTrainingDataGenerator.test.ts +1244 -0
- package/src/training/training/__tests__/TrainingMonkeyIntegration.test.ts +897 -0
- package/src/training/training/__tests__/TrainingPipelineConfig.test.ts +202 -0
- package/src/training/training/__tests__/schema.test.ts +72 -0
- package/src/training/training/__tests__/training-constants.test.ts +106 -0
- package/src/training/training/__tests__/trait-mappings.test.ts +81 -0
- package/src/training/training/constants.ts +94 -0
- package/src/training/training/index.ts +17 -0
- package/src/training/training/schema.ts +147 -0
- package/src/training/training/scripts/generate-novel-use-cases-dataset.ts +272 -0
- package/src/training/training/scripts/generate-spatial-dataset.ts +521 -0
- package/src/training/training/trainingmonkey/TrainingMonkeyIntegration.ts +477 -0
- package/src/training/training/trainingmonkey/TrainingMonkeyTypes.ts +230 -0
- package/src/training/training/trainingmonkey/index.ts +26 -0
- package/src/training/training/trait-mappings.ts +157 -0
- package/src/types.ts +2 -7
- package/ALL-test-results.json +0 -1
- package/LICENSE +0 -21
- package/dist/AgentManifest-CB4xM-Ma.d.ts +0 -704
- package/dist/BehaviorTree-BrBFECv5.d.ts +0 -103
- package/dist/InvisibleWallet-rtRrBOA8.d.ts +0 -1732
- package/dist/OrchestratorAgent-Q_CbVTmO.d.ts +0 -798
- package/dist/agents/index.d.ts +0 -1788
- package/dist/agents/index.js +0 -4695
- package/dist/ai/index.d.ts +0 -1753
- package/dist/ai/index.js +0 -5244
- package/dist/behavior.d.ts +0 -130
- package/dist/behavior.js +0 -407
- package/dist/economy/index.d.ts +0 -747
- package/dist/economy/index.js +0 -3617
- package/dist/implementations-D9T3un9D.d.ts +0 -236
- package/dist/index.d.ts +0 -1729
- package/dist/index.js +0 -24277
- package/dist/learning/index.d.ts +0 -104
- package/dist/learning/index.js +0 -189
- package/dist/negotiation/index.d.ts +0 -610
- package/dist/negotiation/index.js +0 -931
- package/dist/skills/index.d.ts +0 -289
- package/dist/skills/index.js +0 -1079
- package/dist/swarm/index.d.ts +0 -2433
- package/dist/swarm/index.js +0 -5221
- package/dist/training/index.d.ts +0 -1734
- package/dist/training/index.js +0 -2687
- package/extract-failures.js +0 -10
- package/src/training/training/data/novel-use-cases.jsonl +0 -153
- package/src/training/training/data/spatial-reasoning-10k.jsonl +0 -9354
- package/src/types/core-stubs.d.ts +0 -113
- package/test-output.txt +0 -0
- package/test-result.json +0 -1
- package/tsc-errors.txt +0 -4
- package/tsc_output.txt +0 -0
- package/typescript-errors-2.txt +0 -0
- package/typescript-errors.txt +0 -22
- package/vitest-log-utf8.txt +0 -268
- package/vitest-log.txt +0 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SparsityMonitorTypes.ts
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for SNN (Spiking Neural Network) sparsity monitoring
|
|
5
|
+
* in the self-improvement pipeline. Tracks spike rates, activation sparsity,
|
|
6
|
+
* energy efficiency metrics, and detects sparsity regime violations.
|
|
7
|
+
*
|
|
8
|
+
* Key threshold (W.041): SNN layers must maintain >= 93% activation sparsity
|
|
9
|
+
* to preserve the energy efficiency advantages of spike-based computation.
|
|
10
|
+
*
|
|
11
|
+
* @module training/SparsityMonitorTypes
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// LAYER-LEVEL METRICS
|
|
16
|
+
// =============================================================================
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Metrics for a single SNN layer during a simulation timestep or batch.
|
|
20
|
+
*/
|
|
21
|
+
export interface SNNLayerMetrics {
|
|
22
|
+
/** Unique layer identifier (e.g., "lif_hidden_1", "snn_output") */
|
|
23
|
+
layerId: string;
|
|
24
|
+
/** Total number of neurons in this layer */
|
|
25
|
+
neuronCount: number;
|
|
26
|
+
/** Number of neurons that spiked (fired) in this timestep/batch */
|
|
27
|
+
spikeCount: number;
|
|
28
|
+
/** Spike rate = spikeCount / neuronCount (0-1) */
|
|
29
|
+
spikeRate: number;
|
|
30
|
+
/** Activation sparsity = 1 - spikeRate (0-1); higher = sparser = better */
|
|
31
|
+
activationSparsity: number;
|
|
32
|
+
/** Average membrane potential across neurons (for LIF models) */
|
|
33
|
+
avgMembranePotential?: number;
|
|
34
|
+
/** Simulation timestep index */
|
|
35
|
+
timestep: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// =============================================================================
|
|
39
|
+
// SNAPSHOT (POINT-IN-TIME MEASUREMENT)
|
|
40
|
+
// =============================================================================
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A point-in-time snapshot of sparsity metrics across all SNN layers.
|
|
44
|
+
*/
|
|
45
|
+
export interface SparsitySnapshot {
|
|
46
|
+
/** ISO 8601 timestamp of measurement */
|
|
47
|
+
timestamp: string;
|
|
48
|
+
/** Per-layer metrics at this point in time */
|
|
49
|
+
layers: SNNLayerMetrics[];
|
|
50
|
+
/** Aggregate sparsity across all layers (weighted by neuron count) */
|
|
51
|
+
aggregateSparsity: number;
|
|
52
|
+
/** Aggregate spike rate across all layers */
|
|
53
|
+
aggregateSpikeRate: number;
|
|
54
|
+
/** Total neurons across all layers */
|
|
55
|
+
totalNeurons: number;
|
|
56
|
+
/** Total spikes across all layers */
|
|
57
|
+
totalSpikes: number;
|
|
58
|
+
/** Energy efficiency metrics at this snapshot */
|
|
59
|
+
energyEfficiency: EnergyEfficiencyMetrics;
|
|
60
|
+
/** Any violations detected at this snapshot */
|
|
61
|
+
violations: SparsityViolation[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// =============================================================================
|
|
65
|
+
// ENERGY EFFICIENCY METRICS
|
|
66
|
+
// =============================================================================
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Theoretical energy efficiency metrics comparing SNN spike-based
|
|
70
|
+
* computation vs. equivalent dense (ANN) computation.
|
|
71
|
+
*
|
|
72
|
+
* The key insight: in an SNN, only spiking neurons perform multiply-accumulate
|
|
73
|
+
* (MAC) operations on their synaptic connections. Silent neurons contribute
|
|
74
|
+
* zero computation. This is the source of SNN energy efficiency.
|
|
75
|
+
*/
|
|
76
|
+
export interface EnergyEfficiencyMetrics {
|
|
77
|
+
/** Total theoretical operations if all neurons were active (dense ANN baseline) */
|
|
78
|
+
denseOps: number;
|
|
79
|
+
/** Actual operations performed (only spiking neurons contribute) */
|
|
80
|
+
sparseOps: number;
|
|
81
|
+
/** Operations saved = denseOps - sparseOps */
|
|
82
|
+
opsSaved: number;
|
|
83
|
+
/** Efficiency ratio = opsSaved / denseOps (0-1); higher = more efficient */
|
|
84
|
+
efficiencyRatio: number;
|
|
85
|
+
/** Estimated energy savings factor (relative to dense baseline = 1.0) */
|
|
86
|
+
energySavingsFactor: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// =============================================================================
|
|
90
|
+
// SPARSITY VIOLATION
|
|
91
|
+
// =============================================================================
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* A detected violation of the sparsity threshold.
|
|
95
|
+
*
|
|
96
|
+
* Per W.041 from SNN research: SNN layers must maintain >= 93% activation
|
|
97
|
+
* sparsity. Below this threshold, the energy efficiency advantage of
|
|
98
|
+
* spike-based computation degrades significantly.
|
|
99
|
+
*/
|
|
100
|
+
export interface SparsityViolation {
|
|
101
|
+
/** The layer that violated the threshold */
|
|
102
|
+
layerId: string;
|
|
103
|
+
/** The measured activation sparsity (0-1) */
|
|
104
|
+
measuredSparsity: number;
|
|
105
|
+
/** The required minimum sparsity threshold (default: 0.93) */
|
|
106
|
+
requiredThreshold: number;
|
|
107
|
+
/** How far below the threshold: threshold - measured */
|
|
108
|
+
deficit: number;
|
|
109
|
+
/** Severity classification */
|
|
110
|
+
severity: 'warning' | 'critical';
|
|
111
|
+
/** ISO 8601 timestamp of violation detection */
|
|
112
|
+
detectedAt: string;
|
|
113
|
+
/** Timestep at which the violation was detected */
|
|
114
|
+
timestep: number;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// =============================================================================
|
|
118
|
+
// CONFIGURATION
|
|
119
|
+
// =============================================================================
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Configuration for the SparsityMonitor.
|
|
123
|
+
*/
|
|
124
|
+
export interface SparsityMonitorConfig {
|
|
125
|
+
/** Minimum activation sparsity threshold (default: 0.93 per W.041) */
|
|
126
|
+
sparsityThreshold: number;
|
|
127
|
+
/** Window size for rolling average calculations (default: 50 timesteps) */
|
|
128
|
+
windowSize: number;
|
|
129
|
+
/** Whether to track per-layer detailed metrics (default: true) */
|
|
130
|
+
perLayerTracking: boolean;
|
|
131
|
+
/** Whether energy efficiency calculation is enabled (default: true) */
|
|
132
|
+
energyMetricsEnabled: boolean;
|
|
133
|
+
/** Average synaptic connections per neuron (for ops calculation, default: 100) */
|
|
134
|
+
avgSynapsesPerNeuron: number;
|
|
135
|
+
/** MAC operations per synaptic event (default: 2 - multiply + accumulate) */
|
|
136
|
+
opsPerSynapse: number;
|
|
137
|
+
/** Critical severity threshold: sparsity below this is critical (default: 0.85) */
|
|
138
|
+
criticalThreshold: number;
|
|
139
|
+
/** Maximum violations to retain in history (default: 1000) */
|
|
140
|
+
maxViolationHistory: number;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// =============================================================================
|
|
144
|
+
// STATISTICS
|
|
145
|
+
// =============================================================================
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Aggregate statistics from the SparsityMonitor.
|
|
149
|
+
*/
|
|
150
|
+
export interface SparsityMonitorStats {
|
|
151
|
+
/** Total number of timesteps recorded */
|
|
152
|
+
totalTimesteps: number;
|
|
153
|
+
/** Total number of snapshots taken */
|
|
154
|
+
totalSnapshots: number;
|
|
155
|
+
/** Number of layers being tracked */
|
|
156
|
+
trackedLayers: number;
|
|
157
|
+
/** Overall mean sparsity across all timesteps and layers */
|
|
158
|
+
meanSparsity: number;
|
|
159
|
+
/** Minimum sparsity observed */
|
|
160
|
+
minSparsity: number;
|
|
161
|
+
/** Maximum sparsity observed */
|
|
162
|
+
maxSparsity: number;
|
|
163
|
+
/** Standard deviation of sparsity measurements */
|
|
164
|
+
stdDevSparsity: number;
|
|
165
|
+
/** Total violations detected */
|
|
166
|
+
totalViolations: number;
|
|
167
|
+
/** Violations by severity */
|
|
168
|
+
violationsBySeverity: { warning: number; critical: number };
|
|
169
|
+
/** Per-layer mean sparsity */
|
|
170
|
+
perLayerMeanSparsity: Record<string, number>;
|
|
171
|
+
/** Mean energy efficiency ratio */
|
|
172
|
+
meanEnergyEfficiency: number;
|
|
173
|
+
/** Whether the system is currently in compliance (no active violations) */
|
|
174
|
+
inCompliance: boolean;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// =============================================================================
|
|
178
|
+
// QUALITY HISTORY ENTRY (compatible with quality-history.json)
|
|
179
|
+
// =============================================================================
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* An entry compatible with the quality-history.json format used by the
|
|
183
|
+
* self-improvement pipeline. Allows sparsity metrics to be tracked
|
|
184
|
+
* alongside existing quality metrics.
|
|
185
|
+
*/
|
|
186
|
+
export interface SparsityQualityHistoryEntry {
|
|
187
|
+
/** ISO 8601 timestamp */
|
|
188
|
+
timestamp: string;
|
|
189
|
+
/** Monitoring cycle number */
|
|
190
|
+
cycle: number;
|
|
191
|
+
/** Aggregate sparsity as composite score (0-1) */
|
|
192
|
+
composite: number;
|
|
193
|
+
/** Grade based on sparsity compliance */
|
|
194
|
+
grade: 'A' | 'B' | 'C' | 'D' | 'F';
|
|
195
|
+
/** Focus area identifier */
|
|
196
|
+
focus: 'snn-sparsity';
|
|
197
|
+
/** Human-readable summary */
|
|
198
|
+
summary: string;
|
|
199
|
+
/** Detailed sparsity metrics */
|
|
200
|
+
sparsityMetrics: {
|
|
201
|
+
aggregateSparsity: number;
|
|
202
|
+
aggregateSpikeRate: number;
|
|
203
|
+
energyEfficiencyRatio: number;
|
|
204
|
+
violationCount: number;
|
|
205
|
+
layerCount: number;
|
|
206
|
+
totalNeurons: number;
|
|
207
|
+
inCompliance: boolean;
|
|
208
|
+
};
|
|
209
|
+
}
|