@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
@@ -1,13 +1,23 @@
1
1
  # Quick Start Guide: Sesi Programming Language
2
2
 
3
- ## Run a program:
3
+ ### Run a program
4
+
5
+ Once Sesi is installed, you can run Sesi files globally:
6
+
7
+ ```bash
8
+ sesi examples/01_hello.sesi
9
+ ```
10
+
11
+ You can also pass arguments to your script, which are exposed under the global `args` array:
4
12
 
5
13
  ```bash
6
- sesi main/start.sesi
14
+ sesi main/test_args.sesi arg1 arg2
7
15
  ```
8
16
 
9
17
  ### Run Tests
10
18
 
19
+ For devs working on Sesi, you can verify your backend edits with the built-in test suite:
20
+
11
21
  ```bash
12
22
  npm test
13
23
  ```
@@ -16,8 +26,10 @@ npm test
16
26
 
17
27
  Create a file called `hello.sesi`:
18
28
 
19
- ```sesi
20
- print "Hello, Sesi!"
29
+ ```bash
30
+ sesi -e 'let txt = "Hello, world!"
31
+ prompt file {"print \"" txt "\""}
32
+ write_file("hello.sesi", file)'
21
33
  ```
22
34
 
23
35
  Run it:
@@ -81,6 +93,53 @@ let person = {"name": "Alice", "age": age}
81
93
  print person["name"] "is" person["age"] "years old." // "Alice is 25 years old."
82
94
  ```
83
95
 
96
+ Prompts are **composable message templates** that evaluate to strings. You can also utilize these to write clean and concise sesi scripts by nesting variables and even other prompts within prompts.
97
+
98
+ ### Basic Prompt
99
+
100
+ ```sesi
101
+ prompt simplePrompt {"Hello, Sesi!"}
102
+ print simplePrompt // "Hello, Sesi!"
103
+ ```
104
+
105
+ ### Prompts with Variables
106
+
107
+ ```sesi
108
+ let name = "Alice"
109
+ prompt greeting {"Hello, " name "! How are you?"}
110
+ print greeting // "Hello, Alice! How are you?"
111
+ ```
112
+
113
+ ### Composing Prompts
114
+
115
+ ```sesi
116
+ prompt part1 {"First part"}
117
+ prompt part2 {part1 " Second part"}
118
+ print part2 // "First part Second part"
119
+ ```
120
+
121
+ ### Prompts in Functions
122
+
123
+ ```sesi
124
+ let text = "Testing"
125
+ let language = "Spanish"
126
+ fn translatePrompt(text: string, language: string) -> string
127
+ {prompt translate {"Translate " text " to " language ": "} return translate}
128
+ print translatePrompt(text, language)
129
+ ```
130
+
131
+ Structured output allows you to extract structured data natively or via Reasoning. It uses a JSON Schema to define the structure of the output.
132
+
133
+ ### Basic Structured Output
134
+
135
+ ```sesi
136
+ let rawJson = "{\"projectName\": \"Sesi\", \"version\": \"1.3.0\", \"status\": \"active\"}"
137
+ let analysis = structured_output({projectName: string, version: string, status: string})(rawJson)
138
+ print "Project: " analysis["projectName"]
139
+ print "Version: " analysis["version"]
140
+ print "Status: " analysis["status"]
141
+ ```
142
+
84
143
  ## Reasoning Features
85
144
 
86
145
  ### Requiring Gemini API
