@misterscan/sesi 1.3.0 → 1.3.3

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 (86) 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 +74 -33
  6. package/bin/sesi.js +56 -23
  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 +3 -1
  14. package/dist/builtins.js.map +1 -1
  15. package/dist/index.d.ts +5 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +61 -2
  18. package/dist/index.js.map +1 -1
  19. package/dist/interpreter.d.ts +10 -0
  20. package/dist/interpreter.d.ts.map +1 -1
  21. package/dist/interpreter.js +20 -4
  22. package/dist/interpreter.js.map +1 -1
  23. package/dist/parser.d.ts.map +1 -1
  24. package/dist/parser.js +3 -4
  25. package/dist/parser.js.map +1 -1
  26. package/dist/sesi.bundled.js +2526 -1487
  27. package/dist/types.d.ts +1 -1
  28. package/dist/types.d.ts.map +1 -1
  29. package/docs/ARCHITECTURE.md +2 -7
  30. package/docs/BUILTINS.md +27 -8
  31. package/docs/CLI.md +200 -0
  32. package/docs/COMPARISON.md +11 -6
  33. package/docs/IMPLEMENTATION_SUMMARY.md +57 -50
  34. package/docs/QUICKSTART.md +104 -23
  35. package/docs/README.md +84 -42
  36. package/docs/REASONING.md +21 -16
  37. package/docs/ROADMAP.md +10 -5
  38. package/docs/SKILLS.md +63 -116
  39. package/docs/SPECIFICATION.md +35 -23
  40. package/examples/03_functions.sesi +30 -1
  41. package/examples/07_prompts.sesi +26 -2
  42. package/examples/08_model_call.sesi +6 -4
  43. package/examples/09_structured_output.sesi +18 -2
  44. package/examples/10_code_generation.sesi +6 -4
  45. package/examples/11_memory_conversation.sesi +47 -15
  46. package/examples/12_classification.sesi +62 -7
  47. package/examples/13_data_pipeline.sesi +55 -28
  48. package/examples/14_folder_explainer.sesi +52 -51
  49. package/examples/15_image_generation.sesi +15 -14
  50. package/examples/16_modules.sesi +1 -1
  51. package/examples/19_search_web.sesi +18 -2
  52. package/examples/20_model_aliases.sesi +6 -6
  53. package/main/tests/test-args.sesi +7 -0
  54. package/main/tests/test_args.sesi +7 -0
  55. package/main/tests/test_general_modules.sesi +127 -0
  56. package/package.json +25 -21
  57. package/docs/CONCURRENCY.md +0 -71
  58. package/docs/sesi_ai_chronicles.md +0 -96
  59. package/main/conversational_classifier_weights.json +0 -45
  60. package/main/conversational_sentences.json +0 -304
  61. package/main/epochs.sesi +0 -94
  62. package/main/gpu_orchestrator.sesi +0 -36
  63. package/main/hardware_diagnostics.sesi +0 -118
  64. package/main/inference.sesi +0 -54
  65. package/main/native_chatbot.sesi +0 -180
  66. package/main/native_synthesizer.sesi +0 -83
  67. package/main/nn_personas_trainer.sesi +0 -302
  68. package/main/nn_responses_trainer.sesi +0 -269
  69. package/main/nn_sentences_trainer.sesi +0 -330
  70. package/main/orchestrator.sesi +0 -15
  71. package/main/personas.json +0 -124
  72. package/main/personas_classifier_weights.json +0 -45
  73. package/main/playground.sesi +0 -3
  74. package/main/predictive_typing.sesi +0 -127
  75. package/main/query_brain.sesi +0 -45
  76. package/main/response_classifier_weights.json +0 -45
  77. package/main/retro_chat.html +0 -239
  78. package/main/retro_chat_generator.sesi +0 -745
  79. package/main/sesi_ai.sesi +0 -158
  80. package/main/sesi_db_chatbot.sesi +0 -284
  81. package/main/setup_swarm.sesi +0 -5
  82. package/main/start.sesi +0 -13
  83. package/main/terminal.log +0 -56
  84. package/main/terminal_chat.py +0 -385
  85. package/main/unified_sesi_ai.sesi +0 -334
  86. package/main/varied_responses.json +0 -304
