@misterscan/sesi 1.2.3 → 1.3.0

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 (52) hide show
  1. package/README.md +101 -35
  2. package/bin/sesi.js +163 -38
  3. package/dist/builtins.d.ts.map +1 -1
  4. package/dist/builtins.js +196 -4
  5. package/dist/builtins.js.map +1 -1
  6. package/dist/index.d.ts +7 -2
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +30 -5
  9. package/dist/index.js.map +1 -1
  10. package/dist/interpreter.d.ts +11 -2
  11. package/dist/interpreter.d.ts.map +1 -1
  12. package/dist/interpreter.js +181 -88
  13. package/dist/interpreter.js.map +1 -1
  14. package/dist/lexer.d.ts.map +1 -1
  15. package/dist/lexer.js +8 -4
  16. package/dist/lexer.js.map +1 -1
  17. package/dist/parser.d.ts +1 -0
  18. package/dist/parser.d.ts.map +1 -1
  19. package/dist/parser.js +18 -8
  20. package/dist/parser.js.map +1 -1
  21. package/dist/types.d.ts +13 -1
  22. package/dist/types.d.ts.map +1 -1
  23. package/dist/types.js +33 -1
  24. package/dist/types.js.map +1 -1
  25. package/docs/ARCHITECTURE.md +22 -9
  26. package/docs/BUILTINS.md +111 -13
  27. package/docs/COMPARISON.md +7 -9
  28. package/docs/{DISTRIBUTED_SYSTEMS.md → CONCURRENCY.md} +11 -11
  29. package/docs/IMAGE_GENERATION.md +13 -14
  30. package/docs/IMPLEMENTATION_SUMMARY.md +141 -84
  31. package/docs/QUICKSTART.md +81 -28
  32. package/docs/README.md +140 -34
  33. package/docs/{SYSTEMS_REASONING.md → REASONING.md} +100 -110
  34. package/docs/ROADMAP.md +42 -43
  35. package/docs/SKILLS.md +56 -28
  36. package/docs/SPECIFICATION.md +25 -18
  37. package/docs/sesi_ai_chronicles.md +96 -209
  38. package/examples/07_prompts.sesi +1 -1
  39. package/examples/08_model_call.sesi +1 -1
  40. package/examples/09_structured_output.sesi +1 -1
  41. package/examples/10_code_generation.sesi +1 -1
  42. package/examples/13_data_pipeline.sesi +1 -1
  43. package/examples/14_folder_explainer.sesi +2 -2
  44. package/examples/15_image_generation.sesi +1 -1
  45. package/examples/16_modules.sesi +27 -27
  46. package/examples/20_model_aliases.sesi +22 -0
  47. package/examples/21_custom_tools.sesi +27 -0
  48. package/examples/22_reasoning_plus_custom_tools.sesi +19 -0
  49. package/main/orchestrator.sesi +2 -2
  50. package/main/sesi_db_chatbot.sesi +6 -2
  51. package/main/tests/test_grounding.sesi +2 -0
  52. package/package.json +2 -2
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## 📋 Overview
4
4
 
5
- **Sesi** is a high-performance **Systems Language** designed for building resilient, stateful applications. It provides first-class primitives for process management and filesystem orchestration, while integrating reasoning as a first-class execution primitive. Unlike traditional languages that rely on external SDKs for AI interaction, Sesi treats reasoning as a native language construct, enabling developers to build context-aware systems with minimal boilerplate.
5
+ **Sesi** is a highly legible, buildable **programming language**. It provides clean primitives for executing robust internal logic and external APIs, acting as the ideal layer to parse text, orchestrate shell commands, and interact with the file system. Unlike traditional languages that require sprawling SDKs for even basic interactions, Sesi integrates command execution naturally, enabling developers to build context-aware scripts with minimal boilerplate.
6
6
 
7
7
  ## 🎯 Design Philosophy
8
8
 
@@ -10,9 +10,9 @@ Sesi follows these core principles:
10
10
 
11
11
  1. **Reasoning as a Primitive**: Reasoning calls aren't library functions—they're language constructs with dedicated syntax. This allows for deep integration with the interpreter's environment and type system.
12
12
  2. **Practical Over Perfect**: Focus on what developers actually need, not theoretical completeness.
