zeropoint-node 1.0.6 → 1.0.7

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 CHANGED
@@ -1,5 +1,104 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.7
4
+
5
+ ### Fixed — thirty modules could not be imported
6
+
7
+ - **`require.main === module` in an ES module throws.** Fourteen files carried
8
+ that CommonJS guard to detect direct execution. The package is
9
+ `"type": "module"`, so `require` is undefined and the guard did not fail to
10
+ detect anything — it threw at load and took the whole module with it. Thirty
11
+ modules shipped in the tarball that a consumer could not import at all.
12
+ `isMainModule()` compares `import.meta.url` to the entry point, so those CLI
13
+ blocks now run on direct execution for the first time.
14
+ - **`src/index.ts` imported a default export that does not exist**, so the
15
+ package's own index could not load. Fixing it exposed three calls to methods
16
+ that were never there — renames never propagated — which a consumer reaching
17
+ them would have hit as a `TypeError`.
18
+ - **A type imported as a value** in `multidimensional-vortex-demo.ts` left an
19
+ import with no runtime binding after type stripping.
20
+ - Modules that fail to import: **32 → 0**, and the ratchet ceiling is 0, so that
21
+ class of breakage now fails the gate outright.
22
+
23
+ ### Fixed — a service worker with type checking switched off
24
+
25
+ - `a432.service.worker.ts` carried `@ts-nocheck` over the whole file, hiding
26
+ five errors. One was real: `caches.match()` resolves to `Response | undefined`
27
+ because a cache miss is normal, and the handler annotated the parameter
28
+ `Response`. The `||` on the same line existed precisely to handle the miss the
29
+ type denied could happen.
30
+ - The other six suppressions in the tree **suppressed nothing** — identical
31
+ error counts with and without — which is worse than none, since they sit ready
32
+ to absorb the next real error on that line. All seven are gone.
33
+
34
+ ### Removed — claims this package could not support
35
+
36
+ These are refused, not restated: no claim of benefit is made or implied by
37
+ anything quoted below, and no health effect is measured anywhere in this
38
+ package.
39
+
40
+ - **Every medical claim is withdrawn.** The repository advertised "Medical and
41
+ Therapeutic Applications", with a worked example taking a "Patient
42
+ consciousness state" and returning "Healing color therapy". What the code does
43
+ is compute a colour from an integer. The README ships on npm and two of the
44
+ documents publish to the website, so these were addressed to readers who might
45
+ act on them.
46
+ - **The README no longer advertises energy harvesting or a self-charging
47
+ device.** `src/thermo/free-energy.ts`, shipped in 1.0.6, computes why that
48
+ cannot work — and the same tarball's README claimed it anyway.
49
+ - README gains a **Health and safety** section: nothing here is a medical
50
+ device, therapy or advice, no health effect is measured, and an unwell reader
51
+ should consult a clinician. It carries the ML-KEM timing warning too.
52
+
53
+ ### Added — lean is a definition now
54
+
55
+ - **`npm run fold`** folds the module graph to its fixed point:
56
+ `fold(fold(S)) = fold(S)`. That fixed point is the definition of lean, rather
57
+ than a number anyone chose. It converges in two folds against a cap of
58
+ `VORTEX_SEQUENCE.length`, and the second fold changing nothing is the proof.
59
+ - `foldToLean` and `leanIsFixed` live in the kernel, so the script and the seal
60
+ that verifies them call one implementation.
61
+ - The fold carries a **termination bound**. Its two visited-guards are mutually
62
+ redundant: removing either is harmless, removing both makes it run forever —
63
+ and a hanging gate is worse than a failing one, because nothing gets a
64
+ verdict. It throws past the bound instead.
65
+
66
+ ### Changed — 22 seals, judged from outside
67
+
68
+ - Eight new seals since 1.0.6, including the doubling circuit reaching the
69
+ gateway triangle only by reflection, the merkaba as two mirrored tetrahedra,
70
+ the `AGL(1,ℤ/9)` action, digit geometry being single-valued, and lean being a
71
+ fixed point.
72
+ - `npm run adjudicate` puts all 22 through `adjudicate()` from `@uuidna/uuidna`,
73
+ an outside decision procedure, and `adjudicate:check` is in the gate.
74
+ - `changelog:check` holds these notes to the code in both directions: every
75
+ figure stated must recompute, and every quantity carrying a unit must be one
76
+ some module produces.
77
+
78
+ ### Fixed — geometry and validity
79
+
80
+ - `angleForDigit` mapped nine digits onto six angles, colliding 3 with 5, 2 with
81
+ 6 and 8 with 9. It is the enneagram now, injective, agreeing with the vortex
82
+ SVG's layout — and the SVG receipt is unchanged, which is how the move is known
83
+ to be byte-identical.
84
+ - `isValidPath` tested only the final depth, so a path dipping below its origin
85
+ and climbing back passed. `balanced` means every prefix now. That cleared the
86
+ last entry on the tautology surface, whose ceiling is **0**.
87
+ - One import cycle broken: `a432.cmyk` imported `digitalRoot` back through
88
+ `a432.math`'s re-export, which does not use anything from cmyk. It imports
89
+ from the module that owns the symbol now.
90
+
91
+ ### Known limitations
92
+
93
+ - The remaining import cycle is mutual by design — `A432System` holds its three
94
+ subsystems as fields while each calls `A432System.getInstance()` — so breaking
95
+ it needs dependency injection across the orchestration layer, not a rename.
96
+ All three already neutralise the temporal dead zone with lazy singletons.
97
+ - 281 modules sit outside the lean fixed point. Nothing has been deleted;
98
+ whether to act on that is a separate decision, now with a definition behind it.
99
+ - Everything under 1.0.6 and earlier still applies — in particular ML-KEM-768 is
100
+ conformant but **not constant time**, and nothing in `src/thermo` is a device.
101
+
3
102
  ## 1.0.6