@@ -0,0 +1,116 @@
1
+ ---
2
+ trigger: always_on
3
+ ---
4
+
5
+ # The Sesi Programming Language
6
+
7
+ ## 🛑 CRITICAL STARTUP DIRECTIVE
8
+
9
+ - **Strict Active Context**: You must ONLY read the file that is currently the Active Document, or files that the user explicitly mentions in the conversation. Do NOT run `git status`, `git diff`, or scan the directory on startup to find and read other files.
10
+
11
+ ## Core Identity & Execution
12
+
13
+ - **File Extension:** `.sesi`
14
+ - `src/`: The core TypeScript engine (Lexer, Parser, Interpreter, AI-Runtime, Builtins).
15
+ - `bin/sesi.js`: The global CLI executable entry point.
16
+ - `examples/`: Official syntax-demonstration scripts (`01_hello.sesi` through `13_data_pipeline.sesi`).
17
+ - `chatbot/`: Local Sesi support and `sesi_db_chatbot.sesi` - Sesi's built-in Co-Pilot.
18
+ - `main/`: `tests/` like `test_failure_debug.sesi`. **Run inline code evaluations (`-e 'code'`) instead of writing new `.sesi` files for quick tests. Do not overwrite existing `.sesi` files unless explicitly asked to.**
19
+ - `docs/`: The source of truth for all sesi syntax, formatting, and structuring guidelines. It contains the official API docs for all built-in functions and types. AIs must treat this as the primary source of truth for syntax and structure.
20
+ - Root helper scripts: `example.js`, `example-ai.js`, and `examples.sesi` are convenience wrappers. AI agents should still use the `npx sesi` command as specified.
21
+ - **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. The language itself is so simple. It is a language built for clarity and reusability.
22
+
23
+ ## Agent Debug Protocol (MANDATORY)
24
+
25
+ When AI agents write or edit `.sesi` scripts, they must use this debugging loop:
26
+
27
+ 1. **Draft in file, isolate risky snippet:** Identify the smallest parser/runtime-risky block (prompt block, model call, object schema, loop, etc.).
28
+ 2. **Validate snippet with eval mode first:** Run `npm run sesi:eval <file>.sesi` to test the isolated block before full-script execution.
29
+ 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.
30
+ 4. **Run full script after snippet stabilization:** Execute `npm run sesi <file>.sesi` only once the isolated logic is valid.
31
+ 5. **Use file-aware help when blocked:** Run `npm run sesi:help <file>.sesi "<question>"` to get context-grounded help tied to the active script.
32
+ 6. **NEVER EDIT ANY .SESI FILES IN THE TERMINAL (ABSOLUTE RULE):**
33
+ - Do NOT run `sed`, `awk`, `perl`, or any other shell text-processing tools on `.sesi` files.
34
+ - Do NOT use `npm run sesi:eval` to modify files; it is only for syntax validation.
35
+ - Do NOT use Bash/Shell scripting to rewrite or patch Sesi source code.
36
+
37
+ **Correct approach:** You MUST always use your native editor/IDE's file editing capabilities to make clean, safe changes directly to `.sesi` files.
38
+ **Why:** Sesi syntax is sensitive to whitespace, newlines, and brace positioning. Terminal-based string replacement will invariably break code. Use the editor, not the terminal.
39
+
40
+ 7. **Emphasize Native Verification Commands:** Prior to saving or running full Sesi scripts, proactively use inline evaluation (`npm run sesi:eval <file>.sesi` or `node bin/sesi.js -e "..."`) to check and verify syntax and runtime behaviors instantly. It keeps execution cycles fast and deterministic.
41
+
42
+ ## Standards (ONLY REGARDING src/ FILES)
43
+
44
+ - **Type-Only Imports (MANDATORY):** Use `import {type ...}` for AST nodes. **DO NOT REMOVE** these. Removing them will break the build.
45
+ - **Interpreter Patterns (DO NOT "CLEAN UP"):** Dynamic casting and `any` are **EXPLICITLY PERMITTED** for tree-walking logic. They are a foundational part of the Sesi engine's design.
46
+ - **Ignore Linting Noise:** If you see warnings like "Unexpected any" or "Unsafe member access", **IGNORE THEM**.
47
+ - **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.
48
+
49
+ This protocol is required to reduce noisy full-run failures and speed up AI-assisted iteration.
50
+
51
+ Sesi is **NOT** the following coding languages, therefore **NEVER UTILIZE THE SAME SYNTAX OR FORMATTING UNDER ANY CIRCUMSTANCES WHATSOEVER!!!!!**
52
+
53
+ - **NOT** An "AI Wrapper"
54
+ - **NOT** A "LLM Framework"
55
+ - **NOT** An "AI-Native Programming Language"
56
+ - **NOT** Python
57
+ - **NOT** Rust
58
+ - **NOT** Typescript
59
+ - **NOT** YAML
60
+ - **NOT** BAML
61
+ - **NOT** Go
62
+ - **NOT** C++
63
+ - **NOT** C
64
+ - **NOT** Java
65
+ - **NOT** C#
66
+ - **NOT** Javascript
67
+ - **NOT** Bash
68
+ - **NOT** Shell
69
+ - **NOT** Ruby
70
+ - **NOT** PHP
71
+ - **NOT** Swift
72
+ - **NOT** Julia
73
+ - **NOT** Scala
74
+ - **NOT** Any other programming language or scripting language.
75
+
76
+ ### ✅ REQUIRED — Sesi scripts must use the language's built-ins:
77
+
78
+ Every script you write must use **at least one** of:
79
+
80
+ - `prompt` - composable script templates, this is NOT related to AI at all
81
+ - `structured_output` - structured data extraction, this is NOT related to AI at all
82
+ - `memory` — stateful multi-turn context, this is NOT related to AI at all
83
+ - `exec()` — concurrent process orchestration
84
+ - `web_send()` - sending an HTTP request to a URL
85
+ - `web_get()` - collecting data from a URL
86
+ - `define_tool()` - categorizing tool calls
87
+ - `list_tools()` - displaying custom tools
88
+ - `tool_call()` - calling a predefined function, this is NOT related to AI at all
89
+ - `multi_req()` - concurrent function execution
90
+ - `import` / `export` - reusable configuration modules
91
+
92
+ The bar is: **"Is this easy to write and read?"** If the answer is no, rewrite it.
93
+
94
+ ## Mandatory Syntax Rules & Quirks
95
+
96
+ - **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 valid.
97
+ - **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.
98
+ - **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.
99
+ - **Object Literals:** Conversely, standard object literals `{}` DO require strictly quoted string keys (e.g., `{"name": "Alice"}`).
100
+ - **JSON Serialization:** Use `to_json(object)` for valid JSON output. Avoid `stringify(object)` for JSON.
101
+ - **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.
102
+ - **Resilience:** Always wrap file I/O in `try/catch` retry loops to handle filesystem contention.
103
+
104
+ For all quirks and specific syntaxing, visit IMPLEMENTATION_SUMMARY.md, /docs/SPECIFICATION.md, /docs/BUILTINS.md, and /docs/CLI.
105
+
106
+ ## IGNORE THESE FILES
107
+
108
+ - `docs/agent_native_programming.md`
109
+ - `docs/REASONING.md`
110
+ - `docs/IMAGE_GENERATION.md`
111
+ - `*.txt`
112
+ - `*.log`
113
+ - `query.txt`
114
+ - `.sesi_cache.json`
115
+ - `.sesi_chat_history.json`
116
+ - `/landing-pages/`
@@ -0,0 +1,44 @@
1
+ ---
2
+ description: Intent-based development workflow for generating concise, syntax-accurate Sesi scripts using integrated web research and verified implementation patterns.
3
+ ---
4
+
5
+ ## Operational Directives
6
+
7
+ 1. **Let Sesi Do Its Job**: 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 end file(s) are merely the byproduct for post edits and making sure our scripts are behaving as anticipated.
8
+ 2. **Script Creation:** Your primary task is to generate scripts in Sesi.
9
+ 3. **Syntax Integrity:** Strictly adhere to established Sesi syntax and formatting rules. Never fabricate or hallucinate rules. If a pattern is not verified within Sesi, do not use it.
10
+ 4. **Language and Perspective:** Maintain a grounded, practical perspective. Avoid technical jargon, buzzwords, or computational theory in your internal thought process and your final output. Focus on the user's request at hand. Do not drift into irrelevant files not explicitly mentioned by the user, you are not allowed to open them.
11
+ 5. **Information Sourcing:** Do not rely on pre-existing training data for language definitions or outdated practices. Prioritize active research to find current, relevant implementation patterns. If a method or approach is flagged as outdated, discard it immediately.
12
+ 6. **Inspiration:** While Sesi is a distinct, emerging language, draw inspiration for script logic and functionality from any programming language. Ensure that this inspiration is limited to the _concept_ of the solution, not the syntax or formatting of the source language.
13
+ 7. **Cautious Integration:** Do NOT use model(), image(), or workflow(). The user is the only one with permission to use these functions. Unless they explicitly request it, do not even consider it in your script once.
14
+ 8. **Core Philosophy:** Sesi scripts must be concise, legible, and intent-based. If a solution feels overly complex or forced, it likely deviates from the Sesi philosophy. Keep the implementation direct.
15
+ 9. **Efficiency and Accessibility:** Sesi is designed to make development straightforward and enjoyable. Leverage web search and external resources freely to find inspiration and tools. You have full authorization to browse and synthesize information from available sources to streamline script creation.
16
+
17
+ ## Mandatory Syntax Rules & Quirks
18
+
19
+ - **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 valid.
20
+ - **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.
21
+ - **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.
22
+ - **Object Literals:** Conversely, standard object literals `{}` DO require strictly quoted string keys (e.g., `{"name": "Alice"}`).
23
+ - **JSON Serialization:** Use `to_json(object)` for valid JSON output. Avoid `stringify(object)` for JSON.
24
+ - **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.
25
+ - **Resilience:** Always wrap file I/O in `try/catch` retry loops to handle filesystem contention.
26
+
27
+ ## Agent Debug Protocol (MANDATORY)
28
+
29
+ When AI agents write or edit `.sesi` scripts, they must use this debugging loop:
30
+
31
+ 1. **Draft in file, isolate risky snippet:** Identify the smallest parser/runtime-risky block (prompt block, model call, object schema, loop, etc.).
32
+ 2. **Validate snippet with eval mode first:** Run `npm run sesi:eval <file>.sesi` to test the isolated block before full-script execution.
33
+ 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.
34
+ 4. **Run full script after snippet stabilization:** Execute `npm run sesi <file>.sesi` only once the isolated logic is valid.
35
+ 5. **Use file-aware help when blocked:** Run `npm run sesi:help <file>.sesi "<question>"` to get context-grounded help tied to the active script.
36
+ 6. **NEVER EDIT ANY .SESI FILES IN THE TERMINAL (ABSOLUTE RULE):**
37
+ - Do NOT run `sed`, `awk`, `perl`, or any other shell text-processing tools on `.sesi` files.
38
+ - Do NOT use `npm run sesi:eval` to modify files; it is only for syntax validation.
39
+ - Do NOT use Bash/Shell scripting to rewrite or patch Sesi source code.
40
+
41
+ **Correct approach:** You MUST always use your native editor/IDE's file editing capabilities to make clean, safe changes directly to `.sesi` files.
42
+ **Why:** Sesi syntax is sensitive to whitespace, newlines, and brace positioning. Terminal-based string replacement will invariably break code. Use the editor, not the terminal.
43
+
44
+ 7. **Emphasize Native Verification Commands:** Prior to saving or running full Sesi scripts, proactively use inline evaluation (`npm run sesi:eval <file>.sesi` or `node bin/sesi.js -e "..."`) to check and verify syntax and runtime behaviors instantly. It keeps execution cycles fast and deterministic.
@@ -0,0 +1,14 @@
1
+ ---
2
+ description: Debugging and validation of error prone sesi scripts.
3
+ ---
4
+
5
+ 1. **Draft in file, isolate risky snippet:** Identify the smallest parser/runtime-risky block (prompt block, model call, object schema, loop, etc.).
6
+ 2. **Validate snippet with eval mode first:** Run `npm run sesi:eval "..."` to test the isolated block before full-script execution.
7
+ 3. **Run inline code evaluations instead of writing new `.sesi` files for quick tests.:** If eval fails, iterate on snippet; do not repeatedly run full scripts while syntax is unresolved.
8
+ 4. **Run full script after snippet stabilization:** Execute `npm run sesi <file>.sesi` only once the isolated logic is valid.
9
+ 5. **Use file-aware help when blocked:** Run `npm run sesi:help <file>.sesi "<question>"` to get context-grounded help tied to the active script.
10
+ 6. **NEVER Edit Sesi Files in the Terminal:** Under no circumstances should you attempt to perform file editing or text replacements via terminal commands (such as `sed`, `awk`, or scripts). **You MUST always use your native IDE/editor tools to make clean, safe file edits directly.**
11
+ 7. **Emphasize Native Verification Commands:** Prior to saving or running full Sesi scripts, proactively use inline evaluation (`npx run sesi:eval "..."` or `node bin/sesi.js -e "..."`) to check and verify syntax and runtime behaviors instantly. It keeps execution cycles fast and deterministic.
12
+ 8. **Always Check Specifications first:** Verify specifications in the `docs/` or `examples/` folders before assuming language quirks.
13
+
14
+ _If running through Powershell, AI-Agents may not have explicit access to using the `npm` or `sesi` commands in their sandbox enviornments without running into FullExecution errors. In this case, use `node bin/sesi.js <file> <option>` in replacement of `npm run sesi`._
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: MakeInSesi
3
+ description: Intent-based development workflow for generating concise, syntax-accurate Sesi scripts using integrated web research and verified implementation patterns.
4
+ agent: Plan
5
+ model: GPT-4.1 (copilot)
6
+ tools:
7
+ [
8
+ execute/getTerminalOutput,
9
+ execute/killTerminal,
10
+ execute/sendToTerminal,
11
+ execute/runTask,
12
+ execute/createAndRunTask,
13
+ execute/runInTerminal,
14
+ execute/runTests,
15
+ execute/testFailure,
16
+ read/problems,
17
+ read/readFile,
18
+ read/viewImage,
19
+ read/terminalSelection,
20
+ read/terminalLastCommand,
21
+ read/getTaskOutput,
22
+ agent,
23
+ edit/createDirectory,
24
+ edit/createFile,
25
+ edit/editFiles,
26
+ edit/rename,
27
+ search,
28
+ web,
29
+ browser/openBrowserPage,
30
+ browser/readPage,
31
+ browser/screenshotPage,
32
+ browser/navigatePage,
33
+ browser/clickElement,
34
+ azure-mcp/search,
35
+ todo,
36
+ ]
37
+ argument-hint: "Write a Sesi script that..."
38
+ ---
39
+
40
+ ## Operational Directives
41
+
42
+ 1. **Let Sesi Do Its Job**: 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 end file(s) are merely the byproduct for post edits and making sure our scripts are behaving as anticipated.
43
+ 2. **Script Creation:** Your primary task is to generate scripts in Sesi.
44
+ 3. **Syntax Integrity:** Strictly adhere to established Sesi syntax and formatting rules. Never fabricate or hallucinate rules. If a pattern is not verified within Sesi, do not use it.
45
+ 4. **Language and Perspective:** Maintain a grounded, practical perspective. Avoid technical jargon, buzzwords, or computational theory in your internal thought process and your final output. Focus on the user's request at hand. Do not drift into irrelevant files not explicitly mentioned by the user, you are not allowed to open them.
46
+ 5. **Information Sourcing:** Do not rely on pre-existing training data for language definitions or outdated practices. Prioritize active research to find current, relevant implementation patterns. If a method or approach is flagged as outdated, discard it immediately.
47
+ 6. **Inspiration:** While Sesi is a distinct, emerging language, draw inspiration for script logic and functionality from any programming language. Ensure that this inspiration is limited to the _concept_ of the solution, not the syntax or formatting of the source language.
48
+ 7. **Cautious Integration:** Do NOT use model(), image(), or workflow(). The user is the only one with permission to use these functions. Unless they explicitly request it, do not even consider it in your script once.
49
+ 8. **Core Philosophy:** Sesi scripts must be concise, legible, and intent-based. If a solution feels overly complex or forced, it likely deviates from the Sesi philosophy. Keep the implementation direct.
50
+ 9. **Efficiency and Accessibility:** Sesi is designed to make development straightforward and enjoyable. Leverage web search and external resources freely to find inspiration and tools. You have full authorization to browse and synthesize information from available sources to streamline script creation.
51
+
52
+ ## Mandatory Syntax Rules & Quirks
53
+
54
+ - **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 valid.
55
+ - **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.
56
+ - **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.
57
+ - **Object Literals:** Conversely, standard object literals `{}` DO require strictly quoted string keys (e.g., `{"name": "Alice"}`).
58
+ - **JSON Serialization:** Use `to_json(object)` for valid JSON output. Avoid `stringify(object)` for JSON.
59
+ - **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.
60
+ - **Resilience:** Always wrap file I/O in `try/catch` retry loops to handle filesystem contention.
61
+
62
+ ## Agent Debug Protocol (MANDATORY)
63
+
64
+ When AI agents write or edit `.sesi` scripts, they must use this debugging loop:
65
+
66
+ 1. **Draft in file, isolate risky snippet:** Identify the smallest parser/runtime-risky block (prompt block, model call, object schema, loop, etc.).
67
+ 2. **Validate snippet with eval mode first:** Run `npm run sesi:eval <file>.sesi` to test the isolated block before full-script execution.
68
+ 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.
69
+ 4. **Run full script after snippet stabilization:** Execute `npm run sesi <file>.sesi` only once the isolated logic is valid.
70
+ 5. **Use file-aware help when blocked:** Run `npm run sesi:help <file>.sesi "<question>"` to get context-grounded help tied to the active script.
71
+ 6. **NEVER EDIT ANY .SESI FILES IN THE TERMINAL (ABSOLUTE RULE):**
72
+ - Do NOT run `sed`, `awk`, `perl`, or any other shell text-processing tools on `.sesi` files.
73
+ - Do NOT use `npm run sesi:eval` to modify files; it is only for syntax validation.
74
+ - Do NOT use Bash/Shell scripting to rewrite or patch Sesi source code.
75
+
76
+ **Correct approach:** You MUST always use your native editor/IDE's file editing capabilities to make clean, safe changes directly to `.sesi` files.
77
+ **Why:** Sesi syntax is sensitive to whitespace, newlines, and brace positioning. Terminal-based string replacement will invariably break code. Use the editor, not the terminal.
78
+
79
+ 7. **Emphasize Native Verification Commands:** Prior to saving or running full Sesi scripts, proactively use inline evaluation (`npm run sesi:eval <file>.sesi` or `node bin/sesi.js -e "..."`) to check and verify syntax and runtime behaviors instantly. It keeps execution cycles fast and deterministic.
package/README.md CHANGED
@@ -1,6 +1,3 @@
1
- <p align="center">
2
- <img src="./sesi-logo.svg" alt="Sesi Logo" width="250" />
3
- </p>
4
1
 
