@misterscan/sesi 1.2.2 → 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 (58) hide show
  1. package/README.md +138 -34
  2. package/bin/sesi.js +163 -38
  3. package/dist/ai-runtime.d.ts.map +1 -1
  4. package/dist/ai-runtime.js +22 -4
  5. package/dist/ai-runtime.js.map +1 -1
  6. package/dist/builtins.d.ts +1 -0
  7. package/dist/builtins.d.ts.map +1 -1
  8. package/dist/builtins.js +257 -17
  9. package/dist/builtins.js.map +1 -1
  10. package/dist/index.d.ts +7 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +30 -5
  13. package/dist/index.js.map +1 -1
  14. package/dist/interpreter.d.ts +17 -1
  15. package/dist/interpreter.d.ts.map +1 -1
  16. package/dist/interpreter.js +256 -98
  17. package/dist/interpreter.js.map +1 -1
  18. package/dist/lexer.d.ts.map +1 -1
  19. package/dist/lexer.js +8 -4
  20. package/dist/lexer.js.map +1 -1
  21. package/dist/parser.d.ts +2 -0
  22. package/dist/parser.d.ts.map +1 -1
  23. package/dist/parser.js +76 -32
  24. package/dist/parser.js.map +1 -1
  25. package/dist/sesi.bundled.js +87 -20
  26. package/dist/types.d.ts +14 -1
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/types.js +33 -1
  29. package/dist/types.js.map +1 -1
  30. package/docs/ARCHITECTURE.md +26 -9
  31. package/docs/BUILTINS.md +111 -13
  32. package/docs/COMPARISON.md +7 -9
  33. package/docs/{DISTRIBUTED_SYSTEMS.md → CONCURRENCY.md} +11 -11
  34. package/docs/IMAGE_GENERATION.md +13 -14
  35. package/docs/IMPLEMENTATION_SUMMARY.md +141 -84
  36. package/docs/QUICKSTART.md +81 -28
  37. package/docs/README.md +140 -34
  38. package/docs/{SYSTEMS_REASONING.md → REASONING.md} +107 -109
  39. package/docs/ROADMAP.md +44 -44
  40. package/docs/SKILLS.md +56 -28
  41. package/docs/SPECIFICATION.md +25 -18
  42. package/docs/sesi_ai_chronicles.md +96 -209
  43. package/examples/07_prompts.sesi +1 -1
  44. package/examples/08_model_call.sesi +1 -1
  45. package/examples/09_structured_output.sesi +1 -1
  46. package/examples/10_code_generation.sesi +1 -1
  47. package/examples/13_data_pipeline.sesi +1 -1
  48. package/examples/14_folder_explainer.sesi +2 -2
  49. package/examples/15_image_generation.sesi +1 -1
  50. package/examples/16_modules.sesi +27 -27
  51. package/examples/19_search_web.sesi +4 -0
  52. package/examples/20_model_aliases.sesi +22 -0
  53. package/examples/21_custom_tools.sesi +27 -0
  54. package/examples/22_reasoning_plus_custom_tools.sesi +19 -0
  55. package/main/orchestrator.sesi +2 -2
  56. package/main/sesi_db_chatbot.sesi +7 -3
  57. package/main/tests/test_grounding.sesi +2 -0
  58. package/package.json +6 -6
@@ -1,69 +1,12 @@
1
- # Systems Reasoning & Logic Guide
1
+ # Reasoning & Simple Logic
2
2
 
3
3
  ## Overview
4
4
 
5
- Sesi is a **Systems Language** that treats reasoning as a first-class execution primitive. In this paradigm, AI is used to evaluate state, make logical decisions, and handle complex patterns within a systems-level architecture.
5
+ In Sesi, Reasoning is used to evaluate state, make logical decisions, and handle complex patterns. This guide covers how to leverage Sesi's built-in Reasoning functions (`model`, `image` `prompt`, `structured_output`, `tool_call`) to build scripts for your designated needs.
6
6
 
