@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
package/docs/ROADMAP.md CHANGED
@@ -1,4 +1,4 @@
1
- # Sesi Systems Language Roadmap
1
+ # Sesi Programming Language Roadmap
2
2
 
3
3
  ## Version 1.0 - Foundation (Complete)
4
4
 
@@ -42,7 +42,7 @@
42
42
  - [x] Lexer and parser
43
43
  - [x] Tree-walking interpreter
44
44
  - [x] CLI executable (sesi)
45
- - [x] Examples (19 programs)
45
+ - [x] Examples (22 programs)
46
46
  - [x] Documentation
47
47
 
48
48
  ### Limitations
@@ -56,10 +56,10 @@
56
56
 
57
57
  ---
58
58
 
59
- ## Version 1.2 - Stability & Systems Logic (In Progress)
59
+ ## Version 1.3 - Stability & Systems Logic (In Progress)
60
60
 
61
- **Status**: In Progress V1.2 implementation
62
- **Ready for**: Distributed systems orchestration and prototypes
61
+ **Status**: In Progress V1.3 implementation
62
+ **Ready for**: File manipulation and process orchestration
63
63
  **Not ready for**: Massive-scale production (until v2.0 bytecode)
64
64
  **Next milestone**: V2.0 (Async & advanced reasoning)
65
65
 
@@ -74,20 +74,20 @@
74
74
  - [x] Simple error recovery (Parser synchronization)
75
75
  - [x] Implicit statement termination for blocks ending in `}`
76
76
  - [x] Temporal Context Injection for reasoning calls
77
- - [x] Distributed Systems capabilities (Double-Check Write lock pattern)
77
+ - [x] Concurrency capabilities (File-based lock pattern)
78
78
  - [x] API reference (`BUILTINS.md`)
79
79
  - [x] Tutorial: Getting started (`QUICKSTART.md`)
80
- - [x] Cookbook: Common patterns (`SYSTEMS_REASONING.md`)
80
+ - [x] Cookbook: Common patterns (`PROCESS_EXECUTION.md`)
81
81
 
82
82
  ### Deferred to V2.0 ⏳
83
83
 
84
- - [ ] Better error messages with line numbers and stack traces
84
+ - [x] Better error messages with line numbers and stack traces
85
85
  - [ ] REPL (Read-Eval-Print Loop)
86
- - [ ] String escape sequences & Multiline strings
86
+ - [x] String escape sequences & Multiline strings
87
87
  - [ ] Comments preservation (for docs)
88
88
  - [ ] Type hints in function signatures
89
89
  - [ ] Performance optimizations
90
- - [ ] Tutorial: Writing systems logic
90
+ - [ ] Tutorial: Writing scripts
91
91
 
92
92
  ---
93
93
 
@@ -105,10 +105,10 @@
105
105
  ### Advanced Reasoning Features
106
106
 
107
107
  - [ ] Streaming responses
108
- - [x] Extended thinking/reasoning budget
109
- - [ ] Multi-step reasoning workflows
108
+ - [x] Extended thinking
109
+ - [x] Multi-step workflows
110
110
  - [ ] Tool composition and piping
111
- - [ ] Custom tool definitions
111
+ - [x] Custom tool definitions
112
112
  - [ ] Function calling with automatic orchestration
113
113
  - [x] Web search grounding
114
114
 
@@ -122,8 +122,8 @@
122
122
 
123
123
  ### Error Handling
124
124
 
125
- - [ ] finally blocks (try/catch completed in V1)
126
- - [ ] Custom error types
125
+ - [x] finally blocks (try/catch completed in V1)
126
+ - [x] Custom error types
127
127
  - [ ] Error recovery strategies
128
128
  - [ ] Retry logic with exponential backoff
129
129
  - [ ] Timeout handling
@@ -169,16 +169,16 @@
169
169
 
170
170
  ---
171
171
 
172
- ## Version 3.0 - Autonomous Systems Framework (2027)
172
+ ## Version 3.0 - Robust Logic Frameworks (2027)
173
173
 
174
- **Focus**: Full autonomous systems support
174
+ **Focus**: Complete language tooling
175
175
 
176
- ### Autonomous Framework
176
+ ### Technical Frameworks
177
177
 
178
- - [ ] Framework definitions with state machines
178
+ - [ ] Advanced scripting definition models
179
179
  - [ ] Logic composition and chaining