5
2
  <h1 align="center">Sesi: A Concise, Legible Programming Language</h1>
6
3
 
@@ -16,7 +13,7 @@
16
13
  </p>
17
14
 
18
15
  <p align="center">
19
- <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. 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.
16
+ <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.
20
17
  </p>
21
18
 
22
19
  <p align="center">
@@ -70,7 +67,10 @@ Then run any program directly:
70
67
 
71
68
  ```bash
72
69
  # Standard script execution
73
- sesi main/start.sesi
70
+ sesi examples/01_hello.sesi
71
+
72
+ # Run script with arguments
73
+ sesi main/test_args.sesi arg1 arg2
74
74
 
75
75
  # Reasoning script example
76
76
  sesi examples/08_model_call.sesi
@@ -84,28 +84,67 @@ Useful CLI shortcuts:
84
84
  ```bash
85
85
  # Evaluate a quick snippet
86
86
  sesi -e "print 'hello'"
87
+ ```
87
88
 
89
+ ```bash
88
90
  # Ask the built-in co-pilot a question
89
- sesi -help "how do I use memory?"
91
+ sesi -h "how do I use memory?"
92
+ ```
90
93
 
94
+ ```bash
91
95
  # Ask for help about a specific file
92
- sesi main/playground.sesi -h "why is this failing"
96
+ sesi examples/01_hello.sesi -h "what is this script doing?"
97
+ ```
93
98
 
94
- # Encrypt or decrypt a script file
95
- sesi -encrypt my_script.sesi -p "my-password"
96
- sesi -decrypt my_script.sesi -p "my-password"
99
+ ```bash
100
+ # Encrypt or decrypt a script file manually
101
+ sesi -enc my_script.sesi -p "my-password"
102
+ sesi -dec my_script.sesi -p "my-password"
103
+ ```
104
+
105
+ 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).
106
+
107
+ ```bash
108
+ export SESI_PASSWORD="my-password"
109
+ # Encrypt or decrypt automatically using SESI_PASSWORD environment variable
110
+ sesi -enc my_script.sesi
111
+ sesi -dec my_script.sesi
112
+ ```
97
113
 
114
+ ```bash
98
115
  # Run with sandbox restrictions disabled