@@ -104,19 +163,11 @@ Get your key from [Google AI Studio](https://aistudio.google.com/app/apikey).
104
163
  Reasoning features allow passing configuration options via a block format before the prompt.
105
164
 
106
165
  ```sesi
107
- let response = model("gemini-3-flash-preview") {"temperature": 0.8, "max_tokens": 1000} {"What is 2 + 2?"}
166
+ let response = model("gemini-3-flash-preview") {temperature: 0.8, max_tokens: 1000} {"What is 2 + 2?"}
108
167
  print response
109
168
  ```
110
169
 
111
- ### Prompts
112
-
113
- ```sesi
114
- let name = "Developer"
115
- prompt greeting {"Hello, " name "! " "How are you today?"}
116
- print greeting
117
- ```
118
-
119
- ### Structured Output
170
+ ### Reasoning with Structured Output
120
171
 
121
172
  ```sesi
122
173
  let analysis = structured_output({sentiment: string, score: number})(model("gemini-3.1-flash-lite") {"Analyze sentiment of: This product is great!"})
@@ -129,7 +180,7 @@ print "Score: " analysis["score"]
129
180
  Like `model`, the `image` command takes configuration parameters.
130
181
 
131
182
  ```sesi
132
- let logo = image("gemini-3.1-flash-image-preview") {"ratio": '1:1', "size": 512, "temperature": 0.3, "max_tokens": 512} {"make a beautiful logo for the word Sesi"}
183
+ let logo = image("gemini-3.1-flash-image-preview") {ratio: "1:1", size: "512", temperature: 0.3} {"make a beautiful logo for the word Sesi"}
133
184
  write_image("logo.png", logo)
134
185
  print "Generated image successfully!"
135
186
  ```
@@ -143,7 +194,7 @@ print response
143
194
  chat = chat "Assistant:" response
144
195
  ```
145
196
 
146
- ### Concurrent Swarms
197
+ ### Concurrent Processes
147
198
 
148
199
  Sesi can orchestrate multiple concurrent scripts using the `spawn()` builtin.
149
200
 
@@ -167,6 +218,7 @@ from_json(path) // Read a JSON file
167
218
  write_file(path, content) // Write text to a file
168
219
  write_image(path, content) // Write base64 encoded image to a file
169
220
  list_dir(path) // List directory contents
221
+ make_dir(path) // Create a new directory
170
222
  spawn(path) // Launch concurrent background process
171
223
  exec(command) // Synchronous shell execution
172
224
  time() // Unix timestamp (ms)
@@ -178,7 +230,7 @@ random() // Random number (0-1)
178
230
  ```sesi
179
231
  type(value) // Get type name
180
232
  str(value) // Convert to string
181
- to_json(value) // Convert to valid JSON string
233
+ to_json(value) // Convert to valid JSON string
182
234
  num(value) // Convert to number
183
235
  bool(value) // Convert to boolean
184
236
  ```
@@ -199,19 +251,41 @@ range(n) // Create [0, 1, ..., n-1]
199
251
  ### Network & Concurrency
200
252
 
201
253
  ```sesi
202
- web_get(url, headers = {}) // Natively fetch from URL via HTTP GET
254
+ web_get(url, headers = {}) // Natively fetch from URL via HTTP GET
203
255
  web_send(url, body, headers = {}) // Natively post body to URL via HTTP POST
204
- multi_req(array<function>) // Run multiple tasks/requests physically in parallel
256
+ multi_req(array<function>) // Run multiple tasks/requests physically in parallel
257
+ ```
258
+
259
+ ### Reasoning
260
+
261
+ ```sesi
262
+ workflow(steps, input) // Run a multi-step reasoning workflow
263
+ set_alias(alias, model) // Register a custom local name for a model
264
+ define_tool(name, fn, desc) // Register a custom tool
265
+ list_tools() // List custom tool names
266
+ ```
267
+
268
+ ### Error Handling
269
+
270
+ ```sesi
271
+ error_type(type, message, data) // Create a custom error object
272
+ raise_error(error) // Throw an error
273
+ ```
274
+
275
+ ### Math
276
+
277
+ ```sesi
278
+ exp(x) // Exponential function
205
279
  ```
206
280
 
207
281
  ### Standard Library Modules
208
282
 
209
- Standard library features are available natively in **v1.2.0** using imports:
283
+ Standard library features are available natively in **v1.2+** using imports:
210
284
 
211
285
  ```sesi
212
- import { PI, sqrt } from "std/math"
213
- import { sleep, now } from "std/time"
214
- import { stringify, parse } from "std/json"
286
+ import {PI, sqrt} from "std/math"
287
+ import {sleep, now} from "std/time"
288
+ import {stringify, parse} from "std/json"
215
289
  ```
216
290
 
217
291
  ## Running Examples
@@ -239,10 +313,14 @@ sesi examples/14_folder_explainer.sesi
239
313
  # Image generation example
240
314
  sesi examples/15_image_generation.sesi
241
315
 
242
- # Advanced Version 1.2 features
316
+ # Advanced Version 1.3 features
243
317
  sesi examples/16_modules.sesi
244
318
  sesi examples/17_http_client.sesi
245
319
  sesi examples/18_parallel_requests.sesi
320
+ sesi examples/19_search_web.sesi
321
+ sesi examples/20_model_aliases.sesi
322
+ sesi examples/21_custom_tools.sesi
323
+ sesi examples/22_reasoning_plus_custom_tools.sesi
246
324
  ```
247
325
 
248
326
  ## Common Patterns
@@ -284,8 +362,8 @@ let rejoined = join(words, "-")
284
362
  ### Reasoning Classification
285
363
 
286
364
  ```sesi
287
- fn classify(item: string) {print model("gemini-3-flash-preview")
288
- {"Classify as: FRUIT, VEGETABLE, or GRAIN. Item: " item}}
365
+ fn classify(item: string)
366
+ {print model("gemini-3-flash-preview"){"Classify as: FRUIT, VEGETABLE, or GRAIN. Item: " item}}
289
367
  classify("apple")
290
368
  classify("carrot")
291
369
  classify("wheat")
@@ -296,12 +374,11 @@ classify("wheat")
296
374
  ### Print Intermediate Values
297
375
 
298
376
  ```sesi
299
- fn complex(x: number) {
300
- let step1 = x * 2
301
- print "Step 1:" str(step1)
302
- let step2 = step1 + 10
303
- print "Step 2:" str(step2)
304
- }
377
+ fn complex(x: number)
378
+ {let step1 = x * 2
379
+ print "Step 1:" str(step1)
380
+ let step2 = step1 + 10
381
+ print "Step 2:" str(step2)}
305
382
  complex(5)
306
383
  ```
307
384
 
@@ -331,15 +408,17 @@ else {print "Response: " response}
331
408
 
332
409
  ## Next Steps
333
410
 
334
- 1. **Read the spec**: [SPECIFICATION.md](SPECIFICATION.md)
335
- 2. **Learn about reasoning**: [SYSTEMS_REASONING.md](SYSTEMS_REASONING.md)
336
- 3. **Understand architecture**: [ARCHITECTURE.md](ARCHITECTURE.md)
337
- 4. **Check roadmap**: [ROADMAP.md](ROADMAP.md)
338
- 5. **Study examples**: [examples/](/examples/)
411
+ 1. **Read the spec**: [SPECIFICATION.md](docs/SPECIFICATION.md)
412
+ 2. **Learn about reasoning**: [REASONING.md](docs/REASONING.md)
413
+ 3. **Understand architecture**: [ARCHITECTURE.md](docs/ARCHITECTURE.md)
414
+ 4. **Check roadmap**: [ROADMAP.md](docs/ROADMAP.md)
415
+ 5. **Study examples**: [examples/](examples/)
416
+ 6. **Understand the Agent-Native Paradigm**: [agent_native_programming.md](docs/agent_native_programming.md)
417
+ 7. **Read the historical Stress Test Chronicles**: [sesi_ai_chronicles.md](docs/sesi_ai_chronicles.md)
339
418
 
340
419
  ## Getting Help
341
420
 
342
- Sesi comes with an advanced, built-in **Interactive RAG Co-Pilot** right in your command line! Instead of static help messages, you can query Sesi directly about how to use any statement, standard library, or architectural pattern:
421
+ Sesi comes with an advanced, built-in **Interactive Co-Pilot** right in your command line! Instead of static help messages, you can query Sesi directly about how to use any statement, standard library, or architectural pattern:
343
422
 
344
423
  ```bash
345
424
  # Ask the Sesi Co-Pilot for help directly
@@ -348,11 +427,66 @@ sesi --help "explain structured_output and give an example"
348
427
  sesi -h "how to spawn background processes?"
349
428
  ```
350
429
 
430
+ You can also pass a file into the help context so the co-pilot can talk about that exact script:
431
+
432
+ ```bash
433
+ sesi examples/01_hello.sesi -h
434
+ sesi examples/01_hello.sesi -h "what is this script doing?"
435
+ ```
436
+
437
+ Other useful CLI options:
438
+
439
+ ```bash
440
+ # Run a one-line snippet (inline)
441
+ sesi -e "print 'hello'"
442
+ ```
443
+
444
+ ### Security & Sandboxing
445
+
446
+ ```bash
447
+ # Encrypt or decrypt a script file (with password parameter)
448
+ sesi -enc my_script.sesi -p "my-password"
449
+ sesi -dec my_script.sesi -p "my-password"
450
+ ```
451
+
452
+ To avoid exposing passwords in your shell's history, you can set the `SESI_PASSWORD` environment variable in your `.env` file (or your system's shell environment).
453
+
454
+ ```bash
455
+ export SESI_PASSWORD="my-password"
456
+
457
+ # Encrypt or decrypt automatically using SESI_PASSWORD environment variable
458
+ sesi -enc my_script.sesi
459
+ sesi -dec my_script.sesi
460
+
461
+ # Disable sandbox protections for a run
462
+ sesi examples/01_hello.sesi -l
463
+
464
+ # Add extra allowed filesystem paths
465
+ sesi examples/01_hello.sesi -a ./docs,./examples
466
+ ```
467
+
468
+ ### Repository Script Shortcuts
469
+
470
+ If working directly inside the Sesi codebase, you can use convenient npm shortcuts to run Sesi commands:
471
+
472
+ ```bash
473
+ # Evaluate inline code
474
+ npm run sesi:eval -- "print 'Hello from npm!'"
475
+
476
+ # Encrypt / Decrypt files using SESI_PASSWORD environment fallback
477
+ npm run sesi:encrypt -- "my_script.sesi"
478
+ npm run sesi:decrypt -- "my_script.sesi"
479
+
480
+ # Search with Sesi's Co-Pilot
481
+ npm run sesi:help -- "how do I use multi_req()?"
482
+ ```
483
+
351
484
  The co-pilot will dynamically index and train on Sesi's native repository database and retrieve full RAG context from our standard specification docs to generate a syntactically correct, 100% accurate, conversational answer in real-time!