180
- - [ ] Multi-process collaboration
181
- - [ ] Communication protocol
180
+ - [ ] Extended process collaboration
181
+ - [ ] Communication protocols
182
182
  - [ ] Persistence layer
183
183
 
184
184
  ### Knowledge Base
@@ -191,11 +191,11 @@
191
191
 
192
192
  ### Advanced Patterns
193
193
 
194
- - [ ] Plan-and-execute workflows
195
- - [ ] Hierarchical task decomposition
196
- - [ ] Autonomous loop with safety checks
197
- - [ ] Reflection and self-improvement
198
- - [ ] Human-in-the-loop approval
194
+ - [ ] Sub-process execution workflows
195
+ - [ ] Modular scripting decomposition
196
+ - [ ] Retry safety check loops
197
+ - [ ] Deep AST reflection
198
+ - [ ] Human-in-the-loop prompts
199
199
 
200
200
  ### Ecosystem
201
201
 
@@ -207,8 +207,8 @@
207
207
 
208
208
  ### Examples
209
209
 
210
- - [ ] Autonomous research process
211
- - [ ] Customer support automation
210
+ - [ ] Automated code formatting process
211
+ - [ ] Command line utility expansion
212
212
  - [ ] Code generation and testing
213
213
  - [ ] Data analysis pipeline
214
214
  - [ ] Multi-process reasoning debate
@@ -260,7 +260,7 @@
260
260
  | Error handling | 🔴 High | ✅ | ⏳ | | |
261
261
  | Async/await | 🔴 High | | ⏳ | | |
262
262
  | Streaming | 🟡 Medium | | ⏳ | | |
263
- | Systems Logic | 🟡 Medium | | | ⏳ | |
263
+ | Process Logic | 🟡 Medium | | | ⏳ | |
264
264
  | Knowledge base | 🟡 Medium | | | ⏳ | |
265
265
  | Module system | 🟡 Medium | | ⏳ | | |
266
266
  | Debugger | 🟢 Low | | ⏳ | | |
@@ -273,16 +273,16 @@
273
273
 
274
274
  ```
275
275
  2026 Q2
276
- └─ v1.2 - Polish & stabilize
276
+ └─ v1.3 - Polish & stabilize
277
277
 
278
278
  2026 Q3-Q4
279
- └─ v2.0 - Advanced Reasoning & async
279
+ └─ v2.0 - Async & advanced APIs
280
280
 
281
281
  2027 Q1-Q2
282
- └─ v3.0 - Autonomous Framework
282
+ └─ v3.0 - Language Ecosystem
283
283
 
284
284
  2027 Q3+
285
- └─ v4.0+ - Mature ecosystem
285
+ └─ v4.0+ - Mature compilation
286
286
  ```
287
287
 
288
288
  ---
@@ -352,7 +352,7 @@
352
352
  | Startup time | <100ms | <100ms | <50ms |
353
353
  | Simple expression eval | <1µs | <100ns | <10ns |
354
354
  | Function call overhead | <10µs | <1µs | <100ns |
355
- | Reasoning call latency | 2-5s (API) | 2-5s | 2-5s |
355
+ | Reasoning latency | 2-5s (API) | 2-5s | 2-5s |
356
356
  | Memory usage | <50MB | <50MB | <100MB |
357
357
 
358
358
  ---
@@ -367,12 +367,11 @@
367
367
  - **Go**: Clear error handling
368
368
  - **Rust**: Type safety, memory safety
369
369
 
370
- ### Systems Reasoning
370
+ ### Code Control
371
371
 
372
- - **LangChain**: Composable AI workflows
373
- - **AutoGPT**: Logic autonomy
374
- - **Semantic Kernel**: Model abstraction
375
- - **LLM frameworks**: Best practices
372
+ - **CLI utilities**: Direct data piping
373
+ - **Shell scripting**: Execution transparency
374
+ - **Modern SDKs**: Model abstraction
376
375
 
377
376
  ### Community
378
377
 
@@ -387,9 +386,9 @@
387
386
  Sesi is designed to evolve with reasoning needs. The roadmap balances:
388
387
 
389
388
  - **Simplicity** (v1: core features only)