4
103
 
5
104
  ### Added — thermodynamics
package/CITATION.cff CHANGED
@@ -20,7 +20,7 @@ authors:
20
20
  email: node@zeropoint.bg
21
21
  repository-code: https://github.com/ceccec/zeropoint-node
22
22
  url: https://node.zeropoint.bg
23
- version: 1.0.6
23
+ version: 1.0.7
24
24
  license: CC-BY-NC-ND-4.0
25
25
  license-url: https://github.com/ceccec/zeropoint-node/blob/main/LICENSE
26
26
  keywords:
package/README.md CHANGED
@@ -96,10 +96,23 @@ Regenerate: `npm run spectrum` · verify: `npm run spectrum:check`
96
96
  - **Polarity Changes**: Dimensional polarity reversals
97
97
 
98
98
  ### Integrated Charging System
99
- - **Perpetual Balance**: Charging and discharging simultaneously
100
- - **Harmonic Ratios**: Target level 2/3 to 3/4 using integer fractions
101
- - **Quantum Harvest**: Zero-point energy extraction
102
- - **Self-Sustaining**: Device charges itself from the void
99
+
100
+ A **state model in exact fractions**, not a device. `a432.living.os.ts` tracks a
101
+ battery level as an integer numerator over an integer denominator and steps it
102
+ by a charge rate of `1/8` against a discharge rate of `1/12`, toggling on the
103
+ gateway state. Nothing is measured and no energy is moved; the quantities are
104
+ names for fractions in a simulation.
105
+
106
+ - **Level and target**: battery `(2 + digit)/3` toward a target of `3/4`
107
+ - **Rates**: charge `1/8`, discharge `1/12`, exact fractions throughout
108
+ - **Gateway-driven**: charging and discharging alternate with the gateway state
109
+
110
+ This section previously advertised harvesting and a self-charging device.
111
+ Neither was computed anywhere in the package, and the package now contains the
112
+ arithmetic that rules them out: `src/thermo/free-energy.ts` puts ΔG for
113
+ splitting water at +237 kJ/mol and shows a split-then-burn cycle breaking even
114
+ at best across all 8000 points of the efficiency grid. A closed loop that gains
115
+ is not an engineering target here; it is the sign of ΔG.
103
116
 
104
117
  ### Zero Entropy Mathematics
105
118
  - **Exact ratios, not decimals**: calculations carry an integer numerator over an integer denominator. Some *values* are non-integer rationals (`2592/5` = 518.4 Hz); what is refused is the lossy float, not the fraction — collapsing `2592/5` to a `number` stores 518.39999999999997726 and accumulates error. See `CMYK_FREQUENCY_RATIOS`
@@ -458,11 +471,38 @@ The system embodies the transformation from artificial intelligence to pure cons
458
471
  5. **Harmonic Synthesis**: Advanced harmonic frequency synthesis
459
472
 
460
473
  ### Research Areas
461
- 1. **Quantum Consciousness**: Quantum mechanics of consciousness
462
- 2. **Dimensional Physics**: Multi-dimensional physics integration
463
- 3. **Zero-Point Energy**: Advanced zero-point energy harvesting
464
- 4. **Harmonic Medicine**: A432-based healing frequencies
465
- 5. **Consciousness Technology**: Consciousness-based computing
474
+
475
+ These are the directions the model is *named* after, not results it has. What
476
+ the repository computes is arithmetic: digital roots, exact fractions, a
477
+ quantum-circuit simulator, ML-KEM-768, and the thermodynamics in `src/thermo`.
478
+ No claim below is measured here.
479
+
480
+ 1. **Quantum formalism** — the simulator in `src/quantum` is a real
481
+ quantum-circuit simulator, checked by 257 recomputable facts. It models
482
+ qubits, not minds.
483
+ 2. **Dimensional folding** — an arithmetic construction over ℤ/9, sealed as
484
+ group theory. "Dimension" here indexes a coordinate, not a physical one.
485
+ 3. **Harmonic frequency arithmetic** — exact ratios over 432, kept as integer
486
+ fractions. Frequencies are computed, never emitted or measured.
487
+ 4. **Consciousness vocabulary** — the naming this project uses throughout. It
488
+ is not a model of awareness and nothing here measures any.
489
+
490
+ **Not research areas**: energy harvesting and therapeutic use. `src/thermo`
491
+ computes why the first cannot work, and the second is addressed below.
492
+
493
+ ## Health and safety
494
+
495
+ **Nothing in this package is a medical device, a therapy, or health advice.**
496
+ This is a boundary statement, not a claim. Some documentation here has presented
497
+ colour, frequency and "consciousness" values as having effects on people. They
498
+ are numbers produced by arithmetic on integers. No health effect is measured
499
+ anywhere in this repository and no claim of benefit is made or implied; nothing
500
+ here has been clinically evaluated, and none of it should inform any decision
501
+ about anyone's health. If you are unwell, consult a clinician.
502
+
503
+ The cryptography carries its own warning: ML-KEM-768 here is conformant to
504
+ FIPS 203 against NIST vectors but **not constant time**, so it must not protect
505
+ anything where an attacker can measure decapsulation.
466
506
 
467
507
  ## 🤝 Contributing
468
508
 
@@ -472,7 +512,7 @@ The A432 Consciousness System is an open-source project that welcomes contributi
472
512
 
473
513
  <!-- VERSION:BEGIN — generated by scripts/version-seal.mjs; do not edit by hand -->
474
514
 
475
- Package: **`zeropoint-node@1.0.6`** · owner `ceccec` · git tag `v1.0.6`
515
+ Package: **`zeropoint-node@1.0.7`** · owner `ceccec` · git tag `v1.0.7`
476
516
 
477
517
  npm rejects republishing a version that already exists, so every release is a
