@misterscan/sesi 1.2.3 → 1.3.2

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.
Files changed (96) hide show
  1. package/.agents/rules/sesi-must-read.md +116 -0
  2. package/.agents/workflows/create-sesi-script.md +44 -0
  3. package/.agents/workflows/fix-sesi-script.md +14 -0
  4. package/.github/prompts/MakeInSesi.prompt.md +79 -0
  5. package/README.md +163 -51
  6. package/bin/sesi.js +196 -38
  7. package/chatbot/chatbot.html +488 -0
  8. package/{main → chatbot}/chatbot.sesi +1 -2
  9. package/chatbot/chatbot_server.py +105 -0
  10. package/chatbot/sesi_db_chatbot.sesi +278 -0
  11. package/dist/ai-runtime.js +2 -2
  12. package/dist/builtins.d.ts.map +1 -1
  13. package/dist/builtins.js +199 -5
  14. package/dist/builtins.js.map +1 -1
  15. package/dist/index.d.ts +12 -2
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +90 -6
  18. package/dist/index.js.map +1 -1
  19. package/dist/interpreter.d.ts +21 -2
  20. package/dist/interpreter.d.ts.map +1 -1
  21. package/dist/interpreter.js +201 -92
  22. package/dist/interpreter.js.map +1 -1
  23. package/dist/lexer.d.ts.map +1 -1
  24. package/dist/lexer.js +8 -4
  25. package/dist/lexer.js.map +1 -1
  26. package/dist/parser.d.ts +1 -0
  27. package/dist/parser.d.ts.map +1 -1
  28. package/dist/parser.js +21 -12
  29. package/dist/parser.js.map +1 -1
  30. package/dist/sesi.bundled.js +2526 -1487
  31. package/dist/types.d.ts +14 -2
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/types.js +33 -1
  34. package/dist/types.js.map +1 -1
  35. package/docs/ARCHITECTURE.md +21 -13
  36. package/docs/BUILTINS.md +136 -19
  37. package/docs/CLI.md +200 -0
  38. package/docs/COMPARISON.md +16 -13
  39. package/docs/IMAGE_GENERATION.md +13 -14
  40. package/docs/IMPLEMENTATION_SUMMARY.md +174 -110
  41. package/docs/QUICKSTART.md +173 -39
  42. package/docs/README.md +202 -54
  43. package/docs/{SYSTEMS_REASONING.md → REASONING.md} +115 -120
  44. package/docs/ROADMAP.md +51 -47
  45. package/docs/SKILLS.md +73 -98
  46. package/docs/SPECIFICATION.md +59 -40
  47. package/examples/03_functions.sesi +30 -1
  48. package/examples/07_prompts.sesi +27 -3
  49. package/examples/08_model_call.sesi +6 -4
  50. package/examples/09_structured_output.sesi +19 -3
  51. package/examples/10_code_generation.sesi +6 -4
  52. package/examples/11_memory_conversation.sesi +47 -15
  53. package/examples/12_classification.sesi +62 -7
  54. package/examples/13_data_pipeline.sesi +55 -28
  55. package/examples/14_folder_explainer.sesi +52 -51
  56. package/examples/15_image_generation.sesi +15 -14
  57. package/examples/16_modules.sesi +27 -27
  58. package/examples/19_search_web.sesi +18 -2
  59. package/examples/20_model_aliases.sesi +22 -0
  60. package/examples/21_custom_tools.sesi +27 -0
  61. package/examples/22_reasoning_plus_custom_tools.sesi +19 -0
  62. package/main/tests/test-args.sesi +7 -0
  63. package/main/tests/test_args.sesi +7 -0
  64. package/main/tests/test_general_modules.sesi +127 -0
  65. package/main/tests/test_grounding.sesi +2 -0
  66. package/package.json +26 -22
  67. package/docs/DISTRIBUTED_SYSTEMS.md +0 -71
  68. package/docs/sesi_ai_chronicles.md +0 -209
  69. package/main/conversational_classifier_weights.json +0 -45
  70. package/main/conversational_sentences.json +0 -304
  71. package/main/epochs.sesi +0 -94
  72. package/main/gpu_orchestrator.sesi +0 -36
  73. package/main/hardware_diagnostics.sesi +0 -118
  74. package/main/inference.sesi +0 -54
  75. package/main/native_chatbot.sesi +0 -180
  76. package/main/native_synthesizer.sesi +0 -83
  77. package/main/nn_personas_trainer.sesi +0 -302
  78. package/main/nn_responses_trainer.sesi +0 -269
  79. package/main/nn_sentences_trainer.sesi +0 -330
  80. package/main/orchestrator.sesi +0 -15
  81. package/main/personas.json +0 -124
  82. package/main/personas_classifier_weights.json +0 -45
  83. package/main/playground.sesi +0 -3
  84. package/main/predictive_typing.sesi +0 -127
  85. package/main/query_brain.sesi +0 -45
  86. package/main/response_classifier_weights.json +0 -45
  87. package/main/retro_chat.html +0 -239
  88. package/main/retro_chat_generator.sesi +0 -745
  89. package/main/sesi_ai.sesi +0 -158
  90. package/main/sesi_db_chatbot.sesi +0 -280
  91. package/main/setup_swarm.sesi +0 -5
  92. package/main/start.sesi +0 -13
  93. package/main/terminal.log +0 -56
  94. package/main/terminal_chat.py +0 -385
  95. package/main/unified_sesi_ai.sesi +0 -334
  96. package/main/varied_responses.json +0 -304