13
- 3. **Transparency Over Magic**: Explicit reasoning calls with clear costs and latency.
14
- 4. **Simplicity First**: Tree-walking interpreter for clarity and maintainability.
15
- 5. **Type Safety with Flexibility**: Static types for normal code, runtime checking for reasoning outputs.
13
+ 3. **Transparency Over Magic**: Sesi runs exactly what you write with clear costs and execution maps.
14
+ 4. **Simplicity First**: A custom tree-walking interpreter for clarity and maintainability.
15
+ 5. **Type Safety with Flexibility**: Static types for normal code, runtime checking for integration outputs.
16
16
 
17
17
  ## 📁 Complete Project Structure
18
18
 
@@ -21,63 +21,78 @@ Sesi/
21
21
  ├── SKILLS.md # Workspace context and repo guardrails
22
22
  ├── index.html # Sesi-generated systems landing page
23
23
  ├── eslint.config.mjs # ESLint configuration
24
- ├── example.js # Helper script to run basic examples
25
- ├── example-ai.js # Helper script to run reasoning examples
26
- ├── README.md # Project overview
27
- ├── QUICKSTART.md # Getting started guide
28
- ├── package.json # Dependencies & scripts
29
- ├── tsconfig.json # TypeScript configuration
30
- ├── dist/ # Compiled TypeScript output
24
+ ├── example.js # Helper script to run basic examples
25
+ ├── example-ai.js # Helper script to run reasoning examples
26
+ ├── examples.sesi # Central execution suite for examples
27
+ ├── README.md # Project overview
28
+ ├── QUICKSTART.md # Getting started guide
29
+ ├── package.json # Dependencies & scripts
30
+ ├── tsconfig.json # TypeScript configuration
31
+ ├── dist/ # Compiled TypeScript output
31
32
 
32
- ├── src/ # Source code
33
- │ ├── types.ts # Type definitions & AST nodes (400+ lines)
34
- │ ├── lexer.ts # Tokenization (350+ lines)
35
- │ ├── parser.ts # Recursive descent parser (700+ lines)
36
- │ ├── interpreter.ts # Tree-walking interpreter (600+ lines)
37
- │ ├── builtins.ts # Built-in functions (250+ lines)
38
- │ ├── ai-runtime.ts # Integrated reasoning integration (120+ lines)
39
- │ └── index.ts # Entry point (30+ lines)
33
+ ├── src/ # Source code
34
+ │ ├── types.ts # Type definitions & AST nodes (400+ lines)
35
+ │ ├── lexer.ts # Tokenization (350+ lines)
36
+ │ ├── parser.ts # Recursive descent parser (700+ lines)
37
+ │ ├── interpreter.ts # Tree-walking interpreter (600+ lines)
38
+ │ ├── builtins.ts # Built-in functions (250+ lines)
39
+ │ ├── ai-runtime.ts # Integrated reasoning integration (120+ lines)
40
+ │ └── index.ts # Entry point (30+ lines)
40
41
 
41
42
  ├── bin/
42
- │ └── sesi.js # CLI executable
43
+ │ └── sesi.js # CLI executable
43
44
 
44
- ├── main/ # Playgrounds & debugging
45
- │ ├── playground.sesi # Main playground script
46
- │ ├── start.sesi # Beginner script
47
- │ ├── build_website.sesi # Sesi-powered systems site generator
48
- │ └── tests/ # Additional syntax validation scripts
45
+ ├── main/ # Playgrounds & debugging
46
+ │ ├── playground.sesi # Main playground script
47
+ │ ├── start.sesi # Beginner script
48
+ │ ├── build_website.sesi # Sesi-powered systems site generator
49
+ │ └── tests/ # Additional syntax validation scripts
49
50
 
50
51
  ├── docs/