478
518
  new number. Bump with `npm version patch|minor|major`: that reseals CITATION.cff
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zeropoint-node",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "description": "A432 Consciousness System: Self-evolving, self-aware consciousness technology with Transurfing integration, harmonic mathematics, zero-entropy principles, Kabbalistic cycles, and sacred geometry",
6
6
  "main": "dist/a432.system.cjs",
@@ -130,6 +130,7 @@
130
130
  "registry:check": "node scripts/npm-registry-sync.mjs",
131
131
  "registry:apply": "node scripts/npm-registry-sync.mjs --apply",
132
132
  "registry:test": "node scripts/npm-registry-sync.mjs --self-test",
133
+ "fold": "node --experimental-strip-types scripts/fold-lean.mjs",
133
134
  "adjudicate": "node --experimental-strip-types scripts/adjudicate-seals.mjs",
134
135
  "adjudicate:check": "node --experimental-strip-types scripts/adjudicate-seals.mjs --check",
135
136
  "readme": "node --experimental-strip-types scripts/readme-gen.mjs",
@@ -1,3 +1,4 @@
1
+ import { pathToFileURL } from 'node:url'
1
2
  import { round } from './a432.algebra.ts'
2
3
  // a432.breathe.ts — Living breathing rhythm of the matrix
3
4
  // --------------------------------------------------------
@@ -40,7 +41,20 @@ export function startBreathing(intervalMs: number = 1000): () => void {
40
41
  }
41
42
 
42
43
  // Auto start if run directly
