@misterscan/sesi 1.1.2 → 1.2.1
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 +29 -8
- package/bin/sesi.js +35 -34
- package/dist/ai-runtime.d.ts +5 -0
- package/dist/ai-runtime.d.ts.map +1 -1
- package/dist/ai-runtime.js +157 -7
- package/dist/ai-runtime.js.map +1 -1
- package/dist/builtins.d.ts +1 -1
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +114 -1
- package/dist/builtins.js.map +1 -1
- package/dist/interpreter.d.ts +6 -1
- package/dist/interpreter.d.ts.map +1 -1
- package/dist/interpreter.js +210 -36
- package/dist/interpreter.js.map +1 -1
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +2 -0
- package/dist/parser.js.map +1 -1
- package/dist/sesi.bundled.js +1029 -489
- package/dist/types.d.ts +9 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/docs/ARCHITECTURE.md +9 -9
- package/docs/BUILTINS.md +87 -8
- package/docs/DISTRIBUTED_SYSTEMS.md +1 -1
- package/docs/IMAGE_GENERATION.md +82 -1
- package/docs/IMPLEMENTATION_SUMMARY.md +544 -533
- package/docs/QUICKSTART.md +41 -1
- package/docs/README.md +20 -14
- package/docs/ROADMAP.md +10 -11
- package/docs/SPECIFICATION.md +37 -14
- package/docs/SYSTEMS_REASONING.md +35 -11
- package/docs/bakery_logo.png +0 -0
- package/docs/coffee_mug.png +0 -0
- package/docs/desk_lamp.png +0 -0
- package/docs/favicon.ico +0 -0
- package/docs/logo.png +0 -0
- package/docs/notebook.png +0 -0
- package/docs/sesi_ai_chronicles.md +209 -0
- package/examples/16_modules.sesi +28 -0
- package/examples/17_http_client.sesi +29 -0
- package/examples/18_parallel_requests.sesi +37 -0
- package/main/chatbot.sesi +36 -0
- package/main/conversational_classifier_weights.json +45 -0
- package/main/conversational_sentences.json +304 -0
- package/main/epochs.sesi +94 -0
- package/main/gpu_orchestrator.sesi +36 -0
- package/main/hardware_diagnostics.sesi +118 -0
- package/main/inference.sesi +54 -0
- package/main/native_chatbot.sesi +180 -0
- package/main/native_synthesizer.sesi +83 -0
- package/main/nn_personas_trainer.sesi +302 -0
- package/main/nn_responses_trainer.sesi +269 -0
- package/main/nn_sentences_trainer.sesi +330 -0
- package/main/personas.json +124 -0
- package/main/personas_classifier_weights.json +45 -0
- package/main/playground.sesi +3 -1
- package/main/predictive_typing.sesi +127 -0
- package/main/query_brain.sesi +45 -0
- package/main/response_classifier_weights.json +45 -0
- package/main/retro_chat.html +239 -0
- package/main/retro_chat_generator.sesi +745 -0
- package/main/sesi_ai.sesi +158 -0
- package/main/sesi_db_chatbot.sesi +252 -0
- package/main/terminal.log +56 -0
- package/main/terminal_chat.py +385 -0
- package/main/tests/temp_math_mod.sesi +3 -0
- package/main/tests/test_image_input.sesi +40 -0
- package/main/tests/test_v2_features.sesi +48 -0
- package/main/unified_sesi_ai.sesi +334 -0
- package/main/varied_responses.json +304 -0
- package/package.json +27 -15
- package/main/atm_deposit.sesi +0 -37
- package/main/atm_withdraw.sesi +0 -37
- package/main/data.txt +0 -1
- package/main/math_aggregator.sesi +0 -15
- package/main/math_generator.sesi +0 -7
- package/main/math_processor.sesi +0 -23
- package/main/tax_calculator.sesi +0 -15
- package/main/vault.sesi +0 -15
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# The Sesi AI Chronicles: From Idea to Neural-Empathetic Execution
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 📖 Executive Summary
|
|
6
|
+
The **Sesi AI Project** represents an extraordinary computational experiment: building a highly sophisticated, real-time, deep learning-powered conversational ecosystem natively within **Sesi**—a custom-designed, lightweight programming language with a tree-walking interpreter—and interfacing it seamlessly with modern **Python** console REPLs.
|
|
7
|
+
|
|
8
|
+
From its initial concepts of simple keyword-matching bots, Sesi AI has evolved into a **hybrid neural-probabilistic engine** featuring:
|
|
9
|
+
1. **Offline Neural Networks:** Multi-class classification models trained from scratch natively in Sesi to map sentences to complex semantic domains.
|
|
10
|
+
2. **Cognitive Brain Morphing:** Conversational personas that dynamically shift their internal probability state machines (Markov chains) based on real-time neural inference of user statements.
|
|
11
|
+
3. **Dynamic Empathy Bridges:** Multi-layered, varied dynamic analogies bridging distinct technical domains to maximize conversational cohesion.
|
|
12
|
+
4. **Unbreakable Decoding Filters:** Modern LLM-grade decoding constraints (sliding lookback windows and strict Bigram-Blocking) that completely eradicate Markov graph-loop cycles.
|
|
13
|
+
|
|
14
|
+
This chronicle serves as the definitive reference manual for the architecture, math, history, and codebase of Sesi AI.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## ⚙️ The Sesi Programming Language: Foundation & Architecture
|
|
19
|
+
|
|
20
|
+
### 1. Design Philosophy
|
|
21
|
+
Sesi is structured as a retro-inspired, offline-first systems reasoning language. It was developed to eliminate external library bloat and operate with absolute procedural transparency. Sesi is executed via a **custom tree-walking interpreter**, parsing source code files with a `.sesi` extension into an Abstract Syntax Tree (AST) before executing node traversals.
|
|
22
|
+
|
|
23
|
+
### 2. Core Syntactical Features
|
|
24
|
+
Sesi features a highly lightweight, C-like syntax:
|
|
25
|
+
* **Dynamic Typings & Coercion:** Explicit converters allow seamless casting: `num("123")`, `str(45.6)`, `type(val)`.
|
|
26
|
+
* **Dynamic Collections:** Array lists are fully supported with helper functions: `len(arr)`, `push(arr, element)`, `split(string, delimiter)`.
|
|
27
|
+
* **Natively Built-In JSON Parsing:** Crucial for model synchronization and database ingestion: `from_json(raw_string)`, `to_json(object)`.
|
|
28
|
+
* **Direct File System Access:** Natively handles persistent states: `read_file(path)`, `write_file(path, content)`.
|
|
29
|
+
|
|
30
|
+
### 3. Execution Characteristics and AST Constraints
|
|
31
|
+
Because the tree-walking interpreter processes code instructions by traversing AST nodes directly on every statement:
|
|
32
|
+
* **Computational Complexity (O-Notation):** String tokenization, Bag-of-Words mapping, and high-epoch training loops run entirely in single-threaded user space.
|
|
33
|
+
* **Optimization Solutions:** Highly recursive operations are avoided, and large text operations are optimized using localized index boundaries rather than heavy string concatenations.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 📈 The Sesi AI Evolution: Five Key Milestones
|
|
38
|
+
|
|
39
|
+
```mermaid
|
|
40
|
+
graph TD
|
|
41
|
+
A[Idea: Rule-Based Conversational Gateway] -->|Stage 1| B[Static Keyword Matchers]
|
|
42
|
+
B -->|Stage 2: Probabilistic Walk| C[Markov Chain Bigram Walkers]
|
|
43
|
+
C -->|Intermediary Testing| F[Baby Neural Network Testing Phase]
|
|
44
|
+
F -->|Stage 3: Offline Deep Learning| D[Sesi Native Backpropagation Trainer]
|
|
45
|
+
D -->|Stage 4: Cognitive Resonance| E[V4 Neural-Adaptive & Empathetic Chat REPL]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Stage 1: Static Rule-Based Conversational Gateways
|
|
49
|
+
The system began as a traditional chatbot mapping exact keyword matches (e.g. `"synthesizer"`, `"gears"`) to static, pre-written response strings. If a message fell outside the defined vocabularies, it fell back to generic catch-all prompts.
|
|
50
|
+
|
|
51
|
+
### Stage 2: Probabilistic Bigram Markov Walkers
|
|
52
|
+
To achieve natural linguistic variety, we mapped the 300 varied dialogue responses into localized word association tables (Bigram Tables).
|
|
53
|
+
* The walker parsed a text corpus, mapping transitions: `transitions[word_1] = [word_2, word_3, ...]`.
|
|
54
|
+
* To reply, the walker started at a matching keyword seed and walked the bigram associations, ending when a punctuation character (`.`, `!`, `?`) was generated.
|
|
55
|
+
|
|
56
|
+
### 🧪 Intermediary Phase: The Baby Neural Network & Proving Ground Testing Phase
|
|
57
|
+
Before ever considering text keywords, Bag-of-Words vectors, or NLP semantic routing, we initiated a **Proving Ground Phase** to verify if a custom AST-traversing tree-walking compiler could execute multi-layer backpropagation math at all. We proved this natively using raw binary `1` and `0` inputs:
|
|
58
|
+
|
|
59
|
+
#### 1. The Proving Ground: Zero-Dependency Pure Sesi XOR Classifier (`main/sesi_ai.sesi`)
|
|
60
|
+
We engineered a 2-Layer Feedforward Neural Network trained **natively in pure Sesi** to solve the non-linear **XOR Logical Gate** table with absolute zero external language dependencies:
|
|
61
|
+
* **The Math:** Structured a multi-layered network (2 Inputs, 2 Hidden Neurons, 1 Output Neuron) utilizing pure procedure-loop Sigmoid functions and derivatives:
|
|
62
|
+
$$f(x) = \frac{1}{1 + e^{-x}}, \quad f'(y) = y \cdot (1 - y)$$
|
|
63
|
+
* **The Self-Healing Watchdog Engine:** Since random weight allocations can sometimes get stuck in local minima linear traps, we engineered an automated **Self-Healing Watchdog** directly inside the Sesi script:
|
|
64
|
+
- All synaptic weights ($W_{hidden}$, $W_{output}$) and biases ($B_{hidden}$, $b_{output}$) were randomized to $[-2.0, 2.0]$.
|
|
65
|
+
- The model underwent **4,000 backpropagation training epochs** at a learning rate ($\eta$) of `0.40`.
|
|
66
|
+
- After the loop, the watchdog evaluated the final Mean Squared Error (MSE).
|
|
67
|
+
- If $MSE \ge 0.01$, the watchdog triggered an automatic retry:
|
|
68
|
+
```
|
|
69
|
+
⚠️ Stuck in linear saddle trap (MSE: 0.098). Re-seeding synapses...
|
|
70
|
+
⚡ Training attempt #2...
|
|
71
|
+
```
|
|
72
|
+
- It repeatedly re-seeded the synapses and re-ran the training until the model achieved perfect convergence ($MSE < 0.01$).
|
|
73
|
+
* **Significance:** Once the watchdog printed `🎯 Perfect convergence achieved!`, Sesi saved the trained synapses to `sesi_model_weights.json` using `write_file(..., to_json(...))`. This proved mathematically that the custom Sesi tree-walker was capable of deep learning, greenlighting all future character routing systems!
|
|
74
|
+
|
|
75
|
+
#### 2. The Native Sesi AND Logic Gate (`main/playground.sesi`)
|
|
76
|
+
To test single-neuron floating-point calculations and weight adjustments on a simpler truth table, we trained a single-neuron classifier to solve the binary **AND Logical Gate**:
|
|
77
|
+
* **The Math:** Developed a custom, high-speed **Fast Sigmoid (Softsign)** activation function to prevent custom AST float representation overflows:
|
|
78
|
+
$$f(x) = 0.5 + 0.5 \cdot \left(\frac{x}{1 + |x|}\right)$$
|
|
79
|
+
accompanied by its exact analytical derivative $f'(y) = y \cdot (1 - y)$.
|
|
80
|
+
* **Training Parameters:** Programmed weight and bias gradient backpropagation updates ($w_i \leftarrow w_i + \eta \cdot \text{error} \cdot f'(y) \cdot x_i$) over **1,500 epochs** at a learning rate ($\eta$) of `0.30`.
|
|
81
|
+
* **Results:** Successfully converged to a near-zero Mean Squared Error (MSE) loss of **`0.003`**, saving calibrated parameters to `model_weights.json` and delivering 100% accurate binary logic evaluations.
|
|
82
|
+
|
|
83
|
+
#### 3. The Telemetric Python XOR Network (`gpu_trainer.py`)
|
|
84
|
+
To visualize training curves dynamically, we built a duplicate **2-Layer XOR Network** from scratch in Python, integrating direct graphics card telemetry:
|
|
85
|
+
* **The Math:** Implemented standard Sigmoid functions. To guarantee symmetry breaking and force perfect deterministic convergence, weights were initialized dynamically to a wider $[-2.5, 2.5]$ range under seed `42` at a learning rate of `0.35` across `8000` epochs.
|
|
86
|
+
* **GPU Hardware Telemetry:** Embedded an active loop querying your physical **NVIDIA GeForce GTX 1660 Ti** graphics card, tracking live dedicated VRAM consumption (GDDR6 pool), core graphics utilization, and core operating temperatures.
|
|
87
|
+
* **Telemetry Dashboard:** Built a daemon local HTTP server on port 8000 to bypass browser CORS security protocols, streaming epoch-by-epoch predictions and training telemetry directly into the glowing SVG circular gauges of **[`training_hub.html`](file:///c:/Users/owner/Documents/Sesi/training_hub.html)**.
|
|
88
|
+
|
|
89
|
+
### Stage 3: Sesi Native Deep Learning & Zero-Shot Categorization
|
|
90
|
+
Having successfully proved logical gate convergence, we scaled our architecture to NLP vector spaces. We built **`main/nn_personas_trainer.sesi`** and **`main/nn_responses_trainer.sesi`**.
|
|
91
|
+
These scripts read raw character profiles and conversational sentences, constructed Bag-of-Words (BoW) feature vectors, and trained a 10x3 neural classifier from scratch over 1,500–2,500 epochs directly in the Sesi tree-walker, saving the weights to `response_classifier_weights.json`.
|
|
92
|
+
|
|
93
|
+
### Stage 4: V4 Natively Neural-Empathetic & Loop-Free Chat REPL
|
|
94
|
+
The final stage brought absolute conversational symmetry:
|
|
95
|
+
* **Netscape Navigator Web Portal:** Spawns two characters to debate, executing live neural inference on every turn to dynamically shift their brains.
|
|
96
|
+
* **Terminal Chat REPL:** Interactive Python gateway featuring real-time HSL-colored confidence graphs, dynamic speech brain morphing, dynamic analogies, and loop-free decoding filters.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🧠 Neural Network Mathematics & Backpropagation Pipeline
|
|
101
|
+
|
|
102
|
+
Sesi AI uses a **10x3 Single-Layer Feedforward Neural Network Classifier** to distribute semantic probability.
|
|
103
|
+
|
|
104
|
+
### 1. Vectorization Space (Bag-of-Words)
|
|
105
|
+
The input text is tokenized, stripped of punctuation, and mapped against a **10-Feature Vocabulary**:
|
|
106
|
+
$$\mathcal{V} = [\text{"synthesizer"}, \text{"vinyl"}, \text{"record"}, \text{"wood"}, \text{"gears"}, \text{"clock"}, \text{"compiler"}, \text{"framework"}, \text{"memory"}, \text{"offline"}]$$
|
|
107
|
+
|
|
108
|
+
Each string produces a 10-dimensional one-hot representation vector $\mathbf{x} \in \mathbb{R}^{10}$, where:
|
|
109
|
+
$$x_i = \begin{cases} 1.0 & \text{if } \mathcal{V}_i \in \text{input\_tokens} \\ 0.0 & \text{otherwise} \end{cases}$$
|
|
110
|
+
|
|
111
|
+
### 2. Forward Pass Mathematical Calculations
|
|
112
|
+
The 3 output classes correspond directly to our conversational domains:
|
|
113
|
+
$$\mathcal{C} = [\text{"audio"}, \text{"mechanical"}, \text{"systems"}]$$
|
|
114
|
+
|
|
115
|
+
For each class $c \in \{0, 1, 2\}$, the raw activation value $y_c$ is calculated against class biases $\mathbf{b} \in \mathbb{R}^3$ and weights $\mathbf{W} \in \mathbb{R}^{3 \times 10}$:
|
|
116
|
+
$$y_c = b_c + \sum_{i=1}^{10} x_i \cdot W_{c, i}$$
|
|
117
|
+
|
|
118
|
+
To calculate normalized probability distributions $\mathbf{p} \in \mathbb{R}^3$ without overflow on limited custom interpreters, we implement a **Softmax activation function**:
|
|
119
|
+
$$p_c = \frac{e^{y_c}}{\sum_{j=0}^{2} e^{y_j}}$$
|
|
120
|
+
|
|
121
|
+
### 3. Backpropagation Gradient Updates
|
|
122
|
+
Natively programmed in Sesi, the network is trained using **Mean Squared Error (MSE) loss** combined with Sigmoid/Softmax derivatives to adjust weights and biases over thousands of epochs:
|
|
123
|
+
$$\mathbf{W}_{c, i} \leftarrow \mathbf{W}_{c, i} - \eta \cdot \frac{\partial \mathcal{L}}{\partial W_{c, i}}$$
|
|
124
|
+
Where $\eta$ represents the optimized learning rate (`0.30` - `0.45`).
|
|
125
|
+
|
|
126
|
+
The final calibrated parameters are stored in **[`main/response_classifier_weights.json`](file:///c:/Users/owner/Documents/Sesi/main/response_classifier_weights.json)**:
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"weights": [
|
|
130
|
+
[18.51, 18.35, 20.76, -16.23, 0.08, -0.03, -15.94, -16.59, 0.42, -15.24],
|
|
131
|
+
[-16.51, -16.25, -18.64, 17.02, -0.11, -0.27, -17.95, -18.82, 0.23, -17.17],
|
|
132
|
+
[-16.76, -16.51, -18.92, -15.86, -0.35, -0.24, 18.66, 19.53, -0.40, 17.88]
|
|
133
|
+
],
|
|
134
|
+
"biases": [-1.884, -0.418, -0.128]
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 🔗 The Win95 Netscape Navigator Dialectic Portal (V4)
|
|
141
|
+
|
|
142
|
+
### 1. Visual Aesthetics & Window Layout
|
|
143
|
+
The Netscape Portal (**[`retro_chat.html`](file:///c:/Users/owner/Documents/Sesi/main/retro_chat.html)**) implements a beautiful, glassmorphic-inspired Win95 desktop layout:
|
|
144
|
+
* A Win95 Teal desktop background (`#008080`).
|
|
145
|
+
* A fully beveled Netscape Navigator program frame with Linear Gradient title bars, menu panels (`File`, `Edit`, `View`), beveled location input fields, and standard back/forward button controls.
|
|
146
|
+
* A high-contrast, black-and-green IRC chat log console.
|
|
147
|
+
* Real-time color-coded neural tag flags: `[NEURAL: audio]` in vibrant green, `[NEURAL: mechanical]` in bright yellow, and `[NEURAL: systems]` in deep cyan.
|
|
148
|
+
|
|
149
|
+
### 2. The Graph-Loop Repetition Vulnerability
|
|
150
|
+
During early iterations of Markov dialogue walkers, characters would routinely fall into **infinite graph loops**. Because standard bigrams only evaluate a 1-word lookahead, the generator maintains no global semantic context. If the walker selects a common word pair (e.g. `"...how the..."`), the walk can jump back onto an identical path, repeating:
|
|
151
|
+
> *"You should hear how the retro chiptune audio loop plays... You should hear how the retro chiptune..."*
|
|
152
|
+
|
|
153
|
+
### 3. Engineering the Unbreakable Decoding Filters
|
|
154
|
+
To guarantee loop-free, natural prose, we designed and integrated modern LLM-grade decoding constraints natively into the walker:
|
|
155
|
+
1. **Extended Sliding Lookback (Size 15):** The walker maintains a history of the last 15 generated tokens. If a candidate word resides within this sliding window, it is instantly penalized and rejected.
|
|
156
|
+
2. **Strict Bigram Blocking (`No-Repeat-N-Gram` Size 2):** The walker tracks every transition pair `(w1 -> w2)` generated in the current sentence. If a proposed transition `current_word -> candidate` has **already occurred anywhere** in the history array, that candidate is completely banned and the walker selects an alternative.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 📻 The Natively Neural-Empathetic Terminal Chat REPL (V4)
|
|
161
|
+
|
|
162
|
+
The terminal chat portal (**[`main/terminal_chat.py`](file:///c:/Users/owner/Documents/Sesi/main/terminal_chat.py)**) provides an interactive, robust, and highly aesthetic command-line gateway.
|
|
163
|
+
|
|
164
|
+
### 1. Interactive Selection Directory
|
|
165
|
+
On launch, the REPL prints a beautiful, double-beveled ASCII table listing all 20 specialized experts with their native age and categorized domains. The operator can input index `[0-19]` to dial in a secure offline connection to their desired persona.
|
|
166
|
+
|
|
167
|
+
### 2. HSL-Aligned Terminal Dials & Probability Bars
|
|
168
|
+
Upon every conversational turn, the REPL prints a visually outstanding probability progress bar detailing the exact softmax confidence distribution:
|
|
169
|
+
```ansi
|
|
170
|
+
[ NEURAL RESPONSE CLASSIFICATION ]
|
|
171
|
+
[ AUDIO ████████████████ (100.0%) ]
|
|
172
|
+
[ MECH ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ( 0.0%) ]
|
|
173
|
+
[ SYSTEM ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ( 0.0%) ]
|
|
174
|
+
[ ROUTING COGNITIVE FLOW -> AUDIO CLASS ]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 3. Cognitive Brain Morphing & Dynamic Empathy Bridges
|
|
178
|
+
* **Dynamic Morphing:** If you are talking to a `systems` specialist but type an `audio` focused comment, the specialist **instantly morphs their transition matrices** to access the audio corpus, mirroring your cognitive focus.
|
|
179
|
+
* **Empathetic Mismatch Bridges:** The specialist uses the mismatch to formulate a gorgeous technical analogy bridging their native specialty to your predicted domain (e.g. systems compiler pointers compared to mechanical gear leverages).
|
|
180
|
+
* **Loop-Free Prefix Variation:** To prevent prefix monotony, we engineered a dynamic dictionary mapping relationship pairs to pools of **3-4 random prefix variations**, selecting a fresh one on every conversational turn!
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 📂 Mapping the Sesi AI Codebase
|
|
185
|
+
|
|
186
|
+
The architecture is divided logically across modular scripts, databases, and UI assets:
|
|
187
|
+
|
|
188
|
+
### 1. Dynamic Code Files
|
|
189
|
+
* **[`main/terminal_chat.py`](file:///c:/Users/owner/Documents/Sesi/main/terminal_chat.py) [NEW V4]:** The interactive python terminal REPL gateway. Integrates dynamic prefix variations, HSL colored probability bars, cognitive brain morphing, and loop-free bigram blocking.
|
|
190
|
+
* **[`main/retro_chat_generator.sesi`](file:///c:/Users/owner/Documents/Sesi/main/retro_chat_generator.sesi) [NEW V4]:** Compiles the offline 3-category Markov brains, performs real-time neural inference loops in Sesi, runs the strict bigram-blocking walker, and writes the Win95 Netscape HTML portal.
|
|
191
|
+
* **[`main/nn_personas_trainer.sesi`](file:///c:/Users/owner/Documents/Sesi/main/nn_personas_trainer.sesi) [NEW]:** Trains a multi-class neural network on conversational sentences to zero-shot classify all 20 character bios.
|
|
192
|
+
* **[`main/nn_sentences_trainer.sesi`](file:///c:/Users/owner/Documents/Sesi/main/nn_sentences_trainer.sesi) [NEW]:** Inversely trains on character bios to zero-shot classify all 300 dialog sentences.
|
|
193
|
+
|
|
194
|
+
### 2. Calibrated Neural Synapses & Data Layers
|
|
195
|
+
* **[`main/response_classifier_weights.json`](file:///c:/Users/owner/Documents/Sesi/main/response_classifier_weights.json):** The calibrated 10x3 weights and 3x1 biases file.
|
|
196
|
+
* **[`main/personas.json`](file:///c:/Users/owner/Documents/Sesi/main/personas.json):** Roster of all 20 specialized expert character profiles.
|
|
197
|
+
* **[`main/varied_responses.json`](file:///c:/Users/owner/Documents/Sesi/main/varied_responses.json):** The 300 varied conversational sentences corpus (100 audio, 100 mechanical, 100 systems).
|
|
198
|
+
|
|
199
|
+
### 3. Display Portals
|
|
200
|
+
* **[`main/retro_chat.html`](file:///c:/Users/owner/Documents/Sesi/main/retro_chat.html):** The generated beveled Win95 Netscape Navigator portal loaded with loop-free, neural-adaptive dialectics.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 🏆 Conclusion & The Future of Sesi AI
|
|
205
|
+
Sesi AI proves that complex, cognitively adaptive AI environments do not require massive modern cloud API integrations or bloated dependency frameworks.
|
|
206
|
+
|
|
207
|
+
By layering **simple feed-forward neural networks** over **probabilistic Markov structures** and applying **strict LLM-grade decoding constraints (bigram blocking)**, Sesi AI produces highly articulate, technically dense, and contextually empathetic dialog natively on localized hardware.
|
|
208
|
+
|
|
209
|
+
The Sesi compiler and its neural pipelines stand ready for further telemetry, higher-dimensional bag-of-words vocabularies, and expanded multi-layered neural configurations.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Example 16: Modules and Standard Library Namespace
|
|
2
|
+
// Demonstrates:
|
|
3
|
+
// 1. Importing named variables/functions from standard library modules.
|
|
4
|
+
// 2. Importing custom Sesi modules using relative paths.
|
|
5
|
+
|
|
6
|
+
print "=== 1. Standard Math Module ==="
|
|
7
|
+
import {PI, E, sqrt, pow, sin} from "std/math"
|
|
8
|
+
print "PI constant:" + str(PI)
|
|
9
|
+
print "Euler's number:" + str(E)
|
|
10
|
+
print "Square root of 144:" + str(sqrt(144))
|
|
11
|
+
print "2 raised to power of 10:" + str(pow(2, 10))
|
|
12
|
+
print "Sine of PI/2:" + str(sin(PI / 2.0))
|
|
13
|
+
print "=== 2. Standard JSON Module ==="
|
|
14
|
+
import {stringify, parse} from "std/json"
|
|
15
|
+
let original = {"project": "Sesi Language", "version": "1.2.1", "features": ["modules", "http", "parallel"]}
|
|
16
|
+
let json_str = stringify(original)
|
|
17
|
+
print "Serialized JSON string:"
|
|
18
|
+
print json_str
|
|
19
|
+
let restored = parse(json_str)
|
|
20
|
+
print "Deserialized Project Name:" restored["project"]
|
|
21
|
+
print "Deserialized Version:" restored["version"]
|
|
22
|
+
print "=== 3. Custom Sesi Module ==="
|
|
23
|
+
|
|
24
|
+
// Relative imports let you reuse Sesi code across files cleanly.
|
|
25
|
+
// We will import custom exported variables and functions from a local module.
|
|
26
|
+
import {magic_number, multiply} from "main/tests/temp_math_mod"
|
|
27
|
+
print "Imported magic number from local module:" + str(magic_number)
|
|
28
|
+
print "Running imported multiply(5, 5):" + str(multiply(5, 5))
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Example 17: HTTP Network Client
|
|
2
|
+
// Demonstrates:
|
|
3
|
+
// 1. web_get for fetching external JSON resources.
|
|
4
|
+
// 2. web_send for posting raw JSON strings to APIs.
|
|
5
|
+
// 3. std/json parsing to query structural details.
|
|
6
|
+
|
|
7
|
+
import {parse} from "std/json"
|
|
8
|
+
print "=== 1. Executing HTTP GET ==="
|
|
9
|
+
let get_url = "https://jsonplaceholder.typicode.com/posts/1"
|
|
10
|
+
print "Fetching from:" get_url
|
|
11
|
+
let response_str = web_get(get_url)
|
|
12
|
+
print "Raw Response string (truncated):"
|
|
13
|
+
print response_str
|
|
14
|
+
let post = parse(response_str)
|
|
15
|
+
print "\nParsed Fields:"
|
|
16
|
+
print "Post ID:" + str(post["id"])
|
|
17
|
+
print "Title:" post["title"]
|
|
18
|
+
print "Body:" post["body"]
|
|
19
|
+
print "\n=== 2. Executing HTTP POST ==="
|
|
20
|
+
let post_url = "https://jsonplaceholder.typicode.com/posts"
|
|
21
|
+
let payload = "{\"title\": \"Sesi HTTP Client\", \"body\": \"Natively supported in v1.2!\", \"userId\": 42}"
|
|
22
|
+
print "Posting payload to:" post_url
|
|
23
|
+
let post_response = web_send(post_url, payload)
|
|
24
|
+
print "POST Response:"
|
|
25
|
+
print post_response
|
|
26
|
+
let result = parse(post_response)
|
|
27
|
+
print "\nCreated Post Details:"
|
|
28
|
+
print "Assigned ID:" + str(result["id"])
|
|
29
|
+
print "Confirmed Title:" result["title"]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Example 18: Parallel Requests and Concurrency
|
|
2
|
+
// Demonstrates:
|
|
3
|
+
// 1. multi_req builtin to trigger multiple functions in parallel.
|
|
4
|
+
// 2. Concurrency duration benchmarking.
|
|
5
|
+
// 3. Dynamic array resolution.
|
|
6
|
+
|
|
7
|
+
import {sleep, now} from "std/time"
|
|
8
|
+
print "=== 1. Defining Concurrently Run Closures ==="
|
|
9
|
+
fn slowTask1() {
|
|
10
|
+
print "Starting Task 1 (sleeping 150ms)..."
|
|
11
|
+
sleep(150)
|
|
12
|
+
print "Task 1 complete!"
|
|
13
|
+
return "result_from_task_1"
|
|
14
|
+
}
|
|
15
|
+
fn slowTask2() {
|
|
16
|
+
print "Starting Task 2 (sleeping 150ms)..."
|
|
17
|
+
sleep(150)
|
|
18
|
+
print "Task 2 complete!"
|
|
19
|
+
return "result_from_task_2"
|
|
20
|
+
}
|
|
21
|
+
print "=== 2. Sequential Execution (Demonstration) ==="
|
|
22
|
+
let seq_start = now()
|
|
23
|
+
let r1 = slowTask1()
|
|
24
|
+
let r2 = slowTask2()
|
|
25
|
+
let seq_elapsed = now() - seq_start
|
|
26
|
+
print "Sequential took: " + str(seq_elapsed) "ms (should be >= 300ms)"
|
|
27
|
+
print "=== 3. Parallel Execution via multi_req ==="
|
|
28
|
+
let start_time = now()
|
|
29
|
+
// multi_req accepts an array of Sesi functions and executes them concurrently.
|
|
30
|
+
let results = multi_req([slowTask1, slowTask2])
|
|
31
|
+
let elapsed = now() - start_time
|
|
32
|
+
print "Returned Results array:"
|
|
33
|
+
print str(results)
|
|
34
|
+
print "Parallel took: " + str(elapsed) "ms (should be ~150ms - physically parallel!)"
|
|
35
|
+
if elapsed < 220
|
|
36
|
+
{print "✓ Success! Native Sesi concurrency verified: jobs ran in parallel."
|
|
37
|
+
} else {print "✗ Failure: jobs ran sequentially."}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Sesi Script: chatbot.sesi
|
|
2
|
+
// Pure-Sesi AI Chatbot Core
|
|
3
|
+
// Compiles full repository documentation and uses Sesi's native reasoning models to answer user queries!
|
|
4
|
+
|
|
5
|
+
// 1. Read the user's active query
|
|
6
|
+
let query = read_file("query.txt")
|
|
7
|
+
|
|
8
|
+
print "📖 Loading repository documentation context..."
|
|
9
|
+
|
|
10
|
+
// 2. Load repo documents dynamically
|
|
11
|
+
let docs_list = list_dir("docs")
|
|
12
|
+
let sesiDocs = ""
|
|
13
|
+
let d = 0
|
|
14
|
+
while d < len(docs_list) {
|
|
15
|
+
let f_name = docs_list[d]
|
|
16
|
+
let parts = split(f_name, ".")
|
|
17
|
+
let ext = parts[len(parts) - 1]
|
|
18
|
+
|
|
19
|
+
if ext == "md" {
|
|
20
|
+
let doc_content = read_file("docs/" + f_name)
|
|
21
|
+
sesiDocs = sesiDocs + "\n\n=== DOCUMENT: " + f_name + " ===\n" + doc_content
|
|
22
|
+
}
|
|
23
|
+
d = d + 1
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// 3. Assemble full system context
|
|
27
|
+
let system_context = "You are Sesi AI, the official co-pilot of the Sesi Programming Language. Below is the official reference documentation and native codebase of Sesi: " + sesiDocs + "Use this data to answer the user's question with absolute technical precision. Maintain Sesi's programming rules. Be helpful, highly structured, and technical."
|
|
28
|
+
|
|
29
|
+
print "🚀 Querying Sesi's native gemini-3.1-flash-lite reasoning model..."
|
|
30
|
+
|
|
31
|
+
// 4. Fire Sesi's native reasoning model call!
|
|
32
|
+
let response = model("gemini-3.1-flash-lite") {"temperature": 0.2, "max_tokens": 1500} {system_context query}
|
|
33
|
+
|
|
34
|
+
// 5. Write the response back to disk for the server to serve
|
|
35
|
+
write_file("response.txt", response)
|
|
36
|
+
print "💾 Response written to response.txt successfully!"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"weights": [
|
|
3
|
+
[
|
|
4
|
+
6.54751323143524,
|
|
5
|
+
9.161936321711377,
|
|
6
|
+
6.828349502665508,
|
|
7
|
+
-4.363756022192589,
|
|
8
|
+
-4.713488021039098,
|
|
9
|
+
-4.774485427471602,
|
|
10
|
+
-9.286208196591454,
|
|
11
|
+
-0.38991028252594795,
|
|
12
|
+
-8.252401009165684,
|
|
13
|
+
-5.831385522908892
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
-5.908357693081539,
|
|
17
|
+
-8.994984260389524,
|
|
18
|
+
-4.163781852153977,
|
|
19
|
+
5.788867406190068,
|
|
20
|
+
5.250314037771244,
|
|
21
|
+
5.280339654572382,
|
|
22
|
+
-8.720661119362022,
|
|
23
|
+
-0.049324574032459934,
|
|
24
|
+
-8.29913233700915,
|
|
25
|
+
-6.123489460656876
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
-4.136943419887583,
|
|
29
|
+
-4.970069356953488,
|
|
30
|
+
-5.61676352859893,
|
|
31
|
+
-5.649928349291012,
|
|
32
|
+
-3.9290613787717477,
|
|
33
|
+
-3.9411646798077933,
|
|
34
|
+
10.575232816274555,
|
|
35
|
+
-0.3145035226641236,
|
|
36
|
+
10.449678562106097,
|
|
37
|
+
6.957636469807581
|
|
38
|
+
]
|
|
39
|
+
],
|
|
40
|
+
"biases": [
|
|
41
|
+
-2.1216275578739614,
|
|
42
|
+
-1.3831026310976697,
|
|
43
|
+
1.0061063861755581
|
|
44
|
+
]
|
|
45
|
+
}
|