99
- sesi main/start.sesi --local
116
+ sesi examples/01_hello.sesi -l
100
117
  ```
101
118
 
102
119
  # Local Execution (Development)
103
120
 
104
- If you choose not install `sesi` globally, use the helper npm scripts:
121
+ If you are developing inside the repository or haven't installed `sesi` globally, use the npm scripts:
122
+
123
+ ```bash
124
+ # Run a Sesi script
125
+ npm run sesi -- examples/01_hello.sesi
126
+ ```
127
+
128
+ ```bash
129
+ # Evaluate an inline snippet
130
+ npm run sesi:eval -- "print 'Sesi running!'"
131
+ ```
105
132
 
106
133
  ```bash
107
- npm run example 01_hello.sesi
108
- npm run example:ai 08_model_call.sesi
134
+ # Ask Sesi's Co-Pilot
135
+ npm run sesi:help -- "how to make a directory?"
136
+ ```
137
+
138
+ ```bash
139
+ # Encrypt / Decrypt scripts (uses SESI_PASSWORD from your .env automatically)
140
+ npm run sesi:encrypt -- "secret.sesi"
141
+ npm run sesi:decrypt -- "secret.sesi"
142
+ ```
143
+
144
+ ```bash
145
+ # Run classic examples
146
+ npm run example examples/01_hello.sesi
147
+ npm run example:ai examples/08_model_call.sesi
109
148
  npm run example:all