51
- │ ├── SPECIFICATION.md # Complete language spec (600+ lines)
52
- │ ├── ARCHITECTURE.md # Runtime & system design (400+ lines)
53
- │ ├── BUILTINS.md # Built-in functions reference (450+ lines)
54
- │ ├── IMAGE_GENERATION.md # Image generation guide (>100 lines)
55
- │ ├── SYSTEMS_REASONING.md # Integrated reasoning guide (500+ lines)
56
- │ ├── DISTRIBUTED_SYSTEMS.md # Swarm & coordination guide (>100 lines)
57
- └── ROADMAP.md # V2-V4+ development plan (400+ lines)
52
+ │ ├── SPECIFICATION.md # Complete language spec (600+ lines)
53
+ │ ├── ARCHITECTURE.md # Runtime & system design (400+ lines)
54
+ │ ├── BUILTINS.md # Built-in functions reference (450+ lines)
55
+ │ ├── COMPARISON.md # Language comparison showcase
56
+ │ ├── CONCURRENCY.md # Concurrency & coordination guide (>100 lines)
57
+ │ ├── IMAGE_GENERATION.md # Image generation guide (>100 lines)
58
+ ├── REASONING.md # Reasoning and simple logic guide (>500 lines)
59
+ │ ├── ROADMAP.md # V2-V4+ development plan (400+ lines)
60
+ │ └── sesi_ai_chronicles.md # AI project history & notes
58
61
 
59
62
  ├── examples/
60
- │ ├── 01_hello.sesi # Hello World
61
- │ ├── 02_variables.sesi # Variables & operations
62
- │ ├── 03_functions.sesi # Functions with parameters
63
- │ ├── 04_conditionals.sesi # If/else control flow
64
- │ ├── 05_loops.sesi # While, for, for-in loops
65
- │ ├── 06_arrays_objects.sesi # Collections
66
- │ ├── 07_prompts.sesi # Reasoning blocks
67
- │ ├── 08_model_call.sesi # Basic reasoning calls
68
- │ ├── 09_structured_output.sesi # Type-safe reasoning responses
69
- │ ├── 10_code_generation.sesi # Systems logic generation
70
- │ ├── 11_memory_conversation.sesi # Multi-turn stateful reasoning
71
- │ ├── 12_classification.sesi # Systems classification loop
72
- │ ├── 13_data_pipeline.sesi # Complete systems pipeline
73
- │ ├── 14_folder_explainer.sesi # Directory parsing & reasoning
74
- │ ├── 15_image_generation.sesi # Image generation API test
75
- │ ├── 16_modules.sesi # Modules & std library namespaces
76
- │ ├── 17_http_client.sesi # Network GET/POST client
77
- └── 18_parallel_requests.sesi # Parallel requests concurrency
63
+ │ ├── 01_hello.sesi # Hello World
64
+ │ ├── 02_variables.sesi # Variables & operations
65
+ │ ├── 03_functions.sesi # Functions with parameters
66
+ │ ├── 04_conditionals.sesi # If/else control flow
67
+ │ ├── 05_loops.sesi # While, for, for-in loops
68
+ │ ├── 06_arrays_objects.sesi # Collections
69
+ │ ├── 07_prompts.sesi # Reasoning blocks
70
+ │ ├── 08_model_call.sesi # Basic reasoning calls
71
+ │ ├── 09_structured_output.sesi # Type-safe reasoning responses
72
+ │ ├── 10_code_generation.sesi # Systems logic generation
73
+ │ ├── 11_memory_conversation.sesi # Multi-turn stateful reasoning
74
+ │ ├── 12_classification.sesi # Systems classification loop
75
+ │ ├── 13_data_pipeline.sesi # Complete systems pipeline
76
+ │ ├── 14_folder_explainer.sesi # Directory parsing & reasoning
77
+ │ ├── 15_image_generation.sesi # Image generation API test
78
+ │ ├── 16_modules.sesi # Modules & std library namespaces
79
+ │ ├── 17_http_client.sesi # Network GET/POST client
80
+ ├── 18_parallel_requests.sesi # Parallel requests concurrency
81
+ │ ├── 19_search_web.sesi # Web search integration
82
+ │ ├── 20_model_aliases.sesi # Custom model naming aliases
83
+ │ ├── 21_custom_tools.sesi # Custom runtime tool definitions
84
+ │ └── 22_reasoning_plus_custom_tools.sesi # Reasoning composed with custom tools
78
85
 