352
485
 
353
486
  You can also:
487
+
354
488
  - Check documentation in [docs/](docs/)
355
- - Review examples in [examples/](/examples/)
489
+ - Review examples in [examples/](examples/)
356
490
  - Read error messages carefully
357
491
  - Try simpler programs first
358
492
 
package/docs/README.md CHANGED
@@ -1,8 +1,4 @@
1
- <p align="center">
2
- <img src="favicon.ico" alt="Sesi Logo" height="100" />
3
- </p>
4
-
5
- <h1 align="center">Sesi: A High-Performance Systems Language</h1>
1
+ <h1 align="center">Sesi: A Concise, Legible Programming Language</h1>
6
2
 
7
3
  <p align="center">
8
4
  <em>Pronounced "say-see" — What you say, you'll see.</em>
@@ -15,7 +11,15 @@
15
11
  <img alt="Framework" src="https://img.shields.io/badge/Node.js-Engine-success?logo=node.js">
16
12
  </p>
17
13
 
18
- **Sesi** is a high-performance **Systems Language** designed for building resilient, stateful applications. It provides first-class primitives for process management, filesystem orchestration, and integrated reasoning—enabling developers to build complex logic with a fraction of the boilerplate required by traditional languages.
14
+ <p align="center">
15
+ <strong>Sesi</strong> is a clean, minimal, and highly legible programming language. Built from the ground up to be concise and buildable, Sesi removes unnecessary boilerplate. It is a language built for clarity.
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="https://code-with-sesi.netlify.app/">Homepage</a>
20
+ </p>
21
+
22
+ ## SESI IS **NOT** AN AI WRAPPER LANGUAGE. IT IS **NOT** AN AI-NATIVE PROGRAMMING LANGUAGE. IT IS A GENERAL-PURPOSE PROGRAMMING LANGUAGE WITH **OPTIONAL** AI CAPABILITIES BUILT-IN. STRONG EMPHASIS ON **OPTIONAL**.
19
23
 