package/main/epochs.sesi DELETED
@@ -1,94 +0,0 @@
1
- print "------------------------------------------"
2
- print "🎛️ Hyperparameter Tuning Sesi Neural Network..."
3
-
4
- // 1. Inputs and Targets
5
- let inputs = [[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]]
6
- let targets = [0.0, 0.0, 0.0, 1.0]
7
-
8
- // 2. TUNED HYPERPARAMETERS
9
- let w1 = random() - 0.5
10
- let w2 = random() - 0.5
11
- let b = random() - 0.5
12
-
13
- let lr = 0.3 // Increased Learning Rate (from 0.15 to 0.3) to take bigger steps
14
- let epochs = 1500 // Increased Epochs (from 300 to 1500) to give the network 5x more practice!
15
-
16
- print "Initial Parameters:"
17
- print "w1: " + str(w1) + ", w2: " + str(w2) + ", bias: " + str(b)
18
- print "Training with Tuned Parameters (lr = 0.3, epochs = 1500)..."
19
- print "------------------------------------------"
20
-
21
- // Fast Sigmoid (Softsign) activation
22
- fn activate(x) {
23
- let absX = x
24
- if x < 0.0 {
25
- absX = 0.0 - x
26
- }
27
- return 0.5 + (0.5 * (x / (1.0 + absX)))
28
- }
29
-
30
- fn activate_derivative(y) {
31
- return y * (1.0 - y)
32
- }
33
-
34
- // 3. Training Loop
35
- let totalError = 0.0 // Declared outside the loop to be in-scope for final print diagnostics!
36
- let epoch = 0
37
- while epoch < epochs {
38
- totalError = 0.0
39
- let i = 0
40
-
41
- while i < 4 {
42
- let x = inputs[i]
43
- let target = targets[i]
44
-
45
- // Forward Propagation
46
- let sum = (x[0] * w1) + (x[1] * w2) + b
47
- let output = activate(sum)
48
-
49
- // Calculate Error
50
- let error = target - output
51
- totalError = totalError + (error * error)
52
-
53
- // Backpropagation
54
- let gradient = error * activate_derivative(output)
55
-
56
- // Gradient Updates
57
- w1 = w1 + (lr * gradient * x[0])
58
- w2 = w2 + (lr * gradient * x[1])
59
- b = b + (lr * gradient)
60
-
61
- i = i + 1
62
- }
63
-
64
- // Log Loss progress to see convergence
65
- if (epoch % 300) == 0 {
66
- print "Epoch " + str(epoch) + " - Loss (MSE): " + str(totalError / 4.0)
67
- }
68
-
69
- epoch = epoch + 1
70
- }
71
-
72
- print "------------------------------------------"
73
- print "🎉 Tuned Training Complete!"
74
- print "Final Loss (MSE): " + str(totalError / 4.0) // This will now parse successfully!
75
- print "------------------------------------------"
76
-
77
- // 4. Save the tuned model to disk
78
- let modelState = {"w1": w1, "w2": w2, "b": b}
79
- write_file("model_weights.json", to_json(modelState))
80
- print "💾 Saved tuned knobs to model_weights.json"
81
- print "------------------------------------------"
82
-
83
- // 5. Testing Tuned Predictions
84
- print "🔮 Testing Tuned Predictions:"
85
- let i = 0
86
- while i < 4 {
87
- let x = inputs[i]
88
- let sum = (x[0] * w1) + (x[1] * w2) + b
89
- let pred = activate(sum)
90
-
91
- print "Input: [" + str(x[0]) + ", " + str(x[1]) + "] -> Expected: " + str(targets[i]) + " -> Predicted: " + str(pred)
92
- i = i + 1
93
- }
94
- print "------------------------------------------"
@@ -1,36 +0,0 @@
1
- // Sesi Script: gpu_orchestrator.sesi
2
- // Master bootstrap and execution controller for the GPU Live Telemetry & Baby Neural Network pipeline.
3
-
4
- print "=========================================="
5
- print "🖥️ Sesi Deep Learning Pipeline Bootstrap..."
6
- print "=========================================="
7
-
8
- // 1. Seed the initial progress.json file to prevent browser fetch race conditions
9
- let initialState = "{\n \"epoch\": 0,\n \"max_epochs\": 1500,\n \"loss\": 0.25,\n \"accuracy\": 0.5,\n \"loss_history\": [0.25],\n \"accuracy_history\": [0.5],\n \"gpu\": {\n \"temp\": 38,\n \"util\": 0,\n \"vram_used\": 450,\n \"vram_total\": 4096\n },\n \"status\": \"Pipeline initialized... waiting for GPU start.\",\n \"predictions\": [0.5, 0.5, 0.5, 0.5]\n}"
10
-
11
- write_file("progress.json", initialState)
12
- print "📝 Seeded initial telemetry file: progress.json"
13
-
14
- // 2. Spawning background PyTorch/CUDA-simulated Neural Network script asynchronously
15
- print "🚀 Spawning background GPU model trainer and telemetry stream..."
16
-
17
- let spawnSuccess = false
18
- try {
19
- exec("powershell -Command \"Start-Process python -ArgumentList 'gpu_trainer.py'\"")
20
- spawnSuccess = true
21
- } catch (e) {
22
- try {
23
- exec("powershell -Command \"Start-Process py -ArgumentList 'gpu_trainer.py'\"")
24
- spawnSuccess = true
25
- } catch (e2) {
26
- print "❌ Failed to spawn background Python process!"
27
- }
28
- }
29
-
30
- if spawnSuccess {
31
- print "⚡ Background GPU pipeline successfully launched!"
32
- print "🌐 Opening visual telemetry control panel in your browser..."
33
- print "=========================================="
34
- print "🎉 DONE! Sit back, look at your browser, and enjoy watching your actual GTX 1660 Ti load up as the baby network converges!"
35
- print "=========================================="
36
- }
@@ -1,118 +0,0 @@
1
- // Sesi Script: hardware_diagnostics.sesi
2
- // Natively orchestrates Python and PowerShell to query physical CPU & GPU hardware specifications.
3
-
4
- print "------------------------------------------"
5
- print "🔍 Initializing Hardware Specifications Scan..."
6
- print "🔌 Spawning PowerShell-to-Python pipeline..."
7
-
8
- // 1. Write the Python diagnostics script to retrieve advanced hardware specs
9
- let pythonCode = "import subprocess
10
- import json
11
- import platform
12
-
13
- def get_cpu():
14
- try:
15
- cmd = 'powershell -Command \"Get-CimInstance Win32_Processor | Select-Object Name, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed | ConvertTo-Json\"'
16
- output = subprocess.check_output(cmd, shell=True).decode().strip()
17
- data = json.loads(output)
18
- if isinstance(data, list):
19
- data = data[0]
20
- return {
21
- 'name': data.get('Name', 'Unknown CPU').strip(),
22
- 'cores': data.get('NumberOfCores', 4),
23
- 'threads': data.get('NumberOfLogicalProcessors', 8),
24
- 'speed_ghz': round(int(data.get('MaxClockSpeed', 3000)) / 1000, 1)
25
- }
26
- except Exception as e:
27
- return {'name': 'Unknown CPU', 'cores': 0, 'threads': 0, 'speed_ghz': 0.0}
28
-
29
- def get_gpus():
30
- try:
31
- cmd = 'powershell -Command \"Get-CimInstance Win32_VideoController | Select-Object Name, DriverVersion, AdapterRAM | ConvertTo-Json\"'
32
- output = subprocess.check_output(cmd, shell=True).decode().strip()
33
- if not output:
34
- return []
35
- data = json.loads(output)
36
- if not isinstance(data, list):
37
- data = [data]
38
- gpus = []
39
- for g in data:
40
- ram_bytes = g.get('AdapterRAM', 0)
41
- ram_gb = 0.0
42
- if ram_bytes:
43
- try:
44
- ram_val = int(ram_bytes)
45
- if ram_val < 0:
46
- ram_val = ram_val + 2**32
47
- ram_gb = round(ram_val / (1024**3), 1)
48
- except:
49
- pass
50
- gpus.append({
51
- 'name': g.get('Name', 'Unknown GPU'),
52
- 'driver': g.get('DriverVersion', 'Unknown'),
53
- 'vram_gb': ram_gb
54
- })
55
- return gpus
56
- except Exception as e:
57
- return []
58
-
59
- data = {
60
- 'platform': platform.system() + ' ' + platform.release() + ' (' + platform.machine() + ')',
61
- 'cpu': get_cpu(),
62
- 'gpus': get_gpus()
63
- }
64
- print(json.dumps(data))
65
- "
66
-
67
- write_file("hardware_info.py", pythonCode)
68
- print "📝 Hardware script programmatically written to: hardware_info.py"
69
-
70
- // 2. Execute the python subprocess
71
- print "⚙️ Spawning system metrics gathering process..."
72
- let sysOutput = ""
73
- try {
74
- sysOutput = exec("python hardware_info.py")
75
- } catch (e) {
76
- try {
77
- sysOutput = exec("py hardware_info.py")
78
- } catch (e2) {
79
- print "❌ Failed to run Python. Make sure Python is in your PATH!"
80
- }
81
- }
82
-
83
- // 3. Parse and read the returned results natively in Sesi!
84
- if sysOutput != "" {
85
- let specs = from_json(sysOutput)
86
-
87
- print "------------------------------------------"
88
- print "🖥️ SYSTEM HARDWARE DIAGNOSTICS REPORT 🖥️"
89
- print "------------------------------------------"
90
- print "🌐 Platform: " + specs["platform"]
91
- print "------------------------------------------"
92
- print "⚡ PROCESSOR (CPU):"
93
- print " Model Name: " + specs["cpu"]["name"]
94
- print " Physical Cores: " + str(specs["cpu"]["cores"])
95
- print " Logical Threads: " + str(specs["cpu"]["threads"])
96
- print " Max Clock Speed: " + str(specs["cpu"]["speed_ghz"]) + " GHz"
97
- print "------------------------------------------"
98
-
99
- let gpuList = specs["gpus"]
100
- let gpuCount = len(gpuList)
101
- print "🎮 GRAPHICS CONTROLLER (GPU) - Detected (" + str(gpuCount) + "):"
102
-
103
- let i = 0
104
- while i < gpuCount {
105
- let gpu = gpuList[i]
106
- let gpuNum = i + 1
107
- print " GPU #" + str(gpuNum) + ":"
108
- print " Model Name: " + gpu["name"]
109
- print " Driver Version: " + gpu["driver"]
110
- if gpu["vram_gb"] > 0.0 {
111
- print " Dedicated VRAM: " + str(gpu["vram_gb"]) + " GB"
112
- } else {
113
- print " Dedicated VRAM: Shared/Integrated System Memory"
114
- }
115
- i = i + 1
116
- }
117
- print "------------------------------------------"
118
- }
@@ -1,54 +0,0 @@
1
- // Sesi Script: inference.sesi
2
- // Pure-Sesi high-precision 2-layer Neural Network inference engine.
3
- // Instantly loads and propagates saved weights from model_weights.json using our upgraded native exp() compiler builtin!
4
-
5
- print "------------------------------------------"
6
- print "🔮 Running Sesi Multi-Layer Neural Network Inference..."
7
- print "📝 Reading saved parameters from model_weights.json..."
8
-
9
- // 1. Read and parse saved weights natively
10
- let rawState = read_file("model_weights.json")
11
- let weightsData = from_json(rawState)
12
-
13
- let w_hidden = weightsData["w_hidden"]
14
- let b_hidden = weightsData["b_hidden"]
15
- let w_output = weightsData["w_output"]
16
- let b_output = weightsData["b_output"]
17
-
18
- print "------------------------------------------"
19
- print "🚀 Neural weights successfully loaded!"
20
- print "🚀 Performing feedforward propagation completely natively in Sesi..."
21
- print "------------------------------------------"
22
-
23
- // Upgraded native Sigmoid using our compiled exp() builtin!
24
- fn activate(x) {
25
- let denom = 1.0 + exp(0.0 - x)
26
- return 1.0 / denom
27
- }
28
-
29
- // 2. Perform feedforward predictions on the 4 XOR inputs
30
- let inputs = [[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]]
31
- let targets = [0.0, 1.0, 1.0, 0.0]
32
-
33
- let i = 0
34
- while i < 4 {
35
- let x = inputs[i]
36
- let target = targets[i]
37
-
38
- // Forward propagation: Hidden Layer
39
- // Neuron 0
40
- let h_sum0 = (x[0] * w_hidden[0][0]) + (x[1] * w_hidden[0][1]) + b_hidden[0]
41
- let h_out0 = activate(h_sum0)
42
-
43
- // Neuron 1
44
- let h_sum1 = (x[0] * w_hidden[1][0]) + (x[1] * w_hidden[1][1]) + b_hidden[1]
45
- let h_out1 = activate(h_sum1)
46
-
47
- // Forward propagation: Output Layer
48
- let o_sum = (h_out0 * w_output[0]) + (h_out1 * w_output[1]) + b_output
49
- let output = activate(o_sum)
50
-
51
- print "Input: [" + str(x[0]) + ", " + str(x[1]) + "] -> Expected: " + str(target) + " -> Natively Predicted: " + str(output)
52
- i = i + 1
53
- }
54
- print "------------------------------------------"
@@ -1,180 +0,0 @@
1
- // Sesi Script: native_chatbot.sesi
2
- // 100% NATIVE DATA-TRAINED DEVELOEPR CO-PILOT CHATBOT!
3
- // Trained entirely inside Sesi on 14 keywords across 6 distinct functional categories!
4
-
5
- // ==================================================
6
- // 💬 1. CHOOSE YOUR ADVANCED TECHNICAL QUERY HERE!
7
- // (Test it with custom phrases containing our keywords!)
8
- let queryText = "create an svg"
9
- // ==================================================
10
-
11
- print "=================================================="
12
- print "🧠 WELCOME TO THE NATIVE-TRAINED SESI DEVELOEPR CO-PILOT!"
13
- print "=================================================="
14
- print "⚙️ Vectorizing training vocabulary..."
15
-
16
- // Sigmoid math
17
- fn activate(x) {
18
- return 1.0 / (1.0 + exp(0.0 - x))
19
- }
20
-
21
- fn derivative(y) {
22
- return y * (1.0 - y)
23
- }
24
-
25
- // 2. Advanced Bag-of-Words Vectorizer (14 keywords)
26
- fn vectorize(text) {
27
- let words = split(text, " ")
28
- let vec = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
29
-
30
- let w = 0
31
- while w < len(words) {
32
- let word = words[w]
33
- if word == "print" { vec[0] = 1.0 }
34
- if word == "str" { vec[1] = 1.0 }
35
- if word == "type" { vec[2] = 1.0 }
36
- if word == "num" { vec[3] = 1.0 }
37
- if word == "bool" { vec[4] = 1.0 }
38
- if word == "json" { vec[5] = 1.0 }
39
- if word == "convert" { vec[6] = 1.0 }
40
- if word == "array" { vec[7] = 1.0 }
41
- if word == "len" { vec[8] = 1.0 }
42
- if word == "file" { vec[9] = 1.0 }
43
- if word == "write" { vec[10] = 1.0 }
44
- if word == "dir" { vec[11] = 1.0 }
45
- if word == "exp" { vec[12] = 1.0 }
46
- if word == "random" { vec[13] = 1.0 }
47
- w = w + 1
48
- }
49
- return vec
50
- }
51
-
52
- // Helper to calculate neuron forward dot product
53
- fn compute_output(x, w, b) {
54
- let sum = 0.0
55
- let i = 0
56
- while i < 14 {
57
- sum = sum + (x[i] * w[i])
58
- i = i + 1
59
- }
60
- return activate(sum + b)
61
- }
62
-
63
- // 3. Setup Comprehensive Labeled Dataset (6 classes, declared strictly on single continuous lines)
64
- let inputs = [vectorize("how to print str logging output"), vectorize("type check and num bool conversion"), vectorize("convert objects to json format"), vectorize("array length len split push pop keys"), vectorize("file write list dir read image"), vectorize("math exp random synaptic calculations")]
65
-
66
- let targets = [[1.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 1.0]]
67
-
68
- // 4. Initialize synaptic weights and biases for the 6 output units
69
- let w0 = [0.1, 0.2, -0.1, 0.3, -0.2, 0.1, -0.1, 0.2, -0.1, 0.1, -0.2, 0.1, -0.3, 0.2]
70
- let w1 = [-0.1, 0.1, 0.3, 0.2, 0.1, -0.2, 0.1, -0.3, 0.2, -0.1, 0.1, -0.2, 0.1, -0.1]
71
- let w2 = [0.2, -0.2, 0.1, -0.1, 0.2, 0.3, 0.3, 0.1, -0.2, 0.2, -0.1, 0.1, -0.2, 0.1]
72
- let w3 = [-0.1, 0.1, -0.2, 0.1, -0.1, 0.2, -0.1, 0.3, 0.3, -0.2, 0.1, -0.1, 0.2, -0.2]
73
- let w4 = [0.1, -0.1, 0.2, -0.2, 0.1, -0.1, 0.2, -0.1, 0.2, 0.4, 0.4, 0.3, -0.1, 0.1]
74
- let w5 = [-0.2, 0.2, -0.1, 0.1, -0.2, 0.1, -0.2, 0.1, -0.2, 0.1, -0.2, 0.1, 0.4, 0.4]
75
-
76
- let b0 = -0.1
77
- let b1 = 0.1
78
- let b2 = -0.2
79
- let b3 = 0.2
80
- let b4 = -0.1
81
- let b5 = 0.0
82
-
83
- print "🧠 Training 14x6 multi-class Sesi neural synapses..."
84
-
85
- // 5. Run native single-layer gradient descent training loop (2,000 epochs)
86
- let lr = 0.4
87
- let epoch = 1
88
- while epoch <= 2000 {
89
- let c = 0
90
- while c < 6 {
91
- let x = inputs[c]
92
- let t = targets[c]
93
-
94
- // Forward Propagation
95
- let o0 = compute_output(x, w0, b0)
96
- let o1 = compute_output(x, w1, b1)
97
- let o2 = compute_output(x, w2, b2)
98
- let o3 = compute_output(x, w3, b3)
99
- let o4 = compute_output(x, w4, b4)
100
- let o5 = compute_output(x, w5, b5)
101
-
102
- // Backpropagation deltas
103
- let delta0 = (t[0] - o0) * derivative(o0)
104
- let delta1 = (t[1] - o1) * derivative(o1)
105
- let delta2 = (t[2] - o2) * derivative(o2)
106
- let delta3 = (t[3] - o3) * derivative(o3)
107
- let delta4 = (t[4] - o4) * derivative(o4)
108
- let delta5 = (t[5] - o5) * derivative(o5)
109
-
110
- // Synaptic Weight Updates
111
- let k = 0
112
- while k < 14 {
113
- w0[k] = w0[k] + (lr * delta0 * x[k])
114
- w1[k] = w1[k] + (lr * delta1 * x[k])
115
- w2[k] = w2[k] + (lr * delta2 * x[k])
116
- w3[k] = w3[k] + (lr * delta3 * x[k])
117
- w4[k] = w4[k] + (lr * delta4 * x[k])
118
- w5[k] = w5[k] + (lr * delta5 * x[k])
119
- k = k + 1
120
- }
121
-
122
- b0 = b0 + (lr * delta0)
123
- b1 = b1 + (lr * delta1)
124
- b2 = b2 + (lr * delta2)
125
- b3 = b3 + (lr * delta3)
126
- b4 = b4 + (lr * delta4)
127
- b5 = b5 + (lr * delta5)
128
-
129
- c = c + 1
130
- }
131
- epoch = epoch + 1
132
- }
133
-
134
- print "🎯 Synaptic parameters optimized! Brain ready."
135
- print "--------------------------------------------------"
136
-
137
- // 6. Comprehensive Technical Reference Database (Declared strictly on single continuous lines to satisfy Sesi parser!)
138
- let responses = ["📖 SESI MANUAL: I/O & CONSOLE LOGGING\n 🎯 Function: print(...args) -> null\n - Prints multiple values to stdout separated by spaces.\n - Example: print \"Value:\", 42\n 🎯 Function: str(value) -> string\n - Convers any primitive, array, or object into a clean string representation.\n - Example: let s = str([1, 2])", "📖 SESI MANUAL: TYPE CHECKING & CASTING\n 🎯 Function: type(value) -> string\n - Returns native Sesi types: 'number', 'string', 'bool', 'null', 'array', 'object'.\n 🎯 Function: num(value) -> number / bool(value) -> bool\n - Converts values to numbers or booleans using strict truthiness rules.\n - Example: num(\"3.14\") -> 3.14 / bool(0) -> false", "📖 SESI MANUAL: JSON UTILITIES\n 🎯 Function: to_json(value) -> string\n - Serializes an array or object into a formatted JSON string.\n 🎯 Function: from_json(string) -> any\n - Parses valid JSON strings back into native Sesi arrays and objects.\n - Example: let obj = from_json(\"{\\\"a\\\": 1}\")\n - Note: Critical for offline parameters loading!", "📖 SESI MANUAL: ARRAYS & COLLECTIONS\n 🎯 Function: len(col) -> number / range(n) -> array\n - len() returns collection size. range(n) creates a sequence from 0 to n-1.\n 🎯 Function: push(arr, v) -> pop(arr) -> any\n - Adds/removes elements in-place.\n 🎯 Function: join(arr, sep) / split(str, sep)\n - Joins array elements or splits strings into array components.", "📖 SESI MANUAL: FILE SYSTEM OPERATIONS\n 🎯 Function: read_file(path) / write_file(path, text)\n - Reads or writes text files relative to the workspace directory.\n 🎯 Function: write_image(path, base64_content) -> bool\n - Writes base64 strings directly as binary image files (e.g. logos).\n 🎯 Function: list_dir(path) / make_dir(path)\n - Lists directory items or recursively creates new directories.", "📖 SESI MANUAL: MATH & DEEP LEARNING\n 🎯 Function: exp(x) -> number\n - Computes high-speed exponential function Math.exp(x).\n - Fundamental for native neural networks: Sigmoid = 1.0 / (1.0 + exp(-x))\n 🎯 Function: random() -> number\n - Returns a pseudo-random decimal float between 0.0 and 1.0.\n - Essential for seed randomization and breaking saddle points!"]
139
-
140
- // 7. Query User String!
141
- print "📥 User Query Input: \"" + queryText + "\""
142
- let query_vec = vectorize(queryText)
143
- print "📊 Vectorized Input: " + str(query_vec)
144
- print "--------------------------------------------------"
145
-
146
- // Forward propagation on user query
147
- let q_o0 = compute_output(query_vec, w0, b0)
148
- let q_o1 = compute_output(query_vec, w1, b1)
149
- let q_o2 = compute_output(query_vec, w2, b2)
150
- let q_o3 = compute_output(query_vec, w3, b3)
151
- let q_o4 = compute_output(query_vec, w4, b4)
152
- let q_o5 = compute_output(query_vec, w5, b5)
153
-
154
- let outputs = [q_o0, q_o1, q_o2, q_o3, q_o4, q_o5]
155
- print "🧠 Neural Activation Scores: " + str(outputs)
156
-
157
- // Determine class index with highest score
158
- let best_class = 0
159
- let max_score = -1.0
160
- let j = 0
161
- while j < 6 {
162
- if outputs[j] > max_score {
163
- max_score = outputs[j]
164
- best_class = j
165
- }
166
- j = j + 1
167
- }
168
-
169
- print "--------------------------------------------------"
170
- print "🤖 SESI CO-PILOT RESPONDING:"
171
- print "--------------------------------------------------"
172
- if max_score < 0.40 {
173
- print "🤔 Sesi's native synapses evaluated this query with low confidence: " + str(max_score)
174
- print " It seems your question does not contain any Sesi keywords in our vocabulary!"
175
- print " Please try asking about: 'print', 'str', 'files', 'json', 'exp', or 'random'!"
176
- } else {
177
- print responses[best_class]
178
- print "📐 Neural Classification Confidence: " + str(max_score)
179
- }
180
- print "=================================================="
@@ -1,83 +0,0 @@
1
- // Sesi Script: native_synthesizer.sesi
2
- // 100% NATIVE OFFLINE MARKOV TEXT SYNTHESIZER!
3
- // Generatively types Sesi code syntax word-by-word completely offline with zero API calls!
4
-
5
- // ==================================================
6
- // 💬 1. DEFINE YOUR INSPIRATIONAL TRAINING CORPUS!
7
- // ==================================================
8
- let corpus = "let value = 42 print value let raw = to_json(value) let obj = from_json(raw) print obj if value > 10 print value while value < 100 let value = value + 1 print value read_file(path) write_file(path, text) write_image(path, data) list_dir(path) make_dir(path) exp(x) random()"
9
-
10
- print "=================================================="
11
- print "📻 BLUE NOTE SYNTHESIZER: NATIVE TEXT GENERATION"
12
- print "=================================================="
13
- print "⚙️ Analyzing corpus structure..."
14
-
15
- // Native Floor function (Genius string-splitting floor logic!)
16
- fn floor(x) {
17
- let s = str(x)
18
- let parts = split(s, ".")
19
- return num(parts[0])
20
- }
21
-
22
- // 2. Tokenize corpus
23
- let words = split(corpus, " ")
24
- let num_words = len(words)
25
- print "📊 Compiled " + str(num_words) + " corpus tokens!"
26
-
27
- // 3. Compile Markov Transition Table (Word-to-Word transition dictionary)
28
- let transitions = {}
29
-
30
- let i = 0
31
- while i < (num_words - 1) {
32
- let w1 = words[i]
33
- let w2 = words[i + 1]
34
-
35
- let key_exists = type(transitions[w1]) == "array"
36
- if key_exists == false {
37
- // Declared strictly on one line to satisfy Sesi parser
38
- transitions[w1] = []
39
- }
40
-
41
- let list = transitions[w1]
42
- push(list, w2)
43
-
44
- i = i + 1
45
- }
46
-
47
- print "🎯 State transition probabilities calculated!"
48
- print "--------------------------------------------------"
49
-
50
- // 4. Generate synthetic Sesi code sentences!
51
- let current_word = "let" // Start word
52
- let generated = current_word
53
- let gen_steps = 1
54
- let max_steps = 25 // Length of synthesized text
55
-
56
- while gen_steps < max_steps {
57
- let choices = transitions[current_word]
58
- let has_choices = type(choices) == "array"
59
-
60
- if has_choices == false {
61
- // If we hit a dead end, wrap back to starting word
62
- current_word = "let"
63
- } else {
64
- let num_choices = len(choices)
65
- if num_choices == 0 {
66
- current_word = "let"
67
- } else {
68
- // Pick a mathematically safe random index
69
- let rand_idx = floor(random() * num_choices)
70
- let next_word = choices[rand_idx]
71
-
72
- generated = generated + " " + next_word
73
- current_word = next_word
74
- }
75
- }
76
-
77
- gen_steps = gen_steps + 1
78
- }
79
-
80
- print "🤖 GENERATED NATIVE SESI SYNTHESIS:"
81
- print "--------------------------------------------------"
82
- print generated
83
- print "=================================================="