@aleph-ai/tinyaleph 1.3.0 → 1.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.
- package/README.md +423 -12
- package/backends/cryptographic/index.js +455 -2
- package/core/beacon.js +735 -0
- package/core/crt-homology.js +1004 -0
- package/core/enochian-vocabulary.js +910 -0
- package/core/enochian.js +744 -0
- package/core/errors.js +587 -0
- package/core/hilbert.js +651 -1
- package/core/index.js +86 -1
- package/core/lambda.js +284 -33
- package/core/logger.js +350 -0
- package/core/prime.js +136 -1
- package/core/quaternion-semantics.js +623 -0
- package/core/reduction.js +391 -1
- package/core/rformer-crt.js +892 -0
- package/core/topology.js +655 -0
- package/docs/README.md +54 -0
- package/docs/reference/07-topology.md +257 -0
- package/docs/reference/08-observer.md +421 -0
- package/docs/reference/09-crt-homology.md +369 -0
- package/modular.js +231 -3
- package/package.json +1 -1
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
# CRT-Homology Framework
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The CRT-Homology framework integrates **Chinese Remainder Theorem reconstruction** with **homological algebra** to detect and regularize semantic inconsistencies in the tinyaleph library. This enables:
|
|
6
|
+
|
|
7
|
+
1. **Modular encoding** of semantic states over coprime bases
|
|
8
|
+
2. **CRT reconstruction** for unique value recovery
|
|
9
|
+
3. **Birkhoff polytope projection** for doubly-stochastic attention
|
|
10
|
+
4. **Homology loss** for detecting topological "holes" (consistency failures)
|
|
11
|
+
|
|
12
|
+
## Mathematical Foundation
|
|
13
|
+
|
|
14
|
+
### Key Insight
|
|
15
|
+
|
|
16
|
+
> "Holes are not degrees of freedom. Holes are consistency failures that persist under perturbation."
|
|
17
|
+
|
|
18
|
+
In the CRT framework, a semantic "hole" occurs when:
|
|
19
|
+
- Residues `r_k` over coprime moduli `p_k` fail to reconstruct uniquely
|
|
20
|
+
- The reconstruction error `ε(r) = |ℛ(r) - nearest_valid|` exceeds threshold τ
|
|
21
|
+
- These failures form cycles in the kernel `Ker(ℛ)` with non-trivial Betti numbers
|
|
22
|
+
|
|
23
|
+
### Core Equations
|
|
24
|
+
|
|
25
|
+
#### Residue Encoding
|
|
26
|
+
```
|
|
27
|
+
r_k = softmax(W_k h + b_k) ∈ Δ(ℤ/p_k)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Each hidden vector `h` is encoded into K probability distributions, one per coprime modulus.
|
|
31
|
+
|
|
32
|
+
#### CRT Reconstruction
|
|
33
|
+
```
|
|
34
|
+
L̂ = Σ_k E[r_k] · (P/p_k) · (P/p_k)^{-1} mod p_k
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Where:
|
|
38
|
+
- `P = ∏_k p_k` (product of all moduli)
|
|
39
|
+
- `(P/p_k)^{-1}` is the modular inverse mod `p_k`
|
|
40
|
+
- `E[r_k]` is the expected residue
|
|
41
|
+
|
|
42
|
+
#### Birkhoff Projection
|
|
43
|
+
```
|
|
44
|
+
A = Birkhoff(QK^T/√d) ⊙ V
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Attention matrices are projected onto the Birkhoff polytope (doubly-stochastic matrices) using Sinkhorn-Knopp iteration.
|
|
48
|
+
|
|
49
|
+
#### Homology Loss
|
|
50
|
+
```
|
|
51
|
+
ℒ_homology = Σ_{cycles ∈ Ker(ℛ)} f(cycle)
|
|
52
|
+
f(cycle) = Σ_{r ∈ cycle} σ(ε(r) - τ) · |cycle|^α · β^γ
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## API Reference
|
|
56
|
+
|
|
57
|
+
### Core Classes
|
|
58
|
+
|
|
59
|
+
#### `ResidueEncoder`
|
|
60
|
+
|
|
61
|
+
Encodes hidden vectors into residue distributions over coprime moduli.
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
const { ResidueEncoder } = require('tinyaleph/core');
|
|
65
|
+
|
|
66
|
+
const primes = [2, 3, 5, 7]; // Coprime moduli
|
|
67
|
+
const hiddenDim = 32;
|
|
68
|
+
const encoder = new ResidueEncoder(primes, hiddenDim);
|
|
69
|
+
|
|
70
|
+
// Encode a hidden vector
|
|
71
|
+
const h = new Float64Array(32);
|
|
72
|
+
h.fill(0.5);
|
|
73
|
+
const residues = encoder.encode(h); // Array of K distributions
|
|
74
|
+
|
|
75
|
+
// Get expected residues
|
|
76
|
+
const expected = encoder.expectedResidues(residues);
|
|
77
|
+
console.log('Expected residues:', expected);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### `CRTReconstructor`
|
|
81
|
+
|
|
82
|
+
Reconstructs values from residues using Chinese Remainder Theorem.
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
const { CRTReconstructor } = require('tinyaleph/core');
|
|
86
|
+
|
|
87
|
+
const primes = [2, 3, 5, 7];
|
|
88
|
+
const crt = new CRTReconstructor(primes);
|
|
89
|
+
|
|
90
|
+
// Reconstruct from expected residues
|
|
91
|
+
const residues = [1, 2, 3, 4]; // Expected values mod each prime
|
|
92
|
+
const L = crt.reconstruct(residues);
|
|
93
|
+
console.log('Reconstructed:', L, 'mod', crt.P);
|
|
94
|
+
|
|
95
|
+
// Detect kernel (consistency failure)
|
|
96
|
+
const inKernel = crt.detectKernel(residues, 0.1);
|
|
97
|
+
console.log('In kernel:', inKernel);
|
|
98
|
+
|
|
99
|
+
// Validate residues
|
|
100
|
+
const result = crt.validate(residues);
|
|
101
|
+
console.log('Valid:', result.valid, 'Error:', result.error);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### `BirkhoffProjector`
|
|
105
|
+
|
|
106
|
+
Projects matrices onto the Birkhoff polytope using Sinkhorn-Knopp.
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
const { BirkhoffProjector } = require('tinyaleph/core');
|
|
110
|
+
|
|
111
|
+
const projector = new BirkhoffProjector(10); // 10 iterations
|
|
112
|
+
|
|
113
|
+
// Project a matrix to doubly-stochastic
|
|
114
|
+
const matrix = [
|
|
115
|
+
[0.5, 0.3, 0.2],
|
|
116
|
+
[0.3, 0.4, 0.3],
|
|
117
|
+
[0.2, 0.3, 0.5]
|
|
118
|
+
];
|
|
119
|
+
const doublyStochastic = projector.project(matrix);
|
|
120
|
+
|
|
121
|
+
// Validate result
|
|
122
|
+
const validation = projector.validate(doublyStochastic);
|
|
123
|
+
console.log('Is doubly-stochastic:', validation.isDoublyStochastic);
|
|
124
|
+
|
|
125
|
+
// Birkhoff attention
|
|
126
|
+
const Q = [[1, 0], [0, 1]];
|
|
127
|
+
const K = [[1, 0], [0, 1]];
|
|
128
|
+
const V = [[0.5, 0.5], [0.5, 0.5]];
|
|
129
|
+
const output = projector.attention(Q, K, V);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### `HomologyLoss`
|
|
133
|
+
|
|
134
|
+
Computes loss terms for obstruction cycles.
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
const { HomologyLoss, CRTReconstructor } = require('tinyaleph/core');
|
|
138
|
+
|
|
139
|
+
const crt = new CRTReconstructor([2, 3, 5, 7]);
|
|
140
|
+
const homology = new HomologyLoss({
|
|
141
|
+
tau: 0.1, // Kernel detection threshold
|
|
142
|
+
alpha: 0.5, // Cycle length exponent
|
|
143
|
+
beta: 1.0, // Residue weight
|
|
144
|
+
gamma: 0.5 // Residue exponent
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Batch of residue tuples
|
|
148
|
+
const batch = [
|
|
149
|
+
[0.1, 0.2, 0.3, 0.4],
|
|
150
|
+
[0.5, 0.6, 0.7, 0.8],
|
|
151
|
+
[0.9, 0.1, 0.2, 0.3]
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
// Compute homology loss
|
|
155
|
+
const result = homology.compute(batch, crt);
|
|
156
|
+
console.log('Homology loss:', result.loss);
|
|
157
|
+
console.log('Cycles detected:', result.cycles);
|
|
158
|
+
|
|
159
|
+
// Compute Betti numbers
|
|
160
|
+
const betti = homology.computeBettiNumbers(batch, crt);
|
|
161
|
+
console.log('β₀ (components):', betti.beta0);
|
|
162
|
+
console.log('β₁ (holes):', betti.beta1);
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### `CRTModularLayer`
|
|
166
|
+
|
|
167
|
+
Integrated layer combining encoding, reconstruction, and attention.
|
|
168
|
+
|
|
169
|
+
```javascript
|
|
170
|
+
const { createCRTLayer } = require('tinyaleph/core');
|
|
171
|
+
|
|
172
|
+
const layer = createCRTLayer([2, 3, 5, 7], 32);
|
|
173
|
+
|
|
174
|
+
// Forward pass
|
|
175
|
+
const h = new Float64Array(32);
|
|
176
|
+
h.fill(0.5);
|
|
177
|
+
const result = layer.forward(h);
|
|
178
|
+
|
|
179
|
+
console.log('Latent:', result.latent);
|
|
180
|
+
console.log('In kernel:', result.inKernel);
|
|
181
|
+
console.log('Coherence:', result.coherence);
|
|
182
|
+
|
|
183
|
+
// Batch forward with homology loss
|
|
184
|
+
const batch = [h, h, h];
|
|
185
|
+
const batchResult = layer.forwardBatch(batch);
|
|
186
|
+
console.log('Homology loss:', batchResult.homologyLoss);
|
|
187
|
+
console.log('Betti numbers:', batchResult.bettiNumbers);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### CRT-Enhanced ResoFormer
|
|
191
|
+
|
|
192
|
+
#### `CRTResonantAttention`
|
|
193
|
+
|
|
194
|
+
Multi-head attention with per-modulus Birkhoff projection.
|
|
195
|
+
|
|
196
|
+
```javascript
|
|
197
|
+
const { CRTResonantAttention } = require('tinyaleph/core');
|
|
198
|
+
|
|
199
|
+
const attention = new CRTResonantAttention({
|
|
200
|
+
numHeads: 4,
|
|
201
|
+
numPrimes: 4096,
|
|
202
|
+
activeK: 32,
|
|
203
|
+
sinkhornIterations: 10
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// Forward pass
|
|
207
|
+
const query = SparsePrimeState.fromHash('query');
|
|
208
|
+
const keys = [SparsePrimeState.fromHash('key1'), SparsePrimeState.fromHash('key2')];
|
|
209
|
+
const values = [SparsePrimeState.fromHash('val1'), SparsePrimeState.fromHash('val2')];
|
|
210
|
+
|
|
211
|
+
const result = attention.forward(query, keys, values);
|
|
212
|
+
console.log('Result:', result.result);
|
|
213
|
+
console.log('Homology info:', result.homologyInfo);
|
|
214
|
+
console.log('Has holes:', result.homologyInfo.hasHoles);
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### `CRTResoFormer`
|
|
218
|
+
|
|
219
|
+
Complete CRT-enhanced ResoFormer model.
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
const { createCRTResoFormer, SparsePrimeState } = require('tinyaleph/core');
|
|
223
|
+
|
|
224
|
+
const model = createCRTResoFormer({
|
|
225
|
+
numLayers: 6,
|
|
226
|
+
numHeads: 8,
|
|
227
|
+
hiddenDim: 256,
|
|
228
|
+
numPrimes: 4096,
|
|
229
|
+
activeK: 32,
|
|
230
|
+
homologyWeight: 0.1
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// Single input
|
|
234
|
+
const input = SparsePrimeState.fromHash('hello world');
|
|
235
|
+
const output = model.forward(input);
|
|
236
|
+
|
|
237
|
+
console.log('Output:', output.output);
|
|
238
|
+
console.log('Total homology loss:', output.totalLoss);
|
|
239
|
+
console.log('Holes detected:', output.homologyReport.totalHolesDetected);
|
|
240
|
+
|
|
241
|
+
// Sequence input
|
|
242
|
+
const sequence = [
|
|
243
|
+
SparsePrimeState.fromHash('the'),
|
|
244
|
+
SparsePrimeState.fromHash('quick'),
|
|
245
|
+
SparsePrimeState.fromHash('brown'),
|
|
246
|
+
SparsePrimeState.fromHash('fox')
|
|
247
|
+
];
|
|
248
|
+
const seqOutput = model.forward(sequence);
|
|
249
|
+
console.log('Sequence output length:', seqOutput.output.length);
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Homology-Aware Stabilization
|
|
253
|
+
|
|
254
|
+
The `StabilizationController` in `observer/hqe.js` now includes homology detection:
|
|
255
|
+
|
|
256
|
+
```javascript
|
|
257
|
+
const { StabilizationController } = require('tinyaleph/observer/hqe');
|
|
258
|
+
|
|
259
|
+
const controller = new StabilizationController({
|
|
260
|
+
lambda0: 0.1,
|
|
261
|
+
aC: 1.0, // Coherence weight
|
|
262
|
+
aS: 0.8, // Entropy weight
|
|
263
|
+
aH: 0.3, // Homology weight (NEW)
|
|
264
|
+
homology: {
|
|
265
|
+
enabled: true,
|
|
266
|
+
numModuli: 4,
|
|
267
|
+
tau: 0.1
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// Compute λ(t) with homology awareness
|
|
272
|
+
const lambda = controller.computeLambda(
|
|
273
|
+
0.8, // coherence
|
|
274
|
+
0.3, // entropy
|
|
275
|
+
0.1, // SMF entropy
|
|
276
|
+
{ coherence: 0.8, entropy: 0.3 } // state for homology analysis
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
console.log('Lambda:', lambda);
|
|
280
|
+
console.log('Betti numbers:', controller.getHomologyState().bettiNumbers);
|
|
281
|
+
console.log('Holes detected:', controller.getHomologyState().holesDetected);
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Integration with Lyapunov Stability
|
|
285
|
+
|
|
286
|
+
The CRT kernel detection correlates with Lyapunov instability:
|
|
287
|
+
|
|
288
|
+
- **λ > 0** (unstable): High reconstruction error, in kernel
|
|
289
|
+
- **λ ≈ 0** (marginal): Near threshold, transitional
|
|
290
|
+
- **λ < 0** (stable): Low error, consistent reconstruction
|
|
291
|
+
|
|
292
|
+
```javascript
|
|
293
|
+
const { lyapunovExponent } = require('tinyaleph/physics');
|
|
294
|
+
const { CRTReconstructor } = require('tinyaleph/core');
|
|
295
|
+
|
|
296
|
+
const crt = new CRTReconstructor([2, 3, 5, 7]);
|
|
297
|
+
|
|
298
|
+
// Track correlation between Lyapunov and CRT error
|
|
299
|
+
function correlateStability(trajectory) {
|
|
300
|
+
const correlations = [];
|
|
301
|
+
|
|
302
|
+
for (const state of trajectory) {
|
|
303
|
+
const lambda = lyapunovExponent(state);
|
|
304
|
+
const residues = extractResidues(state);
|
|
305
|
+
const crtError = crt.reconstructionError(residues);
|
|
306
|
+
|
|
307
|
+
correlations.push({
|
|
308
|
+
lambda,
|
|
309
|
+
crtError,
|
|
310
|
+
inKernel: crtError > 0.1
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return correlations;
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## Theoretical Background
|
|
319
|
+
|
|
320
|
+
### Chinese Remainder Theorem
|
|
321
|
+
|
|
322
|
+
For pairwise coprime moduli `p₁, p₂, ..., p_k`:
|
|
323
|
+
|
|
324
|
+
1. Any tuple `(r₁, r₂, ..., r_k)` with `0 ≤ r_i < p_i` corresponds to a unique integer `x ∈ [0, P)` where `P = ∏ p_i`
|
|
325
|
+
2. Reconstruction uses: `x = Σ_i r_i · M_i · M_i^{-1} mod P`
|
|
326
|
+
3. Where `M_i = P/p_i` and `M_i^{-1}` is the modular inverse
|
|
327
|
+
|
|
328
|
+
### Birkhoff-von Neumann Theorem
|
|
329
|
+
|
|
330
|
+
Every doubly-stochastic matrix is a convex combination of permutation matrices:
|
|
331
|
+
|
|
332
|
+
1. Row sums = 1, column sums = 1
|
|
333
|
+
2. Birkhoff polytope = convex hull of permutation matrices
|
|
334
|
+
3. Sinkhorn-Knopp alternates row/column normalization
|
|
335
|
+
|
|
336
|
+
### Homology and Betti Numbers
|
|
337
|
+
|
|
338
|
+
- **β₀**: Number of connected components in kernel
|
|
339
|
+
- **β₁**: Number of 1-dimensional holes (cycles that don't bound)
|
|
340
|
+
- Persistence: How long holes survive under parameter changes
|
|
341
|
+
|
|
342
|
+
## Performance Considerations
|
|
343
|
+
|
|
344
|
+
### Coprime Selection
|
|
345
|
+
|
|
346
|
+
Use small primes for efficiency:
|
|
347
|
+
- `[2, 3, 5, 7]`: P = 210, good for most applications
|
|
348
|
+
- `[5, 7, 11, 13]`: P = 5005, for larger latent spaces
|
|
349
|
+
- `[2, 3, 5, 7, 11]`: P = 2310, semantic applications
|
|
350
|
+
|
|
351
|
+
### Sinkhorn Iterations
|
|
352
|
+
|
|
353
|
+
- 5-10 iterations suffice for most applications
|
|
354
|
+
- Higher tolerance (1e-3) for speed, lower (1e-6) for precision
|
|
355
|
+
- Monitor convergence via `maxRowError` and `maxColError`
|
|
356
|
+
|
|
357
|
+
### Homology Computation
|
|
358
|
+
|
|
359
|
+
- Cycle detection scales with kernel size
|
|
360
|
+
- Betti number computation is approximate (not full persistent homology)
|
|
361
|
+
- Consider batching for large sequences
|
|
362
|
+
|
|
363
|
+
## References
|
|
364
|
+
|
|
365
|
+
1. Chinese Remainder Theorem - Hardy & Wright, "An Introduction to the Theory of Numbers"
|
|
366
|
+
2. Birkhoff-von Neumann Theorem - Birkhoff, "Three Observations on Linear Algebra"
|
|
367
|
+
3. Sinkhorn-Knopp Algorithm - Sinkhorn, "A Relationship Between Arbitrary Positive Matrices and Doubly Stochastic Matrices"
|
|
368
|
+
4. Topological Data Analysis - Carlsson, "Topology and Data"
|
|
369
|
+
5. Lyapunov Stability - Strogatz, "Nonlinear Dynamics and Chaos"
|
package/modular.js
CHANGED
|
@@ -1,14 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TinyAleph Modular - Main entry point
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* A backend-agnostic prime-based computing framework supporting:
|
|
5
5
|
* - Semantic Computing (NLP, concept mapping)
|
|
6
6
|
* - Cryptographic Applications (hashing, key derivation)
|
|
7
7
|
* - Scientific Computing (quantum simulation, particle physics)
|
|
8
|
+
*
|
|
9
|
+
* Browser-compatible utilities:
|
|
10
|
+
* - Error Handling (custom errors, error boundary, event emitter)
|
|
11
|
+
* - Logging (structured logging with console API)
|
|
12
|
+
* - Metrics (Prometheus/OTLP compatible telemetry)
|
|
13
|
+
* - Transport (WebSocket, SSE, polling)
|
|
14
|
+
* - Profiling (timers, histograms, sampling)
|
|
15
|
+
*
|
|
16
|
+
* Observer Architecture (Sentient Observer core):
|
|
17
|
+
* - SMF (Sedenion Memory Field) - 16-dimensional semantic orientation
|
|
18
|
+
* - PRSC (Prime Resonance Semantic Computation) - Kuramoto oscillator dynamics
|
|
19
|
+
* - Temporal Layer - Emergent time from coherence dynamics
|
|
20
|
+
* - Entanglement Layer - Semantic binding between concepts
|
|
21
|
+
* - Agency Layer - Attention and goal-directed behavior
|
|
22
|
+
* - Boundary Layer - Self/environment distinction (objectivity gate)
|
|
23
|
+
* - Safety Layer - Ethical constraints and emergency shutdown
|
|
8
24
|
*/
|
|
9
25
|
|
|
10
26
|
// Core mathematical foundation
|
|
11
27
|
const core = require('./core');
|
|
28
|
+
|
|
29
|
+
// Enochian Packet Layer (Section 7.4 of whitepaper)
|
|
30
|
+
const enochian = require('./core/enochian');
|
|
31
|
+
const enochianVocabulary = require('./core/enochian-vocabulary');
|
|
32
|
+
|
|
33
|
+
// Browser-compatible utilities (extracted from apps/sentient)
|
|
34
|
+
const errors = require('./core/errors');
|
|
35
|
+
const logger = require('./core/logger');
|
|
36
|
+
const metrics = require('./telemetry/metrics');
|
|
37
|
+
const transport = require('./transport');
|
|
38
|
+
const profiling = require('./profiling/primitives');
|
|
39
|
+
|
|
40
|
+
// Observer architecture (Sentient Observer core modules)
|
|
41
|
+
const smf = require('./observer/smf');
|
|
42
|
+
const prsc = require('./observer/prsc');
|
|
43
|
+
const temporal = require('./observer/temporal');
|
|
44
|
+
const entanglement = require('./observer/entanglement');
|
|
45
|
+
const agency = require('./observer/agency');
|
|
46
|
+
const boundary = require('./observer/boundary');
|
|
47
|
+
const safety = require('./observer/safety');
|
|
48
|
+
const hqe = require('./observer/hqe');
|
|
12
49
|
const {
|
|
13
50
|
Hypercomplex,
|
|
14
51
|
FANO_LINES,
|
|
@@ -69,6 +106,37 @@ const {
|
|
|
69
106
|
Oscillator,
|
|
70
107
|
OscillatorBank,
|
|
71
108
|
KuramotoModel,
|
|
109
|
+
// Extended sync models
|
|
110
|
+
NetworkKuramoto,
|
|
111
|
+
AdaptiveKuramoto,
|
|
112
|
+
SakaguchiKuramoto,
|
|
113
|
+
SmallWorldKuramoto,
|
|
114
|
+
MultiSystemCoupling,
|
|
115
|
+
createHierarchicalCoupling,
|
|
116
|
+
createPeerCoupling,
|
|
117
|
+
// Stochastic models
|
|
118
|
+
StochasticKuramoto,
|
|
119
|
+
ColoredNoiseKuramoto,
|
|
120
|
+
ThermalKuramoto,
|
|
121
|
+
gaussianRandom,
|
|
122
|
+
// Primeon Z-Ladder
|
|
123
|
+
PrimeonZLadderU,
|
|
124
|
+
createPrimeonLadder,
|
|
125
|
+
shannonEntropyNats,
|
|
126
|
+
probsOf,
|
|
127
|
+
normalizeComplex,
|
|
128
|
+
// Multi-channel ladder
|
|
129
|
+
ZChannel,
|
|
130
|
+
PrimeonZLadderMulti,
|
|
131
|
+
createMultiChannelLadder,
|
|
132
|
+
createAdiabaticSchedule,
|
|
133
|
+
// Kuramoto-coupled ladder
|
|
134
|
+
KuramotoCoupledLadder,
|
|
135
|
+
createKuramotoLadder,
|
|
136
|
+
runCollapsePressureExperiment,
|
|
137
|
+
kuramotoOrderParameter,
|
|
138
|
+
getPhase,
|
|
139
|
+
// Entropy & Information
|
|
72
140
|
shannonEntropy,
|
|
73
141
|
stateEntropy,
|
|
74
142
|
coherence,
|
|
@@ -212,10 +280,41 @@ module.exports = {
|
|
|
212
280
|
sumOfTwoSquares,
|
|
213
281
|
DEFAULT_PRIMES,
|
|
214
282
|
|
|
215
|
-
// Physics
|
|
283
|
+
// Physics - Core oscillators
|
|
216
284
|
Oscillator,
|
|
217
285
|
OscillatorBank,
|
|
218
286
|
KuramotoModel,
|
|
287
|
+
// Extended sync models
|
|
288
|
+
NetworkKuramoto,
|
|
289
|
+
AdaptiveKuramoto,
|
|
290
|
+
SakaguchiKuramoto,
|
|
291
|
+
SmallWorldKuramoto,
|
|
292
|
+
MultiSystemCoupling,
|
|
293
|
+
createHierarchicalCoupling,
|
|
294
|
+
createPeerCoupling,
|
|
295
|
+
// Stochastic models
|
|
296
|
+
StochasticKuramoto,
|
|
297
|
+
ColoredNoiseKuramoto,
|
|
298
|
+
ThermalKuramoto,
|
|
299
|
+
gaussianRandom,
|
|
300
|
+
// Primeon Z-Ladder
|
|
301
|
+
PrimeonZLadderU,
|
|
302
|
+
createPrimeonLadder,
|
|
303
|
+
shannonEntropyNats,
|
|
304
|
+
probsOf,
|
|
305
|
+
normalizeComplex,
|
|
306
|
+
// Multi-channel ladder
|
|
307
|
+
ZChannel,
|
|
308
|
+
PrimeonZLadderMulti,
|
|
309
|
+
createMultiChannelLadder,
|
|
310
|
+
createAdiabaticSchedule,
|
|
311
|
+
// Kuramoto-coupled ladder
|
|
312
|
+
KuramotoCoupledLadder,
|
|
313
|
+
createKuramotoLadder,
|
|
314
|
+
runCollapsePressureExperiment,
|
|
315
|
+
kuramotoOrderParameter,
|
|
316
|
+
getPhase,
|
|
317
|
+
// Entropy & Information
|
|
219
318
|
shannonEntropy,
|
|
220
319
|
stateEntropy,
|
|
221
320
|
coherence,
|
|
@@ -282,5 +381,134 @@ module.exports = {
|
|
|
282
381
|
core,
|
|
283
382
|
physics,
|
|
284
383
|
backends,
|
|
285
|
-
engine
|
|
384
|
+
engine,
|
|
385
|
+
|
|
386
|
+
// Browser-compatible utilities (extracted from apps/sentient)
|
|
387
|
+
// Error handling
|
|
388
|
+
errors,
|
|
389
|
+
SimpleEventEmitter: errors.SimpleEventEmitter,
|
|
390
|
+
AlephError: errors.AlephError,
|
|
391
|
+
NetworkError: errors.NetworkError,
|
|
392
|
+
LLMError: errors.LLMError,
|
|
393
|
+
ValidationError: errors.ValidationError,
|
|
394
|
+
TimeoutError: errors.TimeoutError,
|
|
395
|
+
ErrorHandler: errors.ErrorHandler,
|
|
396
|
+
withErrorHandling: errors.withErrorHandling,
|
|
397
|
+
errorBoundary: errors.errorBoundary,
|
|
398
|
+
withTimeout: errors.withTimeout,
|
|
399
|
+
LogLevel: errors.LogLevel,
|
|
400
|
+
ErrorCategory: errors.ErrorCategory,
|
|
401
|
+
|
|
402
|
+
// Logging
|
|
403
|
+
logger,
|
|
404
|
+
Logger: logger.Logger,
|
|
405
|
+
createLogger: logger.createLogger,
|
|
406
|
+
|
|
407
|
+
// Metrics/Telemetry
|
|
408
|
+
metrics,
|
|
409
|
+
Counter: metrics.Counter,
|
|
410
|
+
Gauge: metrics.Gauge,
|
|
411
|
+
Histogram: metrics.Histogram,
|
|
412
|
+
Summary: metrics.Summary,
|
|
413
|
+
MetricRegistry: metrics.MetricRegistry,
|
|
414
|
+
MetricType: metrics.MetricType,
|
|
415
|
+
|
|
416
|
+
// Transport
|
|
417
|
+
transport,
|
|
418
|
+
Transport: transport.Transport,
|
|
419
|
+
WebSocketTransport: transport.WebSocketTransport,
|
|
420
|
+
SSETransport: transport.SSETransport,
|
|
421
|
+
MemoryTransport: transport.MemoryTransport,
|
|
422
|
+
PollingTransport: transport.PollingTransport,
|
|
423
|
+
TransportManager: transport.TransportManager,
|
|
424
|
+
TransportState: transport.TransportState,
|
|
425
|
+
|
|
426
|
+
// Profiling primitives
|
|
427
|
+
profiling,
|
|
428
|
+
RingBuffer: profiling.RingBuffer,
|
|
429
|
+
Timer: profiling.Timer,
|
|
430
|
+
Sampler: profiling.Sampler,
|
|
431
|
+
RateCalculator: profiling.RateCalculator,
|
|
432
|
+
MovingAverage: profiling.MovingAverage,
|
|
433
|
+
Profiler: profiling.Profiler,
|
|
434
|
+
hrtime: profiling.hrtime,
|
|
435
|
+
hrtimeNs: profiling.hrtimeNs,
|
|
436
|
+
|
|
437
|
+
// Observer Architecture (Sentient Observer core)
|
|
438
|
+
// SMF - Sedenion Memory Field
|
|
439
|
+
smf,
|
|
440
|
+
SedenionMemoryField: smf.SedenionMemoryField,
|
|
441
|
+
SMF_AXES: smf.SMF_AXES,
|
|
442
|
+
AXIS_INDEX: smf.AXIS_INDEX,
|
|
443
|
+
SMF_CODEBOOK: smf.SMF_CODEBOOK,
|
|
444
|
+
CODEBOOK_SIZE: smf.CODEBOOK_SIZE,
|
|
445
|
+
nearestCodebookAttractor: smf.nearestCodebookAttractor,
|
|
446
|
+
codebookTunnel: smf.codebookTunnel,
|
|
447
|
+
getTunnelingCandidates: smf.getTunnelingCandidates,
|
|
448
|
+
|
|
449
|
+
// PRSC - Prime Resonance Semantic Computation
|
|
450
|
+
prsc,
|
|
451
|
+
PRSCLayer: prsc.PRSCLayer,
|
|
452
|
+
PrimeOscillator: prsc.PrimeOscillator,
|
|
453
|
+
EntanglementDetector: prsc.EntanglementDetector,
|
|
454
|
+
|
|
455
|
+
// Temporal Layer
|
|
456
|
+
temporal,
|
|
457
|
+
TemporalLayer: temporal.TemporalLayer,
|
|
458
|
+
Moment: temporal.Moment,
|
|
459
|
+
TemporalPatternDetector: temporal.TemporalPatternDetector,
|
|
460
|
+
|
|
461
|
+
// Entanglement Layer
|
|
462
|
+
entanglement,
|
|
463
|
+
EntanglementLayer: entanglement.EntanglementLayer,
|
|
464
|
+
EntangledPair: entanglement.EntangledPair,
|
|
465
|
+
Phrase: entanglement.Phrase,
|
|
466
|
+
|
|
467
|
+
// Agency Layer
|
|
468
|
+
agency,
|
|
469
|
+
AgencyLayer: agency.AgencyLayer,
|
|
470
|
+
AttentionFocus: agency.AttentionFocus,
|
|
471
|
+
Goal: agency.Goal,
|
|
472
|
+
Action: agency.Action,
|
|
473
|
+
|
|
474
|
+
// Boundary Layer
|
|
475
|
+
boundary,
|
|
476
|
+
BoundaryLayer: boundary.BoundaryLayer,
|
|
477
|
+
SensoryChannel: boundary.SensoryChannel,
|
|
478
|
+
MotorChannel: boundary.MotorChannel,
|
|
479
|
+
EnvironmentalModel: boundary.EnvironmentalModel,
|
|
480
|
+
SelfModel: boundary.SelfModel,
|
|
481
|
+
ObjectivityGate: boundary.ObjectivityGate,
|
|
482
|
+
|
|
483
|
+
// Safety Layer
|
|
484
|
+
safety,
|
|
485
|
+
SafetyLayer: safety.SafetyLayer,
|
|
486
|
+
SafetyConstraint: safety.SafetyConstraint,
|
|
487
|
+
ViolationEvent: safety.ViolationEvent,
|
|
488
|
+
SafetyMonitor: safety.SafetyMonitor,
|
|
489
|
+
|
|
490
|
+
// HQE - Holographic Quantum Encoding (discrete.pdf equations 12-15)
|
|
491
|
+
hqe,
|
|
492
|
+
TickGate: hqe.TickGate,
|
|
493
|
+
StabilizationController: hqe.StabilizationController,
|
|
494
|
+
HolographicEncoder: hqe.HolographicEncoder,
|
|
495
|
+
HolographicMemory: hqe.HolographicMemory,
|
|
496
|
+
HolographicSimilarity: hqe.HolographicSimilarity,
|
|
497
|
+
|
|
498
|
+
// Enochian Packet Layer (Section 7.4 - prime-indexed twist encoding)
|
|
499
|
+
enochian,
|
|
500
|
+
enochianVocabulary,
|
|
501
|
+
ENOCHIAN_ALPHABET: enochianVocabulary.ENOCHIAN_ALPHABET,
|
|
502
|
+
ENOCHIAN_LETTER_PRIMES: enochianVocabulary.ENOCHIAN_LETTER_PRIMES,
|
|
503
|
+
ENOCHIAN_VOCABULARY: enochianVocabulary.ENOCHIAN_VOCABULARY,
|
|
504
|
+
ENOCHIAN_CALLS: enochianVocabulary.ENOCHIAN_CALLS,
|
|
505
|
+
SedenionElement: enochianVocabulary.SedenionElement,
|
|
506
|
+
TwistOperator: enochianVocabulary.TwistOperator,
|
|
507
|
+
EnochianWord: enochianVocabulary.EnochianWord,
|
|
508
|
+
EnochianCall: enochianVocabulary.EnochianCall,
|
|
509
|
+
EnochianPacket: enochian.EnochianPacket,
|
|
510
|
+
EnochianEncoder: enochian.EnochianEncoder,
|
|
511
|
+
EnochianDecoder: enochian.EnochianDecoder,
|
|
512
|
+
EnhancedEnochianEncoder: enochian.EnhancedEnochianEncoder,
|
|
513
|
+
EnhancedEnochianDecoder: enochian.EnhancedEnochianDecoder
|
|
286
514
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-ai/tinyaleph",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Prime-resonant semantic computing framework - hypercomplex algebra, oscillator dynamics, and entropy-minimizing reasoning",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|