7
- This guide covers how to leverage Sesi's systems-level constructs (`spawn`, `exec`, `try/catch`) alongside its reasoning primitives (`model`, `prompt`, `structured_output`) to build resilient, stateful applications.
7
+ ## 1. Prompting
8
8
 
9
- ## 1. Concurrency & Systems Coordination
10
-
11
- The core of Sesi's power lies in its ability to manage distributed execution. Using the `spawn()` builtin, you can launch multiple concurrent Sesi processes that coordinate via shared state or the filesystem.
12
-
13
- A master script can launch concurrent processes and poll for their completion.
14
-
15
- ```sesi
16
- spawn("atm_deposit.sesi")
17
- spawn("atm_withdraw.sesi")
18
- let finished = false
19
- while !finished {
20
- try {
21
- if read_file("bank/done_count.txt") == "2" {
22
- finished = true
23
- }
24
- } catch (e) {
25
- // Wait on I/O contention
26
- let i = 0 while i < 1000 { i = i + 1 }
27
- }
28
- }
29
- print "Swarm task completed."
30
- ```
31
-
32
- ### Coordination & Distributed Locking
33
-
34
- When multiple processes access shared resources, use Sesi's `try/catch`, `time()`, and `random()` builtins to implement mutual exclusion (locking) via the **Double-Check Write** pattern.
35
-
36
- ```sesi
37
- let id = "With_" + str(time()) + "_" + str(random())
38
- let locked = true
39
- while locked {
40
- let status = "error"
41
- try {
42
- status = read_file("bank/lock.txt")
43
- } catch (e) {
44
- status = "error"
45
- }
46
- if status == "unlocked" {
47
- try {
48
- write_file("bank/lock.txt", id)
49
- let i = 0 while i < 500 { i = i + 1 }
50
- if read_file("bank/lock.txt") == id {
51
- locked = false
52
- }
53
- } catch (e) {
54
- status = "error"
55
- }
56
- } else {
57
- let j = 0 while j < 1000 { j = j + 1 }
58
- }
59
- }
60
- ```
61
-
62
- ---
63
-
64
- ## 2. AI as a Reasoning Primitive
65
-
66
- In an orchestrated system, AI is used to make decisions that would be too complex for static logic.
9
+ In Sesi, calling a reasoning model is as simple as defining a string and executing it.
67
10
 
68
11
  Prompts are **composable message templates** that evaluate to strings.
69
12
 
@@ -102,7 +45,7 @@ print translatePrompt(text, language)
102
45
 
103
46
  ## 2. Model Calls
104
47
 
105
- Call Gemini with a prompt and get back text.
48
+ Call a Reasoning model with a prompt and get back text.
106
49
 
107
50
  ### Basic Model Call
108
51
 
@@ -127,8 +70,8 @@ print creative
127
70
 
128
71
  ```sesi
129
72
  // Fast model for simple tasks
130
- let text = " Coding with Reasoning systems language is fun!"
131
- let quick = model("gemini-3.1-flash-lite") {"Summarize this in one sentence:" text}
73
+ let text = "Coding with Reasoning programming language is fun!"
74
+ let quick = model("gemini-3.1-flash-lite") {"Summarize this in one sentence: " text}
132
75
 
133
76
  // Powerful model for complex reasoning
134
77
  let code = "def calculate_sum(n):
@@ -136,25 +79,25 @@ let code = "def calculate_sum(n):
136
79
  for i in range(1, n):
137
80
  total += i
138
81
  return total"
139
- let smart = model("gemini-3.1-pro-preview") {"Analyze this code for bugs:" code}
82
+ let smart = model("gemini-3.1-pro-preview") {"Analyze this code for bugs: " code}
140
83
 
141
84
  // Efficient model for many calls
142
- let item = " Programming Languages"
143
- let cheap = model("gemini-3.5-flash") {thinkingLevel: "minimal"} {"Classify:" item}
85
+ let item = "Programming Languages"
86
+ let cheap = model("gemini-3.5-flash") {thinkingLevel: "minimal"} {"Classify: " item}
144
87
 
145
88
  print quick
146
89
  print smart
147
90
  print cheap
148
91
  ```