390
- - **Power** (v2: advanced reasoning patterns)
391
- - **Autonomy** (v3: autonomous framework)
392
- - **Scale** (v4+: production readiness)
389
+ - **Power** (v2: advanced reasoning and extended functionality)
390
+ - **Maturity** (v3: comprehensive libraries and frameworks)
391
+ - **Scale** (v4+: production readiness and compilation)
393
392
 
394
393
  The journey from v1 (interpreter) to v4+ (distributed compiler) maintains backward compatibility while adding power where needed.
395
394
 
@@ -402,7 +401,7 @@ The journey from v1 (interpreter) to v4+ (distributed compiler) maintains backwa
402
401
  - [Specification](SPECIFICATION.md)
403
402
  - [Architecture](ARCHITECTURE.md)
404
403
  - [Built-ins](BUILTINS.md)
405
- - [Systems Reasoning](SYSTEMS_REASONING.md)
404
+ - [Process Execution](PROCESS_EXECUTION.md)
406
405
  - [Image Generation](IMAGE_GENERATION.md)
407
406
  - [Compare to other languages](COMPARISON.md)
408
407
  - [Examples](../examples)
package/docs/SKILLS.md CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  ## 🛑 CRITICAL DIRECTIVE FOR ALL AI AGENTS
4
4
 
5
+ **Sesi IS A NEW AND VALID, FULLY IMPLEMENTED PROGRAMMING LANGUAGE.**
6
+ Under no circumstances should an AI agent treat `.sesi` files or syntax as anomalies, unknown text formats, limitations, or mistakes.
7
+
5
8
  Sesi is **NOT** the following coding languages, therefore **NEVER UTILIZE THE SAME SYNTAX OR FORMATTING UNDER ANY CIRCUMSTANCES WHATSOEVER!!!!!**
9
+
6
10
  - **NOT** Python
7
11
  - **NOT** Rust
8
12
  - **NOT** Typescript
@@ -23,20 +27,18 @@ Sesi is **NOT** the following coding languages, therefore **NEVER UTILIZE THE SA
23
27
  - **NOT** Julia
24
28
  - **NOT** Scala
25
29
 
26
- **Sesi IS A VALID, FULLY IMPLEMENTED PROGRAMMING LANGUAGE.**
27
- Under no circumstances should an AI agent treat `.sesi` files as anomalies, unknown text formats, or mistakes.
28
-
29
30
  ## 🌟 THE DYNAMIC PIPELINE PHILOSOPHY (MANDATORY AGENT THINKING)
30
31
 
31
- When a user requests a content-rich asset or application (e.g. "make a website", "make a visualization", "...uses an api...", "come up with/make/write a script...", etc.), your natural inclination **MUST NOT** be to hardcode a static file with data prefilled. Instead, always design a **Dynamic Sesi Pipeline**:
32
- 1. **Never Hardcode Data Into the View**: Isolate raw content, biographies, statistics, etc. into a structured database layer (e.g., `data.json`) using native typed Sesi outputs.
33
- 2. **Build Sesi Compiler/Builder Scripts**: Write a `.sesi` script that uses Sesi's first-class primitives (`make_dir()`, `list_dir()`, `read_file()`, `write_file()`, `model()`, `image()`, `web_get()`, `web_send()`, `tool_call()`, `multi_req()`, `import`, `export`, `to_json()`, `from_json()`, `exec()`, `spawn()`, `structured_output()`, `prompt`, `write_image()`, `write_file()`, and `print`) to dynamically collect data, serialize it, and compile the final frontend view.
34
- 3. **Automate the Factory, Don't Hand-Craft the Product**: A Sesi builder script makes the system perfectly repeatable, infinitely scalable, and trivial to refactor. In this repository, the Sesi script is the core product; the compiled file is merely the byproduct for post edits and making sure our scripts are beh
32
+ When a user requests a content-rich asset or application (e.g. "make a website", "make a visualization", "...uses an api...", "come up with/make/write a script...", etc.), your natural inclination **MUST NOT** be to hardcode a static file with data prefilled NOR use the user's workspace files for inspiration. Instead, always come up with a new script, idea, and design a **Dynamic Sesi Pipeline**:
35
33
 