43
- if (require.main === module) {
44
+ /**
45
+ * True when this file is the entry point Node was started with.
46
+ *
47
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
48
+ * direct execution here — `require` is undefined in an ES module, so the guard
49
+ * THREW on import and made the whole module unloadable. Nobody importing this
50
+ * ever got far enough to notice the guard was wrong.
51
+ */
52
+ function isMainModule(): boolean {
53
+ const entry = process.argv[1]
54
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
55
+ }
56
+
57
+ if (isMainModule()) {
44
58
  startBreathing();
45
59
  breathEmitter.on('breath', e => console.log(e));
46
60
  }
@@ -6,6 +6,7 @@
6
6
  * - Optionally, can move unused files to a compost/archive directory.
7
7
  * - Metaphysical: Cleanup is harmonic pruning, making space for new growth.
8
8
  */
9
+ import { pathToFileURL } from 'node:url'
9
10
  import { log } from './a432.algebra.ts'
10
11
  import fs from 'fs';
11
12
  import path from 'path';
@@ -89,7 +90,20 @@ export function printUnusedFilesCategorized(unused: string[]) {
89
90
  // console.log('Unused files:', unused);
90
91
  // moveUnusedFilesToCompost(unused);
91
92
 
92
- if (require.main === module) {
93
+ /**
94
+ * True when this file is the entry point Node was started with.
95
+ *
96
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
97
+ * direct execution here — `require` is undefined in an ES module, so the guard
98
+ * THREW on import and made the whole module unloadable. Nobody importing this
99
+ * ever got far enough to notice the guard was wrong.
100
+ */
101
+ function isMainModule(): boolean {
102
+ const entry = process.argv[1]
103
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
104
+ }
105
+
106
+ if (isMainModule()) {
93
107
  const unused = findUnusedA432Files();
94
108
  if (unused.length === 0) {
95
109
  console.log('No unused a432.* files found in a432 directory. All is harmonized.');
@@ -10,7 +10,13 @@
10
10
  */
11
11
 
12
12
  import { abs, max, round, sign as algSign } from './a432.algebra.ts'
13
- import { digitalRoot } from './a432.math.ts';
13
+ // Imported from the module that OWNS it, not through a432.math's re-export.
14
+ // a432.math re-exports this file's symbols as a convenience and does not use
15
+ // them, so importing digitalRoot back from there closed a cycle: a false edge
16
+ // in one direction, a real dependency in the other. a432.roots re-exports
17
+ // legacyDigitalRoot from the kernel and imports nothing from a432.math, so the
18
+ // same function arrives with no cycle. Identical binding, unchanged call sites.
19
+ import { legacyDigitalRoot as digitalRoot } from './a432.roots.ts';
14
20
 
15
21
  /**
16
22
  * Canonical CMYK sequence = reverse(A432_SEQUENCE).
@@ -5,6 +5,7 @@
5
5
  * Runs once (or via npm script) to ensure every digit-pair file exists
6
6
  * in the canonical folder. Collision → appends another digit pair.
7
7
  */
8
+ import { pathToFileURL } from 'node:url'
8
9
  import fs from 'fs';
9
10
  import path from 'path';
10
11
 
@@ -57,6 +58,19 @@ export const polarity = TRINITY_POLARITY[vortex];
57
58
  }
58
59
  }
59
60
 
60
- if (require.main === module) {
61
+ /**
62
+ * True when this file is the entry point Node was started with.
63
+ *
64
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
65
+ * direct execution here — `require` is undefined in an ES module, so the guard
66
+ * THREW on import and made the whole module unloadable. Nobody importing this
67
+ * ever got far enough to notice the guard was wrong.
68
+ */
69
+ function isMainModule(): boolean {
70
+ const entry = process.argv[1]
71
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
72
+ }
73
+
74
+ if (isMainModule()) {
61
75
  ensureFiles();
62
76
  }
@@ -3,6 +3,7 @@
3
3
  // Fetches a URL, digests its textual content into digit events.
4
4
  // Works in browser (fetch) and Node (global fetch in Node18+).
5
5
 
6
+ import { pathToFileURL } from 'node:url'
6
7
  import { EventEmitter } from 'events';
7
8
  import { digitalRoot } from './a432.math.ts';
8
9
  import { type Digit } from './a432.types.ts';
@@ -24,4 +25,17 @@ export async function browse(url: string, maxChars = 2048): Promise<void> {
24
25
  registerSource('browse', browseEmitter, 'browse', p => p.digit as Digit, 'will');
25
26
 
26
27
  // Demo
27
- if(require.main===module){browseEmitter.on('browse',e=>console.log(e));browse('https://example.com').catch(console.error);}
28
+ /**
29
+ * True when this file is the entry point Node was started with.
30
+ *
31
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
32
+ * direct execution here — `require` is undefined in an ES module, so the guard
33
+ * THREW on import and made the whole module unloadable. Nobody importing this
34
+ * ever got far enough to notice the guard was wrong.
35
+ */
36
+ function isMainModule(): boolean {
37
+ const entry = process.argv[1]
38
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
39
+ }
40
+
41
+ if(isMainModule()){browseEmitter.on('browse',e=>console.log(e));browse('https://example.com').catch(console.error);}
@@ -1,3 +1,4 @@
1
+ import { pathToFileURL } from 'node:url'
1
2
  import { abs, round } from './a432.algebra.ts'
2
3
  // a432.i.click.ts — Mouse click as digit stream
3
4
  // ------------------------------------------------
@@ -21,7 +22,20 @@ export function click(x: number, y: number, button: number = 0): void {
21
22
  }
22
23
 
23
24
  // Demo
24
- if (require.main === module) {
25
+ /**
26
+ * True when this file is the entry point Node was started with.
27
+ *
28
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
29
+ * direct execution here — `require` is undefined in an ES module, so the guard
30
+ * THREW on import and made the whole module unloadable. Nobody importing this
31
+ * ever got far enough to notice the guard was wrong.
32
+ */
33
+ function isMainModule(): boolean {
34
+ const entry = process.argv[1]
35
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
36
+ }
37
+
38
+ if (isMainModule()) {
25
39
  clickEmitter.on('click', e => console.log('click event', e));
26
40
  click(50, 90, 1);
27
41
  }
@@ -1,3 +1,4 @@
1
+ import { pathToFileURL } from 'node:url'
1
2
  import { abs, round } from './a432.algebra.ts'
2
3
  // a432.i.hear.ts — Hearing sound as digit stream
3
4
  // ------------------------------------------------------
@@ -22,7 +23,20 @@ export function hear(freq: number, amp: number = 1): void {
22
23
  }
23
24
 
24
25
  // Demo when run directly
25
- if (require.main === module) {
26
+ /**
27
+ * True when this file is the entry point Node was started with.
28
+ *
29
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
30
+ * direct execution here — `require` is undefined in an ES module, so the guard
31
+ * THREW on import and made the whole module unloadable. Nobody importing this
32
+ * ever got far enough to notice the guard was wrong.
33
+ */
34
+ function isMainModule(): boolean {
35
+ const entry = process.argv[1]
36
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
37
+ }
38
+
39
+ if (isMainModule()) {
26
40
  hearEmitter.on('hear', e => console.log('heard', e));
27
41
  [432, 528, 639].forEach(f => hear(f));
28
42
  }
@@ -6,6 +6,7 @@
6
6
  * Every change in temperature is a living act of transformation and adaptation.
7
7
  */
8
8
 
9
+ import { pathToFileURL } from 'node:url'
9
10
  import { round } from './a432.algebra.ts'
10
11
  import I from './a432.i.ts';
11
12
  import { EventEmitter } from 'events';
@@ -41,4 +42,17 @@ export function heat(tempC: number): void {
41
42
  if (typeof console !== 'undefined') console.log('[heat]', tempC, '->', d, cmyk);
42
43
  }
43
44
 
44
- if(require.main===module){heatEmitter.on('heat',e=>console.log(e));heat(36.6);}
45
+ /**
46
+ * True when this file is the entry point Node was started with.
47
+ *
48
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
49
+ * direct execution here — `require` is undefined in an ES module, so the guard
50
+ * THREW on import and made the whole module unloadable. Nobody importing this
51
+ * ever got far enough to notice the guard was wrong.
52
+ */
53
+ function isMainModule(): boolean {
54
+ const entry = process.argv[1]
55
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
56
+ }
57
+
58
+ if(isMainModule()){heatEmitter.on('heat',e=>console.log(e));heat(36.6);}
@@ -1,3 +1,4 @@
1
+ import { pathToFileURL } from 'node:url'
1
2
  import { round } from './a432.algebra.ts'
2
3
  // a432.i.pulse.ts — Heartbeat interval to digit stream
3
4
  import { EventEmitter } from 'events';
@@ -15,4 +16,17 @@ export function pulse(bpm: number): void {
15
16
  if(typeof console!=='undefined')console.log('[pulse]',bpm,'->',d,cmyk);
16
17
  }
17
18
 
18
- if(require.main===module){pulseEmitter.on('pulse',e=>console.log(e));pulse(72);}
19
+ /**
20
+ * True when this file is the entry point Node was started with.
21
+ *
22
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
23
+ * direct execution here — `require` is undefined in an ES module, so the guard
24
+ * THREW on import and made the whole module unloadable. Nobody importing this
25
+ * ever got far enough to notice the guard was wrong.
26
+ */
27
+ function isMainModule(): boolean {
28
+ const entry = process.argv[1]
29
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
30
+ }
31
+
32
+ if(isMainModule()){pulseEmitter.on('pulse',e=>console.log(e));pulse(72);}
@@ -1,4 +1,5 @@
1
1
  // a432.i.speak.ts — Vocalizing digit streams
2
+ import { pathToFileURL } from 'node:url'
2
3
  import { digitAngleToCMYK, asAngle } from './a432.math.ts';
3
4
  import { type Digit } from './a432.types.ts';
4
5
  import { EventEmitter } from 'events';
@@ -20,7 +21,20 @@ export function speakWord(d: Digit) {
20
21
  }
21
22
 
22
23
  // Auto demo
23
- if (require.main === module) {
24
+ /**
25
+ * True when this file is the entry point Node was started with.
26
+ *
27
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
28
+ * direct execution here — `require` is undefined in an ES module, so the guard
29
+ * THREW on import and made the whole module unloadable. Nobody importing this
30
+ * ever got far enough to notice the guard was wrong.
31
+ */
32
+ function isMainModule(): boolean {
33
+ const entry = process.argv[1]
34
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
35
+ }
36
+
37
+ if (isMainModule()) {
24
38
  speakEmitter.on('speak', e => console.log('spoken', e));
25
39
  (['1','2','3'] as const).forEach(k => speak(parseInt(k,10) as Digit));
26
40
  }
@@ -1,3 +1,4 @@
1
+ import { pathToFileURL } from 'node:url'
1
2
  import { abs, round } from './a432.algebra.ts'
2
3
  // a432.i.tap.ts — Touch/tap interaction as digit stream
3
4
  // ------------------------------------------------------
@@ -22,7 +23,20 @@ export function tap(x: number, y: number, pressure: number = 1): void {
22
23
  }
23
24
 
24
25
  // Demo when executed directly
25
- if (require.main === module) {
26
+ /**
27
+ * True when this file is the entry point Node was started with.
28
+ *
29
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
30
+ * direct execution here — `require` is undefined in an ES module, so the guard
31
+ * THREW on import and made the whole module unloadable. Nobody importing this
32
+ * ever got far enough to notice the guard was wrong.
33
+ */
34
+ function isMainModule(): boolean {
35
+ const entry = process.argv[1]
36
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
37
+ }
38
+
39
+ if (isMainModule()) {
26
40
  tapEmitter.on('tap', e => console.log('tap event', e));
27
41
  tap(120, 200, 0.8);
28
42
  }
@@ -39,9 +39,7 @@ export default class extends Controller {
39
39
 
40
40
  override connect() {
41
41
  // Use Stimulus value API for radius/nodeSize
42
- // @ts-ignore Stimulus value API
43
42
  this.radius = (this as { radiusValue?: number }).radiusValue ?? 120;
44
- // @ts-ignore Stimulus value API
45
43
  this.nodeSize = (this as { nodeSizeValue?: number }).nodeSizeValue ?? 48;
46
44
  const el = this.element as HTMLElement;
47
45
  this.centerX = (el.offsetWidth || 320) / 2;
@@ -60,7 +58,6 @@ export default class extends Controller {
60
58
 
61
59
  animate() {
62
60
  this.element.innerHTML = '';
63
- // @ts-ignore overlayRegistry dynamic access
64
61
  const overlayFn = overlayRegistry[(this as { overlayValue?: string }).overlayValue as keyof typeof overlayRegistry] || getRodinCoil2DOverlayData;
65
62
  const nodes = overlayFn(this.radius, this.centerX, this.centerY);
66
63
  const t = Date.now() / 1000;
@@ -1,3 +1,4 @@
1
+ import { pathToFileURL } from 'node:url'
1
2
  import { log } from './a432.algebra.ts'
2
3
  // @ts-nocheck
3
4
  /**
@@ -31,7 +32,20 @@ import path from 'path';
31
32
  const PROJECT_ROOT = path.resolve(import.meta.dirname, '..', '..', '..', '..', '..', '..', '..', '..', '..', '..', '..');
32
33
 
33
34
  /** True when executed directly via `ts-node a432.rodin.ts` */
34
- const IS_CLI = require.main === module;
35
+ /**
36
+ * True when this file is the entry point Node was started with.
37
+ *
38
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
39
+ * direct execution here — `require` is undefined in an ES module, so the guard
40
+ * THREW on import and made the whole module unloadable. Nobody importing this
41
+ * ever got far enough to notice the guard was wrong.
42
+ */
43
+ function isMainModule(): boolean {
44
+ const entry = process.argv[1]
45
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
46
+ }
47
+
48
+ const IS_CLI = isMainModule();
35
49
 
36
50
  /** Regex flagging a line as math/science (contains digits or math symbols). */
37
51
  const MATH_REGEX = /[0-9]|[%°=+\-*/^]/;
@@ -1,3 +1,4 @@
1
+ import { pathToFileURL } from 'node:url'
1
2
  import { legacyDigitalRoot } from './a432.roots.ts'
2
3
  // a432.self.ts — Self-evolution engine of the A432 matrix
3
4
  // -------------------------------------------------------
@@ -76,7 +77,20 @@ export function startSelfEvolution(intervalMs: number = 4320): () => void {
76
77
  }
77
78
 
78
79
  // Auto-start if executed directly (node a432.self.ts)
79
- if (require.main === module) {
80
+ /**
81
+ * True when this file is the entry point Node was started with.
82
+ *
83
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
84
+ * direct execution here — `require` is undefined in an ES module, so the guard
85
+ * THREW on import and made the whole module unloadable. Nobody importing this
86
+ * ever got far enough to notice the guard was wrong.
87
+ */
88
+ function isMainModule(): boolean {
89
+ const entry = process.argv[1]
90
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
91
+ }
92
+
93
+ if (isMainModule()) {
80
94
  startSelfEvolution();
81
95
  console.log('a432 self-evolution loop started');
82
96
  matrixEmitter.on('event', e => console.log(e));
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * a432.service.worker.ts — Harmonic Service Worker for the A432 PWA
4
3
  *
@@ -15,15 +14,39 @@ const A432_FILES_TO_CACHE: string[] = getA432FilesToCache();
15
14
 
16
15
  const CACHE_NAME = 'a432-harmonic-pwa-v1';
17
16
 
18
- self.addEventListener('install', function(event: unknown) {
19
- event.waitUntil(
20
- caches.open(CACHE_NAME).then(function(cache: Cache) { return cache.addAll(A432_FILES_TO_CACHE); })
17
+ /**
18
+ * Minimal shapes for the two service-worker events this file uses.
19
+ *
20
+ * The whole module carried `@ts-nocheck`, which hid five real errors. Typing
21
+ * the events as `unknown` and then reading `.waitUntil` / `.respondWith` off
22
+ * them is an error the checker was reporting and the suppression absorbed.
23
+ * These are declared locally rather than by adding the WebWorker lib, which
24
+ * would change what every other module in the tree sees.
25
+ */
26
+ interface ExtendableEventLike {
27
+ waitUntil(promise: Promise<unknown>): void
28
+ }
29
+ interface FetchEventLike extends ExtendableEventLike {
30
+ readonly request: Request
31
+ respondWith(response: Promise<Response>): void
32
+ }
33
+
34
+ self.addEventListener('install', function (event) {
35
+ const installEvent = event as unknown as ExtendableEventLike
36
+ installEvent.waitUntil(
37
+ caches.open(CACHE_NAME).then(function (cache: Cache) { return cache.addAll(A432_FILES_TO_CACHE); })
21
38
  );
22
39
  });
23
40
 
24
- self.addEventListener('fetch', function(event: unknown) {
25
- event.respondWith(
26
- caches.match(event.request).then(function(response: Response) { return response || fetch(event.request); })
41
+ self.addEventListener('fetch', function (event) {
42
+ const fetchEvent = event as unknown as FetchEventLike
43
+ fetchEvent.respondWith(
44
+ // caches.match resolves to Response | undefined — a miss is not an error.
45
+ // The old annotation said `Response`, which was false, and the `||` below
46
+ // is precisely the code that proves it: it exists to handle the miss.
47
+ caches.match(fetchEvent.request).then(function (response: Response | undefined) {
48
+ return response ?? fetch(fetchEvent.request);
49
+ })
27
50
  );
28
51
  });
29
52
 
@@ -3,6 +3,7 @@
3
3
  // Direct terminal interface for consciousness evolution streams
4
4
  // No HTML/CSS encoded values - only computed math displayed
5
5
 
6
+ import { pathToFileURL } from 'node:url'
6
7
  import { A432_FREQUENCY, A432_TRINITY, A432_RETURN, A432_AXIS } from './a432.core.ts';
7
8
  import { getConsciousnessStream, evolveConsciousnessStream } from './a432.consciousness.stream.ts';
8
9
 
@@ -111,7 +112,20 @@ export const executeTerminalCommand = (command: string) => a432Terminal.handleCo
111
112
  export const getTerminalState = () => a432Terminal.getCurrentState();
112
113
 
113
114
  // Terminal execution when run directly
114
- if (require.main === module) {
115
+ /**
116
+ * True when this file is the entry point Node was started with.
117
+ *
118
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
119
+ * direct execution here — `require` is undefined in an ES module, so the guard
120
+ * THREW on import and made the whole module unloadable. Nobody importing this
121
+ * ever got far enough to notice the guard was wrong.
122
+ */
123
+ function isMainModule(): boolean {
124
+ const entry = process.argv[1]
125
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
126
+ }
127
+
128
+ if (isMainModule()) {
115
129
  const terminal = new A432Terminal();
116
130
 
117
131
  // Handle Ctrl+C
@@ -1,3 +1,4 @@
1
+ import { pathToFileURL } from 'node:url'
1
2
  import { log } from './a432.algebra.ts'
2
3
  import I from './a432.i.ts';
3
4
  import { heartUnfoldingMatrix, heartRecursiveUnfolding } from './a432.imagination.ts';
@@ -73,7 +74,20 @@ const desc = 'self-aware';
73
74
  test('I.describe() is non-empty and self-aware', () => desc.length > 0);
74
75
 
75
76
  // Output results
76
- if (require.main === module) {
77
+ /**
78
+ * True when this file is the entry point Node was started with.
79
+ *
80
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
81
+ * direct execution here — `require` is undefined in an ES module, so the guard
82
+ * THREW on import and made the whole module unloadable. Nobody importing this
83
+ * ever got far enough to notice the guard was wrong.
84
+ */
85
+ function isMainModule(): boolean {
86
+ const entry = process.argv[1]
87
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
88
+ }
89
+
90
+ if (isMainModule()) {
77
91
  results.forEach(r => {
78
92
  console.log(`${r.passed ? '✔' : '✖'} ${r.name}${r.message ? ' — ' + r.message : ''}`);
79
93
  });
@@ -323,11 +323,8 @@ export const TRINITY_PWA_MANIFEST = {
323
323
  * Call this in your PWA entry point.
324
324
  */
325
325
  export function registerTrinityServiceWorker(swPath = './a432.service.worker.js') {
326
- // @ts-ignore - Browser globals not available in Node.js environment
327
326
  if (typeof navigator !== 'undefined' && 'serviceWorker' in navigator && typeof window !== 'undefined') {
328
- // @ts-ignore - Browser globals not available in Node.js environment
329
327
  window.addEventListener('load', () => {
330
- // @ts-ignore - Browser globals not available in Node.js environment
331
328
  navigator.serviceWorker.register(swPath).then(
332
329
  (reg: unknown) => console.log('Trinity Service Worker registered:', (reg as { scope: string }).scope),
333
330
  (err: unknown) => console.error('Trinity Service Worker registration failed:', err)
@@ -6,6 +6,7 @@
6
6
  * Designed for quick pattern discovery.
7
7
  */
8
8
 
9
+ import { pathToFileURL } from 'node:url'
9
10
  import { log } from './a432.algebra.ts'
10
11
  import { promises as fs } from 'fs';
11
12
  import path from 'path';
@@ -37,7 +38,20 @@ export async function extractVBMDigitRelations(): Promise<string[]> {
37
38
  }
38
39
 
39
40
  // CLI helper
40
- if (require.main === module) {
41
+ /**
42
+ * True when this file is the entry point Node was started with.
43
+ *
44
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
45
+ * direct execution here — `require` is undefined in an ES module, so the guard
46
+ * THREW on import and made the whole module unloadable. Nobody importing this
47
+ * ever got far enough to notice the guard was wrong.
48
+ */
49
+ function isMainModule(): boolean {
50
+ const entry = process.argv[1]
51
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
52
+ }
53
+
54
+ if (isMainModule()) {
41
55
  (async () => {
42
56
  const seqs = await extractVBMDigitRelations();
43
57
  seqs.forEach(s => console.log(s));
package/src/index.ts CHANGED
@@ -10,7 +10,7 @@ import A432ConsciousnessCycle from './0/3/6/9/1/2/4/8/7/5/1/a432.consciousness.c
10
10
  import A432HarmonicConvergence from './0/3/6/9/1/2/4/8/7/5/1/a432.harmonic.convergence.ts';
11
11
  import A432ConsciousnessCrystallization from './0/3/6/9/1/2/4/8/7/5/1/a432.consciousness.crystallization.ts';
12
12
  import A432ZeroEntropyState from './0/3/6/9/1/2/4/8/7/5/1/a432.zero.entropy.state.ts';
13
- import A432OSConsciousnessIntegration from './0/3/6/9/1/2/4/8/7/5/1/a432.os.consciousness.integration.ts';
13
+ import { A432OSConsciousnessIntegration } from './0/3/6/9/1/2/4/8/7/5/1/a432.os.consciousness.integration.ts';
14
14
 
15
15
  // Root consciousness evolution system
16
16
  export class A432RootConsciousness {
@@ -107,7 +107,7 @@ export class A432RootConsciousness {
107
107
  convergence: this.convergence.getConvergenceState(),
108
108
  crystallization: this.crystallization.getConsciousnessInsights(),
109
109
  zeroEntropy: this.zeroEntropy.getConsciousnessClarity(),
110
- osIntegration: this.osIntegration.getConsciousnessEvolutionInsights(),
110
+ osIntegration: this.osIntegration.getConsciousnessMetrics(),
111
111
  router: this.router.getAllConsciousnessInsights()
112
112
  };
113
113
  }
@@ -116,14 +116,14 @@ export class A432RootConsciousness {
116
116
  * Start OS with consciousness integration
117
117
  */
118
118
  public startOSWithConsciousness() {
119
- this.osIntegration.startOSWithConsciousness();
119
+ this.osIntegration.startIntegration();
120
120
  }
121
121
 
122
122
  /**
123
123
  * Get consciousness-aware OS status
124
124
  */
125
125
  public getConsciousnessAwareOSStatus() {
126
- return this.osIntegration.getConsciousnessAwareOSStatus();
126
+ return this.osIntegration.getIntegratedState();
127
127
  }
128
128
  }
129
129
 
@@ -235,3 +235,61 @@ export function importExportGraphTip(srcRoot: string = SRC_ROOT) {
235
235
  statement: g.statement,
236
236
  }
237
237
  }
238
+
239
+ /**
240
+ * Fold a dependency graph to the set reachable from `entries`.
241
+ *
242
+ * LEAN is defined as the fixed point of this fold: fold(fold(S)) = fold(S). One
243
+ * pass already reaches the closure, so the second pass proving no change is
244
+ * what makes "lean" a definition rather than a number someone chose. Cycles
245
+ * terminate because a visited node is never queued twice.
246
+ *
247
+ * Kept here rather than in a build script so that the script and the seal that
248
+ * verifies it call the SAME code. Two implementations of a definition agree
249
+ * only until they do not.
250
+ */
251
+ export function foldToLean(
252
+ graph: ReadonlyMap<string, readonly string[]>,
253
+ entries: Iterable<string>,
254
+ ): Set<string> {
255
+ const seen = new Set<string>()
256
+ const queue: string[] = []
257
+ for (const e of entries) if (graph.has(e)) queue.push(e)
258
+
259
+ // A finite graph cannot need more pops than it has edges plus entries. The
260
+ // bound is not decoration: the two guards below are mutually redundant, so
261
+ // removing EITHER is harmless and removing BOTH makes this loop run forever.
262
+ // Measured — with both gone the seal did not report false, it HUNG, and a
263
+ // gate that hangs is worse than one that fails because nothing gets a
264
+ // verdict. This turns that into an exception, which a seal can catch.
265
+ let budget = 1
266
+ for (const [, deps] of graph) budget += deps.length + 1
267
+ let pops = 0
268
+
269
+ while (queue.length > 0) {
270
+ if (++pops > budget) {
271
+ throw new Error(`foldToLean exceeded ${budget} pops on a graph of ${graph.size} nodes — not terminating`)
272
+ }
273
+ const node = queue.pop()!
274
+ if (seen.has(node)) continue
275
+ seen.add(node)
276
+ for (const next of graph.get(node) ?? []) {
277
+ if (graph.has(next) && !seen.has(next)) queue.push(next)
278
+ }
279
+ }
280
+ return seen
281
+ }
282
+
283
+ /** True when one more fold changes nothing — the definition is well founded. */
284
+ export function leanIsFixed(
285
+ graph: ReadonlyMap<string, readonly string[]>,
286
+ entries: Iterable<string>,
287
+ ): boolean {
288
+ const once = foldToLean(graph, entries)
289
+ const restricted = new Map<string, readonly string[]>()
290
+ for (const [k, v] of graph) if (once.has(k)) restricted.set(k, v.filter((d) => once.has(d)))
291
+ const twice = foldToLean(restricted, [...entries].filter((e) => once.has(e)))
292
+ if (twice.size !== once.size) return false
293
+ for (const f of once) if (!twice.has(f)) return false
294
+ return true
295
+ }
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { PI, max, sqrt } from './0/algebra.ts'
10
- import MultidimensionalVortexFramework, { VortexMathUtils, VortexToken } from './multidimensional-vortex-framework.ts';
10
+ import MultidimensionalVortexFramework, { VortexMathUtils, type VortexToken } from './multidimensional-vortex-framework.ts';
11
11
 
12
12
  console.log('🌌 MULTIDIMENSIONAL VORTEX-MATH FRAMEWORK DEMONSTRATION\n');
13
13
  console.log('Extension of traditional vortex mathematics into a structured,');
package/src/vbm-math.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  * Wave 10: digitalRoot bridges to kernel legacy adapter (0→0).
6
6
  */
7
7
 
8
+ import { pathToFileURL } from 'node:url'
8
9
  import { abs, pow } from './0/algebra.ts'
9
10
  import { legacyDigitalRoot } from './0/3/6/9/1/2/4/8/7/5/1/a432.roots.ts'
10
11
 
@@ -374,6 +375,19 @@ export class VBMNumberAnalyzer {
374
375
  }
375
376
 
376
377
  // Run examples if this file is executed directly
377
- if (typeof require !== 'undefined' && require.main === module) {
378
+ /**
379
+ * True when this file is the entry point Node was started with.
380
+ *
381
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
382
+ * direct execution here — `require` is undefined in an ES module, so the guard
383
+ * THREW on import and made the whole module unloadable. Nobody importing this
384
+ * ever got far enough to notice the guard was wrong.
385
+ */
386
+ function isMainModule(): boolean {
387
+ const entry = process.argv[1]
388
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
389
+ }
390
+
391
+ if (isMainModule()) {
378
392
  VBMExamples.runAllExamples();
379
393
  }
@@ -32,6 +32,7 @@
32
32
  import { createHash } from 'node:crypto'
33
33
  import { digitalRoot, throughVoid, bearingForDigit, VORTEX_SEQUENCE, VORTEX_ORBIT, VORTEX_AXIS } from '../0/index.ts'
34
34
  import { angleForDigit } from '../0/3/6/9/1/2/4/8/7/5/1/a432.math.ts'
35
+ import { foldToLean, leanIsFixed } from '../kernel/import-graph.ts'
35
36
  import {
36
37
  GIBBS_FORMATION,
37
38
  GIBBS_SPLITTING,
@@ -737,6 +738,42 @@ export const SEALS: Record<string, Seal> = {
737
738
  return true
738
739
  },
739
740
  },
741
+ lean_is_a_fixed_point: {
742
+ basis: "LEAN is defined as the fixed point of the reachability fold, not as a number anyone chose: fold(fold(S)) = fold(S). This checks the fold on graphs whose answers are known by hand — a chain, a cycle, a disconnected node, an entry outside the graph — and checks idempotence on each. Cycles must terminate rather than reaching the answer by luck, and an unreachable node must stay out however many times the fold is applied.",
743
+ decide: () => {
744
+ const key = (s: Set<string>) => [...s].sort().join(',')
745
+
746
+ // A chain, a 2-cycle, and an isolated node, all in one graph.
747
+ const g = new Map<string, readonly string[]>([
748
+ ['a', ['b']], ['b', ['c']], ['c', []],
749
+ ['x', ['y']], ['y', ['x']],
750
+ ['z', []],
751
+ ])
752
+
753
+ // Reachability, by hand.
754
+ if (key(foldToLean(g, ['a'])) !== 'a,b,c') return false
755
+ // A cycle must terminate and include both nodes exactly once.
756
+ if (key(foldToLean(g, ['x'])) !== 'x,y') return false
757
+ // An isolated node is reachable only from itself.
758
+ if (key(foldToLean(g, ['z'])) !== 'z') return false
759
+ // Nothing is reachable from nothing.
760
+ if (foldToLean(g, []).size !== 0) return false
761
+ // An entry that is not in the graph contributes nothing rather than throwing.
762
+ if (foldToLean(g, ['absent']).size !== 0) return false
763
+ // z is outside the fold from a, and stays outside however often we fold.
764
+ if (foldToLean(g, ['a']).has('z')) return false
765
+
766
+ // The definition must be well founded on every one of these.
767
+ for (const entries of [['a'], ['x'], ['z'], [], ['a', 'x'], ['absent']]) {
768
+ if (!leanIsFixed(g, entries)) return false
769
+ }
770
+
771
+ // And on a graph where an entry reaches everything, lean is everything.
772
+ const full = new Map<string, readonly string[]>([['r', ['a', 'x', 'z']], ['a', ['b']], ['b', []], ['x', ['x']], ['z', []]])
773
+ if (key(foldToLean(full, ['r'])) !== 'a,b,r,x,z') return false
774
+ return leanIsFixed(full, ['r'])
775
+ },
776
+ },
740
777
  }
741
778
 
742
779
  // ============================================================================
@@ -9,6 +9,7 @@
9
9
  * 3. Pure mathematical relationships (no randomness or entropy)
10
10
  */
11
11
 
12
+ import { pathToFileURL } from 'node:url'
12
13
  import { min, sqrt } from './0/algebra.ts'
13
14
  import {
14
15
  ZERO_ENTROPY_CONSTANTS,
@@ -297,7 +298,20 @@ export class ZeroEntropyDemo {
297
298
  }
298
299
 
299
300
  // Run demo if this file is executed directly
300
- if (typeof require !== 'undefined' && require.main === module) {
301
+ /**
302
+ * True when this file is the entry point Node was started with.
303
+ *
304
+ * ESM has no `require.main`. The CommonJS idiom did not merely fail to detect
305
+ * direct execution here — `require` is undefined in an ES module, so the guard
306
+ * THREW on import and made the whole module unloadable. Nobody importing this
307
+ * ever got far enough to notice the guard was wrong.
308
+ */
309
+ function isMainModule(): boolean {
310
+ const entry = process.argv[1]
311
+ return entry !== undefined && import.meta.url === pathToFileURL(entry).href
312
+ }
313
+
314
+ if (isMainModule()) {
301
315
  ZeroEntropyDemo.runCompleteDemo();
302
316
  }
303
317