110
149
  ```
111
150
 
@@ -136,13 +175,13 @@ print code
136
175
 
137
176
  ## Security & Sandboxing
138
177
 
139
- Sesi is designed to run and orchestrate untrusted AI reasoning pipelines. Because code can be influenced by prompt injections or generated model instructions, Sesi incorporates a **safe-by-default, zero-trust sandboxing engine**.
178
+ Sesi incorporates a **safe-by-default, zero-trust sandboxing engine**.
140
179
 
141
180
  ### 🛡️ Core Security Features
142
181
 
143
182
  1. **Safe-by-Default Execution**:
144
183
  - Sesi's sandbox is **enabled by default**. Any standard Sesi interpreter execution blocks system command lines (`exec`, `spawn`) and locks down imports and paths.
145
- - *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`.
184
+ - _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`.
146
185
 
147
186
  2. **Absolute Prototype Pollution Immunity**:
148
187
  - 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.
@@ -159,12 +198,14 @@ Sesi is designed to run and orchestrate untrusted AI reasoning pipelines. Becaus
159
198
  - 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.
160
199
 
161
200
  ### ⚙️ Programmatic Embedding Configurations
201
+
162
202
  When embedding Sesi inside a host application, you can statically configure safety settings directly in code:
203
+
163
204
  ```typescript