79
- └── tests/
80
- └── basic.test.ts # Test suite
86
+ └── tests/ # Engine test suite
87
+ ├── basic.test.ts # Core parsing & evaluation tests
88
+ ├── cache.test.ts # Execution caching tests
89
+ ├── http.test.ts # Web request builtins testing
90
+ ├── module.test.ts # Imports & module loading tests
91
+ ├── parallel.test.ts # Concurrent execution tests
92
+ ├── security.test.ts # Sandbox & guardrail tests
93
+ ├── test-gemini.ts # Base model integration test
94
+ ├── test-gemini2.ts # Extended model integration test
95
+ └── workflow.test.ts # Complex sequence workflows tests
81
96
  ```
82
97
 
83
98
  ## 🔧 Technology Stack
@@ -161,7 +176,13 @@ prompt greeting {"Hello, " name "!"}
161
176
  **Reasoning Calls**
162
177
 
163
178
  ```sesi
164
- let response = model("gemini-3-flash-preview") {"temperature": 0.7, "max_tokens": 1000} {"Your prompt here"}
179
+ let response = model("gemini-3-flash-preview") {temperature: 0.7, max_tokens: 1000} {"Your prompt here"}
180
+ ```
181
+
182
+ **Web Search Grounding**
183
+
184
+ ```sesi
185
+ let response = model("gemini-3.1-flash-lite") {search, max_tokens: 1000} {"What is the weather in Tokyo?"}
165
186
  ```
166
187
 
167
188
  **Structured Output**
@@ -173,13 +194,13 @@ let result = structured_output({field1: string, field2: number})(model("gemini-3
173
194
  **Image Generation**
174
195
 
175
196
  ```sesi
176
- let logo = image("gemini-3.1-flash-image-preview") {"ratio": '1:1', "size": 512} {"Your prompt here"}
197
+ let logo = image("gemini-3.1-flash-image-preview") {ratio: "1:1", size: "512"} {"Your prompt here"}
177
198
  write_image("logo.png", logo)
178
199
  ```
179
200
 
180
201
  **Temporal Context Injection** ✅
181
202
 
182
- Every reasoning call automatically includes the current UTC date and time in its context, providing the system with a native sense of "now."
203
+ Every reasoning call automatically includes the current UTC date and time in its context, providing the script with a native sense of "now."
183
204
 
184
205
  **Implicit Statement Termination** ✅
185
206
 
@@ -187,7 +208,7 @@ Expressions ending in `}` (such as prompt blocks or reasoning calls) no longer s
187
208
 
188
209
  **Async Polling for MAX_TOKENS** ✅
189
210
 
190
- The AI runtime natively polls the model if it hits a `MAX_TOKENS` finish reasoning block, automatically appending previous chunks and prompting the model to continue exactly where it left off, seamlessly synthesizing long responses.
211
+ The runtime natively polls the model if it hits a `MAX_TOKENS` finish status during large generation tasks.
191
212
 
192
213
  **Tool Calling**
193
214
 
@@ -217,7 +238,9 @@ print("Reasoning Response:", response)
217
238
  - `read_file(path)` - Read file contents
218
239
  - `write_file(path, content)` - Write file contents
219
240
  - `write_image(path, content)` - Write base64 image data to file
241
+ - `from_json(path)` - Read a JSON file
220
242
  - `list_dir(path)` - List directory contents
243
+ - `make_dir(path)` - Create a new directory
221
244
  - `spawn(path)` - Launch concurrent background process
222
245
  - `exec(command)` - Synchronous shell execution
223
246
  - `time()` - Unix timestamp (ms)
@@ -227,6 +250,7 @@ print("Reasoning Response:", response)
227
250
 
228
251
  - `type(value)` - Get type name
229
252
  - `str(value)` - Convert to string
253
+ - `to_json(value)` - Convert to JSON string
230
254
  - `num(value)` - Convert to number
231
255
  - `bool(value)` - Convert to boolean
232
256
 
@@ -250,21 +274,46 @@ print("Reasoning Response:", response)
250
274
 
251
275
  - `multi_req(fns)` - Concurrently execute multiple closures/functions
252
276
 
277
+ ### Reasoning
278
+
279
+ - `workflow(steps, input)` - Run a multi-step reasoning workflow
280
+ - `set_alias(alias, model)` - Register a custom local name for a model
281
+ - `define_tool(name, fn, description)` - Register a custom tool
282
+ - `list_tools()` - List custom tool names
283
+
284
+ ### Error Handling
285
+
286
+ - `error_type(type, message, data)` - Create a custom error object
287
+ - `raise_error(type_or_error, message, data)` - Throw an error
288
+
289
+ ### Math
290
+
291
+ - `exp(x)` - Exponential function
292
+
253
293
  ## 📊 Implementation Statistics
254
294
 
255
295
  | Metric | Value |
256
296
  | ------------------- | ------ |
257
297
  | Total lines of code | ~3,000 |
258
298
  | Source files | 7 |
259
- | Documentation pages | 5 |
260
- | Example programs | 15 |
261
- | Built-in functions | 23 |
299
+ | Documentation pages | 12 |
300
+ | Example programs | 22 |
301
+ | Built-in functions | 34 |
262
302
  | Supported operators | 20+ |
263
303
  | AST node types | 30+ |
264
304
  | Token types | 50+ |
265
305
 
266
306
  ## 🚀 Getting Started
267
307
 
308
+ ### Installation
309
+
310
+ ```bash
311
+ cd Sesi
312
+ npm install
313
+ npm run build
314
+ npm install -g .
315
+ ```
316
+
268
317
  ### Run Example
269
318
 
270
319
  ```bash