20
24
  ## Quick Start
21
25
 
@@ -23,7 +27,10 @@ Run any program directly:
23
27
 
24
28
  ```bash
25
29
  # Standard script execution
26
- sesi main/start.sesi
30
+ sesi examples/01_hello.sesi
31
+
32
+ # Run script with arguments
33
+ sesi main/test_args.sesi arg1 arg2
27
34
 
28
35
  # Reasoning script example
29
36
  sesi examples/08_model_call.sesi
@@ -32,13 +39,72 @@ sesi examples/08_model_call.sesi
32
39
  sesi examples.sesi
33
40
  ```
34
41
 
42
+ Useful CLI shortcuts:
43
+
44
+ ```bash
45
+ # Evaluate a quick snippet
46
+ sesi -e "print 'hello'"
47
+ ```
48
+
49
+ ```bash
50
+ # Ask the built-in co-pilot a question
51
+ sesi -h "how do I use memory?"
52
+ ```
53
+
54
+ ```bash
55
+ # Ask for help about a specific file
56
+ sesi examples/01_hello.sesi -h "what is this script doing?"
57
+ ```
58
+
59
+ ```bash
60
+ # Encrypt or decrypt a script file manually
61
+ sesi -enc my_script.sesi -p "my-password"
62
+ sesi -dec my_script.sesi -p "my-password"
63
+ ```
64
+
65
+ To avoid exposing passwords in your shell's history, you can set the `SESI_PASSWORD` environment variable in your `.env` file (or your system's shell environment).
66
+
67
+ ```bash
68
+ export SESI_PASSWORD="my-password"
69
+ # Encrypt or decrypt automatically using SESI_PASSWORD environment variable
70
+ sesi -enc my_script.sesi
71
+ sesi -dec my_script.sesi
72
+ ```
73
+
74
+ ```bash
75
+ # Run with sandbox restrictions disabled
76
+ sesi examples/01_hello.sesi -l
77
+ ```
78
+
35
79
  # Local Execution (Development)