164
205
  const interpreter = new Interpreter(scriptDir, {
165
- safeMode: true, // Enable full sandbox limits (on by default)
166
- allowLocalFs: false, // Block directory escapes (on by default)
167
- allowedPaths: ['/var/tmp/sandbox'] // Custom strict whitelist directories
206
+ safeMode: true, // Enable full sandbox limits (on by default)
207
+ allowLocalFs: false, // Block directory escapes (on by default)
208
+ allowedPaths: ["/var/tmp/sandbox"], // Custom strict whitelist directories
168
209
  });
169
210
  ```
170
211
 
@@ -172,6 +213,7 @@ const interpreter = new Interpreter(scriptDir, {
172
213
 
173
214
  - [Getting Started](./QUICKSTART.md)
174
215
  - [Examples](./examples/)
216
+ - [CLI Reference](./docs/CLI.md)
175
217
  - [Language Specification](./docs/SPECIFICATION.md)
176
218
  - [Language Comparison Showcase](./docs/COMPARISON.md)
177
219
  - [Built-in Functions](./docs/BUILTINS.md)
@@ -181,14 +223,13 @@ const interpreter = new Interpreter(scriptDir, {
181
223
 
182
224
  ## Agent Context
183
225
 
184
- 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/`.
226
+ The root-level `SKILLS.md` file is a workspace context file for AI agents.
185
227
 
186
228
  ## Project Structure
187
229
 
