spl-lang 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -30,7 +30,7 @@ under `~/.spl` (override with `SPL_HOME`); `spl logout` removes those saved cred
30
30
  Prose and code fences are not silently extracted.
31
31
  - **Repairs:** `repairs=0..5` retries only malformed/invalid generation, not transport errors
32
32
  or external actions. Agents require `repairs=0`. Use `assert` for business rules.
33
- - **Guidance:** `instruct`, `avoid`, and `len` influence prompts, not runtime guarantees.
33
+ - **Guidance:** `enforce`/`forbid` and `len` influence prompts, not runtime guarantees.
34
34
  - **Capabilities:** nested `restrict fs/net/exec/mcp` clauses intersect. Shell command
35
35
  inspection is best effort; MCP servers are trusted services, not OS-sandboxed.
36
36
  - **Bindings:** `let` declares/redeclares function/script locals; `x = ...` and `x += ...`
@@ -85,7 +85,7 @@ See [embedding](../docs/internals.html#embedding).
85
85
 
86
86
  ## Migration
87
87
 
88
- 0.3 intentionally removes `enforce`/`forbid`, `think{level=...}`, tool-command syntax,
89
- and `let` before compound/member/index assignments. Use `instruct`/`avoid`,
90
- `reasoning`, ordinary raw functions, and explicit agents instead.
88
+ Use `enforce` and `forbid` for scoped prompt guidance; `instruct` and `avoid` are not accepted.
89
+ 0.3 removes `think{level=...}`, tool-command syntax, and `let` before
90
+ compound/member/index assignments. Use `reasoning`, ordinary raw functions, and explicit agents instead.
91
91
  Bare blocks no longer create scopes. See the [migration table](../README.md#breaking-changes-in-03).
package/dist/ast.d.ts CHANGED
@@ -148,7 +148,7 @@ export type Stmt = Base & ({
148
148
  value?: Expr;
149
149
  } | {
150
150
  t: 'constraint';
151
- kind: 'instruct' | 'avoid';
151
+ kind: 'enforce' | 'forbid';
152
152
  text: Expr;
153
153
  body: Stmt[];
154
154
  } | {
package/dist/llm.d.ts CHANGED
@@ -4,7 +4,7 @@ import type { ToolHost } from './tools.js';
4
4
  import { type Value } from './values.js';
5
5
  export type ReasoningLevel = 'low' | 'medium' | 'high';
6
6
  export interface Constraint {
7
- kind: 'instruct' | 'avoid';
7
+ kind: 'enforce' | 'forbid';
8
8
  text: string;
9
9
  }
10
10
  export interface LlmRequest {
package/dist/llm.js CHANGED
@@ -14,7 +14,7 @@ export function buildPrompt(opts) {
14
14
  const sections = [];
15
15
  if (opts.constraints.length) {
16
16
  sections.push('Response guidance (not runtime validation):\n' +
17
- opts.constraints.map((c) => `- ${c.kind === 'instruct' ? 'Follow' : 'Avoid'}: ${c.text}`).join('\n'));
17
+ opts.constraints.map((c) => `- ${c.kind === 'enforce' ? 'Follow' : 'Avoid'}: ${c.text}`).join('\n'));
18
18
  }
19
19
  const guidance = opts.restrictions.guidance();
20
20
  if (guidance.length)
package/dist/parser.js CHANGED
@@ -2,7 +2,7 @@ import { SplSyntaxError } from './errors.js';
2
2
  import { tokenize } from './lexer.js';
3
3
  const KEYWORDS = new Set([
4
4
  'let', 'if', 'elif', 'else', 'for', 'in', 'while', 'def', 'return', 'try', 'except', 'assert', 'fail',
5
- 'success', 'instruct', 'avoid', 'restrict', 'think', 'agent', 'break', 'continue', 'pass', 'and', 'or', 'not',
5
+ 'success', 'enforce', 'forbid', 'restrict', 'think', 'agent', 'break', 'continue', 'pass', 'and', 'or', 'not',
6
6
  'True', 'False', 'None',
7
7
  ]);
8
8
  export const MODIFIER_NAMES = ['len', 'fmt', 'reasoning', 'show', 'schema', 'repairs', 'model'];
@@ -242,17 +242,17 @@ class Parser {
242
242
  this.next();
243
243
  return { t: 'success', line, value: this.atStatementEnd() ? undefined : this.parseExpr() };
244
244
  }
245
- case 'instruct':
246
- case 'avoid': {
245
+ case 'enforce':
246
+ case 'forbid': {
247
247
  const kind = t.value;
248
248
  this.next();
249
249
  const text = this.parseExpr();
250
250
  return { t: 'constraint', line, kind, text, body: this.parseBlock() };
251
251
  }
252
252
  case 'restrict': return this.parseRestrict();
253
- case 'enforce':
254
- case 'forbid':
255
- this.fail(`'${t.value}' was removed; use '${t.value === 'enforce' ? 'instruct' : 'avoid'}' for prompt guidance, or assert/schema for validation`);
253
+ case 'instruct':
254
+ case 'avoid':
255
+ this.fail(`use '${t.value === 'instruct' ? 'enforce' : 'forbid'}' instead of '${t.value}' for scoped prompt guidance`);
256
256
  default:
257
257
  break;
258
258
  }
package/docs/syntax.ebnf CHANGED
@@ -20,7 +20,7 @@ for_stmt = "for" , NAME , { "," , NAME } , "in" , expr , block ;
20
20
  while_stmt = "while" , expr , block ;
21
21
  def_stmt = "def" , NAME , "(" , [ NAME , { "," , NAME } , [ "," ] ] , ")" , block ;
22
22
  try_stmt = "try" , block , NL* , "except" , NAME , block ;
23
- guidance_stmt = ( "instruct" | "avoid" ) , expr , block ;
23
+ guidance_stmt = ( "enforce" | "forbid" ) , expr , block ;
24
24
  restrict_stmt = "restrict" , restrict_clause , { "," , restrict_clause } , block ;
25
25
  restrict_clause = [ "fs" | "net" | "exec" | "mcp" ] , expr ;
26
26
 
@@ -63,7 +63,8 @@ modifier = ( "len" | "fmt" | "reasoning" | "show" | "schema" | "repairs" |
63
63
  Generation (? and think) has no tools. agent explicitly enables restricted runtime/MCP tools.
64
64
  Raw tools are ordinary positional functions: read_file(path), write_file(path, content),
65
65
  web_fetch(url), web_search(query), shell(command). They never invoke a model.
66
- instruct/avoid are prompt guidance; schema/assert validate data; restrict checks actions. *)
66
+ enforce/forbid are scoped prompt guidance.
67
+ schema/assert validate data; restrict checks actions. *)
67
68
 
68
69
  string = [ "r" ] , quote , { char | escape | interpolation } , closing_quote ;
69
70
  quote = "'" | '"' | "'''" | '"""' ;
@@ -76,6 +77,6 @@ NL = newline ;
76
77
 
77
78
  (* "{{"/"}}" are literal braces; raw strings have no interpolation or escapes.
78
79
  Reserved words: let if elif else for in while def return try except assert fail success
79
- instruct avoid restrict think agent break continue pass and or not True False None.
80
- Removed syntax: enforce/forbid, think{level=...}, tool{param=...} 'instructions',
80
+ enforce forbid restrict think agent break continue pass and or not True False None.
81
+ Removed syntax: think{level=...}, tool{param=...} 'instructions',
81
82
  let x += ... and let d.key = ... . *)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spl-lang",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Semantic Prompt Language: a Python-like language with LLM calls built into the syntax",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",