36
80
 
37
- If you choose not use the `sesi` command, use the helper npm scripts:
81
+ If you are developing inside the repository or haven't installed `sesi` globally, use the npm scripts:
82
+
83
+ ```bash
84
+ # Run a Sesi script
85
+ npm run sesi -- examples/01_hello.sesi
86
+ ```
87
+
88
+ ```bash
89
+ # Evaluate an inline snippet
90
+ npm run sesi:eval -- "print 'Sesi running!'"
91
+ ```
38
92
 
39
93
  ```bash
40
- npm run example 01_hello.sesi
41
- npm run example:ai 08_model_call.sesi
94
+ # Ask Sesi's Co-Pilot
95
+ npm run sesi:help -- "how to make a directory?"
96
+ ```
97
+
98
+ ```bash
99
+ # Encrypt / Decrypt scripts (uses SESI_PASSWORD from your .env automatically)
100
+ npm run sesi:encrypt -- "secret.sesi"
101
+ npm run sesi:decrypt -- "secret.sesi"
102
+ ```
103
+
104
+ ```bash
105
+ # Run classic examples
106
+ npm run example examples/01_hello.sesi
107
+ npm run example:ai examples/08_model_call.sesi
42
108
  npm run example:all
43
109
  ```
44
110
 
@@ -67,56 +133,136 @@ let code = model("gemini-3.1-pro-preview") {generateCode}
67
133
  print code