188
230
  ```
189
231
  Sesi/
190
232
  ├── SKILLS.md # Workspace context and repo guardrails
191
- ├── index.html # Sesi-generated systems landing page
192
233
  ├── eslint.config.mjs # ESLint configuration
193
234
  ├── example.js # Helper script to run basic examples
194
235
  ├── example-ai.js # Helper script to run reasoning examples
@@ -212,20 +253,18 @@ Sesi/
212
253
  │ └── sesi.js # CLI executable
213
254
 
214
255
  ├── main/ # Playgrounds & debugging
215
- │ ├── playground.sesi # Main playground script
216
- │ ├── start.sesi # Beginner script
217
256
  │ └── tests/ # Additional syntax validation scripts
218
257
 
219
258
  ├── docs/
259
+ │ ├── CLI.md # Comprehensive CLI & Parametric Eval guide
220
260
  │ ├── SPECIFICATION.md # Complete language spec (600+ lines)
221
261
  │ ├── ARCHITECTURE.md # Runtime & system design (400+ lines)
222
262
  │ ├── BUILTINS.md # Built-in functions reference (450+ lines)
223
263
  │ ├── COMPARISON.md # Language comparison showcase
224
- │ ├── CONCURRENCY.md # Concurrency & coordination guide (>100 lines)
225
264
  │ ├── IMAGE_GENERATION.md # Image generation guide (>100 lines)
226
265
  │ ├── REASONING.md # Reasoning and simple logic guide (>500 lines)
227
- ├── ROADMAP.md # V2-V4+ development plan (400+ lines)
228
- └── sesi_ai_chronicles.md # AI project history & notes
266
+ └── ROADMAP.md # V2-V4+ development plan (400+ lines)
267
+
229
268
 
230
269
  ├── examples/
231
270
  │ ├── 01_hello.sesi # Hello World
@@ -280,19 +319,21 @@ Sesi/
280
319
 
281
320
  ### Reasoning-Native Features ✅
282
321
 
283
- - `prompt` blocks for message composition
284
322
  - `model()` calls with Reasoning provider configuration
285
323
  - `image()` calls with specific ratio/size generation capabilities
286
- - `structured_output()` for typed Reasoning responses
287
- - `tool_call()` for function calling
288
- - Basic memory for multi-turn reasoning
289
- - `read_file()`, `write_file()`, `to_json()`, `write_image()`, and `list_dir()` for local file I/O
324
+ - **Async Polling**: Native looping to auto-resume generation when hitting `MAX_TOKENS` limit
325
+
326
+ ### System Features
327
+
328
+ - **Memory**: Basic memory for multi-turn reasoning
329
+ - **Filesystem I/O**: `read_file()`, `write_file()`, `to_json()`, `write_image()`, and `list_dir()` for local file I/O
290
330
  - **Native Concurrency**: `spawn()` and `exec()` for concurrent process management, and `multi_req(array<function>)` for physical parallel request execution.
291
331
  - **Logic Caching**: High-efficiency Sesi Logic Caching (`.sesi_cache.json`) for local call caching.
292
- - **Thinking Scale**: Scaled Gemini reasoning configurations using the `thinking` parameters.
293
332
  - **HTTP Client**: Built-in, native HTTP client support using `web_get(url)` and `web_send(url, body, headers)` with zero external dependencies.
294
- - **Async Polling**: Native looping to auto-resume generation when hitting `MAX_TOKENS` limit
295
333
  - **Utility Builtins**: `time()` and `random()` for robust coordination
334
+ - **Structured Output**: `structured_output()` for typed JSON Schema
335
+ - **Function Calling**: `tool_call()` for function calling
336
+ - **Prompt Blocks**: `prompt` blocks for cleaner and more concise script composition
296
337
 
297
338
  ### Type System
298
339
 
package/bin/sesi.js CHANGED
@@ -7,26 +7,36 @@ const path = require('path');
7
7
  const args = process.argv.slice(2);
8
8
 
9
9
  const argsHeader = `
10
- Sesi Programming Language v1.3.0
10
+ Sesi Programming Language v1.3.2
11
11
 
12
12
  Usage:
13
- sesi <file> [options] Run a Sesi program
13
+ sesi <file> [options] <args> Run a Sesi program
14
14
  sesi -e "code" Evaluate Sesi code directly
15
- sesi -help <query> Ask for help from our Sesi Co-Pilot
15
+ sesi -h <query> Ask for help from our Sesi Co-Pilot
16
+ sesi -v Show version
17
+ sesi -enc <file> -p <password> Encrypt a file
18
+ sesi -dec <file> -p <password> Decrypt a file
19
+ sesi -r <file> Show the raw parser output
16
20
 
17
21
  Options:
18
- --local Disable safe mode (careful!)
19
- --allowed-paths <p> Comma-separated list of allowed directories
20
- -encrypt <file> Encrypt a file
21
- -decrypt <file> Decrypt a file
22
+ -l, --local Disable safe mode (careful!)
23
+ -a, --allowed-paths <p> Comma-separated list of allowed directories
24
+ -e, --eval "<code_to_run>" Evaluate Sesi code directly
25
+ -enc, --encrypt <file> Encrypt a file
26
+ -dec, --decrypt <file> Decrypt a file
22
27
  -p, --password <pass> Password for encryption/decryption
23
- --version Show version
24
- --help, -h Show this help
28
+ -v, --version Show version
29
+ -h, --help Show this help
30
+ -r, --raw Show the raw parser output
25
31
 
26
32
  Examples:
27
- sesi main/start.sesi
33
+ sesi examples/01_hello.sesi
34
+ sesi main/test_args.sesi arg1 arg2
28
35
  sesi -e "print 'hello'"
