@plurnk/plurnk-grammar 0.23.1 → 0.26.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 +19 -9
- package/dist/plurnk.gbnf +638 -0
- package/dist/schema/LogEntry.json +2 -2
- package/dist/schema/MatcherBody.json +1 -1
- package/dist/schema/PlurnkStatement.json +7 -7
- package/dist/src/AstBuilder.js +12 -12
- package/dist/src/PlurnkErrorStrategy.js +2 -2
- package/dist/src/generated/plurnkLexer.d.ts +4 -4
- package/dist/src/generated/plurnkLexer.js +13 -13
- package/dist/src/generated/plurnkParser.d.ts +12 -12
- package/dist/src/generated/plurnkParser.js +36 -36
- package/dist/src/generated/plurnkParserVisitor.d.ts +6 -6
- package/dist/src/generated/plurnkParserVisitor.js +4 -4
- package/dist/src/index.d.ts +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.generated.d.ts +8 -8
- package/package.json +6 -3
- package/plurnk.md +12 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plurnk/plurnk-grammar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "ANTLR4 grammar for the Plurnk LLM agent protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"types": "./dist/src/index.d.ts",
|
|
16
16
|
"default": "./dist/src/index.js"
|
|
17
17
|
},
|
|
18
|
-
"./package.json": "./package.json"
|
|
18
|
+
"./package.json": "./package.json",
|
|
19
|
+
"./plurnk.gbnf": "./dist/plurnk.gbnf"
|
|
19
20
|
},
|
|
20
21
|
"bin": {
|
|
21
22
|
"plurnk": "./bin/plurnk.js"
|
|
@@ -29,7 +30,8 @@
|
|
|
29
30
|
"build:grammar": "antlr-ng -D language=TypeScript -o src/generated --generate-visitor true --generate-listener false plurnkLexer.g4 plurnkParser.g4 && node scriptify/fix-generated-imports.ts",
|
|
30
31
|
"build:types": "node scriptify/generate-types.ts",
|
|
31
32
|
"build:dist": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
32
|
-
"build": "
|
|
33
|
+
"build:gbnf": "node scriptify/generate-gbnf.ts",
|
|
34
|
+
"build": "npm run build:grammar && npm run build:types && npm run build:dist && npm run build:gbnf",
|
|
33
35
|
"antlr:tokens": "testrig src/generated/plurnk document --tokens",
|
|
34
36
|
"antlr:trace": "testrig src/generated/plurnk document --trace",
|
|
35
37
|
"antlr:parse": "testrig src/generated/plurnk document --tree",
|
|
@@ -38,6 +40,7 @@
|
|
|
38
40
|
"test:intg": "node --test test/integration/*.test.ts",
|
|
39
41
|
"test:demo": "node --test test/demo/*.test.ts",
|
|
40
42
|
"test:smoke": "node scriptify/smoke-test.ts",
|
|
43
|
+
"test:llama": "node --test test/llama/*.test.ts",
|
|
41
44
|
"test:all": "npm run test:lint && npm run test:unit && npm run test:intg && npm run test:demo",
|
|
42
45
|
"prepare": "npm run build",
|
|
43
46
|
"prepublishOnly": "npm run build && npm run test:all && npm run test:smoke"
|
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|
|
|
3
|
+
YOU MUST ONLY use the Extended HEREDOC Plurnk Operations (FIND|READ|EDIT|COPY|MOVE|OPEN|FOLD|SEND|EXEC).
|
|
4
4
|
|
|
5
5
|
## Syntax
|
|
6
6
|
|
|
@@ -17,8 +17,8 @@ Slots between `<<OPsuffix` and `:body:` are all optional. `:body:` fences are re
|
|
|
17
17
|
| EDIT | tags | required | lines `N,M` | content |
|
|
18
18
|
| COPY | apply tags | required | lines `N,M` | destination URI |
|
|
19
19
|
| MOVE | apply tags | required | lines `N,M` | destination URI |
|
|
20
|
-
|
|
|
21
|
-
|
|
|
20
|
+
| OPEN | filter tags | log path | results `N,M` | matcher |
|
|
21
|
+
| FOLD | filter tags | log path | results `N,M` | matcher |
|
|
22
22
|
| SEND | status code | recipient | — | message body |
|
|
23
23
|
| EXEC | executor | cwd | — | command or code |
|
|
24
24
|
|
|
@@ -31,12 +31,12 @@ EXEC defaults to `sh`; override with an optional executor (`node`, `python`, `se
|
|
|
31
31
|
|
|
32
32
|
The agent maintains two surfaces for budgeting working-memory tokens:
|
|
33
33
|
|
|
34
|
-
- **Log** — what you did: the chronological record of every operation.
|
|
34
|
+
- **Log** — what you did: the chronological record of every operation. FOLD contracts a log row to its one-line summary and saves tokens; OPEN restores the complete record and spends tokens. Non-destructive — folded rows remain listed and re-OPENable.
|
|
35
35
|
- **`plurnk://manifest.json`** — what's available: the complete, unranked directory of every entry (items are `{ path, channels }`). Query it to discover what exists; the system never ranks for you.
|
|
36
36
|
|
|
37
|
-
READ pulls an entry's content (full, ranged, or matcher-filtered) and appends a fresh log row.
|
|
37
|
+
READ pulls an entry's content (full, ranged, or matcher-filtered) and appends a fresh log row. OPEN and FOLD operate on the log only; against an entry they return 501.
|
|
38
38
|
|
|
39
|
-
YOU SHOULD
|
|
39
|
+
YOU SHOULD FOLD distilled and irrelevant log rows to save tokens and optimize context relevance.
|
|
40
40
|
YOU SHOULD distill durable findings into `known://` entries with EDIT.
|
|
41
41
|
YOU MAY permanently delete entries by MOVE to `/dev/null` (works regardless of environment).
|
|
42
42
|
|
|
@@ -51,7 +51,7 @@ Clearing content: `<1,-1>` selects every position; combine with an empty body to
|
|
|
51
51
|
|
|
52
52
|
On structured entries, `<Result>` addresses result index, not line number.
|
|
53
53
|
|
|
54
|
-
## Body matcher dispatch (FIND, READ,
|
|
54
|
+
## Body matcher dispatch (FIND, READ, OPEN, FOLD)
|
|
55
55
|
|
|
56
56
|
| leading prefix | dialect | form |
|
|
57
57
|
|----------------|----------|-----------------------------------|
|
|
@@ -84,11 +84,11 @@ Internal schemes:
|
|
|
84
84
|
|
|
85
85
|
## Suffix
|
|
86
86
|
|
|
87
|
-
YOU
|
|
87
|
+
YOU MUST use a matching digit suffix on the opening and closing tags when quoting plurnk operations in a body.
|
|
88
88
|
|
|
89
|
-
<<
|
|
89
|
+
<<EDIT1(known://demo):
|
|
90
90
|
quoted: <<EDIT(known://inner):hello:EDIT
|
|
91
|
-
:
|
|
91
|
+
:EDIT1
|
|
92
92
|
|
|
93
93
|
## Body
|
|
94
94
|
|
|
@@ -120,9 +120,9 @@ Body content is character-perfect, exactly matching whitespace.
|
|
|
120
120
|
<<COPY[archive,2026-05-14](known://draft.md):known://archive/2026-05-14/draft.md:COPY
|
|
121
121
|
<<MOVE[final](known://draft/answer.md):known://final/answer.md:MOVE
|
|
122
122
|
<<MOVE(known://obsolete/note.md):/dev/null:MOVE
|
|
123
|
-
<<
|
|
123
|
+
<<OPEN(log://**/get)<1,10>::OPEN
|
|
124
124
|
<<FIND(known://**)<5>:~french revolutionary history:FIND
|
|
125
|
-
<<
|
|
125
|
+
<<FOLD(log://**/get)<101,200>::FOLD
|
|
126
126
|
<<FIND(log://**/error):/timeout|deadline exceeded/i:FIND
|
|
127
127
|
<<FIND(known://**):revolution:FIND
|
|
128
128
|
<<FIND(src/**):@<createCoder:FIND
|