68
134
  ```
69
135
 
136
+ ## Security & Sandboxing
137
+
138
+ Sesi incorporates a **safe-by-default, zero-trust sandboxing engine**.
139
+
140
+ ### 🛡️ Core Security Features
141
+
142
+ 1. **Safe-by-Default Execution**:
143
+ - Sesi's sandbox is **enabled by default**. Any standard Sesi interpreter execution blocks system command lines (`exec`, `spawn`) and locks down imports and paths.
144
+ - _Overriding Safety:_ Developers can explicitly bypass safe mode programmatically by initializing the interpreter with options, or on the command line by setting `SESI_SAFE_MODE=false`.
145
+
146
+ 2. **Absolute Prototype Pollution Immunity**:
147
+ - Sesi uses **prototype-free objects (`Object.create(null)`)** for all object literals, JSON parses (`from_json` or `std/json`), and structured model responses inside the interpreter.
148
+ - Because these objects do not inherit from standard JavaScript prototypes and possess no `__proto__` or prototype chain, **prototype pollution is physically and architecturally impossible**.
149
+
150
+ 3. **Strict Path Whitelisting**:
151
+ - Sesi validates all filesystem and subprocess paths against a **strict directory whitelist** (by default, only the Current Working Directory and the Script's base directory are allowed).
152
+ - Any path traversal resolving outside the whitelist is instantly rejected with a `Security Violation` exception.
153
+
154
+ 4. **Automated LLM Tool Call Sanitization**:
155
+ - Even if safe mode is explicitly turned off for developer automation, Sesi **strictly blocks automated tool execution** of sensitive commands (like `exec` and `spawn`) when requested dynamically by the model via `tool_call`. This completely isolates the host from prompt-injection RCE.
156
+
157
+ 5. **Deep isolation & Map Cloning**:
158
+ - Sub-interpreters loaded via concurrent workflows (`multi_req`) are fully isolated. Sesi **deep-clones** prompts and memories, preventing concurrent agent tasks from leaking state or polluting each other.
159
+
160
+ ### ⚙️ Programmatic Embedding Configurations
161
+
162
+ When embedding Sesi inside a host application, you can statically configure safety settings directly in code:
163
+
164
+ ```typescript
165
+ const interpreter = new Interpreter(scriptDir, {
166
+ safeMode: true, // Enable full sandbox limits (on by default)
167
+ allowLocalFs: false, // Block directory escapes (on by default)
168
+ allowedPaths: ["/var/tmp/sandbox"], // Custom strict whitelist directories
169
+ });
170
+ ```
171
+
70
172
  ## Documentation
71
173
 
72
- - [Getting Started](https://github.com/Misterscan/Sesi/blob/main/QUICKSTART.md)
174
+ - [Getting Started](./QUICKSTART.md)
73
175
  - [Examples](./examples/)
74
- - [Language Specification](https://github.com/Misterscan/Sesi/blob/main/docs/SPECIFICATION.md)
75
- - [Language Comparison Showcase](https://github.com/Misterscan/Sesi/blob/main/docs/COMPARISON.md)
76
- - [Built-in Functions](https://github.com/Misterscan/Sesi/blob/main/docs/BUILTINS.md)
77
- - [Reasoning Guide](https://github.com/Misterscan/Sesi/blob/main/docs/SYSTEMS_REASONING.md)
78
- - [Distributed Systems](https://github.com/Misterscan/Sesi/blob/main/docs/DISTRIBUTED_SYSTEMS.md)
79
- - [Runtime Architecture](https://github.com/Misterscan/Sesi/blob/main/docs/ARCHITECTURE.md)
176
+ - [CLI Reference](./docs/CLI.md)
177
+ - [Language Specification](./docs/SPECIFICATION.md)
178
+ - [Language Comparison Showcase](./docs/COMPARISON.md)
179
+ - [Built-in Functions](./docs/BUILTINS.md)
180
+ - [Reasoning](./docs/REASONING.md)
181
+ - [Concurrency Systems](./docs/CONCURRENCY.md)
182
+ - [Runtime Architecture](./docs/ARCHITECTURE.md)
80
183
 
81
- ## AI Agent Context
184
+ ## Agent Context
82
185
 
83
- The root-level `SKILLS.md` file is a workspace context file for AI agents. It records repo-specific constraints such as valid Sesi syntax expectations, execution conventions, and the intended meaning of directories like `main/` and `main/tests/`.
186
+ The root-level `SKILLS.md` file is a workspace context file for AI agents.
84
187
 
85
188
  ## Project Structure
86
189
 
87
190
  ```
88
191
  Sesi/
