@plurnk/plurnk-grammar 0.67.0 → 0.68.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.
package/README.md CHANGED
@@ -201,9 +201,9 @@ Errors are JSON-serializable. Shape: `{ line, column, source, message }` where `
201
201
 
202
202
  One generated [GBNF](https://github.com/ggml-org/llama.cpp/blob/master/grammars/README.md) grammar ships for llama.cpp constrained sampling, calibrated for the Fireworks/DeepSeek backend:
203
203
 
204
- - **`plurnk.gbnf` (think-optional root)** — `root ::= think? sep batch-step* send-final-any sep`. An optional `<think>…</think>` reasoning preamble (a reasoning model fills it natively; a non-reasoning model skips straight to ops one grammar serves both), then a strict ops-only batch (bounded `WS{0,7}` separators, no free prose between), closed by exactly one terminal `SEND[102|200|202|300|499]` — structural termination (forced EOS), not an optional stop a near-greedy decoder can sail past. `PLAN` is allowed but inert (bare, never forced).
204
+ - **`plurnk.gbnf` (PLAN-anchored turn)** — `root ::= preplan plan sep batch-step* send-final-any sep`. A Plurnk turn is a `*:PLAN:OPS:SEND[N]` sandwich: a FREE reasoning preamble (any text up to the first `<<PLAN`), then a MANDATORY `<<PLAN` anchoring a strict ops-only batch (bounded `WS{0,7}` separators, no free prose between), closed by exactly one terminal `SEND[102|200|202|300|499]` — structural termination (forced EOS), not an optional stop a near-greedy decoder can sail past.
205
205
 
206
- The grammar masks the **raw** token stream, reasoning included (the `reasoning_content`/`content` split is post-hoc and sampler-invisible), so `<think>` lives in the grammar to give the model's native reasoning tokens somewhere to go. Its body excludes only `</think>`, so the model may rehearse anything inside complete ops and terminals included because the provider separates reasoning from content before the parser runs. The parser remains the permissive contract over that `content`: everything the grammar can generate, the parser accepts (and much it doesn't: word suffixes, richer slot internals).
206
+ The preamble names **no reasoning delimiter** it admits any text completing no `<<PLAN`. That keeps it format-agnostic across models and, crucially, never masks a model's native reasoning token: the model reasons freely (a reasoning model's CoT separates into `reasoning_content`; a non-reasoning model reasons in the `<<PLAN` body, the public statement of intent), then the mandatory `<<PLAN` anchors the strict turn. `PlurnkParser` discards everything before the first `<<PLAN`. The parser remains the permissive contract over the actionable turn: everything the grammar can generate, the parser accepts (and much it doesn't: word suffixes, richer slot internals).
207
207
 
208
208
  ```ts
209
209
  import.meta.resolve("@plurnk/plurnk-grammar/plurnk.gbnf")
package/dist/plurnk.gbnf CHANGED
@@ -1,5 +1,5 @@
1
1
  # @generated by scriptify/generate-gbnf.ts — do not edit; run `npm run build:gbnf`.
2
- root ::= root-think
2
+ root ::= root-turn
3
3
  find-b0 ::= (":" find-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:] find-b0)?
4
4
  find-b1 ::= ("F" find-b2 | ":" find-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:F] find-b0)?
5
5
  find-b2 ::= ("I" find-b3 | ":" find-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:I] find-b0)?
@@ -709,17 +709,14 @@ plan ::= "<<PLAN" ":" plan-b0 ":PLAN"
709
709
  sep ::= [ \t\r\n]? [ \t\r\n]? [ \t\r\n]? [ \t\r\n]? [ \t\r\n]? [ \t\r\n]? [ \t\r\n]?
710
710
  batch-step ::= mid-statement sep
711
711
  mid-statement ::= op-statement | send-mid-any