149
92
 
150
- ### Available Models (v1.2)
93
+ ### Available Models (v1.3)
151
94
 
152
95
  - `gemini-2.5-flash` - Legacy, but supported. 1M tokens.
153
96
  - `gemini-2.5-pro` - Legacy, but supported. 1M tokens.
154
97
  - `gemini-2.5-flash-image` - Standard image model. (No `512` image size support for this model. Only `1K` is supported.)
155
- - `gemini-3-flash-preview` - Fast, balanced, legacy preview.
98
+ - `gemini-3-flash-preview` - Fast, most balanced model for coding and minimal tasks.
156
99
  - `gemini-3.1-flash-lite` - Fastest, most cost-efficient.
157
- - `gemini-3.5-flash` - Standard GA Model. Fast, balanced, supports all native thinking effort levels (`minimal`, `low`, `medium`, `high`).
100
+ - `gemini-3.5-flash` - Newest GA model. Balanced, but token hungry (USE WISELY) supports all native thinking effort levels (`minimal`, `low`, `medium`, `high`).
158
101
  - `gemini-3.1-pro-preview` - Most powerful reasoning model, doesn't support `minimal` thinking (falls back to `low`).
159
102
  - `gemini-3.1-flash-image-preview` - Cost efficient image generation model.
160
103
  - `gemini-3-pro-image-preview` - High quality image generation model. (No `512` image size support for this model.)
@@ -196,8 +139,7 @@ Get typed responses from Reasoning with field validation.
196
139
  ### Basic Structured Output
197
140
 
198
141
  ```sesi
199
- let analysis = structured_output({sentiment: string, confidence: number, summary: string})
200
- (model("gemini-3-flash-preview") {"Analyze sentiment of: " text "Return JSON with sentiment, confidence (0-1), and summary"})
142
+ let analysis = structured_output({sentiment: string, confidence: number, summary: string})(model("gemini-3-flash-preview") {"Analyze sentiment of: " text "Return JSON with sentiment, confidence (0-1), and summary"})
201
143
  print analysis["sentiment"] // "positive"
202
144
  print analysis["confidence"] // 0.85
203
145
  print analysis["summary"] // "..."
@@ -216,12 +158,12 @@ print bookInfo["title"]
216
158
 
217
159
  - Always include instructions for JSON format
218
160
  - Specify the exact schema in the prompt
219
- - Use "thinkingLevel": "low" for fast, consistent parsing
161
+ - Use "thinkingLevel": "minimal" for fast, consistent parsing
220
162
  - Validate output structure in code
221
163
 
222
164
  ```sesi
223
165
  let listText = "eggs, milk, bread, cheese, fruit, vegetables"
224
- let output = structured_output({items: string})(model("gemini-3.5-flash") {thinkingLevel: "minimal"}{"Return JSON with items array containing: " listText})
166
+ let output = structured_output({items: string})(model("gemini-3.5-flash") {thinkingLevel: "minimal"} {"Return JSON with items array containing: " listText})
225
167
 
226
168
  // Validate
227
169
  if type(output["items"]) == "array" {print "Got" str(len(output["items"])) "items"} // Got 6 items
@@ -236,7 +178,8 @@ Let Reasoning call functions in your program.
236
178
  ```sesi
237
179
  let city = "New York"
238
180
  fn getWeather(city: string) -> string
239
- {let weather = model("gemini-3.1-flash-lite"){"What is the weather like in " city} return weather}
181
+ {let weather = model("gemini-3.1-flash-lite") {"What is the weather like in " city}
182
+ return weather}
240
183
  let result = getWeather(city)
241
184
  print result
242
185
 
@@ -289,11 +232,11 @@ print response2 // Has context from turn 1
289
232
  ```sesi
290
233
  memory conversation {"Chat history: "}
291
234
  fn chat(userMessage: string) -> string