89
- ├── SKILLS.md # AI-agent workspace context and repo guardrails
90
- ├── index.html # Sesi-generated landing page
91
- ├── eslint.config.mjs # ESLint configuration
92
- ├── dist/ # Compiled TypeScript output
93
- ├── example.js # Helper script to run basic examples
94
- ├── example-ai.js # Helper script to run Reasoning examples
95
- ├── package.json # Dependencies & scripts
96
- ├── tsconfig.json # TypeScript configuration
97
- ├── QUICKSTART.md # Quick start guide
98
- ├── IMPLEMENTATION_SUMMARY.md # Progress and tracking
99
- ├── src/
100
- ├── types.ts # Type system & AST nodes
101
- │ ├── lexer.ts # Tokenization
102
- │ ├── parser.ts # AST generation
103
- │ ├── interpreter.ts # Execution engine
104
- │ ├── builtins.ts # Standard library
105
- │ ├── ai-runtime.ts # Gemini integration
106
- └── index.ts # Main entry point
192
+ ├── SKILLS.md # Workspace context and repo guardrails
193
+ ├── eslint.config.mjs # ESLint configuration
194
+ ├── example.js # Helper script to run basic examples
195
+ ├── example-ai.js # Helper script to run reasoning examples
196
+ ├── examples.sesi # Central execution suite for examples
197
+ ├── README.md # Project overview
198
+ ├── QUICKSTART.md # Getting started guide
199
+ ├── package.json # Dependencies & scripts
200
+ ├── tsconfig.json # TypeScript configuration
201
+ ├── dist/ # Compiled TypeScript output
202
+
203
+ ├── src/ # Source code
204
+ │ ├── types.ts # Type definitions & AST nodes (400+ lines)
205
+ │ ├── lexer.ts # Tokenization (350+ lines)
206
+ │ ├── parser.ts # Recursive descent parser (700+ lines)
207
+ │ ├── interpreter.ts # Tree-walking interpreter (600+ lines)
208
+ │ ├── builtins.ts # Built-in functions (250+ lines)
209
+ ├── ai-runtime.ts # Integrated reasoning integration (120+ lines)
210
+ │ └── index.ts # Entry point (30+ lines)
211
+
107
212
  ├── bin/