712
- thinkbody-s0 ::= ("<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F<] thinkbody-s0)?
713
- thinkbody-s1 ::= ("/" thinkbody-s2 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F/<] thinkbody-s0)?
714
- thinkbody-s2 ::= ("t" thinkbody-s3 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7Ft<] thinkbody-s0)?
715
- thinkbody-s3 ::= ("h" thinkbody-s4 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7Fh<] thinkbody-s0)?
716
- thinkbody-s4 ::= ("i" thinkbody-s5 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7Fi<] thinkbody-s0)?
717
- thinkbody-s5 ::= ("n" thinkbody-s6 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7Fn<] thinkbody-s0)?
718
- thinkbody-s6 ::= ("k" thinkbody-s7 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7Fk<] thinkbody-s0)?
719
- thinkbody-s7 ::= ("<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F><] thinkbody-s0)?
720
- thinkbody ::= thinkbody-s0
721
- think ::= "<think>" thinkbody "</think>"
722
- root-think ::= think? sep batch-step* send-final-any sep
712
+ preplan-s0 ::= ("<" preplan-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F<] preplan-s0)?
713
+ preplan-s1 ::= ("<" preplan-s2 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F<] preplan-s0)?
714
+ preplan-s2 ::= ("P" preplan-s3 | "<" preplan-s2 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7FP<] preplan-s0)?
715
+ preplan-s3 ::= ("L" preplan-s4 | "<" preplan-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7FL<] preplan-s0)?
716
+ preplan-s4 ::= ("A" preplan-s5 | "<" preplan-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7FA<] preplan-s0)?
717
+ preplan-s5 ::= ("<" preplan-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7FN<] preplan-s0)?
718
+ preplan ::= preplan-s0
719
+ root-turn ::= preplan plan sep batch-step* send-final-any sep
723
720
  op-statement ::= find | find-1 | find-2 | find-3 | find-4 | find-5 | find-6 | find-7 | find-8 | find-9 | read | read-1 | read-2 | read-3 | read-4 | read-5 | read-6 | read-7 | read-8 | read-9 | edit | edit-1 | edit-2 | edit-3 | edit-4 | edit-5 | edit-6 | edit-7 | edit-8 | edit-9 | copy | copy-1 | copy-2 | copy-3 | copy-4 | copy-5 | copy-6 | copy-7 | copy-8 | copy-9 | move | move-1 | move-2 | move-3 | move-4 | move-5 | move-6 | move-7 | move-8 | move-9 | open | open-1 | open-2 | open-3 | open-4 | open-5 | open-6 | open-7 | open-8 | open-9 | fold | fold-1 | fold-2 | fold-3 | fold-4 | fold-5 | fold-6 | fold-7 | fold-8 | fold-9 | exec | exec-1 | exec-2 | exec-3 | exec-4 | exec-5 | exec-6 | exec-7 | exec-8 | exec-9 | kill | kill-1 | kill-2 | kill-3 | kill-4 | kill-5 | kill-6 | kill-7 | kill-8 | kill-9 | plan
724
721
  send-mid-any ::= send-mid | send-1-mid | send-2-mid | send-3-mid | send-4-mid | send-5-mid | send-6-mid | send-7-mid | send-8-mid | send-9-mid
725
722
  send-final-any ::= send-final | send-1-final | send-2-final | send-3-final | send-4-final | send-5-final | send-6-final | send-7-final | send-8-final | send-9-final