@@ -347,7 +396,7 @@ npm test
347
396
  - Performance notes
348
397
  - Standard library plans
349
398
 
350
- ✅ **SYSTEMS_REASONING.md** (500+ lines)
399
+ ✅ **REASONING.md** (500+ lines)
351
400
 
352
401
  - Systems reasoning overview
353
402
  - Prompt blocks explained
@@ -390,6 +439,10 @@ npm test
390
439
  | 16_modules.sesi | Imports/exports & std namespaces|
391
440
  | 17_http_client.sesi | HTTP GET and POST operations |
392
441
  | 18_parallel_requests.sesi | Parallel request concurrency |
442
+ | 19_search_web.sesi | Web search integration |
443
+ | 20_model_aliases.sesi | Custom model naming aliases |
444
+ | 21_custom_tools.sesi | Custom runtime tool definitions |
445
+ | 22_reasoning_plus_custom_tools.sesi | Compose reasoning & tools |
393
446
 
394
447
  ## ✨ Unique Features
395
448
 
@@ -440,7 +493,7 @@ npm test
440
493
 
441
494
  **Example Coverage**
442
495
 
443
- - 15 complete example programs
496
+ - 22 complete example programs
444
497
  - Covers all major language features
445
498
  - Demonstrates reasoning integration
446
499
  - Real-world use cases
@@ -469,30 +522,34 @@ npm test
469
522
  - **Cost**: Competitive pricing
470
523
  - **Availability**: Easy to use via official SDK
471
524
 
472
- ### Why does v1.1.2 support a module system?
525
+ ### Why does v1+ support a module system?
473
526
 
474
- - **Organization**: As Sesi programs grew, having a single-file system became limiting. Local module imports/exports and standard libraries (`std/math`, `std/time`, `std/json`) are natively supported in v1.1.2.
527
+ - **Organization**: As Sesi programs grew, having a single-file system became limiting. Local module imports/exports and standard libraries (`std/math`, `std/time`, `std/json`) are natively supported in v1.x.
475
528
 
476
- ### Why does v1.1.2 support parallel execution?
529
+ ### Why does v1+ support parallel execution?
477
530
 
478
531
  - **Concurrency**: While the interpreter remains tree-walking and single-threaded for simplicity, native concurrency is supported via the parallel request executor `multi_req(array<function>)`, executing asynchronous operations physically in parallel.
479
532
 
480
533
  ## 📖 Learning Path
481
534
 
482
535
  1. **Start**: [QUICKSTART.md](QUICKSTART.md) - Get running in 5 minutes