29
- sesi -help "how do I use memory?"
36
+ sesi -h "how do I use memory?"
37
+ sesi -r examples/01_hello.sesi
38
+ sesi -enc secret.sesi -p mypassword
39
+ sesi -dec secret.sesi -p mypassword
30
40
  `;
31
41
 
32
42
  function parseArgs(args) {
@@ -40,7 +50,9 @@ function parseArgs(args) {
40
50
  password: null,
41
51
  sesiOptions: {
42
52
  safeMode: true,
43
- allowedPaths: [process.cwd()]
53
+ allowedPaths: [process.cwd()],
54
+ raw: false,
55
+ args: []
44
56
  }
45
57
  };
46
58
 
@@ -48,8 +60,8 @@ function parseArgs(args) {
48
60
  const arg = args[i];
49
61
  const isHelpFlag = arg === '--help' || arg === '-help' || arg === '-h';
50
62
 
51
- if (arg === '--version') {
52
- console.log('Sesi v1.3.0');
63
+ if (arg === '-v' || arg === '--version') {
64
+ console.log('Sesi v1.3.2');
53
65
  process.exit(0);
54
66
  } else if (isHelpFlag && i === 0 && !options.file && !options.eval) {
55
67
  if (args[i + 1] && !args[i + 1].startsWith('-')) {
@@ -67,20 +79,34 @@ function parseArgs(args) {
67
79
  break;
68
80
  } else if (arg === '-e' || arg === '--eval') {
69
81
  options.eval = args[++i];
70
- } else if (arg === '-encrypt' || arg === '--encrypt') {
82
+ } else if (arg === '-enc' || arg === '--encrypt') {
71
83
  options.encryptFile = args[++i];
72
- } else if (arg === '-decrypt' || arg === '--decrypt') {
84
+ } else if (arg === '-dec' || arg === '--decrypt') {
73
85
  options.decryptFile = args[++i];
74
86
  } else if (arg === '-p' || arg === '--password') {
75
87
  options.password = args[++i];
76
- } else if (arg === '--local') {
88
+ } else if (arg === '-l' || arg === '--local') {
77
89
  options.sesiOptions.safeMode = false;
78
90
  options.sesiOptions.allowLocalFs = true;
79
- } else if (arg === '--allowed-paths') {
91
+ } else if (arg === '-a' || arg === '--allowed-paths') {
80
92
  const paths = args[++i].split(',');
81
93
  options.sesiOptions.allowedPaths.push(...paths.map(p => path.resolve(p)));
82
- } else if (!arg.startsWith('-') && !options.file) {
94
+ } else if (!arg.startsWith('-') && !options.file && !options.eval && !options.encryptFile && !options.decryptFile) {
83
95
  options.file = arg;
96
+ } else if (arg == '-r' || arg == '--raw') {
97
+ options.sesiOptions.raw = true;
98
+ }
99
+ }
100
+
101
+ if (options.file && !options.helpQuery) {
102
+ const fileIndex = args.indexOf(options.file);
103
+ if (fileIndex !== -1) {
104
+ options.sesiOptions.args = args.slice(fileIndex + 1);
105
+ }
106
+ } else if (options.eval) {
107
+ const evalIndex = args.findIndex(arg => arg === '-e' || arg === '--eval');
108
+ if (evalIndex !== -1) {
109
+ options.sesiOptions.args = args.slice(evalIndex + 2);
84
110
  }
85
111
  }
86
112
 
@@ -96,8 +122,9 @@ async function main() {
96
122
  }
97
123
 
98
124
  if (parsed.encryptFile || parsed.decryptFile) {
99
- if (!parsed.password) {
100
- console.error('Error: Password is required for encryption/decryption. Use -p <password>.');
125
+ const password = parsed.password || process.env.SESI_PASSWORD;
126
+ if (!password) {
127
+ console.error('Error: Password is required for encryption/decryption. Use -p <password> or set the SESI_PASSWORD environment variable.');
101
128
  process.exit(1);
102
129
  }
103
130
  const crypto = require('crypto');
@@ -112,7 +139,7 @@ async function main() {
112
139
  const content = fs.readFileSync(targetFile, 'utf-8');
113
140
  try {
114
141
  const algorithm = 'aes-256-cbc';
115
- const key = crypto.createHash('sha256').update(String(parsed.password)).digest();
142
+ const key = crypto.createHash('sha256').update(String(password)).digest();
116
143
 
117
144
  if (isEncrypt) {
118
145
  const iv = crypto.randomBytes(16);
@@ -148,7 +175,7 @@ async function main() {
148
175
  } else if (fs.existsSync('help_context.txt')) {
149
176
  fs.unlinkSync('help_context.txt');
150
177
  }
151
- const copilotPath = path.join(__dirname, '../main/sesi_db_chatbot.sesi');
178
+ const copilotPath = path.join(__dirname, '../chatbot/sesi_db_chatbot.sesi');
152
179
  await runSesiFile(copilotPath).catch((error) => {
153
180
  console.error('Fatal error in Sesi Co-Pilot:', error.message);
154
181
  process.exit(1);
@@ -176,6 +203,12 @@ async function main() {
176
203
  console.error('Fatal error:', error.message);
177
204
  process.exit(1);
178
205
  });
206
+ } else if (parsed.raw) {
207
+ const content = fs.readFileSync(parsed.file, 'utf-8');
208
+ await runSesi(content, process.cwd(), { ...parsed.sesiOptions, raw: true }).catch((error) => {
209
+ console.error('Fatal error:', error.message);
210
+ process.exit(1);
211
+ });
179
212
  }
180
213
  }
181
214