@@ -1 +1 @@
1
- {"version":3,"file":"PlurnkParser.d.ts","sourceRoot":"","sources":["../../src/PlurnkParser.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAa,WAAW,EAAY,MAAM,YAAY,CAAC;AAEnE,MAAM,CAAC,OAAO,OAAO,YAAY;;IAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;CAiF3C"}
1
+ {"version":3,"file":"PlurnkParser.d.ts","sourceRoot":"","sources":["../../src/PlurnkParser.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAa,WAAW,EAAY,MAAM,YAAY,CAAC;AAEnE,MAAM,CAAC,OAAO,OAAO,YAAY;;IAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;CA0F3C"}
@@ -7,6 +7,16 @@ import PlurnkErrorStrategy from "./PlurnkErrorStrategy.js";
7
7
  import RecordingListener from "./RecordingListener.js";
8
8
  export default class PlurnkParser {
9
9
  static parse(input) {
10
+ // A Plurnk turn is a `*:PLAN:OPS:SEND[N]` sandwich: the model's private reasoning
11
+ // (any format — native channel, prose, nothing) precedes the first `<<PLAN`, which
12
+ // anchors the actionable turn. Discard that preamble before lexing — the turn
13
+ // begins at `<<PLAN`. Provider-separated content already starts there (no-op);
14
+ // this also rescues un-separated raw content and prevents the lexer from
15
+ // mis-tokenizing op-lookalikes a model may rehearse inside its reasoning. No
16
+ // `<<PLAN` present ⇒ parse as-is (e.g. a statement list or the examples block).
17
+ const planIdx = input.indexOf("<<PLAN");
18
+ if (planIdx > 0)
19
+ input = input.slice(planIdx);
10
20
  const lexer = new plurnkLexer(CharStream.fromString(input));
11
21
  const errors = [];
12
22
  lexer.removeErrorListeners();
@@ -1 +1 @@
1
- {"version":3,"file":"PlurnkParser.js","sourceRoot":"","sources":["../../src/PlurnkParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAGvD,MAAM,CAAC,OAAO,OAAO,YAAY;IAC7B,MAAM,CAAC,KAAK,CAAC,KAAa;QACtB,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,KAAK,CAAC,gBAAgB,CAAC,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QAE/D,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAA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C,CAAC,QAAQ,KAAK,aAAa,IAAI,QAAQ,KAAK,YAAY,IAAI,QAAQ,KAAK,cAAc;oBACpF,CAAC,CAAC,sBAAsB,OAAO,qBAAqB,IAAI,CAAC,IAAI,uDAAuD;oBACpH,CAAC,CAAC,QAAQ,KAAK,QAAQ;wBACnB,CAAC,CAAC,sBAAsB,OAAO,qBAAqB,IAAI,CAAC,IAAI,uDAAuD;wBACpH,CAAC,CAAC,iBAAiB,OAAO,qBAAqB,IAAI,CAAC,IAAI,6CAA6C,OAAO,iBAAiB,CAAC;YAC1I,YAAY,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACpC,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,aAAa,CAChB,GAAqB,EACrB,KAAuC,EACvC,IAAsC;QAEtC,IAAI,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QAChE,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QACvE,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QACrE,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plurnk/plurnk-grammar",
3
- "version": "0.67.0",
3
+ "version": "0.68.0",
4
4
  "description": "ANTLR4 grammar for the Plurnk LLM agent protocol",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/plurnk.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Plurnk System Grammar
2
2
 
3
- YOU MUST ONLY use the Extended HEREDOC Plurnk Operations (FIND|READ|EDIT|COPY|MOVE|OPEN|FOLD|KILL|EXEC|SEND).
3
+ YOU MUST ONLY use the Extended HEREDOC Plurnk Operations (PLAN|FIND|READ|EDIT|COPY|MOVE|OPEN|FOLD|KILL|EXEC|SEND).
4
4
 
5
5
  ## Syntax
6
6
 
@@ -12,6 +12,7 @@ Slots between `<<OPsuffix` and `:body:` are all optional. `:body:` fences are re
12
12
 
13
13
  | OP | `[signal]` | `(target)` | `<Line> / <Result>` | body |
14
14
  |------|-------------|------------|---------------------|------------------|
15
+ | PLAN | - | - | - | plan / reasoning |
15
16
  | FIND | filter tags | required | results `N,M` | matcher |
16
17
  | READ | filter tags | required | lines `N,M` | matcher |
17
18
  | EDIT | tags | required | lines `N,M` | content |
@@ -147,8 +148,9 @@ chmod +x ./example.sh
147
148
 
148
149
  ## Imperatives
149
150
 
151
+ YOU MUST begin the turn with <<PLAN:...:PLAN
150
152
  YOU MUST ONLY use EXEC commands for actions that can't be performed with Extended HEREDOC Plurnk Operations.
151
- YOU MUST ONLY communicate with SEND, not with free text between operations.
153
+ YOU MUST NOT emit free text between operations.
152
154
  YOU SHOULD NOT leak internal resource information when SENDing user messages.
153
155
  YOU MUST document all relevant questions and uncertainties into taxonomized, tagged, and topical unknown entries.
154
156
  YOU MUST ONLY populate known entries with source entry information, never with model training.