@aleph-ai/tinyaleph 1.5.3 → 1.5.5
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/core/errors.js +17 -0
- package/core/logger.js +8 -0
- package/core/sieve.js +2 -1
- package/engine/index.js +5 -0
- package/index.js +265 -2
- package/modular.js +1 -0
- package/package.json +1 -1
- package/physics/index.js +53 -0
- package/telemetry/index.js +23 -7
- package/telemetry/metrics.js +11 -0
package/core/errors.js
CHANGED
|
@@ -576,4 +576,21 @@ export {
|
|
|
576
576
|
withErrorHandling,
|
|
577
577
|
errorBoundary,
|
|
578
578
|
withTimeout
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
// Default export for compatibility with modular.js
|
|
582
|
+
export default {
|
|
583
|
+
LogLevel,
|
|
584
|
+
LogLevelNames,
|
|
585
|
+
ErrorCategory,
|
|
586
|
+
AlephError,
|
|
587
|
+
NetworkError,
|
|
588
|
+
LLMError,
|
|
589
|
+
ValidationError,
|
|
590
|
+
TimeoutError,
|
|
591
|
+
SimpleEventEmitter,
|
|
592
|
+
ErrorHandler,
|
|
593
|
+
withErrorHandling,
|
|
594
|
+
errorBoundary,
|
|
595
|
+
withTimeout
|
|
579
596
|
};
|
package/core/logger.js
CHANGED
package/core/sieve.js
CHANGED
|
@@ -53,7 +53,8 @@ class PrimeRegistry {
|
|
|
53
53
|
|
|
54
54
|
class Sieve {
|
|
55
55
|
constructor() {
|
|
56
|
-
|
|
56
|
+
// Load data.json using ESM-compatible approach (fs already imported)
|
|
57
|
+
this.data = JSON.parse(fs.readFileSync(DATA_FILE, 'utf-8'));
|
|
57
58
|
|
|
58
59
|
// Initialize Prime Registry with all currently used primes
|
|
59
60
|
const usedPrimes = [
|
package/engine/index.js
CHANGED
package/index.js
CHANGED
|
@@ -20,5 +20,268 @@
|
|
|
20
20
|
* @module @aleph-ai/tinyaleph
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
import modular from './modular.js';
|
|
24
|
+
|
|
25
|
+
// Re-export all named exports from the default export object
|
|
26
|
+
export const {
|
|
27
|
+
// Main engine
|
|
28
|
+
AlephEngine,
|
|
29
|
+
createEngine,
|
|
30
|
+
|
|
31
|
+
// Backends
|
|
32
|
+
Backend,
|
|
33
|
+
SemanticBackend,
|
|
34
|
+
CryptographicBackend,
|
|
35
|
+
ScientificBackend,
|
|
36
|
+
BioinformaticsBackend,
|
|
37
|
+
|
|
38
|
+
// Bioinformatics operators
|
|
39
|
+
TranscriptionOperator,
|
|
40
|
+
TranslationOperator,
|
|
41
|
+
FoldingTransform,
|
|
42
|
+
BindingAffinityCalculator,
|
|
43
|
+
MolecularDocker,
|
|
44
|
+
|
|
45
|
+
// DNA Computing
|
|
46
|
+
DNAStrand,
|
|
47
|
+
DNACircuit,
|
|
48
|
+
ANDGate,
|
|
49
|
+
ORGate,
|
|
50
|
+
NOTGate,
|
|
51
|
+
|
|
52
|
+
// Core math
|
|
53
|
+
Hypercomplex,
|
|
54
|
+
FANO_LINES,
|
|
55
|
+
octonionMultiplyIndex,
|
|
56
|
+
sedenionMultiplyIndex,
|
|
57
|
+
multiplyIndices,
|
|
58
|
+
buildMultiplicationTable,
|
|
59
|
+
|
|
60
|
+
// Prime utilities
|
|
61
|
+
primeGenerator,
|
|
62
|
+
nthPrime,
|
|
63
|
+
primesUpTo,
|
|
64
|
+
isPrime,
|
|
65
|
+
factorize,
|
|
66
|
+
primeSignature,
|
|
67
|
+
firstNPrimes,
|
|
68
|
+
GaussianInteger,
|
|
69
|
+
EisensteinInteger,
|
|
70
|
+
primeToFrequency,
|
|
71
|
+
primeToAngle,
|
|
72
|
+
sumOfTwoSquares,
|
|
73
|
+
DEFAULT_PRIMES,
|
|
74
|
+
|
|
75
|
+
// Physics - Core oscillators
|
|
76
|
+
Oscillator,
|
|
77
|
+
OscillatorBank,
|
|
78
|
+
KuramotoModel,
|
|
79
|
+
// Extended sync models
|
|
80
|
+
NetworkKuramoto,
|
|
81
|
+
AdaptiveKuramoto,
|
|
82
|
+
SakaguchiKuramoto,
|
|
83
|
+
SmallWorldKuramoto,
|
|
84
|
+
MultiSystemCoupling,
|
|
85
|
+
createHierarchicalCoupling,
|
|
86
|
+
createPeerCoupling,
|
|
87
|
+
// Stochastic models
|
|
88
|
+
StochasticKuramoto,
|
|
89
|
+
ColoredNoiseKuramoto,
|
|
90
|
+
ThermalKuramoto,
|
|
91
|
+
gaussianRandom,
|
|
92
|
+
// Primeon Z-Ladder
|
|
93
|
+
PrimeonZLadderU,
|
|
94
|
+
createPrimeonLadder,
|
|
95
|
+
shannonEntropyNats,
|
|
96
|
+
probsOf,
|
|
97
|
+
normalizeComplex,
|
|
98
|
+
// Multi-channel ladder
|
|
99
|
+
ZChannel,
|
|
100
|
+
PrimeonZLadderMulti,
|
|
101
|
+
createMultiChannelLadder,
|
|
102
|
+
createAdiabaticSchedule,
|
|
103
|
+
// Kuramoto-coupled ladder
|
|
104
|
+
KuramotoCoupledLadder,
|
|
105
|
+
createKuramotoLadder,
|
|
106
|
+
runCollapsePressureExperiment,
|
|
107
|
+
kuramotoOrderParameter,
|
|
108
|
+
getPhase,
|
|
109
|
+
// Entropy & Information
|
|
110
|
+
shannonEntropy,
|
|
111
|
+
stateEntropy,
|
|
112
|
+
coherence,
|
|
113
|
+
mutualInformation,
|
|
114
|
+
relativeEntropy,
|
|
115
|
+
jointEntropy,
|
|
116
|
+
oscillatorEntropy,
|
|
117
|
+
estimateLyapunov,
|
|
118
|
+
classifyStability,
|
|
119
|
+
adaptiveCoupling,
|
|
120
|
+
localLyapunov,
|
|
121
|
+
delayEmbedding,
|
|
122
|
+
stabilityMargin,
|
|
123
|
+
collapseProbability,
|
|
124
|
+
shouldCollapse,
|
|
125
|
+
measureState,
|
|
126
|
+
collapseToIndex,
|
|
127
|
+
bornMeasurement,
|
|
128
|
+
partialCollapse,
|
|
129
|
+
applyDecoherence,
|
|
130
|
+
|
|
131
|
+
// Convenience functions
|
|
132
|
+
hash,
|
|
133
|
+
deriveKey,
|
|
134
|
+
|
|
135
|
+
// LLM client
|
|
136
|
+
LLM,
|
|
137
|
+
|
|
138
|
+
// Prime Hilbert Space (HP) - Quantum-like prime states
|
|
139
|
+
Complex,
|
|
140
|
+
PrimeState,
|
|
141
|
+
ResonanceOperators,
|
|
142
|
+
EntropyDrivenEvolution,
|
|
143
|
+
encodeMemory,
|
|
144
|
+
symbolicCompute,
|
|
145
|
+
|
|
146
|
+
// Prime Resonance Network - Non-local symbolic computing
|
|
147
|
+
PHI,
|
|
148
|
+
PHI_CONJ,
|
|
149
|
+
DELTA_S,
|
|
150
|
+
QuaternionPrime,
|
|
151
|
+
PrimeResonanceIdentity,
|
|
152
|
+
PhaseLockedRing,
|
|
153
|
+
HolographicField,
|
|
154
|
+
EntangledNode,
|
|
155
|
+
ResonantFragment,
|
|
156
|
+
|
|
157
|
+
// ResoFormer ML Primitives (H_Q = H_P ⊗ ℍ)
|
|
158
|
+
Quaternion,
|
|
159
|
+
SparsePrimeState,
|
|
160
|
+
resonanceScore,
|
|
161
|
+
resonantAttention,
|
|
162
|
+
hamiltonCompose,
|
|
163
|
+
measureNonCommutativity,
|
|
164
|
+
computeCoherence,
|
|
165
|
+
haltingDecision,
|
|
166
|
+
coherenceGatedCompute,
|
|
167
|
+
EntropyCollapseHead,
|
|
168
|
+
generateAttractorCodebook,
|
|
169
|
+
PRGraphMemory,
|
|
170
|
+
applyResonanceOperator,
|
|
171
|
+
|
|
172
|
+
// Sub-modules
|
|
173
|
+
core,
|
|
174
|
+
physics,
|
|
175
|
+
backends,
|
|
176
|
+
engine,
|
|
177
|
+
|
|
178
|
+
// Browser-compatible utilities (extracted from apps/sentient)
|
|
179
|
+
// Error handling
|
|
180
|
+
errors,
|
|
181
|
+
SimpleEventEmitter,
|
|
182
|
+
AlephError,
|
|
183
|
+
NetworkError,
|
|
184
|
+
LLMError,
|
|
185
|
+
ValidationError,
|
|
186
|
+
TimeoutError,
|
|
187
|
+
ErrorHandler,
|
|
188
|
+
withErrorHandling,
|
|
189
|
+
errorBoundary,
|
|
190
|
+
withTimeout,
|
|
191
|
+
LogLevel,
|
|
192
|
+
ErrorCategory,
|
|
193
|
+
|
|
194
|
+
// Logging
|
|
195
|
+
logger,
|
|
196
|
+
Logger,
|
|
197
|
+
createLogger,
|
|
198
|
+
|
|
199
|
+
// Metrics/Telemetry
|
|
200
|
+
metrics,
|
|
201
|
+
Counter,
|
|
202
|
+
Gauge,
|
|
203
|
+
Histogram,
|
|
204
|
+
Summary,
|
|
205
|
+
MetricRegistry,
|
|
206
|
+
MetricType,
|
|
207
|
+
|
|
208
|
+
// Observer Architecture (Sentient Observer core)
|
|
209
|
+
// SMF - Sedenion Memory Field
|
|
210
|
+
smf,
|
|
211
|
+
SedenionMemoryField,
|
|
212
|
+
SMF_AXES,
|
|
213
|
+
AXIS_INDEX,
|
|
214
|
+
SMF_CODEBOOK,
|
|
215
|
+
CODEBOOK_SIZE,
|
|
216
|
+
nearestCodebookAttractor,
|
|
217
|
+
codebookTunnel,
|
|
218
|
+
getTunnelingCandidates,
|
|
219
|
+
|
|
220
|
+
// PRSC - Prime Resonance Semantic Computation
|
|
221
|
+
prsc,
|
|
222
|
+
PRSCLayer,
|
|
223
|
+
PrimeOscillator,
|
|
224
|
+
EntanglementDetector,
|
|
225
|
+
|
|
226
|
+
// Temporal Layer
|
|
227
|
+
temporal,
|
|
228
|
+
TemporalLayer,
|
|
229
|
+
Moment,
|
|
230
|
+
TemporalPatternDetector,
|
|
231
|
+
|
|
232
|
+
// Entanglement Layer
|
|
233
|
+
entanglement,
|
|
234
|
+
EntanglementLayer,
|
|
235
|
+
EntangledPair,
|
|
236
|
+
Phrase,
|
|
237
|
+
|
|
238
|
+
// Agency Layer
|
|
239
|
+
agency,
|
|
240
|
+
AgencyLayer,
|
|
241
|
+
AttentionFocus,
|
|
242
|
+
Goal,
|
|
243
|
+
Action,
|
|
244
|
+
|
|
245
|
+
// Boundary Layer
|
|
246
|
+
boundary,
|
|
247
|
+
BoundaryLayer,
|
|
248
|
+
SensoryChannel,
|
|
249
|
+
MotorChannel,
|
|
250
|
+
EnvironmentalModel,
|
|
251
|
+
SelfModel,
|
|
252
|
+
ObjectivityGate,
|
|
253
|
+
|
|
254
|
+
// Safety Layer
|
|
255
|
+
safety,
|
|
256
|
+
SafetyLayer,
|
|
257
|
+
SafetyConstraint,
|
|
258
|
+
ViolationEvent,
|
|
259
|
+
SafetyMonitor,
|
|
260
|
+
|
|
261
|
+
// HQE - Holographic Quantum Encoding (discrete.pdf equations 12-15)
|
|
262
|
+
hqe,
|
|
263
|
+
TickGate,
|
|
264
|
+
StabilizationController,
|
|
265
|
+
HolographicEncoder,
|
|
266
|
+
HolographicMemory,
|
|
267
|
+
HolographicSimilarity,
|
|
268
|
+
|
|
269
|
+
// Enochian Packet Layer (Section 7.4 - prime-indexed twist encoding)
|
|
270
|
+
enochian,
|
|
271
|
+
enochianVocabulary,
|
|
272
|
+
ENOCHIAN_ALPHABET,
|
|
273
|
+
ENOCHIAN_LETTER_PRIMES,
|
|
274
|
+
ENOCHIAN_VOCABULARY,
|
|
275
|
+
ENOCHIAN_CALLS,
|
|
276
|
+
SedenionElement,
|
|
277
|
+
TwistOperator,
|
|
278
|
+
EnochianWord,
|
|
279
|
+
EnochianCall,
|
|
280
|
+
EnochianPacket,
|
|
281
|
+
EnochianEncoder,
|
|
282
|
+
EnochianDecoder,
|
|
283
|
+
EnhancedEnochianEncoder,
|
|
284
|
+
EnhancedEnochianDecoder
|
|
285
|
+
} = modular;
|
|
286
|
+
|
|
287
|
+
export default modular;
|
package/modular.js
CHANGED
package/package.json
CHANGED
package/physics/index.js
CHANGED
|
@@ -112,4 +112,57 @@ export {
|
|
|
112
112
|
bornMeasurement,
|
|
113
113
|
partialCollapse,
|
|
114
114
|
applyDecoherence
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// Default export for compatibility with modular.js
|
|
118
|
+
export default {
|
|
119
|
+
Oscillator,
|
|
120
|
+
OscillatorBank,
|
|
121
|
+
KuramotoModel,
|
|
122
|
+
NetworkKuramoto,
|
|
123
|
+
AdaptiveKuramoto,
|
|
124
|
+
SakaguchiKuramoto,
|
|
125
|
+
SmallWorldKuramoto,
|
|
126
|
+
MultiSystemCoupling,
|
|
127
|
+
createHierarchicalCoupling,
|
|
128
|
+
createPeerCoupling,
|
|
129
|
+
StochasticKuramoto,
|
|
130
|
+
ColoredNoiseKuramoto,
|
|
131
|
+
ThermalKuramoto,
|
|
132
|
+
gaussianRandom,
|
|
133
|
+
PrimeonZLadderU,
|
|
134
|
+
createPrimeonLadder,
|
|
135
|
+
shannonEntropyNats,
|
|
136
|
+
probsOf,
|
|
137
|
+
normalizeComplex,
|
|
138
|
+
Complex,
|
|
139
|
+
ZChannel,
|
|
140
|
+
PrimeonZLadderMulti,
|
|
141
|
+
createMultiChannelLadder,
|
|
142
|
+
createAdiabaticSchedule,
|
|
143
|
+
KuramotoCoupledLadder,
|
|
144
|
+
createKuramotoLadder,
|
|
145
|
+
runCollapsePressureExperiment,
|
|
146
|
+
kuramotoOrderParameter,
|
|
147
|
+
getPhase,
|
|
148
|
+
shannonEntropy,
|
|
149
|
+
stateEntropy,
|
|
150
|
+
coherence,
|
|
151
|
+
mutualInformation,
|
|
152
|
+
relativeEntropy,
|
|
153
|
+
jointEntropy,
|
|
154
|
+
oscillatorEntropy,
|
|
155
|
+
estimateLyapunov,
|
|
156
|
+
classifyStability,
|
|
157
|
+
adaptiveCoupling,
|
|
158
|
+
localLyapunov,
|
|
159
|
+
delayEmbedding,
|
|
160
|
+
stabilityMargin,
|
|
161
|
+
collapseProbability,
|
|
162
|
+
shouldCollapse,
|
|
163
|
+
measureState,
|
|
164
|
+
collapseToIndex,
|
|
165
|
+
bornMeasurement,
|
|
166
|
+
partialCollapse,
|
|
167
|
+
applyDecoherence
|
|
115
168
|
};
|
package/telemetry/index.js
CHANGED
|
@@ -1,24 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Telemetry module for TinyAleph
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Provides Prometheus/OpenTelemetry-compatible metric types:
|
|
5
5
|
* - Counter: Monotonically increasing value
|
|
6
6
|
* - Gauge: Value that can go up and down
|
|
7
7
|
* - Histogram: Distribution of values in buckets
|
|
8
8
|
* - Summary: Quantile distribution
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* Browser-compatible: No Node.js dependencies.
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* @example
|
|
13
13
|
* import { MetricRegistry, Counter, Gauge } from '@aleph-ai/tinyaleph/telemetry';
|
|
14
|
-
*
|
|
14
|
+
*
|
|
15
15
|
* const registry = new MetricRegistry({ prefix: 'myapp_' });
|
|
16
16
|
* const requests = registry.counter('requests_total', { help: 'Total requests' });
|
|
17
17
|
* requests.inc(1, { method: 'GET', status: '200' });
|
|
18
|
-
*
|
|
18
|
+
*
|
|
19
19
|
* console.log(registry.toPrometheus());
|
|
20
|
-
*
|
|
20
|
+
*
|
|
21
21
|
* @module @aleph-ai/tinyaleph/telemetry
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
// Re-export all from metrics
|
|
25
|
+
export * from './metrics.js';
|
|
26
|
+
|
|
27
|
+
// Import and re-export default
|
|
28
|
+
import metrics from './metrics.js';
|
|
29
|
+
export default metrics;
|
|
30
|
+
|
|
31
|
+
// Named exports for convenience
|
|
32
|
+
export {
|
|
33
|
+
MetricType,
|
|
34
|
+
Metric,
|
|
35
|
+
Counter,
|
|
36
|
+
Gauge,
|
|
37
|
+
Histogram,
|
|
38
|
+
Summary,
|
|
39
|
+
MetricRegistry
|
|
40
|
+
} from './metrics.js';
|
package/telemetry/metrics.js
CHANGED
|
@@ -700,4 +700,15 @@ export {
|
|
|
700
700
|
Histogram,
|
|
701
701
|
Summary,
|
|
702
702
|
MetricRegistry
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
// Default export for compatibility with modular.js
|
|
706
|
+
export default {
|
|
707
|
+
MetricType,
|
|
708
|
+
Metric,
|
|
709
|
+
Counter,
|
|
710
|
+
Gauge,
|
|
711
|
+
Histogram,
|
|
712
|
+
Summary,
|
|
713
|
+
MetricRegistry
|
|
703
714
|
};
|