292
- {let fullPrompt = conversation + "User:" + userMessage
235
+ {let fullPrompt = conversation + "User: " + userMessage
293
236
  let response = model("gemini-3-flash-preview") {fullPrompt}
294
237
 
295
238
  // Append to memory
296
- conversation = conversation + "User:" + userMessage + "Assistant:" + response
239
+ conversation = conversation + "User: " + userMessage + "Assistant: " + response
297
240
  return response}
298
241
  let msg = "What is the capital of France? "
299
242
  print "User:" msg
@@ -313,7 +256,7 @@ print "Updated Memory!"
313
256
  memory conversation {"User: Hello! Assistant: Hi there! User: How are you? Assistant: I'm great!"}
314
257
  fn summarizeMemory()
315
258
  {let oldConversation = conversation
316
- let summary = model("gemini-3.1-flash-lite") {"Summarize this conversation concisely:" oldConversation}
259
+ let summary = model("gemini-3.1-flash-lite") {"Summarize this conversation concisely: " oldConversation}
317
260
  conversation = "Previous summary:" + summary + "Recent messages: " + oldConversation}
318
261
  print "Original Memory:" conversation
319
262
  summarizeMemory()
@@ -329,8 +272,7 @@ print conversation
329
272
  let categories = "fruit, vegetable, grain"
330
273
  let item = "banana"
331
274
  fn classify(item: string, categories: string) -> string
332
- {return model("gemini-3.5-flash") {thinkingLevel: "minimal"}
333
- {"Classify this item into one category. Categories: " categories " Item: " item " Return only the category name."}}
275
+ {return model("gemini-3.5-flash") {thinkingLevel: "minimal"} {"Classify this item into one category. Categories: " categories " Item: " item " Return only the category name."}}
334
276
  print "Item: " item //banana
335
277
  print "Category: " classify(item, categories) //fruit
336
278
  ```
@@ -340,8 +282,7 @@ print "Category: " classify(item, categories) //fruit
340
282
  ```sesi
341
283
  let text = "Elon Musk is the CEO of Tesla and SpaceX."
342
284
  fn extractEntities(text: string) -> object
343
- {let result = structured_output({people: string, places: string, organizations: string})
344
- (model("gemini-3.5-flash") {thinkingLevel: "minimal"}{"Extract named entities from:" text})
285
+ {let result = structured_output({people: string, places: string, organizations: string})(model("gemini-3.5-flash") {thinkingLevel: "minimal"} {"Extract named entities from: " text})
345
286
  print "Name(s) found: result"
346
287
  return result}
347
288
  print extractEntities(text)
@@ -354,9 +295,17 @@ print extractEntities(text)
354
295
  let text = "Hello, world!"
355
296
  let language = "Spanish"
356
297
  fn translate(text: string, language: string) -> string
357
- {return model("gemini-3-flash-preview") {"Translate to" language ":" text}}
358
- print "Translation:"
359
- print translate(text, language)
298
+ {return model("gemini-3-flash-preview") {"Translate to " language ": " text}}
299
+ print "Translation:" translate(text, language)
300
+ ```
301
+
302
+ ### Web Search Grounding
303
+
304
+ Access real-time information by enabling the `search` shorthand configuration natively.
305
+
306
+ ```sesi
307
+ let response = model("gemini-3.1-flash-lite") {search, max_tokens: 200} {"What is the weather in Tokyo right now?"}
308
+ print response
360
309
  ```
361
310
 
362
311
  ### Image Generation
@@ -376,7 +325,7 @@ print "Image generated!"
376
325
  ```sesi
377
326
  let requirement = "Write a function that reverses a string."
378
327
  fn generateCode(requirement: string) -> string
379
- {return model("gemini-3.5-flash") {thinkingLevel: "low"} {"Generate JavaScript code for:" requirement "Only provide code, no explanation."}}
328
+ {return model("gemini-3.5-flash") {thinkingLevel: "low"} {"Generate JavaScript code for: " requirement " Only provide code, no explanation."}}
380
329
  print "Code generation:"
381
330
  print generateCode(requirement)
382
331
  ```
@@ -386,8 +335,7 @@ print generateCode(requirement)
386
335
  ```sesi
387
336
  let text = "I love Sesi!"
388
337
  fn analyzeSentiment(text: string) -> object
389
- {return structured_output({sentiment: string, score: number, explanation: string})
390
- (model("gemini-3-flash-preview") {"Analyze sentiment of:" text})}
338
+ {return structured_output({sentiment: string, score: number, explanation: string})(model("gemini-3-flash-preview") {"Analyze sentiment of: " text})}
391
339
  print "Sentiment analysis:"
392
340
  print analyzeSentiment(text)
393
341
  ```
@@ -396,11 +344,11 @@ print analyzeSentiment(text)
396
344
 
397
345
  Reasoning operations can fail. Handle gracefully.
398
346
 
399
- ### Try/Catch (v1.2)
347
+ ### Try/Catch (v1.3)
400
348
 
401
349
  ```sesi
402
350
  try
403
- {let response = model("gemini-3-flash-preview") {"Analyze" text}
351
+ {let response = model("gemini-3-flash-preview") {"Analyze " text}
404
352
  print response}
405
353
  catch (e) {print "Reasoning call failed"
406
354
  print e}
@@ -418,14 +366,13 @@ print e}
418
366
  let text = "Coding is evolving rapidly!"
419
367
  fn safeAnalyze(text: string) {
420
368
  try
421
- {let result = structured_output({sentiment: string, score: number})(model("gemini-3.1-flash-lite") {"Analyze sentiment and return JSON for:" text})
369
+ {let result = structured_output({sentiment: string, score: number})(model("gemini-3.1-flash-lite") {"Analyze sentiment, score, and return JSON for: " text})
422
370
  if len(keys(result)) == 0 {print "Structured parsing failed"
423
371
  return null}
424
- return result}
425
- catch (e)
426
- {print e
372
+ return result
373
+ } catch (e) {print e
427
374
  return null}}
428
- print "Analysis Result: " safeAnalyze(text)
375
+ print "Analysis Result:" safeAnalyze(text)
429
376
  ```
430
377
 
431
378
  ## 8. Performance Tips
@@ -435,11 +382,11 @@ print "Analysis Result: " safeAnalyze(text)
435
382
  ```sesi
436
383
  // Bad: Calls API 3 times
437
384
  for item in items
438
- {let analysis = model("gemini-3.1-flash-lite") {"Analyze:" item}}
385
+ {let analysis = model("gemini-3.1-flash-lite") {"Analyze: " item}}
439
386
  print analysis
440
387
 
441
388
  // Better: Batch into one call (v2: parallel calls)
442
- let analyses = model("gemini-3.1-flash-lite") {"Analyze each:" join(items, " ")}
389
+ let analyses = model("gemini-3.1-flash-lite") {"Analyze each: " join(items, " ")}
443
390
  print analyses
444
391
  ```
445
392
 
@@ -447,11 +394,11 @@ print analyses
447
394
 
448
395
  ```sesi
449
396
  // Simple classification → flash-lite
450
- let category = model("gemini-3.1-flash-lite") {"Classify:" item}
397
+ let category = model("gemini-3.1-flash-lite") {"Classify: " item}
451
398
  print category
452
399
 
453
400
  // Complex reasoning → pro
454
- let analysis = model("gemini-3.1-pro-preview") {"Deep analysis of:" complex_problem}
401
+ let analysis = model("gemini-3.1-pro-preview") {"Deep analysis of: " complex_problem}
455
402
  print analysis
456
403
  ```
457
404
 
@@ -460,7 +407,7 @@ print analysis
460
407
  ```sesi
461
408
  // Long prompts waste tokens
462
409
  // Bad:
463
- let response = model("gemini-3-flash-preview") {"Here is a very long system prompt that repeats itself... " "Please analyze the following text very carefully..." text}
410
+ let response = model("gemini-3-flash-preview") {"Here is a very long system prompt that repeats itself... Please analyze the following text very carefully..." text}
464
411
  print response
465
412
 
466
413
  // Better:
@@ -472,14 +419,17 @@ print response
472
419
 
473
420
  ```sesi
474
421
  // Bad: Same analysis done multiple times
475
- for person in people {let assessment = model("gemini-3.1-flash-lite") {"Assess based on criteria A, B, C: " person}}
422
+ for person in people
423
+ {let assessment = model("gemini-3.1-flash-lite") {"Assess based on criteria A, B, C: " person}}
476
424
  print assessment
477
425
 
478
426
 
479
427
  // Better: Reuse cached prompt
480
428
  let people = ["Elon Musk", "Bill Gates", "Steve Jobs"]
481
- fn assessPerson(person: string) -> string {return model("gemini-3.1-flash-lite") {"Assess on A, B, C: " person}}
482
- for person in people {print assessPerson(person)}
429
+ fn assessPerson(person: string) -> string
430
+ {return model("gemini-3.1-flash-lite") {"Assess on A, B, C: " person}}
431
+ for person in people
432
+ {print assessPerson(person)}
483
433
  ```
484
434
 
485
435
  ## 9. Token Counting (Future)
@@ -494,7 +444,7 @@ print "This costs " str(tokens * PRICE_PER_TOKEN) " cents"
494
444
  // Plan memory size
495
445
  let remaining = MAX_TOKENS - count_tokens(memory, model)
496
446
  if remaining < 500 {summarizeMemory()}
497
- print "Memory size: " count_tokens(memory, model)
447
+ print "Memory size:" count_tokens(memory, model)
498
448
  ```
499
449
 
500
450
  ## 10. Advanced: Custom Reasoning Workflows
@@ -507,20 +457,21 @@ fn smartSummarize(text: string) -> string
507
457
 
508
458
  // Chain multiple Reasoning operations
509
459
  // Step 1: Extract key points
510
- {let keyPoints = model("gemini-3.1-pro-preview") {thinkingLevel: "low"} {"Extract 5 key points from:" text}
460
+ {let keyPoints = model("gemini-3.1-pro-preview") {thinkingLevel: "low"} {"Extract 5 key points from: " text}
511
461
 
512
462
  // Step 2: Analyze topics
513
- let topics = structured_output({ topics: string })(model("gemini-3.5-flash") {thinkingLevel: "low"} {"Identify topics in:" keyPoints})
463
+ let topics = structured_output({topics: string})(model("gemini-3.5-flash") {thinkingLevel: "low"} {"Identify topics in: " keyPoints})
514
464
 
515
465
  // Step 3: Generate summary
516
- let summary = model("gemini-3-flash-preview") {"Summarize with topics " topics ":" keyPoints} return summary}
466
+ let summary = model("gemini-3-flash-preview") {"Summarize with topics " topics ": " keyPoints}
467
+ return summary}
517
468
  print "Summary:" smartSummarize(text)
518
469
  ```
519
470
 
520
471
  ### Reasoning Pattern
521
472
 
522
473
  ```sesi
523
- let analysis = model("gemini-3.5-flash") {thinkingLevel: "medium", max_tokens: 8192} {"Reason carefully about:" problem}
474
+ let analysis = model("gemini-3.5-flash") {thinkingLevel: "medium", max_tokens: 8192} {"Reason carefully about: " problem}
524
475
  print analysis
525
476
  ```
526
477
 
@@ -529,12 +480,59 @@ print analysis
529
480
  ```sesi
530
481
  let text = "banana"
531
482
  fn classifyWithExamples(text: string) -> string
532
- {return model("gemini-3.5-flash") {thinkingLevel: "minimal"} {"Classify as A, B, or C" "Examples:" "'apple' -> A" "'dog' -> B" "'happy' -> C" "Classify: " text}}
483
+ {return model("gemini-3.5-flash") {thinkingLevel: "minimal"} {"Classify as A, B, or C. Examples: 'apple' -> A , 'dog' -> B , 'happy' -> C. Classify: " text}}
533
484
  print "Classification:" classifyWithExamples(text)
534
485
  ```
535
486
 
536
487
  ---
537
488
 
489
+ ## 11. Built-in Tools
490
+
491
+ ### Built-in Workflows
492
+
493
+ Sesi provides a native `workflow` function to easily chain reasoning steps:
494
+
495
+ ```sesi
496
+ let steps = [
497
+ {"prompt": "Summarize:"},
498
+ {"prompt": "Critique:"},
499
+ {"prompt": "Finalize:"}
500
+ ]
501
+ let result = workflow(steps, "Design a landing page brief")
502
+ print result["final"]
503
+ ```
504
+
505
+ ### Model Aliases
506
+
507
+ You can define custom names for models using `set_alias`:
508
+
509
+ ```sesi
510
+ set_alias("fast", "gemini-3.1-flash-lite")
511
+ let answer = model("fast") {"Summarize this paragraph."}
512
+ print answer
513
+ ```
514
+
515
+ ### Custom Tools
516
+
517
+ Sesi allows you to define custom tools that can be invoked during reasoning operations.
518
+
519
+ ```sesi
520
+ fn get_weather(city: string, conditions: string) -> string
521
+ {return "It is currently " + conditions + " in " + city}
522
+ // Register the tool
523
+ define_tool("weather", get_weather, "Get weather for a city")
524
+
525
+ // List available tools
526
+ print list_tools()
527
+
528
+ // Call the tool
529
+ let weatherData = structured_output({city: string, conditions: string})(model("gemini-3.1-flash-lite") {search} {"What is the weather like in London? Return JSON with the exact 'conditions' and 'city' name."})
530
+ let result = tool_call(weather)(weatherData["city"], weatherData["conditions"])
531
+ print result
532
+ ```
533
+
534
+ ---
535
+
538
536
  ## See Also
539
537
 
540
538
  - [Compare to other languages](COMPARISON.md)
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 (13 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,11 +105,12 @@
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
+ - [x] Web search grounding
113
114
 
114
115
  ### Memory System
115
116
 
@@ -121,8 +122,8 @@
121
122
 
122
123
  ### Error Handling
123
124
 
124
- - [ ] finally blocks (try/catch completed in V1)
125
- - [ ] Custom error types
125
+ - [x] finally blocks (try/catch completed in V1)
126
+ - [x] Custom error types
126
127
  - [ ] Error recovery strategies
127
128
  - [ ] Retry logic with exponential backoff
128
129
  - [ ] Timeout handling
@@ -160,7 +161,7 @@
160
161
 
161
162
  ### Examples
162
163
 
163
- - [ ] Web scraper with reasoning analysis
164
+ - [x] Web scraper with reasoning analysis
164
165
  - [ ] Document processor (PDF, DOCX)
165
166
  - [ ] Chatbot with memory
166
167
  - [ ] Data pipeline with reasoning
@@ -168,16 +169,16 @@
168
169
 
169
170
  ---
170
171
 
171
- ## Version 3.0 - Autonomous Systems Framework (2027)
172
+ ## Version 3.0 - Robust Logic Frameworks (2027)
172
173
 
173
- **Focus**: Full autonomous systems support
174
+ **Focus**: Complete language tooling
174
175
 
175
- ### Autonomous Framework
176
+ ### Technical Frameworks
176
177
 
177
- - [ ] Framework definitions with state machines
178
+ - [ ] Advanced scripting definition models
178
179
  - [ ] Logic composition and chaining
179
- - [ ] Multi-process collaboration
180
- - [ ] Communication protocol
180
+ - [ ] Extended process collaboration
181
+ - [ ] Communication protocols
181
182
  - [ ] Persistence layer
182
183
 
183
184
  ### Knowledge Base
@@ -190,11 +191,11 @@
190
191
 
191
192
  ### Advanced Patterns
192
193
 
193
- - [ ] Plan-and-execute workflows
194
- - [ ] Hierarchical task decomposition
195
- - [ ] Autonomous loop with safety checks
196
- - [ ] Reflection and self-improvement
197
- - [ ] 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
198
199
 
199
200
  ### Ecosystem
200
201
 
@@ -206,8 +207,8 @@
206
207
 
207
208
  ### Examples
208
209
 
209
- - [ ] Autonomous research process
210
- - [ ] Customer support automation
210
+ - [ ] Automated code formatting process
211
+ - [ ] Command line utility expansion
211
212
  - [ ] Code generation and testing
212
213
  - [ ] Data analysis pipeline
213
214
  - [ ] Multi-process reasoning debate
@@ -259,7 +260,7 @@
259
260
  | Error handling | 🔴 High | ✅ | ⏳ | | |
260
261
  | Async/await | 🔴 High | | ⏳ | | |
261
262
  | Streaming | 🟡 Medium | | ⏳ | | |
262
- | Systems Logic | 🟡 Medium | | | ⏳ | |
263
+ | Process Logic | 🟡 Medium | | | ⏳ | |
263
264
  | Knowledge base | 🟡 Medium | | | ⏳ | |
264
265
  | Module system | 🟡 Medium | | ⏳ | | |
265
266
  | Debugger | 🟢 Low | | ⏳ | | |
@@ -272,16 +273,16 @@
272
273
 
273
274
  ```
274
275
  2026 Q2
275
- └─ v1.2 - Polish & stabilize
276
+ └─ v1.3 - Polish & stabilize
276
277
 
277
278
  2026 Q3-Q4
278
- └─ v2.0 - Advanced Reasoning & async
279
+ └─ v2.0 - Async & advanced APIs
279
280
 
280
281
  2027 Q1-Q2
281
- └─ v3.0 - Autonomous Framework
282
+ └─ v3.0 - Language Ecosystem
282
283
 
283
284
  2027 Q3+
284
- └─ v4.0+ - Mature ecosystem
285
+ └─ v4.0+ - Mature compilation
285
286
  ```
286
287
 
287
288
  ---
@@ -351,7 +352,7 @@
351
352
  | Startup time | <100ms | <100ms | <50ms |
352
353
  | Simple expression eval | <1µs | <100ns | <10ns |
353
354
  | Function call overhead | <10µs | <1µs | <100ns |
354
- | Reasoning call latency | 2-5s (API) | 2-5s | 2-5s |
355
+ | Reasoning latency | 2-5s (API) | 2-5s | 2-5s |
355
356
  | Memory usage | <50MB | <50MB | <100MB |
356
357
 
357
358
  ---
@@ -366,12 +367,11 @@
366
367
  - **Go**: Clear error handling
367
368
  - **Rust**: Type safety, memory safety
368
369
 
369
- ### Systems Reasoning
370
+ ### Code Control
370
371
 
371
- - **LangChain**: Composable AI workflows
372
- - **AutoGPT**: Logic autonomy
373
- - **Semantic Kernel**: Model abstraction
374
- - **LLM frameworks**: Best practices
372
+ - **CLI utilities**: Direct data piping
373
+ - **Shell scripting**: Execution transparency
374
+ - **Modern SDKs**: Model abstraction
375
375
 
376
376
  ### Community
377
377
 
@@ -386,9 +386,9 @@
386
386
  Sesi is designed to evolve with reasoning needs. The roadmap balances:
387
387
 
388
388
  - **Simplicity** (v1: core features only)
389
- - **Power** (v2: advanced reasoning patterns)
390
- - **Autonomy** (v3: autonomous framework)
391
- - **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)
392
392
 
393
393
  The journey from v1 (interpreter) to v4+ (distributed compiler) maintains backward compatibility while adding power where needed.
394
394
 
@@ -401,7 +401,7 @@ The journey from v1 (interpreter) to v4+ (distributed compiler) maintains backwa
401
401
  - [Specification](SPECIFICATION.md)
402
402
  - [Architecture](ARCHITECTURE.md)
403
403
  - [Built-ins](BUILTINS.md)
404
- - [Systems Reasoning](SYSTEMS_REASONING.md)
404
+ - [Process Execution](PROCESS_EXECUTION.md)
405
405
  - [Image Generation](IMAGE_GENERATION.md)
406
406
  - [Compare to other languages](COMPARISON.md)
407
407
  - [Examples](../examples)