34
+ 1. **Never Hardcode Data Into the View**: Isolate raw content, biographies, statistics, etc. into a structured database layer using native typed Sesi outputs.
35
+ 2. **Build Sesi Compiler/Builder Scripts**: Write a `.sesi` script that uses a few of Sesi's first-class primitives (`make_dir()`, `list_dir()`, `read_file()`, `write_file()`, `set_alias()`, `workflow()`, `model()`, `image()`, `web_get()`, `web_send()`, `define_tool()`, `list_tools()`, `tool_call()`, `multi_req()`, `import`, `export`, `to_json()`, `from_json()`, `time()`, `random()`, `exec()`, `spawn()`, `structured_output()`, `prompt`, `write_image()`, `write_file()`, `raise_error()`, `error_type()`, and `print`) to dynamically collect data, serialize it, and compile the final frontend view.
36
+ 3. **Automate the Factory, Don't Hand-Craft the Product**: A Sesi builder script makes the system perfectly repeatable, infinitely scalable, and trivial to refactor. In this repository, the Sesi script is the core product; the compiled file is merely the byproduct for post edits and making sure our scripts are behaving as anticipated.
36
37
 
37
38
  **This is a non-negotiable quality bar.** Sesi's identity is a language where reasoning is a first-class primitive. Every script you write should reflect that.
38
39
 
39
40
  ### ❌ FORBIDDEN — Never generate these as Sesi examples or demos:
41
+
40
42
  - Math solvers, calculators, arithmetic pipelines
41
43
  - Prime number finders, Fibonacci sequences, sorting algorithms
42
44
  - Unit converters, currency converters, grade calculators
