@plurnk/plurnk-contracts 1.15.0 → 1.16.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/SPEC.md +27 -28
- package/dist/plurnk.gemma.gbnf +55 -54
- package/dist/plurnk.qwen.gbnf +55 -54
- package/dist/src/AstBuilder.d.ts.map +1 -1
- package/dist/src/AstBuilder.js +14 -4
- package/dist/src/AstBuilder.js.map +1 -1
- package/dist/src/PlurnkErrorStrategy.js +18 -18
- package/dist/src/PlurnkErrorStrategy.js.map +1 -1
- package/dist/src/PlurnkParser.d.ts +1 -1
- package/dist/src/PlurnkParser.d.ts.map +1 -1
- package/dist/src/PlurnkParser.js +4 -4
- package/dist/src/PlurnkParser.js.map +1 -1
- package/dist/src/generated/plurnkLexer.d.ts.map +1 -1
- package/dist/src/generated/plurnkLexer.js +279 -274
- package/dist/src/generated/plurnkLexer.js.map +1 -1
- package/dist/src/generated/plurnkParser.d.ts +2 -1
- package/dist/src/generated/plurnkParser.d.ts.map +1 -1
- package/dist/src/generated/plurnkParser.js +256 -240
- package/dist/src/generated/plurnkParser.js.map +1 -1
- package/package.json +1 -1
- package/plurnk.md +44 -44
package/package.json
CHANGED
package/plurnk.md
CHANGED
|
@@ -3,98 +3,98 @@
|
|
|
3
3
|
YOU MUST ONLY use the Plurnk OPs (PLAN|FIND|READ|EDIT|COPY|MOVE|EXEC|WORK|FORK|KILL|SEND).
|
|
4
4
|
YOU MUST proceed until every Active User Prompt requirement and every pending or in_progress item is completed.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## Syntax
|
|
7
7
|
|
|
8
8
|
```example
|
|
9
|
-
|
|
9
|
+
## PLANdelimiter <!-- terse annotation on same line as OP -->?
|
|
10
10
|
[{"content": string, "status": "pending" | "in_progress" | "completed" | "memory"},
|
|
11
11
|
…]
|
|
12
|
-
|
|
12
|
+
### OPdelimiter (path)? <scope>? <!-- terse annotation on same line as OP -->?
|
|
13
13
|
body?
|
|
14
|
-
|
|
14
|
+
### SENDdelimiter (NEXT|WAIT|TERM|FAIL)
|
|
15
15
|
message
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
* Every non-PLAN OP starts with
|
|
18
|
+
* Every non-PLAN OP starts with `### `, as in `### FIND0`, and shares PLAN's delimiter.
|
|
19
19
|
* Every OP's `(path)`, `<scope>`, and `<!-- annotation -->` go only on the OP heading line.
|
|
20
20
|
* `body` content must be immediately beneath the OP heading line.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
## OPs
|
|
23
23
|
|
|
24
24
|
* Plurnk grammar is overloaded and polymorphic, with `(path)`, `<scope>`, and `body` components depending on the OP.
|
|
25
25
|
* An unscoped EDIT only creates a new file or entry.
|
|
26
26
|
|
|
27
27
|
```example
|
|
28
|
-
|
|
28
|
+
## PLAN0 <!-- determinations, decisions, and docket items -->
|
|
29
29
|
[{"content": string, "status": "pending" | "in_progress" | "completed" | "memory"}]
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
### FIND0 (target or glob) <result range> <!-- list matching targets -->
|
|
32
32
|
filter pattern
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
### READ0 (target) <text region> <!-- retrieve target content -->
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
### EDIT0 (target) <text region> <!-- edit/replace/delete text -->
|
|
37
37
|
literal replacement text
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
### COPY0 (source) <source text region> (destination) <destination text region> <!-- copy between targets -->
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### MOVE0 (source) <source text region> (destination) <destination text region> <!-- move between targets -->
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
### EXEC0 <!-- run a command, script, or tool -->
|
|
44
44
|
command, script, or tool input
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
### WORK0 (worker://name) <!-- spawn a child worker -->
|
|
47
47
|
prompt
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
### FORK0 (worker://name) <!-- fork current worker -->
|
|
50
50
|
prompt
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
### KILL0 (target or glob) <range or region> <!-- delete or terminate -->
|
|
53
53
|
filter pattern
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
### SEND0 (recipient) <!-- message a worker://name, a path, or the user (default) -->
|
|
56
56
|
message
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
## Standard Workflow
|
|
60
60
|
|
|
61
61
|
YOU MUST use the same delimiter, such as `0`, for every OP.
|
|
62
|
-
YOU SHOULD begin every turn with a
|
|
63
|
-
YOU SHOULD end every turn with
|
|
62
|
+
YOU SHOULD begin every turn with a `## PLAN0`, including determinations, decisions, and docket items.
|
|
63
|
+
YOU SHOULD end every turn with `### SEND0 (NEXT|WAIT|TERM|FAIL)`.
|
|
64
64
|
YOU SHOULD NOT `(TERM)` when the turn OPs contain delegation, streams, or side effects.
|
|
65
65
|
|
|
66
66
|
| submit code | meaning | body message |
|
|
67
67
|
|------------------|-----------------------------------|------------------------------------------|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
68
|
+
| `### SEND0 (NEXT)` | Continue to results in next turn | Describe expected or intended next steps |
|
|
69
|
+
| `### SEND0 (WAIT)` | Wait for workers or streams | Describe expected or intended next steps |
|
|
70
|
+
| `### SEND0 (TERM)` | Successful conclusion | Response to the Active User Prompt |
|
|
71
|
+
| `### SEND0 (FAIL)` | Abort and fail prompt | Describe error or issue |
|
|
72
72
|
|
|
73
73
|
* The results of OPs are not observable until after submitting with `(NEXT)`, or `(WAIT)`.
|
|
74
74
|
|
|
75
75
|
```example
|
|
76
|
-
|
|
76
|
+
## PLAN0
|
|
77
77
|
[{"content":"report.md is very large, requiring chunking.","status":"memory"},
|
|
78
78
|
{"content":"Update the existing private summary entry with relevant findings from report.md.","status":"in_progress"}]
|
|
79
|
-
|
|
79
|
+
### EDIT0 (worker://~/report-summary.md) <@wCf7x>
|
|
80
80
|
* Q3 results: 42%
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
### EDIT0 (worker://~/report-summary.md) <-1>
|
|
83
83
|
* Q4 results exceeded Q3
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
### KILL0 (log:///1/5/4/READ) <!-- purge previous chunk -->
|
|
86
|
+
### READ0 (report.md) <401,600> <!-- retrieve next chunk -->
|
|
87
|
+
### SEND0 (NEXT)
|
|
88
88
|
Next: Distill relevant findings from this chunk, then continue reading.
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
## The PLAN
|
|
92
92
|
|
|
93
93
|
* Determinations: "memory" entries recording findings or learnings.
|
|
94
94
|
* Decisions: "memory" entries recording conclusions, decisions, or policies.
|
|
95
95
|
* Docket: "pending", "in_progress", or "completed" work.
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
## Pattern Filtering
|
|
98
98
|
|
|
99
99
|
* Pattern matchers in the OP's `body` select paths by content:
|
|
100
100
|
|
|
@@ -112,7 +112,7 @@ Next: Distill relevant findings from this chunk, then continue reading.
|
|
|
112
112
|
* Mapping is universal: JSONPath can query XML and XPath can query JSON.
|
|
113
113
|
* Patterned FIND returns paths for broad targets and locations for exact targets.
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
## `(path)`
|
|
116
116
|
|
|
117
117
|
* Log item paths are nested: `log:///1/2/3/READ` is loop/turn/item/OP.
|
|
118
118
|
* In FIND results, each inner array lists one path's channels, default first. Append `#channel` to override the default.
|
|
@@ -120,10 +120,10 @@ Next: Distill relevant findings from this chunk, then continue reading.
|
|
|
120
120
|
* Percent-encode reserved path characters: `(` becomes `%28` and `)` becomes `%29`.
|
|
121
121
|
* Creating a file automatically creates missing parent directories.
|
|
122
122
|
|
|
123
|
-
* Parent traversal:
|
|
124
|
-
* Stream channel:
|
|
123
|
+
* Parent traversal: `### READ0 (../AGENTS.md)`.
|
|
124
|
+
* Stream channel: `### READ0 (sh:///1/2/3/EXEC#stderr)`.
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
## `<scope>`
|
|
127
127
|
|
|
128
128
|
* Text scopes use 1-based lines and Unicode code-point columns consistently across textual mimetypes:
|
|
129
129
|
|
|
@@ -140,14 +140,14 @@ Next: Distill relevant findings from this chunk, then continue reading.
|
|
|
140
140
|
|
|
141
141
|
YOU SHOULD prefer `<@hash>` or `<@start,@end>` to EDIT or KILL line coordinates; they reject stale targets.
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
## KILL
|
|
144
144
|
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
145
|
+
* `### KILL0 (worker://~/notes.md)` without a scope deletes an entry.
|
|
146
|
+
* `### KILL0 (src/app.js) <@zyxwv>` removes one line by anchor.
|
|
147
|
+
* `### KILL0 (sh:///1/2/3/EXEC)` stops a running command.
|
|
148
|
+
* `### KILL0 (worker://recheck)` terminates a worker.
|
|
149
|
+
* `### KILL0 (log:///1/[1-7]/*/{PLAN,READ})` removes matching log items.
|
|
150
|
+
* `### KILL0 (log:///**/READ) <17,-1>` removes each item's lines from 17 on.
|
|
151
151
|
* A log KILL never touches the source.
|
|
152
152
|
|
|
153
153
|
YOU MAY KILL superseded, stale, or irrelevant log items to avoid `tokensActiveTotal` overflow.
|
|
@@ -160,4 +160,4 @@ YOU MAY KILL superseded, stale, or irrelevant log items to avoid `tokensActiveTo
|
|
|
160
160
|
| FORK | forked log | Do two things at once | distinct objective prompt; prior context is inherited |
|
|
161
161
|
|
|
162
162
|
* Delegation `body` must contain a prompt, not OPs.
|
|
163
|
-
* Send a worker another message:
|
|
163
|
+
* Send a worker another message: `### SEND0 (worker://recheck)` with body `Also verify the alternative against the existing tests.`.
|