@astralarkitekt/tau-tongue 3.6.10
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/LICENSE +21 -0
- package/README.md +319 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/phonemeCipher.d.ts +9 -0
- package/dist/phonemeCipher.d.ts.map +1 -0
- package/dist/phonemeCipher.js +97 -0
- package/dist/pythagoreanUtils.d.ts +28 -0
- package/dist/pythagoreanUtils.d.ts.map +1 -0
- package/dist/pythagoreanUtils.js +141 -0
- package/dist/tau-tongue/TauSpine.d.ts +171 -0
- package/dist/tau-tongue/TauSpine.d.ts.map +1 -0
- package/dist/tau-tongue/TauSpine.js +506 -0
- package/dist/tau-tongue/TauTomeCoverRenderer.d.ts +13 -0
- package/dist/tau-tongue/TauTomeCoverRenderer.d.ts.map +1 -0
- package/dist/tau-tongue/TauTomeCoverRenderer.js +194 -0
- package/dist/tau-tongue/TauTongueFictionTypeMap.d.ts +215 -0
- package/dist/tau-tongue/TauTongueFictionTypeMap.d.ts.map +1 -0
- package/dist/tau-tongue/TauTongueFictionTypeMap.js +107 -0
- package/dist/tau-tongue/TauTongueInterpreter_v1.d.ts +66 -0
- package/dist/tau-tongue/TauTongueInterpreter_v1.d.ts.map +1 -0
- package/dist/tau-tongue/TauTongueInterpreter_v1.js +209 -0
- package/dist/tau-tongue/TauTongueInterpreter_v2.d.ts +137 -0
- package/dist/tau-tongue/TauTongueInterpreter_v2.d.ts.map +1 -0
- package/dist/tau-tongue/TauTongueInterpreter_v2.js +545 -0
- package/dist/tau-tongue/TauTongueInterpreter_v3.d.ts +193 -0
- package/dist/tau-tongue/TauTongueInterpreter_v3.d.ts.map +1 -0
- package/dist/tau-tongue/TauTongueInterpreter_v3.js +574 -0
- package/dist/tau-tongue/TauTongueRenderer.d.ts +20 -0
- package/dist/tau-tongue/TauTongueRenderer.d.ts.map +1 -0
- package/dist/tau-tongue/TauTongueRenderer.js +114 -0
- package/dist/tau-tongue/TauTongueSymbolMap.d.ts +20 -0
- package/dist/tau-tongue/TauTongueSymbolMap.d.ts.map +1 -0
- package/dist/tau-tongue/TauTongueSymbolMap.js +1291 -0
- package/dist/tau-tongue/archetype-fiction-type-map.json +61 -0
- package/dist/tau-tongue/story-unit-specs.json +6 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Astral Arkitekt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# @astralarkitekt/tau-tongue
|
|
2
|
+
|
|
3
|
+
**A symbolic narrative algebra for meaning-making and storytelling.**
|
|
4
|
+
|
|
5
|
+
[]()
|
|
6
|
+
[]()
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## What Is Tau-Tongue?
|
|
11
|
+
|
|
12
|
+
Tau-Tongue is a deterministic symbolic pipeline that transforms any text into structured narrative data. It converts input text to numbers via Pythagorean numerology, reduces those numbers to digital roots, generates symbolic equations from a 256-operator algebra, decomposes those equations into braids, derives a crucible (thematic core), identifies antagonistic forces, locates inflection points, and produces a full narrative interpretation.
|
|
13
|
+
|
|
14
|
+
It is not AI. There is no neural network. It is pure algebraic structure — and yet the outputs land with an uncanny resonance because the mathematics of reduction naturally surfaces archetypal patterns in language.
|
|
15
|
+
|
|
16
|
+
As of v3.6.9, the entire pipeline is **config-injectable**. Supply a `TauTongueConfig` object and every layer — from digital root reduction through narrative interpretation — operates within your custom symbolic system.
|
|
17
|
+
|
|
18
|
+
**The constraint doesn't change. The vocabulary does.**
|
|
19
|
+
|
|
20
|
+
Learn more about how to use Tau-Tongue on the Astral Architecture blog!
|
|
21
|
+
|
|
22
|
+
[Tau-Tongue & Braidcraft: My secret sauce to writing better faster](https://www.astralarchitecture.com/blog/2026/tau-tongue-and-braidcraft/)
|
|
23
|
+
|
|
24
|
+
Website in the works!
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install @astralarkitekt/tau-tongue
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { TauTongueInterpreter } from '@astralarkitekt/tau-tongue';
|
|
36
|
+
|
|
37
|
+
const interpreter = new TauTongueInterpreter();
|
|
38
|
+
const result = interpreter.interpret('Once upon a time');
|
|
39
|
+
|
|
40
|
+
console.log(result.archetype); // "The Dreamweaver"
|
|
41
|
+
console.log(result.resonance); // "SOURCE"
|
|
42
|
+
console.log(result.symbolicEquation); // "∂(1, [∇(3,4),⊗(1,3,9,2,4,4,6), ...])"
|
|
43
|
+
console.log(result.crucible); // "≳(8) - A mythic potential (≳) acting upon The Mechanist"
|
|
44
|
+
console.log(result.narrativeInterpretation);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The `TauTongueResult` object contains everything: digital root, archetype, resonance, symbolic equation, braid breakdown, crucible, antagonist, inflection points, and narrative interpretation.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Custom Symbolic Systems
|
|
52
|
+
|
|
53
|
+
The headline feature of v3. Pass a `TauTongueConfig` to the constructor and the entire pipeline adapts:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { TauTongueInterpreter, SceneFunction } from '@astralarkitekt/tau-tongue';
|
|
57
|
+
|
|
58
|
+
const jungian = new TauTongueInterpreter({
|
|
59
|
+
archetypeMap: {
|
|
60
|
+
1: 'The Hero',
|
|
61
|
+
2: 'The Shadow',
|
|
62
|
+
3: 'The Anima',
|
|
63
|
+
// ... up to 12
|
|
64
|
+
},
|
|
65
|
+
archetypeDescriptions: {
|
|
66
|
+
'The Hero': 'The conscious ego embarking on the journey...',
|
|
67
|
+
'The Shadow': 'The repressed darkness...',
|
|
68
|
+
// ...
|
|
69
|
+
},
|
|
70
|
+
resonanceMap: {
|
|
71
|
+
1: 'QUEST',
|
|
72
|
+
2: 'REPRESSION',
|
|
73
|
+
3: 'INTUITION',
|
|
74
|
+
// ...
|
|
75
|
+
},
|
|
76
|
+
resonanceDescriptions: {
|
|
77
|
+
'QUEST': 'The call to adventure...',
|
|
78
|
+
// ...
|
|
79
|
+
},
|
|
80
|
+
archetypeFunctionMap: {
|
|
81
|
+
1: SceneFunction.ACTION,
|
|
82
|
+
2: SceneFunction.FLASHBACK,
|
|
83
|
+
// ...
|
|
84
|
+
},
|
|
85
|
+
typalNumbers: [10, 11, 12],
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const result = jungian.interpret('What does the shadow want?');
|
|
89
|
+
console.log(result.archetype); // A Jungian archetype, not BraidCraft
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### TauTongueConfig
|
|
93
|
+
|
|
94
|
+
Every field is optional. Omitted fields fall back to the BraidCraft defaults.
|
|
95
|
+
|
|
96
|
+
| Field | Type | Description |
|
|
97
|
+
|-------|------|-------------|
|
|
98
|
+
| `archetypeMap` | `Record<number, string>` | Digital root → archetype name. Keys define valid reduction endpoints. |
|
|
99
|
+
| `archetypeDescriptions` | `Record<string, string>` | Archetype name → prose description. |
|
|
100
|
+
| `resonanceMap` | `Record<number, string>` | Digital root → resonance label (e.g. `"QUEST"`). |
|
|
101
|
+
| `resonanceDescriptions` | `Record<string, string>` | Resonance label → prose description. |
|
|
102
|
+
| `archetypeFunctionMap` | `Record<number, SceneFunction>` | Digital root → narrative scene function (used by TauSpine). |
|
|
103
|
+
| `symbolMap` | `Record<string, SymbolDefinition>` | Custom operator algebra — symbol → definition. |
|
|
104
|
+
| `typalNumbers` | `number[]` | Numbers that halt digital-root reduction (default: `[11, 22]`). |
|
|
105
|
+
|
|
106
|
+
### Typal Numbers
|
|
107
|
+
|
|
108
|
+
A typal number is any multi-digit number you want to preserve as a valid reduction endpoint instead of summing it down to a single digit. In the default BraidCraft system, `11` and `22` are typal. In a Norse system you might use `[24]` for the Elder Futhark count. In a Jungian system, `[10, 11, 12]`.
|
|
109
|
+
|
|
110
|
+
Single-digit numbers (1–9) don't need to be listed — they're natural endpoints by definition.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## API Reference
|
|
115
|
+
|
|
116
|
+
### Core: `TauTongueInterpreter`
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
const interpreter = new TauTongueInterpreter(config?: TauTongueConfig);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
| Method | Returns | Description |
|
|
123
|
+
|--------|---------|-------------|
|
|
124
|
+
| `interpret(input)` | `TauTongueResult` | Full pipeline: text → digital root → equation → braid → crucible → narrative. |
|
|
125
|
+
| `getCrucible(equation, digitalSum, resonance, archetype)` | `string` | Extract the crucible operator and description from a symbolic equation. |
|
|
126
|
+
| `getMicroCrucible(braidFunction)` | `string` | Get a micro-crucible from a single braid function. |
|
|
127
|
+
| `getAntagonist(equation)` | `TauTongueAntagonist` | Extract the antagonist (longest braid) from the symbolic equation. |
|
|
128
|
+
| `analyzeInterference(result)` | `InflectionPoint[]` | Locate inflection points between braid functions and the interference wave. |
|
|
129
|
+
| `getInterferenceWave(result)` | `string` | Calculate the Braid Interference Wave. |
|
|
130
|
+
| `extractNarrativePalette(braid)` | `NarrativePalette` | Analyze the distribution of scene functions across the braid. |
|
|
131
|
+
| `getFunctionDescription(func)` | `string` | Get a prose description for a symbolic function string. |
|
|
132
|
+
| `render(canvas, result, options?)` | `void` | Render the tau spiral visualization on an HTML canvas. |
|
|
133
|
+
|
|
134
|
+
### Legacy Interpreters (v1 & v2)
|
|
135
|
+
|
|
136
|
+
The pre-config-injection interpreters are available under aliased exports for backward compatibility or comparison:
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
import { TauTongueInterpreterV1, TauTongueInterpreterV2 } from '@astralarkitekt/tau-tongue';
|
|
140
|
+
import type { TauTongueResultV1, TauTongueResultV2 } from '@astralarkitekt/tau-tongue';
|
|
141
|
+
|
|
142
|
+
const v2 = new TauTongueInterpreterV2();
|
|
143
|
+
const result = v2.interpret('some text'); // Uses hardcoded BraidCraft defaults
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
These are frozen at their original implementations — no config injection, no `TauTongueConfig`. Use the primary `TauTongueInterpreter` (v3) for new work.
|
|
147
|
+
|
|
148
|
+
### Narrative Structure: `TauSpine`
|
|
149
|
+
|
|
150
|
+
`TauSpine` extends `TauTongueInterpreter` and generates recursive narrative trees from interpreted results.
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import { createTauSpine, SpineFormat } from '@astralarkitekt/tau-tongue';
|
|
154
|
+
|
|
155
|
+
const spine = await createTauSpine('Once upon a time', SpineFormat.NOVEL);
|
|
156
|
+
console.log(spine.spine); // TauSpineNode[]
|
|
157
|
+
console.log(spine.stats); // { totalNodes, maxDepth, generationTime }
|
|
158
|
+
|
|
159
|
+
// Or with a custom config:
|
|
160
|
+
const spine = await createTauSpine('Once upon a time', SpineFormat.NOVEL, jungianConfig);
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**SpineFormat** determines the narrative scope:
|
|
164
|
+
|
|
165
|
+
| Format | Value | Description |
|
|
166
|
+
|--------|-------|-------------|
|
|
167
|
+
| `SHORT` | 6 | Short story |
|
|
168
|
+
| `NOVELETTE` | 7 | Novelette |
|
|
169
|
+
| `NOVELLA` | 8 | Novella |
|
|
170
|
+
| `NOVEL` | 9 | Novel |
|
|
171
|
+
| `EPIC` | 11 | Epic |
|
|
172
|
+
| `SAGA` | 22 | Saga |
|
|
173
|
+
|
|
174
|
+
Spine results can be flattened to a simple scene list via `spine.flatten()`, and scene paths formatted with `getPath(scene)`.
|
|
175
|
+
|
|
176
|
+
### Pythagorean Utilities
|
|
177
|
+
|
|
178
|
+
Low-level functions for numerological reduction. These accept an optional `PythagoreanConfig` (derived automatically when using `TauTongueInterpreter`).
|
|
179
|
+
|
|
180
|
+
| Function | Description |
|
|
181
|
+
|----------|-------------|
|
|
182
|
+
| `convertToNumbers(text)` | Convert text to a string of Pythagorean digit values. |
|
|
183
|
+
| `calculateDigitalRoot(numStr, config?)` | Reduce a number string to its digital root, respecting typal numbers. |
|
|
184
|
+
| `cipherCycle(numeroCipher, resonance, config?)` | Generate a cipher cycle string (async). |
|
|
185
|
+
| `extractBraidDigits(equation)` | Extract braid digits from a symbolic equation string. |
|
|
186
|
+
| `integerStringFromBase36(bs)` | Convert a base-36 string to its integer representation. |
|
|
187
|
+
|
|
188
|
+
### Symbol Algebra
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import { DEFAULT_SYMBOL_MAP } from '@astralarkitekt/tau-tongue';
|
|
192
|
+
import type { SymbolDefinition } from '@astralarkitekt/tau-tongue';
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Each `SymbolDefinition` contains:
|
|
196
|
+
|
|
197
|
+
| Field | Type | Description |
|
|
198
|
+
|-------|------|-------------|
|
|
199
|
+
| `name` | `string` | Display name (e.g. "Partial Derivative") |
|
|
200
|
+
| `mathMeaning` | `string` | Formal mathematical meaning |
|
|
201
|
+
| `metaphoricalMeaning` | `string` | Narrative meaning used in interpretation |
|
|
202
|
+
|
|
203
|
+
### Phoneme Generation
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
import { generatePhonemeticNames } from '@astralarkitekt/tau-tongue';
|
|
207
|
+
|
|
208
|
+
const names = generatePhonemeticNames('12345', 0, 10);
|
|
209
|
+
// Returns 10 phonemic word variations derived from the numerocipher
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Default Constants
|
|
213
|
+
|
|
214
|
+
All BraidCraft defaults are available as named exports:
|
|
215
|
+
|
|
216
|
+
- `DEFAULT_ARCHETYPE_MAP`
|
|
217
|
+
- `DEFAULT_ARCHETYPE_DESCRIPTIONS`
|
|
218
|
+
- `DEFAULT_RESONANCE_MAP`
|
|
219
|
+
- `DEFAULT_RESONANCE_DESCRIPTIONS`
|
|
220
|
+
- `DEFAULT_ARCHETYPE_FUNCTION_MAP`
|
|
221
|
+
- `DEFAULT_SYMBOL_MAP`
|
|
222
|
+
- `DEFAULT_TYPAL_NUMBERS`
|
|
223
|
+
|
|
224
|
+
### Types
|
|
225
|
+
|
|
226
|
+
All TypeScript types are exported:
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
import type {
|
|
230
|
+
TauTongueConfig,
|
|
231
|
+
TauTongueResult,
|
|
232
|
+
TauTongueAntagonist,
|
|
233
|
+
BraidInterpretation,
|
|
234
|
+
InflectionPoint,
|
|
235
|
+
NarrativePalette,
|
|
236
|
+
RenderOptions,
|
|
237
|
+
PythagoreanConfig,
|
|
238
|
+
SymbolDefinition,
|
|
239
|
+
TauSpineNode,
|
|
240
|
+
TauSpineResult,
|
|
241
|
+
FlattenedTauSpineResult,
|
|
242
|
+
FlattenedScene,
|
|
243
|
+
ArchetypalMatrix,
|
|
244
|
+
ArchetypalEntry,
|
|
245
|
+
FormatData,
|
|
246
|
+
UnitSpec,
|
|
247
|
+
} from '@astralarkitekt/tau-tongue';
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Demo Gallery
|
|
253
|
+
|
|
254
|
+
Live demos at [tools.astralarchitecture.com/tau-tongue](https://tools.astralarchitecture.com/tau-tongue/):
|
|
255
|
+
|
|
256
|
+
| Demo | Description |
|
|
257
|
+
|------|-------------|
|
|
258
|
+
| [Interpreter](https://tools.astralarchitecture.com/tau-tongue/demos/interpreter.html) | Full result workbench — digital root, archetype, equation, braid, crucible, narrative. |
|
|
259
|
+
| [Spine Generator](https://tools.astralarchitecture.com/tau-tongue/demos/spine-generator.html) | Recursive `TauSpine` tree visualization from input text. |
|
|
260
|
+
| [TauSigils](https://tools.astralarchitecture.com/tau-tongue/demos/TauSigils.html) | Ethereal continuous-line sigil drawings from braid structure. |
|
|
261
|
+
| [TauGlyphs](https://tools.astralarchitecture.com/tau-tongue/demos/TauGlyphs.html) | Colored node graphs showing structural braid relationships. |
|
|
262
|
+
| [TauAlchemy](https://tools.astralarchitecture.com/tau-tongue/demos/TauAlchemy.html) | Animated alchemical seal geometry driven by braid data. |
|
|
263
|
+
| [TauAstrolabe](https://tools.astralarchitecture.com/tau-tongue/demos/TauAstrolabe.html) | Alchemical system (v3 config) — celestial orbit visualization. |
|
|
264
|
+
| [TauAether](https://tools.astralarchitecture.com/tau-tongue/demos/TauAether.html) | Norse Runic system (v3 config) — organic aether energy fields. |
|
|
265
|
+
| [Jung-Tongue](https://tools.astralarchitecture.com/tau-tongue/demos/JungTongue.html) | Jungian chatbot — 12 archetypes, session persistence, voice input. |
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Project Structure
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
src/
|
|
273
|
+
index.ts # Public API re-exports
|
|
274
|
+
pythagoreanUtils.ts # Numerological reduction utilities
|
|
275
|
+
phonemeCipher.ts # Phonemic name generation
|
|
276
|
+
tau-tongue/
|
|
277
|
+
TauTongueInterpreter_v3.ts # Core interpreter — config-injectable (v3)
|
|
278
|
+
TauTongueInterpreter_v2.ts # Legacy interpreter (v2, pre-config)
|
|
279
|
+
TauTongueInterpreter_v1.ts # Legacy interpreter (v1)
|
|
280
|
+
TauSpine.ts # Recursive narrative structure generator
|
|
281
|
+
TauTongueSymbolMap.ts # 256-operator symbol algebra
|
|
282
|
+
TauTongueRenderer.ts # Canvas spiral renderer
|
|
283
|
+
TauTongueFictionTypeMap.ts # Fiction type classification
|
|
284
|
+
TauTomeCoverRenderer.ts # Book cover generation
|
|
285
|
+
symbol-map.json # Symbol definitions data
|
|
286
|
+
archetype-fiction-type-map.json # Archetype → fiction type mapping
|
|
287
|
+
story-unit-specs.json # Narrative unit specifications
|
|
288
|
+
demos/
|
|
289
|
+
interpreter.html # Full result workbench
|
|
290
|
+
spine-generator.html # TauSpine tree visualizer
|
|
291
|
+
TauSigils.html # Sigil art renderer
|
|
292
|
+
TauGlyphs.html # Glyph graph renderer
|
|
293
|
+
TauAlchemy.html # Alchemical seal geometry
|
|
294
|
+
TauAstrolabe.html # Alchemical config demo (v3)
|
|
295
|
+
TauAether.html # Norse Runic config demo (v3)
|
|
296
|
+
JungTongue.html # Jungian chatbot demo
|
|
297
|
+
jung-tongue-config.js # Jungian symbolic system config
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Development
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
git clone https://github.com/astralarkitekt/tau-tongue.git
|
|
306
|
+
cd tau-tongue
|
|
307
|
+
npm install
|
|
308
|
+
npm run build # Compiles TypeScript to dist/
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Demos load from `../dist/index.js` as ES modules — open any HTML file in `demos/` after building.
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Author
|
|
316
|
+
|
|
317
|
+
**Astral Arkitekt** — [astralarkitekt@gmail.com](mailto:astralarkitekt@gmail.com)
|
|
318
|
+
|
|
319
|
+
Built with deterministic algebra, insomnia, and an unreasonable amount of love. I mean coffee.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { TauTongueInterpreter, DEFAULT_ARCHETYPE_MAP, DEFAULT_ARCHETYPE_DESCRIPTIONS, DEFAULT_RESONANCE_MAP, DEFAULT_RESONANCE_DESCRIPTIONS, DEFAULT_ARCHETYPE_FUNCTION_MAP, SceneFunction, } from './tau-tongue/TauTongueInterpreter_v3.js';
|
|
2
|
+
export type { TauTongueResult, TauTongueAntagonist, BraidInterpretation, InflectionPoint, RenderOptions, NarrativePalette, TauTongueConfig, } from './tau-tongue/TauTongueInterpreter_v3.js';
|
|
3
|
+
export { TauTongueInterpreter as TauTongueInterpreterV1, } from './tau-tongue/TauTongueInterpreter_v1.js';
|
|
4
|
+
export type { TauTongueResult as TauTongueResultV1, } from './tau-tongue/TauTongueInterpreter_v1.js';
|
|
5
|
+
export { TauTongueInterpreter as TauTongueInterpreterV2, } from './tau-tongue/TauTongueInterpreter_v2.js';
|
|
6
|
+
export type { TauTongueResult as TauTongueResultV2, TauTongueAntagonist as TauTongueAntagonistV2, BraidInterpretation as BraidInterpretationV2, InflectionPoint as InflectionPointV2, NarrativePalette as NarrativePaletteV2, } from './tau-tongue/TauTongueInterpreter_v2.js';
|
|
7
|
+
export { TauSpine, createTauSpine, SpineFormat, getPath } from './tau-tongue/TauSpine.js';
|
|
8
|
+
export type { TauSpineNode, TauSpineResult, FlattenedTauSpineResult, FlattenedScene, FormatData, UnitSpec, ArchetypalEntry, ArchetypalMatrix } from './tau-tongue/TauSpine.js';
|
|
9
|
+
export { numerologyMap, convertToNumbers, calculateDigitalRoot, integerStringFromBase36, cipherCycle, extractBraidDigits, DEFAULT_TYPAL_NUMBERS } from './pythagoreanUtils.js';
|
|
10
|
+
export type { PythagoreanConfig } from './pythagoreanUtils.js';
|
|
11
|
+
export { guessPythagoreanWord as generatePhonemeticNames } from './phonemeCipher.js';
|
|
12
|
+
export { getSymbol, getSymbols, DEFAULT_SYMBOL_MAP } from './tau-tongue/TauTongueSymbolMap.js';
|
|
13
|
+
export type { SymbolDefinition } from './tau-tongue/TauTongueSymbolMap.js';
|
|
14
|
+
export { renderTauSpiral } from './tau-tongue/TauTongueRenderer.js';
|
|
15
|
+
export type { TauInput } from './tau-tongue/TauTongueRenderer.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,8BAA8B,EAC9B,qBAAqB,EACrB,8BAA8B,EAC9B,8BAA8B,EAC9B,aAAa,GACd,MAAM,yCAAyC,CAAC;AACjD,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,eAAe,GAChB,MAAM,yCAAyC,CAAC;AAGjD,OAAO,EACL,oBAAoB,IAAI,sBAAsB,GAC/C,MAAM,yCAAyC,CAAC;AACjD,YAAY,EACV,eAAe,IAAI,iBAAiB,GACrC,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACL,oBAAoB,IAAI,sBAAsB,GAC/C,MAAM,yCAAyC,CAAC;AACjD,YAAY,EACV,eAAe,IAAI,iBAAiB,EACpC,mBAAmB,IAAI,qBAAqB,EAC5C,mBAAmB,IAAI,qBAAqB,EAC5C,eAAe,IAAI,iBAAiB,EACpC,gBAAgB,IAAI,kBAAkB,GACvC,MAAM,yCAAyC,CAAC;AAGjD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC1F,YAAY,EACV,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,QAAQ,EACR,eAAe,EACf,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG/D,OAAO,EAAE,oBAAoB,IAAI,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC/F,YAAY,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,YAAY,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Main exports for the Tau-Tongue library (v3 — config-injectable)
|
|
2
|
+
export { TauTongueInterpreter, DEFAULT_ARCHETYPE_MAP, DEFAULT_ARCHETYPE_DESCRIPTIONS, DEFAULT_RESONANCE_MAP, DEFAULT_RESONANCE_DESCRIPTIONS, DEFAULT_ARCHETYPE_FUNCTION_MAP, SceneFunction, } from './tau-tongue/TauTongueInterpreter_v3.js';
|
|
3
|
+
// Legacy interpreter exports (v1 and v2 — hardcoded BraidCraft defaults)
|
|
4
|
+
export { TauTongueInterpreter as TauTongueInterpreterV1, } from './tau-tongue/TauTongueInterpreter_v1.js';
|
|
5
|
+
export { TauTongueInterpreter as TauTongueInterpreterV2, } from './tau-tongue/TauTongueInterpreter_v2.js';
|
|
6
|
+
// TauSpine exports
|
|
7
|
+
export { TauSpine, createTauSpine, SpineFormat, getPath } from './tau-tongue/TauSpine.js';
|
|
8
|
+
// Pythagorean utilities
|
|
9
|
+
export { numerologyMap, convertToNumbers, calculateDigitalRoot, integerStringFromBase36, cipherCycle, extractBraidDigits, DEFAULT_TYPAL_NUMBERS } from './pythagoreanUtils.js';
|
|
10
|
+
// Phoneme cipher utilities
|
|
11
|
+
export { guessPythagoreanWord as generatePhonemeticNames } from './phonemeCipher.js';
|
|
12
|
+
// Tau-Tongue core components
|
|
13
|
+
export { getSymbol, getSymbols, DEFAULT_SYMBOL_MAP } from './tau-tongue/TauTongueSymbolMap.js';
|
|
14
|
+
export { renderTauSpiral } from './tau-tongue/TauTongueRenderer.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate multiple phonemic variations from a numerocipher
|
|
3
|
+
* @param input - The numerocipher string
|
|
4
|
+
* @param augment - Base augment value for variation
|
|
5
|
+
* @param results - Number of results to generate (default: 10)
|
|
6
|
+
* @returns Array of phonemic strings
|
|
7
|
+
*/
|
|
8
|
+
export declare const guessPythagoreanWord: (input: string, augment?: number, results?: number) => string[];
|
|
9
|
+
//# sourceMappingURL=phonemeCipher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phonemeCipher.d.ts","sourceRoot":"","sources":["../src/phonemeCipher.ts"],"names":[],"mappings":"AAuGA;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,EACb,UAAS,MAAU,EACnB,UAAS,MAAW,KACnB,MAAM,EAUR,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// phonemicGenerator.ts
|
|
2
|
+
import { calculateDigitalRoot } from './pythagoreanUtils.js';
|
|
3
|
+
// Reverse mapping: number to possible letters
|
|
4
|
+
const reverseNumerologyMap = {
|
|
5
|
+
1: ['A', 'J', 'S'],
|
|
6
|
+
2: ['B', 'K', 'T'],
|
|
7
|
+
3: ['C', 'L', 'U'],
|
|
8
|
+
4: ['D', 'M', 'V'],
|
|
9
|
+
5: ['E', 'N', 'W'],
|
|
10
|
+
6: ['F', 'O', 'X'],
|
|
11
|
+
7: ['G', 'P', 'Y'],
|
|
12
|
+
8: ['H', 'Q', 'Z'],
|
|
13
|
+
9: ['I', 'R']
|
|
14
|
+
};
|
|
15
|
+
const isVowel = (char) => 'AEIOUYW'.includes(char.toUpperCase());
|
|
16
|
+
const getCharacterType = (char) => {
|
|
17
|
+
if (isVowel(char))
|
|
18
|
+
return 'vowel';
|
|
19
|
+
if (/[BCDFGHJKLMNPQRSTVXZ]/i.test(char))
|
|
20
|
+
return 'consonant';
|
|
21
|
+
return 'other';
|
|
22
|
+
};
|
|
23
|
+
const selectCharacterBySyllable = (options, seed, expectedType, context) => {
|
|
24
|
+
// Filter by expected type
|
|
25
|
+
let filteredOptions = options;
|
|
26
|
+
if (expectedType !== 'any') {
|
|
27
|
+
filteredOptions = options.filter(char => getCharacterType(char) === expectedType);
|
|
28
|
+
}
|
|
29
|
+
// If no options match, fall back to all options
|
|
30
|
+
if (filteredOptions.length === 0) {
|
|
31
|
+
filteredOptions = options;
|
|
32
|
+
}
|
|
33
|
+
// Avoid repetition
|
|
34
|
+
if (context.prev) {
|
|
35
|
+
const nonRepeating = filteredOptions.filter(char => char !== context.prev);
|
|
36
|
+
if (nonRepeating.length > 0) {
|
|
37
|
+
filteredOptions = nonRepeating;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Deterministic selection
|
|
41
|
+
const index = ((seed * 7919) % filteredOptions.length + filteredOptions.length) % filteredOptions.length;
|
|
42
|
+
return filteredOptions[index];
|
|
43
|
+
};
|
|
44
|
+
const generateSinglePhonemeticName = (numeroCipher, augment = 0) => {
|
|
45
|
+
if (!numeroCipher || numeroCipher.length === 0)
|
|
46
|
+
return '';
|
|
47
|
+
const digitalRoot = calculateDigitalRoot(numeroCipher) || 1;
|
|
48
|
+
let result = '';
|
|
49
|
+
for (let i = 0; i < numeroCipher.length; i++) {
|
|
50
|
+
const digit = parseInt(numeroCipher[i]);
|
|
51
|
+
if (isNaN(digit) || digit === 0) {
|
|
52
|
+
result += numeroCipher[i];
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const options = reverseNumerologyMap[digit] || [];
|
|
56
|
+
if (options.length === 0) {
|
|
57
|
+
result += numeroCipher[i];
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
// Determine what type of character we want based on position in syllable
|
|
61
|
+
let expectedType = 'any';
|
|
62
|
+
const positionInSyllable = i % 3; // Simple 3-beat syllable pattern
|
|
63
|
+
if (positionInSyllable === 0) {
|
|
64
|
+
expectedType = result.length === 0 ? 'consonant' : 'any'; // Prefer consonants at start
|
|
65
|
+
}
|
|
66
|
+
else if (positionInSyllable === 1) {
|
|
67
|
+
expectedType = 'vowel'; // Prefer vowels in middle
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
expectedType = 'consonant'; // Prefer consonants at end
|
|
71
|
+
}
|
|
72
|
+
const seed = (digitalRoot * 13) + (augment * 97) + (i * 17) + (digit * 23);
|
|
73
|
+
const context = {
|
|
74
|
+
prev: result[result.length - 1],
|
|
75
|
+
position: i
|
|
76
|
+
};
|
|
77
|
+
const selectedChar = selectCharacterBySyllable(options, seed, expectedType, context);
|
|
78
|
+
result += selectedChar;
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Generate multiple phonemic variations from a numerocipher
|
|
84
|
+
* @param input - The numerocipher string
|
|
85
|
+
* @param augment - Base augment value for variation
|
|
86
|
+
* @param results - Number of results to generate (default: 10)
|
|
87
|
+
* @returns Array of phonemic strings
|
|
88
|
+
*/
|
|
89
|
+
export const guessPythagoreanWord = (input, augment = 0, results = 10) => {
|
|
90
|
+
const variations = [];
|
|
91
|
+
for (let i = 0; i < results; i++) {
|
|
92
|
+
const currentAugment = augment + (i * 13); // Larger step between variations
|
|
93
|
+
const variation = generateSinglePhonemeticName(input, currentAugment);
|
|
94
|
+
variations.push(variation);
|
|
95
|
+
}
|
|
96
|
+
return variations;
|
|
97
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const numerologyMap: Record<string, number>;
|
|
2
|
+
export declare const convertToNumbers: (text: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Low-level Pythagorean numerology configuration.
|
|
5
|
+
* Derived automatically from {@link TauTongueConfig} — consumers
|
|
6
|
+
* should not need to construct this directly.
|
|
7
|
+
*/
|
|
8
|
+
export interface PythagoreanConfig {
|
|
9
|
+
/** Map of digital-root keys to archetype names. Keys that appear here are treated as valid reduction endpoints. */
|
|
10
|
+
archetypes: Record<number, string>;
|
|
11
|
+
/** Numbers that halt digital-root reduction (default: `[11, 22]`). */
|
|
12
|
+
typalNumbers?: number[];
|
|
13
|
+
}
|
|
14
|
+
/** Default typal (master) numbers in classical Pythagorean numerology. */
|
|
15
|
+
export declare const DEFAULT_TYPAL_NUMBERS: number[];
|
|
16
|
+
export declare const calculateDigitalRoot: (numStr: string, config?: PythagoreanConfig) => number | null;
|
|
17
|
+
export declare function integerStringFromBase36(bs: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Cipher cycling - evolve the numerical signature
|
|
20
|
+
*/
|
|
21
|
+
export declare const cipherCycle: (numeroCipher: string, resonance: number, config?: PythagoreanConfig) => Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Extract braid digits from a tau-tongue equation string.
|
|
24
|
+
* @param equation - tau-tongue equation string
|
|
25
|
+
* @returns Braid digits as a string
|
|
26
|
+
*/
|
|
27
|
+
export declare const extractBraidDigits: (equation: string) => string;
|
|
28
|
+
//# sourceMappingURL=pythagoreanUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pythagoreanUtils.d.ts","sourceRoot":"","sources":["../src/pythagoreanUtils.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA2BhD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,MAW/C,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,mHAAmH;IACnH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,EAAE,MAAM,EAAa,CAAC;AAExD,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,EAAE,SAAS,iBAAiB,KAAG,MAAM,GAAG,IA6B1F,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAgB1D;AAoBD;;GAEG;AACH,eAAO,MAAM,WAAW,GAAU,cAAc,MAAM,EAAE,WAAW,MAAM,EAAE,SAAS,iBAAiB,KAAG,OAAO,CAAC,MAAM,CAmCrH,CAAA;AAID;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,MAIrD,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Mapping of letters to numbers
|
|
2
|
+
export const numerologyMap = {
|
|
3
|
+
A: 1,
|
|
4
|
+
J: 1,
|
|
5
|
+
S: 1,
|
|
6
|
+
B: 2,
|
|
7
|
+
K: 2,
|
|
8
|
+
T: 2,
|
|
9
|
+
C: 3,
|
|
10
|
+
L: 3,
|
|
11
|
+
U: 3,
|
|
12
|
+
D: 4,
|
|
13
|
+
M: 4,
|
|
14
|
+
V: 4,
|
|
15
|
+
E: 5,
|
|
16
|
+
N: 5,
|
|
17
|
+
W: 5,
|
|
18
|
+
F: 6,
|
|
19
|
+
O: 6,
|
|
20
|
+
X: 6,
|
|
21
|
+
G: 7,
|
|
22
|
+
P: 7,
|
|
23
|
+
Y: 7,
|
|
24
|
+
H: 8,
|
|
25
|
+
Q: 8,
|
|
26
|
+
Z: 8,
|
|
27
|
+
I: 9,
|
|
28
|
+
R: 9,
|
|
29
|
+
};
|
|
30
|
+
export const convertToNumbers = (text) => {
|
|
31
|
+
// if the provided string contains NO letters and IS all numbers, return it as is
|
|
32
|
+
if (/^[0-9\s]+$/.test(text)) {
|
|
33
|
+
return text;
|
|
34
|
+
}
|
|
35
|
+
return text
|
|
36
|
+
.toUpperCase()
|
|
37
|
+
.split("")
|
|
38
|
+
.map((char) => numerologyMap[char] || char)
|
|
39
|
+
.join("");
|
|
40
|
+
};
|
|
41
|
+
/** Default typal (master) numbers in classical Pythagorean numerology. */
|
|
42
|
+
export const DEFAULT_TYPAL_NUMBERS = [11, 22];
|
|
43
|
+
export const calculateDigitalRoot = (numStr, config) => {
|
|
44
|
+
// Filter out non-numeric characters and convert to array of numbers
|
|
45
|
+
const numbers = numStr
|
|
46
|
+
.split('')
|
|
47
|
+
.filter(char => !isNaN(parseInt(char)))
|
|
48
|
+
.map(Number);
|
|
49
|
+
if (numbers.length === 0)
|
|
50
|
+
return null;
|
|
51
|
+
const isValidRoot = (n) => {
|
|
52
|
+
if (config) {
|
|
53
|
+
return config.archetypes[n] !== undefined ||
|
|
54
|
+
(config.typalNumbers ?? DEFAULT_TYPAL_NUMBERS).includes(n);
|
|
55
|
+
}
|
|
56
|
+
return n < 10 || n === 11 || n === 22; // backward compat default
|
|
57
|
+
};
|
|
58
|
+
// Initial sum
|
|
59
|
+
let sum = numbers.reduce((acc, curr) => acc + curr, 0);
|
|
60
|
+
// Keep reducing until we get a valid root
|
|
61
|
+
while (!isValidRoot(sum)) {
|
|
62
|
+
sum = String(sum)
|
|
63
|
+
.split('')
|
|
64
|
+
.map(Number)
|
|
65
|
+
.reduce((acc, curr) => acc + curr, 0);
|
|
66
|
+
}
|
|
67
|
+
return sum;
|
|
68
|
+
};
|
|
69
|
+
export function integerStringFromBase36(bs) {
|
|
70
|
+
let result = 0n;
|
|
71
|
+
const base = 36n;
|
|
72
|
+
for (const ch of bs.toUpperCase()) {
|
|
73
|
+
const code = ch.charCodeAt(0);
|
|
74
|
+
// ‘0’–‘9’ → 0–9, ‘A’–‘Z’ → 10–35
|
|
75
|
+
const digit = code >= 48 && code <= 57 ? BigInt(code - 48)
|
|
76
|
+
: code >= 65 && code <= 90 ? BigInt(code - 65 + 10)
|
|
77
|
+
: (() => { throw new Error(`Invalid base36 digit “${ch}”`); })();
|
|
78
|
+
result = result * base + digit;
|
|
79
|
+
}
|
|
80
|
+
return result.toString();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* SHA-256 hash that works in both Node.js and browser environments
|
|
84
|
+
*/
|
|
85
|
+
async function sha256Hash(input) {
|
|
86
|
+
// Check if we're in a browser environment
|
|
87
|
+
if (typeof window !== 'undefined' && window.crypto && window.crypto.subtle) {
|
|
88
|
+
const encoder = new TextEncoder();
|
|
89
|
+
const data = encoder.encode(input);
|
|
90
|
+
const hashBuffer = await window.crypto.subtle.digest('SHA-256', data);
|
|
91
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
92
|
+
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
93
|
+
}
|
|
94
|
+
// Node.js environment - dynamically import hash-wasm
|
|
95
|
+
const { sha256 } = await import('hash-wasm');
|
|
96
|
+
return sha256(input);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Cipher cycling - evolve the numerical signature
|
|
100
|
+
*/
|
|
101
|
+
export const cipherCycle = async (numeroCipher, resonance, config) => {
|
|
102
|
+
const digits = numeroCipher.split('').map(Number);
|
|
103
|
+
// create a sha256 hash of the input numeroCipher
|
|
104
|
+
const hash = await sha256Hash(numeroCipher);
|
|
105
|
+
const BigIntHash = BigInt('0x' + hash);
|
|
106
|
+
const evolved = [];
|
|
107
|
+
for (let i = 0; i < digits.length; i++) {
|
|
108
|
+
const digit = digits[i];
|
|
109
|
+
let newDigit = calculateDigitalRoot((BigIntHash / BigInt((digit + resonance + i) * resonance)).toString(), config);
|
|
110
|
+
if (newDigit === null) {
|
|
111
|
+
throw new Error(`Invalid digit encountered: ${digit}`);
|
|
112
|
+
}
|
|
113
|
+
if (!config) {
|
|
114
|
+
if (newDigit === 11)
|
|
115
|
+
newDigit = 2; // Treat master number 11 as 2
|
|
116
|
+
if (newDigit === 22)
|
|
117
|
+
newDigit = 4; // Treat master number 22 as 4
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const typal = config.typalNumbers ?? DEFAULT_TYPAL_NUMBERS;
|
|
121
|
+
if (typal.includes(newDigit) && config.archetypes[newDigit] === undefined) {
|
|
122
|
+
// collapse typal numbers to single-digit equivalents
|
|
123
|
+
while (newDigit > 9) {
|
|
124
|
+
newDigit = String(newDigit).split('').map(Number).reduce((a, b) => a + b, 0);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
evolved.push(newDigit);
|
|
129
|
+
}
|
|
130
|
+
return evolved.join('');
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Extract braid digits from a tau-tongue equation string.
|
|
134
|
+
* @param equation - tau-tongue equation string
|
|
135
|
+
* @returns Braid digits as a string
|
|
136
|
+
*/
|
|
137
|
+
export const extractBraidDigits = (equation) => {
|
|
138
|
+
// extract braid from equation (every digit between the [ and ] characters)
|
|
139
|
+
const braidMatch = equation.match(/\[(.*?)\]/);
|
|
140
|
+
return braidMatch ? braidMatch[1].replace(/\D/g, '') : '';
|
|
141
|
+
};
|