483
- 2. **Basics**: examples/01-06 - Core language features
484
- 3. **Prompts**: examples/07 - Prompt blocks
485
- 4. **Reasoning**: examples/08-12 - Reasoning feature exploration
486
- 5. **Specification**: [SPECIFICATION.md](SPECIFICATION.md) - Complete grammar
487
- 6. **Advanced**: [SYSTEMS_REASONING.md](SYSTEMS_REASONING.md) - Patterns and best practices
488
- 7. **Builtins**: [BUILTINS.md](BUILTINS.md) - Built-in functions
489
- 8. **Image Generation**: [IMAGE_GENERATION.md](IMAGE_GENERATION.md) examples/15 - Generating images natively
490
- 9. **Architecture**: [ARCHITECTURE.md](ARCHITECTURE.md) - How it works
491
- 10. **Roadmap**: [ROADMAP.md](ROADMAP.md) - Future vision
492
-
493
- ## 🤝 Contributing Path (Future)
494
-
495
- When open source:
536
+ 2. **Builtins**: [BUILTINS.md](docs/BUILTINS.md) - Built-in functions
537
+ 3. **Basics**: examples/01-06 - Core language features
538
+ 4. **Prompts**: examples/07 - Prompt blocks
539
+ 5. **Reasoning**: examples/08-12 - Reasoning feature exploration
540
+ 6. **Advanced**: [REASONING.md](docs/REASONING.md) - Patterns and best practices
541
+ 7. **Systems**: examples/13-14 - Systems reasoning and data pipelines
542
+ 8. **Modules**: examples/16 - Modules & std library namespaces
543
+ 9. **Image Generation**: [IMAGE_GENERATION.md](docs/IMAGE_GENERATION.md) examples/15 - Generating images natively
544
+ 10. **Concurrency**: examples/17-18 - Concurrency & coordination
545
+ 11. **Web Search**: examples/19 - Web search integration
546
+ 12. **Model Aliases**: examples/20 - Custom model naming aliases
547
+ 13. **Custom Tools**: examples/21-22 - Custom runtime tool definitions and compose reasoning with custom tools
548
+ 14. **Specification**: [SPECIFICATION.md](docs/SPECIFICATION.md) - Complete grammar
549
+ 15. **Architecture**: [ARCHITECTURE.md](docs/ARCHITECTURE.md) - How it works
550
+ 16. **Roadmap**: [ROADMAP.md](docs/ROADMAP.md) - Future vision
551
+
552
+ ## 🤝 Contributing Path
496
553
 
497
554
  1. Report bugs with minimal examples
498
555
  2. Suggest language features via RFCs
@@ -509,7 +566,7 @@ When open source:
509
566
  - ✅ API reference (450+ lines)
510
567
  - ✅ Systems reasoning guide (500+ lines)
511
568
  - ✅ Development roadmap (400+ lines)
512
- - ✅ 15 example programs
569
+ - ✅ 20+ example programs
513
570
  - ✅ CLI executable
514
571
  - ✅ Test suite
515
572
  - ✅ Quick start guide
@@ -526,19 +583,19 @@ When open source:
526
583
 
527
584
  ## 🚀 Philosophy
528
585
 
529
- > "Sesi demonstrates that systems-level logic and integrated reasoning can be unified into a single, elegant language primitive, eliminating the boilerplate of traditional AI development."
586
+ > "Sesi demonstrates that coding shouldn't need to be hard to understand, eliminating the boilerplate of traditional development and lowering the entry-level for those interested in code or programming."
530
587
 
531
- The language is designed to evolve. V1 provides a solid foundation. V2+ adds power. The architecture supports this gracefully without breaking existing programs.
588
+ The language is designed to evolve. V1+ provides a solid foundation. V2+ adds power. The architecture supports this gracefully without breaking existing programs.
532
589
 
533
590
  ---
534
591
 
535
- **Status**: Complete V1.1 implementation
536
- **Ready for**: Distributed systems orchestration and prototypes
592
+ **Status**: Ongoing V1.3 implementation
593
+ **Ready for**: File manipulation and process orchestration
537
594
  **Not ready for**: Massive-scale production (until v2.0 bytecode)
538
595
  **Next milestone**: V2.0 (Async & advanced reasoning)
539
596
 
540
- Sesi is an experiment in language design. Use it to learn, explore, and evolve what integrated reasoning will become.
597
+ Sesi is not just an experiment in language design. Use it to learn, explore, and evolve what the future of coding will become.
541
598
 
542
599
  ---
543
600
 