108
- │ └── sesi.js # CLI executable
109
- ├── examples/ # 18 sample programs demonstrating all features
110
- ├── main/ # Main entry and specialized tests
111
- ├── playground.sesi # Main playground script
112
- ├── start.sesi # Beginner script
113
- ├── build_website.sesi # Sesi-powered landing page generator
114
- └── tests/ # Debug and syntax scripts
115
- ├── tests/ # Test suite
116
- └── docs/ # Documentation (ARCHITECTURE, BUILTINS, SPECIFICATION, etc.)
213
+ │ └── sesi.js # CLI executable
214
+
215
+ ├── main/ # Playgrounds & debugging
216
+ └── tests/ # Additional syntax validation scripts
217
+
218
+ ├── docs/
219
+ ├── CLI.md # Comprehensive CLI & Parametric Eval guide
220
+ ├── SPECIFICATION.md # Complete language spec (600+ lines)
221
+ │ ├── ARCHITECTURE.md # Runtime & system design (400+ lines)
222
+ │ ├── BUILTINS.md # Built-in functions reference (450+ lines)
223
+ │ ├── COMPARISON.md # Language comparison showcase
224
+ │ ├── IMAGE_GENERATION.md # Image generation guide (>100 lines)
225
+ │ ├── REASONING.md # Reasoning and simple logic guide (>500 lines)
226
+ │ └── ROADMAP.md # V2-V4+ development plan (400+ lines)
227
+
228
+
229
+ ├── examples/
230
+ │ ├── 01_hello.sesi # Hello World
231
+ │ ├── 02_variables.sesi # Variables & operations
232
+ │ ├── 03_functions.sesi # Functions with parameters
233
+ │ ├── 04_conditionals.sesi # If/else control flow
234
+ │ ├── 05_loops.sesi # While, for, for-in loops
235
+ │ ├── 06_arrays_objects.sesi # Collections
236
+ │ ├── 07_prompts.sesi # Reasoning blocks
237
+ │ ├── 08_model_call.sesi # Basic reasoning calls
238
+ │ ├── 09_structured_output.sesi # Type-safe reasoning responses
239
+ │ ├── 10_code_generation.sesi # Systems logic generation
240
+ │ ├── 11_memory_conversation.sesi # Multi-turn stateful reasoning
241
+ │ ├── 12_classification.sesi # Systems classification loop
242
+ │ ├── 13_data_pipeline.sesi # Complete systems pipeline
243
+ │ ├── 14_folder_explainer.sesi # Directory parsing & reasoning
244
+ │ ├── 15_image_generation.sesi # Image generation API test
245
+ │ ├── 16_modules.sesi # Modules & std library namespaces
246
+ │ ├── 17_http_client.sesi # Network GET/POST client
247
+ │ ├── 18_parallel_requests.sesi # Parallel requests concurrency
248
+ │ ├── 19_search_web.sesi # Web search integration
249
+ │ ├── 20_model_aliases.sesi # Custom model naming aliases
250
+ │ ├── 21_custom_tools.sesi # Custom runtime tool definitions
251
+ │ └── 22_reasoning_plus_custom_tools.sesi # Reasoning composed with custom tools
252
+
253
+ └── tests/ # Engine test suite
254
+ ├── basic.test.ts # Core parsing & evaluation tests
255
+ ├── cache.test.ts # Execution caching tests
256
+ ├── http.test.ts # Web request builtins testing
257
+ ├── module.test.ts # Imports & module loading tests
258
+ ├── parallel.test.ts # Concurrent execution tests
259
+ ├── security.test.ts # Sandbox & guardrail tests
260
+ ├── test-gemini.ts # Base model integration test
261
+ ├── test-gemini2.ts # Extended model integration test
262
+ └── workflow.test.ts # Complex sequence workflows tests
117
263
  ```
118
264
 
119
- ## Version 1.2 Features (In Progress)
265
+ ## Version 1.3 Features (In Progress)
120
266
 
121
267
  ### Core Language ✅
122
268
 
@@ -133,19 +279,21 @@ Sesi/
133
279
 
134
280
  ### Reasoning-Native Features ✅
135
281
 
136
- - `prompt` blocks for message composition
137
282
  - `model()` calls with Reasoning provider configuration
138
283
  - `image()` calls with specific ratio/size generation capabilities
139
- - `structured_output()` for typed Reasoning responses
140
- - `tool_call()` for function calling
141
- - Basic memory for multi-turn reasoning
142
- - `read_file()`, `write_file()`, `to_json()`, `write_image()`, and `list_dir()` for local file I/O
284
+ - **Async Polling**: Native looping to auto-resume generation when hitting `MAX_TOKENS` limit
285
+
286
+ ### System Features
287
+
288
+ - **Memory**: Basic memory for multi-turn reasoning
289
+ - **Filesystem I/O**: `read_file()`, `write_file()`, `to_json()`, `write_image()`, and `list_dir()` for local file I/O
143
290
  - **Native Concurrency**: `spawn()` and `exec()` for concurrent process management, and `multi_req(array<function>)` for physical parallel request execution.
144
291
  - **Logic Caching**: High-efficiency Sesi Logic Caching (`.sesi_cache.json`) for local call caching.
145
- - **Thinking Scale**: Scaled Gemini reasoning configurations using the `thinking` parameters.
146
292
  - **HTTP Client**: Built-in, native HTTP client support using `web_get(url)` and `web_send(url, body, headers)` with zero external dependencies.
147
- - **Async Polling**: Native looping to auto-resume generation when hitting `MAX_TOKENS` limit
148
293
  - **Utility Builtins**: `time()` and `random()` for robust coordination
294
+ - **Structured Output**: `structured_output()` for typed JSON Schema
295
+ - **Function Calling**: `tool_call()` for function calling
296
+ - **Prompt Blocks**: `prompt` blocks for cleaner and more concise script composition
149
297
 
150
298
  ### Type System
151
299