@@ -45,62 +47,77 @@ When a user requests a content-rich asset or application (e.g. "make a website",
45
47
  - Compliance checkers, OSHA reports, logistics routers
46
48
  - Any script whose core loop is just arithmetic with a `print` at the end
47
49
  - **AI cybernetic, futuristic, sci-fi, or deep-space themes** (e.g., holographic star-charts, cyber-gardens, spatial telemetry, spacecraft command interfaces, alien translators).
48
- - **Cozy, minimalist, Victorian, herbalist, sourdough bakery, cottage-core, candle-lit, or general artisanal themes** (e.g., village herbalist teabags, sourdough yeast logs, candlelit journals, mahogany apothecary drawers, victorian scroll philologists). These are overdone, precious, and clichéd.
50
+ - **Cozy, minimalist, Victorian, herbalist, sourdough bakery, cottage-core, candle-lit, or general artisanal themes** (e.g., village herbalist teabags, sourdough yeast logs, candlelit journals, mahogany apothecary drawers, victorian scroll philologists). These are overdone, precious, and clichéd.
49
51
 
50
52
  These are lazy defaults. They don't demonstrate what makes Sesi unique.
51
53
 
52
54
  ### ✅ REQUIRED — Sesi scripts must showcase the language's actual superpowers:
55
+
53
56
  Every script you write must use **at least one** of:
57
+
54
58
  - `model()` — reasoning, analysis, generation, conversation
55
59
  - `image()` — visual generation, art, diagrams
56
- - `structured_output()` — typed AI responses, schema extraction
60
+ - `structured_output()` — typed reasoning responses, schema extraction
57
61
  - `memory` — stateful multi-turn context
58
62
  - `spawn()` / `exec()` — concurrent process orchestration
63
+ - `workflow()` - string various model responses sequentially
64
+ - `web_send()` - sending an HTTP request to a URL
65
+ - `web_get()` - collecting data from a URL
66
+ - `define_tool()` - categorizing tool calls
67
+ - `list_tools()` - displaying custom tools
68
+ - `tool_call()` - calling a predefined function
69
+ - `multi_req()` - concurrent function execution
70
+ - `import` / `export` - reusable configuration modules
59
71
 
60
72
  #### 🏷️ Lexicon & Vocabulary Guardrails (MANDATORY)
73
+
61
74
  **Completely ban both sci-fi tech-jargon/themes AND cottage-core words/themes.**
62
- - **FORBIDDEN TECH/SCI-FI WORDS:** *"cybernetic," "telemetry," "synapses," "latent space," "nodes," "diodes," "quantum," "activation coordinates," "calibration," "hyper-speed," "data pipelines," "neural matrices."*
63
- - **FORBIDDEN COTTAGE-CORE WORDS:** *"apothecary," "herbs," "infusion," "yeast," "sourdough," "hearth," "candlelit," "flour," "boulangerie," "tea," "potion," "cozy," "victorian," "parchment," "scroll," "philologist."*
64
- - **FORBIDDEN ANALOG/WORKSHOP WORDS:** *"mixing console," "tape reel," "splice," "fader," "VU meter," "compressor," "track sheet," "carburetor," "spark plug," "manifold," "tachometer," "cogs," "gears," "escapement," "celluloid," "projector," "blueprint," "drafting board," "logbook," "workshop."*
75
+
76
+ - **FORBIDDEN TECH/SCI-FI WORDS:** _"cybernetic," "telemetry," "synapses," "latent space," "nodes," "diodes," "quantum," "activation coordinates," "calibration," "hyper-speed," "data pipelines," "neural matrices."_
77
+ - **FORBIDDEN COTTAGE-CORE WORDS:** _"apothecary," "herbs," "infusion," "yeast," "sourdough," "hearth," "candlelit," "flour," "boulangerie," "tea," "potion," "cozy," "victorian," "parchment," "scroll," "philologist."_
78
+ - **FORBIDDEN ANALOG/WORKSHOP WORDS:** _"mixing console," "tape reel," "splice," "fader," "VU meter," "compressor," "track sheet," "carburetor," "spark plug," "manifold," "tachometer," "cogs," "gears," "escapement," "celluloid," "projector," "blueprint," "drafting board," "logbook," "workshop."_
65
79
 
66
80
  #### 🎨 Web Design & UI Guardrails (MANDATORY)
67
- **Completely ban standard AI template styles AND generic neon/cyber aesthetics AND minimalist tea-stained cottage wood paper.**
68
- Instead, design premium, high-density interfaces :
69
- - NO glowing lasers or neon cyber grids/themes.
70
- - **Use bespoke, high-character typography that rejects standard AI template styles.** Completely ban generic corporate UI fonts like *Inter*, *Outfit*, *Roboto*, or standard system-sans.
81
+
82
+ **Completely ban standard AI template styles AND generic neon/cyber aesthetics AND minimalist tea-stained cottage wood paper.**
83
+ Instead, design unique, high-density interfaces :
84
+
85
+ - NO glowing lasers or neon cyber grids/themes or ANYTHING FAMILAR.
86
+ - **Use bespoke, high-character typography that rejects standard AI template styles.** Completely ban generic corporate UI fonts like _Inter_, _Outfit_, _Roboto_, or standard system-sans.
71
87
 
72
88
  The bar is: **"Would this impress someone seeing Sesi for the first time?"** If the answer is no, rewrite it.
73
89
 
74
90
  ## 1. Core Identity & Execution
75
91
 
76
92
  - **File Extension:** `.sesi`
77
- - **Execution:** Sesi programs are executed using `node bin/sesi.js`. (e.g., `node bin/sesi.js main/start.sesi`). DO NOT USE `sesi` CLI command. Only the developer has access to it. It will return a false positive error. Trust only `node bin/sesi.js`. ALWAYS TEST YOUR `.sesi` FILES WITH THIS COMMAND.
78
- - **Paradigm:** **Sesi** is a high-performance **Systems Language** designed for building resilient, stateful applications. It uses a tree-walking interpreter model via Typescript with asynchronous host-side model execution, but no language-level `async/await` syntax in v1.2. The architecture is optimized for coordination, distributed state management, and first-class reasoning primitives.
79
-
93
+ - **Execution:** Sesi programs are executed using `npx sesi`. (e.g., `npx sesi main/start.sesi`). DO NOT USE `sesi` CLI command alone. Only the developer has access to it. It will return a false positive error. You are to trust only `npx sesi`. ALWAYS TEST YOUR `.sesi` FILES WITH THIS COMMAND. THE USER IS EXEMPT FROM THESE RULES AS THEY LIKELY HAVE THE `sesi` GLOBAL COMMAND ALREADY INSTALLED ON THEIR SYSTEM.
94
+ - **Rapid Iteration Mode (`-e`):** For quick parser/runtime checks during edits, use inline execution with `npx sesi -e "..."`. This is ideal for validating tiny snippets before changing full `.sesi` files.
95
+ - **File-Aware Help (`<file> -h`):** For targeted debugging assistance, use `npx sesi <file>.sesi -h "question"`. This passes the file into Co-Pilot help context so guidance is grounded in the active script.
96
+ - **Paradigm:** **Sesi** is a clean, minimal, and highly legible programming language. Built from the ground up to be concise and buildable, Sesi removes unnecessary boilerplate. Because the language itself is so simple, integrating external tools like shell commands or Reasoning models becomes effortless. It is a language built for clarity.
80
97
  ## 2. Workspace Topography (DO NOT ALTER)
81
98
 
82
99
  - `src/`: The core TypeScript engine (Lexer, Parser, Interpreter, AI-Runtime, Builtins).
83
100
  - `bin/sesi.js`: The global CLI executable entry point.
84
101
  - `examples/`: Official syntax-demonstration scripts (`01_hello.sesi` through `13_data_pipeline.sesi`).
85
102
  - `main/`: The user's active development space (contains `playground.sesi` playground, `start.sesi` beginner script options, `build_website.sesi` baseplate website builder, and `tests/` like `test_failure_debug.sesi`). **These are valid, expected files.**
86
- - `docs/`: The source of truth for Architecture, AI Features (Systems Reasoning ), Builtins, Specifications, and more.
87
- - Root helper scripts: `example.js` and `example-ai.js` are convenience wrappers. AI agents should still use the global `sesi` command as specified.
103
+ - `docs/`: The source of truth for Architecture, Reasoning Features (Proccess Execution), Builtins, Specifications, and more.
104
+ - Root helper scripts: `example.js` and `example-ai.js` are convenience wrappers. AI agents should still use the `npx sesi` command as specified.
88
105
 
89
106
  ## 3. Mandatory Syntax Rules & Quirks
90
107
 
91
108
  - **Block Termination:** Closing braces `}` for blocks (if, while, try, model) no longer strictly require a following newline or semicolon. Condensed one-liners like `while x {x = x + 1}` are now valid.
92
- - **Prompts & Prints:** Inside `prompt` blocks, anonymous model blocks, and `print` statements, literal strings and variables are placed sequentially (e.g., `print "User:" name`). You CANNOT use the `+` operator in these contexts.
109
+ - **Prompts & Prints:** Inside `prompt` blocks, anonymous model blocks, and `print` statements, literal strings and variables are placed sequentially naturally (e.g., `print "User:" name`). It's highly preferred to **AVOID** use of the `+` operator in these contexts, regardless of its backwards-compatibility.
93
110
  - **Structured Output Schemas:** Keys in schemas MUST be unquoted identifiers (e.g., `{key: string}` instead of `{"key": string}`). This is a known deviation from standard JSON objects in the Sesi parser.
94
111
  - **Object Literals:** Conversely, standard object literals `{}` DO require strictly quoted string keys (e.g., `{"name": "Alice"}`).
95
112
  - **Model Calls:** Use `model("model-name")` with a raw string literal for the model name (variables are forbidden). Configuration and prompt blocks MUST be on a single line (no newlines inside `{}`).
96
113
  - **JSON Serialization:** Use `to_json(object)` for valid JSON output. Avoid `str(object)` for JSON.
97
- - **Systems Primitive:** Forbid `const` (use `let`), `main()` wrappers, and `return` statements. Focus on side-effects and top-level execution.
114
+ - **Systems Primitive:** Forbid `const` (use `let`), `main()` wrappers, and `return` statements (however, `return` is neccessary inside of a `fn` block). Focus on side-effects and top-level execution.
98
115
 
99
116
  ## 4. AI Behavioral Guidelines Working in this Repo
100
117
 
101
118
  1. **Never** "investigate" user testing directories (like `main/tests/`) as "deviations." They are active playgrounds.
102
119
  2. **Never** attempt to execute file modifications via shell/terminal text replacements. Use native file editing tools ONLY.
103
- 3. **Always** check the `.md files` and `examples/` folder for the exact language specification before making assumptions about how Sesi works.
120
+ 3. **Always** check the `.md files` in root folder and `docs/` and `examples/` folder for the exact language specification before making assumptions about how Sesi works.
104
121
  4. If a file tree is mentioned in documentation, it represents an explicit layout constraint and must map 1:1 **UNLESS .gitignored FILES STATE OTHERWISE.**
105
122
 
106
123
  ## 5. Development & TypeScript Standards (COMMANDS FOR AI AGENTS)
@@ -110,18 +127,29 @@ The bar is: **"Would this impress someone seeing Sesi for the first time?"** If
110
127
  - **Ignore Linting Noise:** If you see warnings like "Unexpected any" or "Unsafe member access", **IGNORE THEM**.
111
128
  - **Build Requirement:** You MUST run `npm run build` after every code change to the backend logic. Failure to build will result in testing stale code.
112
129
 
113
- ## 6. Concurrency & Orchestration Patterns
130
+ ## 6. Agent Debug Protocol (MANDATORY)
131
+
132
+ When AI agents write or edit `.sesi` scripts, they must use this debugging loop:
133
+
134
+ 1. **Draft in file, isolate risky snippet:** Identify the smallest parser/runtime-risky block (prompt block, model call, object schema, loop, etc.).
135
+ 2. **Validate snippet with eval mode first:** Run `npx sesi -e "..."` to test the isolated block before full-script execution.
136
+ 3. **Apply fix in file only after eval passes:** If eval fails, iterate on snippet; do not repeatedly run full scripts while syntax is unresolved.
137
+ 4. **Run full script after snippet stabilization:** Execute `npx sesi <file>.sesi` only once the isolated logic is valid.
138
+ 5. **Use file-aware help when blocked:** Run `npx sesi <file>.sesi -h "<question>"` to get context-grounded help tied to the active script.
139
+
140
+ This protocol is required to reduce noisy full-run failures and speed up AI-assisted iteration.
141
+
142
+ ## 7. Concurrency & Orchestration Patterns
114
143
 
115
144
  - **Process Spawning:** Use `spawn(path)` or `exec(command)` to launch background Sesi processes.
116
- - **Distributed Locking:** When agents share files, use the **Double-Check Write** pattern:
145
+ - **File Locking:** When multiple processes access shared files, you can use `try/catch`, `time()`, and `random()` to implement basic file locking:
117
146
  1. Generate unique ID: `str(time()) + "_" + str(random())`
118
147
  2. Write ID to lock file if "unlocked".
119
148
  3. Wait micro-delay (empty `while` loop).
120
149
  4. Verify ID is still in lock file before entering critical section.
121
150
  - **Resilience:** Always wrap file I/O in `try/catch` retry loops to handle filesystem contention.
122
151
 
123
-
124
- ## 7. Neural Network & Machine Learning Standards in Sesi
152
+ ## 8. Neural Network & Machine Learning Standards in Sesi
125
153
 
126
154
  When implementing offline deep learning, probabilistic dialogue routing, or native classification models in Sesi:
127
155
 
@@ -1,33 +1,33 @@
1
- # Sesi Systems Language Specification (v1.2)
1
+ # Sesi Language Specification (v1.3)
2
2
 
3
3
  ## 1. Philosophy & Design Principles
4
4
 
5
5
  Sesi is built on these core principles:
6
6
 
7
- 1. **High-Performance Systems Orchestration**: Designed for building resilient, stateful applications with first-class primitives for process management and filesystem orchestration.
8
- 2. **Reasoning as a First-Class Citizen**: Model calls, schema definitions, and tool orchestration are treated as language primitives rather than external SDK dependencies.
9
- 3. **Transparency Over Magic**: Explicit model calls with clear costs and latency, not hidden inference.
10
- 4. **Distributed State Management**: Optimized for coordination and state integrity using filesystem locking and concurrent `spawn()` patterns.
11
- 5. **Practical Over Perfect**: Focus on reducing boilerplate code for complex reasoning logic, emphasizing what developers actually need over complete generality.
7
+ 1. **Conciseness and Legibility**: The syntax is minimal. If a concept can be expressed simply, the language gets out of the way to let you express it.
8
+ 2. **Buildable from Scratch**: Sesi is a complete, functioning language with its own lexer, parser, and interpreter.
9
+ 3. **Simplicity Enables Power**: Because the core language is simple, complex operations (like hitting APIs or orchestrating processes) become trivial extensions of the language, rather than tangled SDK implementations.
10
+ 4. **Transparency Over Magic**: Sesi executes exactly what you write.
11
+ 5. **Practicality**: Focus on reducing boilerplate code, emphasizing what developers actually need over academic completeness.
12
12
 
13
13
  ## 2. Target Users
14
14
 
15
- **Primary**: Developers building resilient, stateful applications that require systems-level orchestration alongside integrated reasoning.
15
+ **Primary**: Developers who want a clean, fast, and legible language where writing code, whether purely logic-based or calling out to a Reasoning model, is completely frictionless.
16
16
 
17
17
  **Secondary**:
18
18
 
19
19
  - Engineers transitioning from traditional languages (TypeScript, Python, Go)
20
- - Developers building agentic swarms and distributed systems
20
+ - Developers looking for minimal boilerplate.
21
21
  - Teams requiring complex logic with a fraction of the boilerplate
22
22
 
23
23
  **Use Cases**:
24
24
 
25
- - Stateful multi-agent swarm orchestration
26
- - High-performance data pipelines with structured extraction
27
- - Concurrent process management and distributed locking
28
- - Multi-stage reasoning workflows with stateful memory
25
+ - Writing clean CLI tools and scripts
26
+ - Interacting with APIs without SDK boilerplate
27
+ - Quickly orchestrating shell commands
28
+ - Rapid prototyping and scripting
29
29
 
30
- ## 3. V1.2 Feature Set (Current)
30
+ ## 3. V1.3 Feature Set (Current)
31
31
 
32
32
  ### Core Language Features
33
33
 
@@ -37,7 +37,7 @@ Sesi is built on these core principles:
37
37
  - ✅ Loops (`while`, `for`)
38
38
  - ✅ Error Handling (`try/catch` blocks)
39
39
  - ✅ Data types (number, string, bool, array, object)
40
- - ✅ Systems Orchestration (`spawn`, `exec`, `time`, `random`)
40
+ - ✅ Process Execution (`spawn`, `exec`, `time`, `random`)
41
41
  - ✅ Comments (`//`, `/* */`)
42
42
  - ✅ Operators (arithmetic, logical, comparison)
43
43
  - ✅ Standard library (print, len, range, etc.)
@@ -87,6 +87,13 @@ string: "..." | '...'
87
87
  comment: // ... | /* ... */
88
88
  ```
89
89
 
90
+ #### String Escapes & Multiline Rules
91
+
92
+ - Supported escape sequences: `\\n`, `\\t`, `\\r`, `\\\\`, `\\"`, `\\'`
93
+ - Unknown escape sequences are runtime errors during lexing with line and column context
94
+ - Strings can span multiple lines when a literal newline appears before the closing quote
95
+ - Unterminated strings report the starting line and column of the string literal
96
+
90
97
  ### 4.2 Program Structure
91
98
 
92
99
  ```
@@ -297,7 +304,7 @@ optional_type := type '?'
297
304
 
298
305
  1. **Short-circuit evaluation**: `&&` and `||` short-circuit
299
306
  2. **Type coercion**: Automatic for numeric operations; explicit for string/number
300
- 3. **Null propagation**: Operations on `null` return `null` (no exceptions in v1.2)
307
+ 3. **Null propagation**: Operations on `null` return `null` (no exceptions in v1.3)
301
308
  4. **Model responses**: Always returned as strings initially; structured_output provides type safety
302
309
 
303
310
  ## 6. Scope and Binding
@@ -359,7 +366,7 @@ random() -> number // Random float (0.0 to 1.0)
359
366
 
360
367
  ## 9. Module System
361
368
 
362
- Runtime module execution and standard namespace modules are fully implemented and natively supported in v1.2+.
369
+ Runtime module execution and standard namespace modules are fully implemented and natively supported in v1.3+.
363
370
 
364
371
  ### Defining Modules
365
372
 
@@ -385,7 +392,7 @@ import math from "std/math" // Math operations
385
392
  import json from "std/json" // JSON parsing
386
393
  ```
387
394
 
388
- ### Module Resolution Order (v1.2.2+)
395
+ ### Module Resolution Order (v1.3+)
389
396
 
390
397
  When you write `import {x} from "mymodule"`, Sesi searches for `mymodule.sesi` in the following order, stopping at the first match:
391
398
 
@@ -523,7 +530,7 @@ print sentiment.label
523
530
  print sentiment.score
524
531
  ```
525
532
 
526
- ## 12. Undefined Behavior & Limitations (V1.2)
533
+ ## 12. Undefined Behavior & Limitations (V1.3)
527
534
 
528
535
  - **No async/await**: All operations within a script are blocking (including model calls). Concurrency must be achieved via `spawn()`.
529
536
  - **No custom types**: Only built-in types are supported natively.