544
- For more information, see more of the documentation in this folder and examples in `examples/`.
601
+ For more information, see the documentation in `docs/` and examples in `examples/`.
@@ -1,6 +1,8 @@
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:
4
6
 
5
7
  ```bash
6
8
  sesi main/start.sesi
@@ -8,6 +10,7 @@ sesi main/start.sesi
8
10
 
9
11
  ### Run Tests
10
12
 
13
+ For devs working on Sesi, you can verify your backend edits with the built-in test suite:
11
14
  ```bash
12
15
  npm test
13
16
  ```
@@ -104,7 +107,7 @@ Get your key from [Google AI Studio](https://aistudio.google.com/app/apikey).
104
107
  Reasoning features allow passing configuration options via a block format before the prompt.
105
108
 
106
109
  ```sesi
107
- let response = model("gemini-3-flash-preview") {"temperature": 0.8, "max_tokens": 1000} {"What is 2 + 2?"}
110
+ let response = model("gemini-3-flash-preview") {temperature: 0.8, max_tokens: 1000} {"What is 2 + 2?"}
108
111
  print response
109
112
  ```
110
113
 
@@ -129,7 +132,7 @@ print "Score: " analysis["score"]
129
132
  Like `model`, the `image` command takes configuration parameters.
130
133
 
131
134
  ```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"}
135
+ 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
136
  write_image("logo.png", logo)
134
137
  print "Generated image successfully!"
135
138
  ```
@@ -143,7 +146,7 @@ print response
143
146
  chat = chat "Assistant:" response
144
147
  ```
145
148
 
146
- ### Concurrent Swarms
149
+ ### Concurrent Processes
147
150
 
148
151
  Sesi can orchestrate multiple concurrent scripts using the `spawn()` builtin.
149
152
 
@@ -167,6 +170,7 @@ from_json(path) // Read a JSON file
167
170
  write_file(path, content) // Write text to a file
168
171
  write_image(path, content) // Write base64 encoded image to a file
169
172
  list_dir(path) // List directory contents
173
+ make_dir(path) // Create a new directory
170
174
  spawn(path) // Launch concurrent background process
171
175
  exec(command) // Synchronous shell execution
172
176
  time() // Unix timestamp (ms)
@@ -178,7 +182,7 @@ random() // Random number (0-1)
178
182
  ```sesi
179
183
  type(value) // Get type name
180
184
  str(value) // Convert to string
181
- to_json(value) // Convert to valid JSON string
185
+ to_json(value) // Convert to valid JSON string
182
186
  num(value) // Convert to number
183
187
  bool(value) // Convert to boolean
184
188
  ```
@@ -199,19 +203,41 @@ range(n) // Create [0, 1, ..., n-1]
199
203
  ### Network & Concurrency
200
204
 
201
205
  ```sesi
202
- web_get(url, headers = {}) // Natively fetch from URL via HTTP GET
206
+ web_get(url, headers = {}) // Natively fetch from URL via HTTP GET
203
207
  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
208
+ multi_req(array<function>) // Run multiple tasks/requests physically in parallel
209
+ ```
210
+
211
+ ### Reasoning
212
+
213
+ ```sesi
214
+ workflow(steps, input) // Run a multi-step reasoning workflow
215
+ set_alias(alias, model) // Register a custom local name for a model
216
+ define_tool(name, fn, desc) // Register a custom tool
217
+ list_tools() // List custom tool names
218
+ ```
219
+
220
+ ### Error Handling
221
+
222
+ ```sesi
223
+ error_type(type, message, data) // Create a custom error object
224
+ raise_error(error) // Throw an error
225
+ ```
226
+
227
+ ### Math
228
+
229
+ ```sesi
230
+ exp(x) // Exponential function
205
231
  ```
206
232
 
207
233
  ### Standard Library Modules
208
234
 
209
- Standard library features are available natively in **v1.2.0** using imports:
235
+ Standard library features are available natively in **v1.2+** using imports:
210
236
 
211
237
  ```sesi
212
- import { PI, sqrt } from "std/math"
213
- import { sleep, now } from "std/time"
214
- import { stringify, parse } from "std/json"
238
+ import {PI, sqrt} from "std/math"
239
+ import {sleep, now} from "std/time"
240
+ import {stringify, parse} from "std/json"
215
241
  ```
