@misterscan/sesi 1.2.3 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/rules/sesi-must-read.md +116 -0
- package/.agents/workflows/create-sesi-script.md +44 -0
- package/.agents/workflows/fix-sesi-script.md +14 -0
- package/.github/prompts/MakeInSesi.prompt.md +79 -0
- package/README.md +163 -51
- package/bin/sesi.js +196 -38
- package/chatbot/chatbot.html +488 -0
- package/{main → chatbot}/chatbot.sesi +1 -2
- package/chatbot/chatbot_server.py +105 -0
- package/chatbot/sesi_db_chatbot.sesi +278 -0
- package/dist/ai-runtime.js +2 -2
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +199 -5
- package/dist/builtins.js.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +90 -6
- package/dist/index.js.map +1 -1
- package/dist/interpreter.d.ts +21 -2
- package/dist/interpreter.d.ts.map +1 -1
- package/dist/interpreter.js +201 -92
- package/dist/interpreter.js.map +1 -1
- package/dist/lexer.d.ts.map +1 -1
- package/dist/lexer.js +8 -4
- package/dist/lexer.js.map +1 -1
- package/dist/parser.d.ts +1 -0
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +21 -12
- package/dist/parser.js.map +1 -1
- package/dist/sesi.bundled.js +2526 -1487
- package/dist/types.d.ts +14 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +33 -1
- package/dist/types.js.map +1 -1
- package/docs/ARCHITECTURE.md +21 -13
- package/docs/BUILTINS.md +136 -19
- package/docs/CLI.md +200 -0
- package/docs/COMPARISON.md +16 -13
- package/docs/IMAGE_GENERATION.md +13 -14
- package/docs/IMPLEMENTATION_SUMMARY.md +174 -110
- package/docs/QUICKSTART.md +173 -39
- package/docs/README.md +202 -54
- package/docs/{SYSTEMS_REASONING.md → REASONING.md} +115 -120
- package/docs/ROADMAP.md +51 -47
- package/docs/SKILLS.md +73 -98
- package/docs/SPECIFICATION.md +59 -40
- package/examples/03_functions.sesi +30 -1
- package/examples/07_prompts.sesi +27 -3
- package/examples/08_model_call.sesi +6 -4
- package/examples/09_structured_output.sesi +19 -3
- package/examples/10_code_generation.sesi +6 -4
- package/examples/11_memory_conversation.sesi +47 -15
- package/examples/12_classification.sesi +62 -7
- package/examples/13_data_pipeline.sesi +55 -28
- package/examples/14_folder_explainer.sesi +52 -51
- package/examples/15_image_generation.sesi +15 -14
- package/examples/16_modules.sesi +27 -27
- package/examples/19_search_web.sesi +18 -2
- package/examples/20_model_aliases.sesi +22 -0
- package/examples/21_custom_tools.sesi +27 -0
- package/examples/22_reasoning_plus_custom_tools.sesi +19 -0
- package/main/tests/test-args.sesi +7 -0
- package/main/tests/test_args.sesi +7 -0
- package/main/tests/test_general_modules.sesi +127 -0
- package/main/tests/test_grounding.sesi +2 -0
- package/package.json +26 -22
- package/docs/DISTRIBUTED_SYSTEMS.md +0 -71
- package/docs/sesi_ai_chronicles.md +0 -209
- package/main/conversational_classifier_weights.json +0 -45
- package/main/conversational_sentences.json +0 -304
- package/main/epochs.sesi +0 -94
- package/main/gpu_orchestrator.sesi +0 -36
- package/main/hardware_diagnostics.sesi +0 -118
- package/main/inference.sesi +0 -54
- package/main/native_chatbot.sesi +0 -180
- package/main/native_synthesizer.sesi +0 -83
- package/main/nn_personas_trainer.sesi +0 -302
- package/main/nn_responses_trainer.sesi +0 -269
- package/main/nn_sentences_trainer.sesi +0 -330
- package/main/orchestrator.sesi +0 -15
- package/main/personas.json +0 -124
- package/main/personas_classifier_weights.json +0 -45
- package/main/playground.sesi +0 -3
- package/main/predictive_typing.sesi +0 -127
- package/main/query_brain.sesi +0 -45
- package/main/response_classifier_weights.json +0 -45
- package/main/retro_chat.html +0 -239
- package/main/retro_chat_generator.sesi +0 -745
- package/main/sesi_ai.sesi +0 -158
- package/main/sesi_db_chatbot.sesi +0 -280
- package/main/setup_swarm.sesi +0 -5
- package/main/start.sesi +0 -13
- package/main/terminal.log +0 -56
- package/main/terminal_chat.py +0 -385
- package/main/unified_sesi_ai.sesi +0 -334
- package/main/varied_responses.json +0 -304
|
@@ -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,8 +1,10 @@
|
|
|
1
|
+
## SESI IS **NOT** AN AI WRAPPER LANGUAGE. IT IS **NOT** AN AI-NATIVE PROGRAMMING LANGUAGE. IT IS A GENERAL-PURPOSE PROGRAMMING LANGUAGE WITH **OPTIONAL** AI CAPABILITIES BUILT-IN. STRONG EMPHASIS ON **OPTIONAL**.
|
|
2
|
+
|
|
1
3
|
<p align="center">
|
|
2
4
|
<img src="./sesi-logo.svg" alt="Sesi Logo" width="250" />
|
|
3
5
|
</p>
|
|
4
6
|
|
|
5
|
-
<h1 align="center">Sesi: A
|
|
7
|
+
<h1 align="center">Sesi: A Concise, Legible Programming Language</h1>
|
|
6
8
|
|
|
7
9
|
<p align="center">
|
|
8
10
|
<em>Pronounced "say-see" — What you say, you'll see.</em>
|
|
@@ -10,13 +12,13 @@
|
|
|
10
12
|
|
|
11
13
|
<p align="center">
|
|
12
14
|
<img alt="License" src="https://img.shields.io/badge/license-MIT-blue.svg">
|
|
13
|
-
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-
|
|
15
|
+
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-Interpreter-blue?logo=typescript">
|
|
14
16
|
<img alt="Powered by Gemini" src="https://img.shields.io/badge/Powered%20By-Google%20Gemini-orange">
|
|
15
17
|
<img alt="Framework" src="https://img.shields.io/badge/Node.js-Engine-success?logo=node.js">
|
|
16
18
|
</p>
|
|
17
19
|
|
|
18
20
|
<p align="center">
|
|
19
|
-
<strong>Sesi</strong> is a
|
|
21
|
+
<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
22
|
</p>
|
|
21
23
|
|
|
22
24
|
<p align="center">
|
|
@@ -70,7 +72,10 @@ Then run any program directly:
|
|
|
70
72
|
|
|
71
73
|
```bash
|
|
72
74
|
# Standard script execution
|
|
73
|
-
sesi
|
|
75
|
+
sesi examples/01_hello.sesi
|
|
76
|
+
|
|
77
|
+
# Run script with arguments
|
|
78
|
+
sesi main/test_args.sesi arg1 arg2
|
|
74
79
|
|
|
75
80
|
# Reasoning script example
|
|
76
81
|
sesi examples/08_model_call.sesi
|
|
@@ -79,13 +84,72 @@ sesi examples/08_model_call.sesi
|
|
|
79
84
|
sesi examples.sesi
|
|
80
85
|
```
|
|
81
86
|
|
|
87
|
+
Useful CLI shortcuts:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Evaluate a quick snippet
|
|
91
|
+
sesi -e "print 'hello'"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Ask the built-in co-pilot a question
|
|
96
|
+
sesi -h "how do I use memory?"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Ask for help about a specific file
|
|
101
|
+
sesi examples/01_hello.sesi -h "what is this script doing?"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Encrypt or decrypt a script file manually
|
|
106
|
+
sesi -enc my_script.sesi -p "my-password"
|
|
107
|
+
sesi -dec my_script.sesi -p "my-password"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
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).
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
export SESI_PASSWORD="my-password"
|
|
114
|
+
# Encrypt or decrypt automatically using SESI_PASSWORD environment variable
|
|
115
|
+
sesi -enc my_script.sesi
|
|
116
|
+
sesi -dec my_script.sesi
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Run with sandbox restrictions disabled
|
|
121
|
+
sesi examples/01_hello.sesi -l
|
|
122
|
+
```
|
|
123
|
+
|
|
82
124
|
# Local Execution (Development)
|
|
83
125
|
|
|
84
|
-
If you
|
|
126
|
+
If you are developing inside the repository or haven't installed `sesi` globally, use the npm scripts:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Run a Sesi script
|
|
130
|
+
npm run sesi -- examples/01_hello.sesi
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Evaluate an inline snippet
|
|
135
|
+
npm run sesi:eval -- "print 'Sesi running!'"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Ask Sesi's Co-Pilot
|
|
140
|
+
npm run sesi:help -- "how to make a directory?"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Encrypt / Decrypt scripts (uses SESI_PASSWORD from your .env automatically)
|
|
145
|
+
npm run sesi:encrypt -- "secret.sesi"
|
|
146
|
+
npm run sesi:decrypt -- "secret.sesi"
|
|
147
|
+
```
|
|
85
148
|
|
|
86
149
|
```bash
|
|
87
|
-
|
|
88
|
-
npm run example
|
|
150
|
+
# Run classic examples
|
|
151
|
+
npm run example examples/01_hello.sesi
|
|
152
|
+
npm run example:ai examples/08_model_call.sesi
|
|
89
153
|
npm run example:all
|
|
90
154
|
```
|
|
91
155
|
|
|
@@ -116,13 +180,13 @@ print code
|
|
|
116
180
|
|
|
117
181
|
## Security & Sandboxing
|
|
118
182
|
|
|
119
|
-
Sesi
|
|
183
|
+
Sesi incorporates a **safe-by-default, zero-trust sandboxing engine**.
|
|
120
184
|
|
|
121
185
|
### 🛡️ Core Security Features
|
|
122
186
|
|
|
123
187
|
1. **Safe-by-Default Execution**:
|
|
124
188
|
- Sesi's sandbox is **enabled by default**. Any standard Sesi interpreter execution blocks system command lines (`exec`, `spawn`) and locks down imports and paths.
|
|
125
|
-
-
|
|
189
|
+
- _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`.
|
|
126
190
|
|
|
127
191
|
2. **Absolute Prototype Pollution Immunity**:
|
|
128
192
|
- 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.
|
|
@@ -139,12 +203,14 @@ Sesi is designed to run and orchestrate untrusted AI reasoning pipelines. Becaus
|
|
|
139
203
|
- 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.
|
|
140
204
|
|
|
141
205
|
### ⚙️ Programmatic Embedding Configurations
|
|
206
|
+
|
|
142
207
|
When embedding Sesi inside a host application, you can statically configure safety settings directly in code:
|
|
208
|
+
|
|
143
209
|
```typescript
|
|
144
210
|
const interpreter = new Interpreter(scriptDir, {
|
|
145
|
-
safeMode: true,
|
|
146
|
-
|
|
147
|
-
allowedPaths: [
|
|
211
|
+
safeMode: true, // Enable full sandbox limits (on by default)
|
|
212
|
+
allowLocalFs: false, // Block directory escapes (on by default)
|
|
213
|
+
allowedPaths: ["/var/tmp/sandbox"], // Custom strict whitelist directories
|
|
148
214
|
});
|
|
149
215
|
```
|
|
150
216
|
|
|
@@ -152,52 +218,96 @@ const interpreter = new Interpreter(scriptDir, {
|
|
|
152
218
|
|
|
153
219
|
- [Getting Started](./QUICKSTART.md)
|
|
154
220
|
- [Examples](./examples/)
|
|
221
|
+
- [CLI Reference](./docs/CLI.md)
|
|
155
222
|
- [Language Specification](./docs/SPECIFICATION.md)
|
|
156
223
|
- [Language Comparison Showcase](./docs/COMPARISON.md)
|
|
157
224
|
- [Built-in Functions](./docs/BUILTINS.md)
|
|
158
|
-
- [Reasoning
|
|
159
|
-
- [
|
|
225
|
+
- [Reasoning](./docs/REASONING.md)
|
|
226
|
+
- [Concurrency Systems](./docs/CONCURRENCY.md)
|
|
160
227
|
- [Runtime Architecture](./docs/ARCHITECTURE.md)
|
|
161
228
|
|
|
162
|
-
##
|
|
229
|
+
## Agent Context
|
|
163
230
|
|
|
164
|
-
The root-level `SKILLS.md` file is a workspace context file for AI agents.
|
|
231
|
+
The root-level `SKILLS.md` file is a workspace context file for AI agents.
|
|
165
232
|
|
|
166
233
|
## Project Structure
|
|
167
234
|
|
|
168
235
|
```
|
|
169
236
|
Sesi/
|
|
170
|
-
├── SKILLS.md
|
|
171
|
-
├──
|
|
172
|
-
├──
|
|
173
|
-
├──
|
|
174
|
-
├──
|
|
175
|
-
├──
|
|
176
|
-
├──
|
|
177
|
-
├──
|
|
178
|
-
├──
|
|
179
|
-
├──
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
│ ├──
|
|
183
|
-
│ ├──
|
|
184
|
-
│ ├──
|
|
185
|
-
│ ├──
|
|
186
|
-
│ ├──
|
|
187
|
-
│
|
|
237
|
+
├── SKILLS.md # Workspace context and repo guardrails
|
|
238
|
+
├── eslint.config.mjs # ESLint configuration
|
|
239
|
+
├── example.js # Helper script to run basic examples
|
|
240
|
+
├── example-ai.js # Helper script to run reasoning examples
|
|
241
|
+
├── examples.sesi # Central execution suite for examples
|
|
242
|
+
├── README.md # Project overview
|
|
243
|
+
├── QUICKSTART.md # Getting started guide
|
|
244
|
+
├── package.json # Dependencies & scripts
|
|
245
|
+
├── tsconfig.json # TypeScript configuration
|
|
246
|
+
├── dist/ # Compiled TypeScript output
|
|
247
|
+
│
|
|
248
|
+
├── src/ # Source code
|
|
249
|
+
│ ├── types.ts # Type definitions & AST nodes (400+ lines)
|
|
250
|
+
│ ├── lexer.ts # Tokenization (350+ lines)
|
|
251
|
+
│ ├── parser.ts # Recursive descent parser (700+ lines)
|
|
252
|
+
│ ├── interpreter.ts # Tree-walking interpreter (600+ lines)
|
|
253
|
+
│ ├── builtins.ts # Built-in functions (250+ lines)
|
|
254
|
+
│ ├── ai-runtime.ts # Integrated reasoning integration (120+ lines)
|
|
255
|
+
│ └── index.ts # Entry point (30+ lines)
|
|
256
|
+
│
|
|
188
257
|
├── bin/
|
|
189
|
-
│ └── sesi.js
|
|
190
|
-
|
|
191
|
-
├── main/
|
|
192
|
-
│
|
|
193
|
-
│
|
|
194
|
-
|
|
195
|
-
│
|
|
196
|
-
├──
|
|
197
|
-
|
|
258
|
+
│ └── sesi.js # CLI executable
|
|
259
|
+
│
|
|
260
|
+
├── main/ # Playgrounds & debugging
|
|
261
|
+
│ └── tests/ # Additional syntax validation scripts
|
|
262
|
+
│
|
|
263
|
+
├── docs/
|
|
264
|
+
│ ├── CLI.md # Comprehensive CLI & Parametric Eval guide
|
|
265
|
+
│ ├── SPECIFICATION.md # Complete language spec (600+ lines)
|
|
266
|
+
│ ├── ARCHITECTURE.md # Runtime & system design (400+ lines)
|
|
267
|
+
│ ├── BUILTINS.md # Built-in functions reference (450+ lines)
|
|
268
|
+
│ ├── COMPARISON.md # Language comparison showcase
|
|
269
|
+
│ ├── IMAGE_GENERATION.md # Image generation guide (>100 lines)
|
|
270
|
+
│ ├── REASONING.md # Reasoning and simple logic guide (>500 lines)
|
|
271
|
+
│ └── ROADMAP.md # V2-V4+ development plan (400+ lines)
|
|
272
|
+
│
|
|
273
|
+
│
|
|
274
|
+
├── examples/
|
|
275
|
+
│ ├── 01_hello.sesi # Hello World
|
|
276
|
+
│ ├── 02_variables.sesi # Variables & operations
|
|
277
|
+
│ ├── 03_functions.sesi # Functions with parameters
|
|
278
|
+
│ ├── 04_conditionals.sesi # If/else control flow
|
|
279
|
+
│ ├── 05_loops.sesi # While, for, for-in loops
|
|
280
|
+
│ ├── 06_arrays_objects.sesi # Collections
|
|
281
|
+
│ ├── 07_prompts.sesi # Reasoning blocks
|
|
282
|
+
│ ├── 08_model_call.sesi # Basic reasoning calls
|
|
283
|
+
│ ├── 09_structured_output.sesi # Type-safe reasoning responses
|
|
284
|
+
│ ├── 10_code_generation.sesi # Systems logic generation
|
|
285
|
+
│ ├── 11_memory_conversation.sesi # Multi-turn stateful reasoning
|
|
286
|
+
│ ├── 12_classification.sesi # Systems classification loop
|
|
287
|
+
│ ├── 13_data_pipeline.sesi # Complete systems pipeline
|
|
288
|
+
│ ├── 14_folder_explainer.sesi # Directory parsing & reasoning
|
|
289
|
+
│ ├── 15_image_generation.sesi # Image generation API test
|
|
290
|
+
│ ├── 16_modules.sesi # Modules & std library namespaces
|
|
291
|
+
│ ├── 17_http_client.sesi # Network GET/POST client
|
|
292
|
+
│ ├── 18_parallel_requests.sesi # Parallel requests concurrency
|
|
293
|
+
│ ├── 19_search_web.sesi # Web search integration
|
|
294
|
+
│ ├── 20_model_aliases.sesi # Custom model naming aliases
|
|
295
|
+
│ ├── 21_custom_tools.sesi # Custom runtime tool definitions
|
|
296
|
+
│ └── 22_reasoning_plus_custom_tools.sesi # Reasoning composed with custom tools
|
|
297
|
+
│
|
|
298
|
+
└── tests/ # Engine test suite
|
|
299
|
+
├── basic.test.ts # Core parsing & evaluation tests
|
|
300
|
+
├── cache.test.ts # Execution caching tests
|
|
301
|
+
├── http.test.ts # Web request builtins testing
|
|
302
|
+
├── module.test.ts # Imports & module loading tests
|
|
303
|
+
├── parallel.test.ts # Concurrent execution tests
|
|
304
|
+
├── security.test.ts # Sandbox & guardrail tests
|
|
305
|
+
├── test-gemini.ts # Base model integration test
|
|
306
|
+
├── test-gemini2.ts # Extended model integration test
|
|
307
|
+
└── workflow.test.ts # Complex sequence workflows tests
|
|
198
308
|
```
|
|
199
309
|
|
|
200
|
-
## Version 1.
|
|
310
|
+
## Version 1.3 Features (In Progress)
|
|
201
311
|
|
|
202
312
|
### Core Language ✅
|
|
203
313
|
|
|
@@ -214,19 +324,21 @@ Sesi/
|
|
|
214
324
|
|
|
215
325
|
### Reasoning-Native Features ✅
|
|
216
326
|
|
|
217
|
-
- `prompt` blocks for message composition
|
|
218
327
|
- `model()` calls with Reasoning provider configuration
|
|
219
328
|
- `image()` calls with specific ratio/size generation capabilities
|
|
220
|
-
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
329
|
+
- **Async Polling**: Native looping to auto-resume generation when hitting `MAX_TOKENS` limit
|
|
330
|
+
|
|
331
|
+
### System Features ✅
|
|
332
|
+
|
|
333
|
+
- **Memory**: Basic memory for multi-turn reasoning
|
|
334
|
+
- **Filesystem I/O**: `read_file()`, `write_file()`, `to_json()`, `write_image()`, and `list_dir()` for local file I/O
|
|
224
335
|
- **Native Concurrency**: `spawn()` and `exec()` for concurrent process management, and `multi_req(array<function>)` for physical parallel request execution.
|
|
225
336
|
- **Logic Caching**: High-efficiency Sesi Logic Caching (`.sesi_cache.json`) for local call caching.
|
|
226
|
-
- **Thinking Scale**: Scaled Gemini reasoning configurations using the `thinking` parameters.
|
|
227
337
|
- **HTTP Client**: Built-in, native HTTP client support using `web_get(url)` and `web_send(url, body, headers)` with zero external dependencies.
|
|
228
|
-
- **Async Polling**: Native looping to auto-resume generation when hitting `MAX_TOKENS` limit
|
|
229
338
|
- **Utility Builtins**: `time()` and `random()` for robust coordination
|
|
339
|
+
- **Structured Output**: `structured_output()` for typed JSON Schema
|
|
340
|
+
- **Function Calling**: `tool_call()` for function calling
|
|
341
|
+
- **Prompt Blocks**: `prompt` blocks for cleaner and more concise script composition
|
|
230
342
|
|
|
231
343
|
### Type System
|
|
232
344
|
|