@misterscan/sesi 1.3.0 → 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.
- package/.agents/rules/sesi-must-read.md +116 -0
- package/.agents/workflows/create-sesi-script.md +44 -0
- package/.agents/workflows/fix-sesi-script.md +14 -0
- package/.github/prompts/MakeInSesi.prompt.md +79 -0
- package/README.md +76 -30
- package/bin/sesi.js +56 -23
- package/chatbot/chatbot.html +488 -0
- package/{main → chatbot}/chatbot.sesi +1 -2
- package/chatbot/chatbot_server.py +105 -0
- package/chatbot/sesi_db_chatbot.sesi +278 -0
- package/dist/ai-runtime.js +2 -2
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +3 -1
- package/dist/builtins.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -2
- package/dist/index.js.map +1 -1
- package/dist/interpreter.d.ts +10 -0
- package/dist/interpreter.d.ts.map +1 -1
- package/dist/interpreter.js +20 -4
- package/dist/interpreter.js.map +1 -1
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +3 -4
- package/dist/parser.js.map +1 -1
- package/dist/sesi.bundled.js +2526 -1487
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/docs/ARCHITECTURE.md +2 -7
- package/docs/BUILTINS.md +27 -8
- package/docs/CLI.md +200 -0
- package/docs/COMPARISON.md +11 -6
- package/docs/IMPLEMENTATION_SUMMARY.md +57 -50
- package/docs/QUICKSTART.md +104 -23
- package/docs/README.md +84 -42
- package/docs/REASONING.md +21 -16
- package/docs/ROADMAP.md +10 -5
- package/docs/SKILLS.md +63 -116
- package/docs/SPECIFICATION.md +35 -23
- package/examples/03_functions.sesi +30 -1
- package/examples/07_prompts.sesi +26 -2
- package/examples/08_model_call.sesi +6 -4
- package/examples/09_structured_output.sesi +18 -2
- package/examples/10_code_generation.sesi +6 -4
- package/examples/11_memory_conversation.sesi +47 -15
- package/examples/12_classification.sesi +62 -7
- package/examples/13_data_pipeline.sesi +55 -28
- package/examples/14_folder_explainer.sesi +52 -51
- package/examples/15_image_generation.sesi +15 -14
- package/examples/16_modules.sesi +1 -1
- package/examples/19_search_web.sesi +18 -2
- package/examples/20_model_aliases.sesi +6 -6
- package/main/tests/test-args.sesi +7 -0
- package/main/tests/test_args.sesi +7 -0
- package/main/tests/test_general_modules.sesi +127 -0
- package/package.json +25 -21
- package/docs/CONCURRENCY.md +0 -71
- package/docs/sesi_ai_chronicles.md +0 -96
- package/main/conversational_classifier_weights.json +0 -45
- package/main/conversational_sentences.json +0 -304
- package/main/epochs.sesi +0 -94
- package/main/gpu_orchestrator.sesi +0 -36
- package/main/hardware_diagnostics.sesi +0 -118
- package/main/inference.sesi +0 -54
- package/main/native_chatbot.sesi +0 -180
- package/main/native_synthesizer.sesi +0 -83
- package/main/nn_personas_trainer.sesi +0 -302
- package/main/nn_responses_trainer.sesi +0 -269
- package/main/nn_sentences_trainer.sesi +0 -330
- package/main/orchestrator.sesi +0 -15
- package/main/personas.json +0 -124
- package/main/personas_classifier_weights.json +0 -45
- package/main/playground.sesi +0 -3
- package/main/predictive_typing.sesi +0 -127
- package/main/query_brain.sesi +0 -45
- package/main/response_classifier_weights.json +0 -45
- package/main/retro_chat.html +0 -239
- package/main/retro_chat_generator.sesi +0 -745
- package/main/sesi_ai.sesi +0 -158
- package/main/sesi_db_chatbot.sesi +0 -284
- package/main/setup_swarm.sesi +0 -5
- package/main/start.sesi +0 -13
- package/main/terminal.log +0 -56
- package/main/terminal_chat.py +0 -385
- package/main/unified_sesi_ai.sesi +0 -334
- package/main/varied_responses.json +0 -304
|
@@ -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
|
-
}
|
package/main/inference.sesi
DELETED
|
@@ -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 "------------------------------------------"
|
package/main/native_chatbot.sesi
DELETED
|
@@ -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 "=================================================="
|