216
242
 
217
243
  ## Running Examples
@@ -239,10 +265,14 @@ sesi examples/14_folder_explainer.sesi
239
265
  # Image generation example
240
266
  sesi examples/15_image_generation.sesi
241
267
 
242
- # Advanced Version 1.2 features
268
+ # Advanced Version 1.3 features
243
269
  sesi examples/16_modules.sesi
244
270
  sesi examples/17_http_client.sesi
245
271
  sesi examples/18_parallel_requests.sesi
272
+ sesi examples/19_search_web.sesi
273
+ sesi examples/20_model_aliases.sesi
274
+ sesi examples/21_custom_tools.sesi
275
+ sesi examples/22_reasoning_plus_custom_tools.sesi
246
276
  ```
247
277
 
248
278
  ## Common Patterns
@@ -284,8 +314,8 @@ let rejoined = join(words, "-")
284
314
  ### Reasoning Classification
285
315
 
286
316
  ```sesi
287
- fn classify(item: string) {print model("gemini-3-flash-preview")
288
- {"Classify as: FRUIT, VEGETABLE, or GRAIN. Item: " item}}
317
+ fn classify(item: string)
318
+ {print model("gemini-3-flash-preview"){"Classify as: FRUIT, VEGETABLE, or GRAIN. Item: " item}}
289
319
  classify("apple")
290
320
  classify("carrot")
291
321
  classify("wheat")
@@ -296,12 +326,11 @@ classify("wheat")
296
326
  ### Print Intermediate Values
297
327
 
298
328
  ```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
- }
329
+ fn complex(x: number)
330
+ {let step1 = x * 2
331
+ print "Step 1:" str(step1)
332
+ let step2 = step1 + 10
333
+ print "Step 2:" str(step2)}
305
334
  complex(5)
306
335
  ```
307
336
 
@@ -331,15 +360,15 @@ else {print "Response: " response}
331
360
 
332
361
  ## Next Steps
333
362
 
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/)
363
+ 1. **Read the spec**: [SPECIFICATION.md](docs/SPECIFICATION.md)
364
+ 2. **Learn about reasoning**: [REASONING.md](docs/REASONING.md)
365
+ 3. **Understand architecture**: [ARCHITECTURE.md](docs/ARCHITECTURE.md)
366
+ 4. **Check roadmap**: [ROADMAP.md](docs/ROADMAP.md)
367
+ 5. **Study examples**: [examples/](examples/)
339
368
 
340
369
  ## Getting Help
341
370
 
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:
371
+ 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
372
 
344
373
  ```bash
345
374
  # Ask the Sesi Co-Pilot for help directly
@@ -348,11 +377,35 @@ sesi --help "explain structured_output and give an example"
348
377
  sesi -h "how to spawn background processes?"
349
378
  ```
350
379
 
380
+ You can also pass a file into the help context so the co-pilot can talk about that exact script:
381
+
382
+ ```bash
383
+ sesi main/playground.sesi -h
384
+ sesi main/playground.sesi -h "why is this failing?"
385
+ ```
386
+
387
+ Other useful CLI options:
388
+
389
+ ```bash
390
+ # Run a one-line snippet
391
+ sesi -e "print 'hello'"
392
+
393
+ # Encrypt or decrypt a script file
394
+ sesi -encrypt my_script.sesi -p "my-password"
395
+ sesi -decrypt my_script.sesi -p "my-password"
396
+
397
+ # Disable sandbox protections for a run
398
+ sesi main/start.sesi --local
399
+
400
+ # Add extra allowed filesystem paths
401
+ sesi main/start.sesi --allowed-paths ./docs,./examples
402
+ ```
403
+
351
404
  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
405
 
353
406
  You can also:
354
407
  - Check documentation in [docs/](docs/)
355
- - Review examples in [examples/](/examples/)
408
+ - Review examples in [examples/](examples/)
356
409
  - Read error messages carefully
357
410
  - Try simpler programs first
358
411
 
@@ -367,4 +420,4 @@ When reporting bugs:
367
420
 
368
421
  ---
369
422
 
370
- Happy programming with Sesi! 🚀
423
+ Happy programming with Sesi! 🚀