@plurnk/plurnk-contracts 1.5.0 → 1.6.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 +9 -5
- package/SPEC.md +327 -227
- package/dist/plurnk.gemma.gbnf +160 -0
- package/dist/plurnk.qwen.gbnf +149 -0
- package/dist/schema/ClientStatement.json +7 -1
- package/dist/schema/EntryReadResult.json +1 -9
- package/dist/schema/PlurnkStatement.json +56 -11
- package/dist/schema/ProposalProjection.json +1 -1
- package/dist/schema/ProviderAccounting.json +30 -0
- package/dist/schema/ProviderCost.json +6 -15
- package/dist/schema/ProviderRequestAccounting.json +17 -0
- package/dist/schema/ProviderUsage.json +40 -0
- package/dist/schema/ResourceSelection.json +1 -1
- package/dist/schema/TextLineMarker.json +21 -0
- package/dist/src/AstBuilder.d.ts.map +1 -1
- package/dist/src/AstBuilder.js +108 -20
- package/dist/src/AstBuilder.js.map +1 -1
- package/dist/src/PlurnkErrorStrategy.d.ts +1 -0
- package/dist/src/PlurnkErrorStrategy.d.ts.map +1 -1
- package/dist/src/PlurnkErrorStrategy.js +42 -19
- package/dist/src/PlurnkErrorStrategy.js.map +1 -1
- package/dist/src/PlurnkParser.d.ts.map +1 -1
- package/dist/src/PlurnkParser.js +22 -145
- package/dist/src/PlurnkParser.js.map +1 -1
- package/dist/src/TagSignal.d.ts +15 -0
- package/dist/src/TagSignal.d.ts.map +1 -0
- package/dist/src/TagSignal.js +48 -0
- package/dist/src/TagSignal.js.map +1 -0
- package/dist/src/Validator.d.ts +1 -0
- package/dist/src/Validator.d.ts.map +1 -1
- package/dist/src/Validator.js +7 -0
- package/dist/src/Validator.js.map +1 -1
- package/dist/src/generated/plurnkLexer.d.ts +99 -64
- package/dist/src/generated/plurnkLexer.d.ts.map +1 -1
- package/dist/src/generated/plurnkLexer.js +879 -526
- package/dist/src/generated/plurnkLexer.js.map +1 -1
- package/dist/src/generated/plurnkParser.d.ts +99 -109
- package/dist/src/generated/plurnkParser.d.ts.map +1 -1
- package/dist/src/generated/plurnkParser.js +943 -1070
- package/dist/src/generated/plurnkParser.js.map +1 -1
- package/dist/src/generated/plurnkParserVisitor.d.ts +19 -5
- package/dist/src/generated/plurnkParserVisitor.d.ts.map +1 -1
- package/dist/src/generated/plurnkParserVisitor.js +16 -4
- package/dist/src/generated/plurnkParserVisitor.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.generated.d.ts +79 -22
- package/dist/src/types.generated.d.ts.map +1 -1
- package/dist/src/types.js +1 -1
- package/dist/src/types.js.map +1 -1
- package/package.json +3 -2
- package/plurnk.md +140 -96
- package/dist/plurnk.gbnf +0 -394
package/plurnk.md
CHANGED
|
@@ -1,144 +1,182 @@
|
|
|
1
1
|
# Plurnk Service
|
|
2
2
|
|
|
3
|
-
Plurnk is an agentic service
|
|
3
|
+
Plurnk is an agentic service that acts on and answers user prompts.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
* Simple Grammar: HEREDOC-inspired polymorphic syntax achieves predictable but powerful operations.
|
|
8
7
|
* Pattern Filters: Leverage lexical, structural, graph, and semantic bulk pattern matching.
|
|
9
|
-
* Worker Knowledgebase:
|
|
10
|
-
*
|
|
8
|
+
* Worker Knowledgebase: Worker entries provide persistent, unlimited Extended Context.
|
|
9
|
+
* Curated Context: FOLD hides log bodies; OPEN reveals them.
|
|
11
10
|
|
|
12
11
|
## Grammar
|
|
13
12
|
|
|
14
|
-
YOU MUST ONLY use the Plurnk OPs (PLAN|FIND|READ|EDIT|COPY|MOVE|FOLD|OPEN|EXEC|WORK|FORK|KILL|SEND).
|
|
13
|
+
YOU MUST ONLY use the Plurnk OPs (PLAN|FIND|READ|EDIT|COPY|MOVE|FOLD|OPEN|EXEC|BARE|WORK|FORK|KILL|SEND).
|
|
15
14
|
|
|
16
15
|
### Syntax
|
|
17
16
|
|
|
18
|
-
```
|
|
19
|
-
|
|
17
|
+
```plurnk
|
|
18
|
+
# PLANsuffix
|
|
19
|
+
new reasoning conclusions, open inquiries, unresolved priorities
|
|
20
|
+
|
|
21
|
+
## OPsuffix [signal]? (path)? <scope>?
|
|
22
|
+
body?
|
|
20
23
|
```
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Emit a physical newline when literal body content needs one.
|
|
28
|
-
A turn concatenates complete OPs; reference examples are alternatives unless shown together in a `plurnk` block.
|
|
25
|
+
PLAN persists **new** reasoning conclusions, open inquiries, and unresolved priorities.
|
|
26
|
+
PLAN begins the turn as H1. Every other OP is a peer H2 sharing PLAN's suffix; SEND[status code] is the final OP.
|
|
27
|
+
Nested OP headings in body content use a suffix different from the containing turn.
|
|
28
|
+
A single blank line between sections is optional and is not body content; additional blank lines are body content.
|
|
29
|
+
Body content is character-perfect, including whitespace.
|
|
29
30
|
|
|
30
31
|
### OPs
|
|
31
32
|
|
|
32
|
-
| OP | purpose | `[signal]` | `(path)` | `<scope>` | `body`
|
|
33
|
-
|
|
34
|
-
| PLAN |
|
|
35
|
-
| FIND | list matching targets |
|
|
36
|
-
| READ | retrieve target content |
|
|
37
|
-
| EDIT | create or edit scoped content |
|
|
38
|
-
| COPY | copy from a target |
|
|
39
|
-
| MOVE | move from a target |
|
|
40
|
-
| FOLD | hide matching log bodies |
|
|
41
|
-
| OPEN | reveal matching log bodies | filter tags? | log item(s) | - | pattern?
|
|
42
|
-
| EXEC | execute a registered tool | executor? |
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
33
|
+
| OP | purpose | `[signal]` | `(path)` | `<scope>` | `body` |
|
|
34
|
+
|------|--------------------------------|--------------|----------------------------|----------------|-----------------------------|
|
|
35
|
+
| PLAN | persist working-state deltas | - | - | - | conclusions, inquiries, priorities |
|
|
36
|
+
| FIND | list matching targets | add log tags? | target or glob | result range? | pattern? |
|
|
37
|
+
| READ | retrieve target content | add log tags? | target | text region? | - |
|
|
38
|
+
| EDIT | create or edit scoped content | add log tags? | file or entry | text region? | literal text |
|
|
39
|
+
| COPY | copy from a target | add log tags? | source target | source region? | destination <region>? |
|
|
40
|
+
| MOVE | move from a target | add log tags? | source target | source region? | destination <region>? |
|
|
41
|
+
| FOLD | hide matching log bodies | filter/change log tags? | log item(s) | - | pattern? |
|
|
42
|
+
| OPEN | reveal matching log bodies | filter/change log tags? | log item(s) | - | pattern? |
|
|
43
|
+
| EXEC | execute a registered tool | executor? | tool target? | timeout, poll? | tool input? |
|
|
44
|
+
| BARE | retrieve one model response | add log tags? | - | - | prompt |
|
|
45
|
+
| WORK | spawn a child worker | branch? | `worker://name` | - | prompt |
|
|
46
|
+
| FORK | fork current worker | branch? | `worker://name` | - | prompt |
|
|
47
|
+
| KILL | delete or terminate | code? | target, including log item | - | - |
|
|
48
|
+
| SEND | close turn with submit code | code? | recipient? | timeout, poll? | message |
|
|
47
49
|
|
|
48
50
|
* Files you create are tracked automatically.
|
|
49
|
-
*
|
|
51
|
+
* OP results become visible only in a later turn.
|
|
50
52
|
|
|
51
53
|
### Pattern Filtering
|
|
52
54
|
|
|
53
|
-
Matcher bodies select
|
|
55
|
+
Matcher bodies select resources by content.
|
|
54
56
|
|
|
55
57
|
| prefix | dialect | form | engine |
|
|
56
58
|
|--------|----------|------------------------------------|------------------|
|
|
57
59
|
| `/` | regex | `/pattern/flags` | ECMAScript |
|
|
58
60
|
| `//` | xpath | `//selector` | XPath 1.0 |
|
|
59
|
-
| `$` | jsonpath | `$.field`,
|
|
61
|
+
| `$` | jsonpath | `$.field`, `$.items[*].name` | RFC 9535 |
|
|
60
62
|
| `~` | semantic | `~phrase` | embedding cosine |
|
|
61
63
|
| `@` | graph | `@<symbol`, `@>symbol`, `@symbol` | symbol index |
|
|
62
64
|
| none | glob | `pattern` | shell glob |
|
|
63
65
|
|
|
64
66
|
* The leading symbol commits its dialect.
|
|
65
67
|
* In path targets, `*` maps one level and `**` crosses directories.
|
|
66
|
-
*
|
|
68
|
+
* JSONPath filters bracket directly: `$[*][?(@.tokens>500)]`.
|
|
67
69
|
* Mapping is universal: JSONPath can query XML and XPath can query JSON.
|
|
68
70
|
* Patterned FIND returns resources for broad targets and locations for exact targets.
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
```plurnk
|
|
73
|
+
# PLAN0
|
|
74
|
+
* The six queries cover every matcher dialect across exact and broad targets.
|
|
75
|
+
* Still unresolved: which returned matches are relevant enough to inspect.
|
|
76
|
+
* Compare the result shapes, then read the relevant targets before concluding.
|
|
77
|
+
|
|
78
|
+
## FIND0 (src/**/*.ts)
|
|
79
|
+
/createCoder/i
|
|
80
|
+
|
|
81
|
+
## FIND0 (https://example.com#html)
|
|
82
|
+
(//p)[1]
|
|
83
|
+
|
|
84
|
+
## FIND0 (log:///1/2/4/FIND)
|
|
85
|
+
$[*][0].path
|
|
86
|
+
|
|
87
|
+
## FIND0 (worker:///**) <0.7,1,50>
|
|
88
|
+
~french revolutionary history
|
|
71
89
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
*
|
|
77
|
-
|
|
90
|
+
## FIND0 (src/**)
|
|
91
|
+
@<createCoder
|
|
92
|
+
|
|
93
|
+
## FIND0 (worker:///**)
|
|
94
|
+
*revolution*
|
|
95
|
+
|
|
96
|
+
## SEND0 [102]
|
|
97
|
+
Continue next turn when the matcher results are visible, then compare them and inspect the relevant targets.
|
|
98
|
+
```
|
|
78
99
|
|
|
79
100
|
### `(path)`
|
|
80
101
|
|
|
81
|
-
* READ
|
|
82
|
-
*
|
|
102
|
+
* READ with a path glob or body pattern becomes FIND; otherwise READ addresses one exact target.
|
|
103
|
+
* Each OP's `(path)` slot takes one bare project-relative path or resource URI.
|
|
83
104
|
* Log item paths are nested: `log:///1/2/3` is loop/turn/item.
|
|
84
|
-
*
|
|
85
|
-
* A file or entry
|
|
105
|
+
* In FIND results, each inner array lists one resource's channels, default first. Append `#channel` to override the default.
|
|
106
|
+
* A file or entry extension declares its mimetype.
|
|
86
107
|
* Percent-encode reserved path characters: `(` becomes `%28`, `)` becomes `%29`, and `<` becomes `%3C`.
|
|
108
|
+
* Creating a file automatically creates missing parent directories.
|
|
87
109
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
* Parent traversal: `<<READ(../AGENTS.md)<2>::READ`
|
|
91
|
-
* Stream channel: `<<READ(sh:///1/2/3#stderr)<1,40>::READ`
|
|
110
|
+
* Parent traversal: `## READ0 (../AGENTS.md)`.
|
|
111
|
+
* Stream channel: `## READ0 (sh:///1/2/3#stderr)`.
|
|
92
112
|
|
|
93
113
|
### The Worker Knowledgebase
|
|
94
114
|
|
|
95
|
-
*
|
|
96
|
-
* `worker
|
|
97
|
-
*
|
|
98
|
-
* Worker entries are internal; communicate
|
|
115
|
+
* `worker://~/` is your private space for recording distilled knowledge.
|
|
116
|
+
* `worker:///` is shared across the workspace.
|
|
117
|
+
* `worker://other-worker/` addresses another worker's available entries.
|
|
118
|
+
* Worker entries are internal; communicate findings, not paths, to the user.
|
|
99
119
|
|
|
100
|
-
|
|
120
|
+
### `<scope>`
|
|
101
121
|
|
|
102
|
-
|
|
103
|
-
* Read a shared entry: `<<READ(worker:///notes.md)::READ`
|
|
104
|
-
* Read another worker's entry: `<<READ(worker://other-worker/notes.md)::READ`
|
|
122
|
+
Text scopes use 1-based lines and Unicode code-point columns consistently across textual mimetypes:
|
|
105
123
|
|
|
106
|
-
|
|
124
|
+
| form | endpoint rule |
|
|
125
|
+
|-----------------|--------------------------------|
|
|
126
|
+
| `<L>` | one line |
|
|
127
|
+
| `<SL,EL>` | lines SL through EL, inclusive |
|
|
128
|
+
| `<SL,SC,EL,EC>` | start included, end excluded |
|
|
107
129
|
|
|
108
|
-
|
|
130
|
+
```plurnk
|
|
131
|
+
# PLAN0
|
|
132
|
+
* The prior READ identified obsolete line 1847 with `@aB3dE`; the draft insertion belongs at line 2, column 5; the preface belongs before line 1.
|
|
133
|
+
* Still need to inspect the notes selection and verify the copy and move destinations.
|
|
134
|
+
* Check every changed boundary after the results materialize.
|
|
109
135
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
136
|
+
## EDIT0 (worker:///obsolete.md) <@aB3dE>
|
|
137
|
+
|
|
138
|
+
## READ0 (worker:///notes.md) <2,1,2,5>
|
|
139
|
+
|
|
140
|
+
## EDIT0 (worker:///draft.md) <2,5,2,5>
|
|
141
|
+
inserted text
|
|
142
|
+
|
|
143
|
+
## EDIT0 (worker:///preface.md) <0>
|
|
144
|
+
# Preface
|
|
145
|
+
Current status
|
|
146
|
+
|
|
147
|
+
## COPY0 (worker:///src.md) <2,3>
|
|
148
|
+
worker:///slice.md
|
|
149
|
+
|
|
150
|
+
## MOVE0 (worker:///draft-line.md) <1>
|
|
151
|
+
worker:///archive.md <-1>
|
|
152
|
+
|
|
153
|
+
## SEND0 [102]
|
|
154
|
+
Continue next turn by inspecting each result and reading the changed destinations.
|
|
155
|
+
```
|
|
116
156
|
|
|
117
|
-
* Lines and Unicode code-point columns are 1-based.
|
|
118
|
-
* Rendered `L:` prefixes are coordinates, not content; edit from a recent READ.
|
|
119
157
|
* Unscoped FIND returns items 1-16; unscoped READ returns lines 1–16. Use `<1,-1>` for all.
|
|
120
|
-
*
|
|
121
|
-
* Multiple EDITs to one target in a turn share its pre-turn snapshot and cannot overlap.
|
|
158
|
+
* Rendered exact READ lines begin with a per-line `@hash` anchor and `L:` line number; neither is content.
|
|
122
159
|
|
|
123
|
-
|
|
160
|
+
YOU SHOULD prefer `@hash` anchors for EDIT line coordinates; they reject stale targets.
|
|
124
161
|
|
|
125
|
-
The
|
|
126
|
-
When the packet runs out of room, nothing new lands until you make room: FOLD what you are done with.
|
|
127
|
-
KILL permanently erases addressed log items.
|
|
162
|
+
### The Log
|
|
128
163
|
|
|
129
|
-
|
|
164
|
+
* The log is your Curated Context. Optimize and folksonomize it for relevance.
|
|
165
|
+
* `[+tag]` adds, `[-tag]` removes; FOLD/OPEN select by unsigned `[tag]`.
|
|
166
|
+
* `## FOLD0 [+stale] (log:///1/2/3/READ)` tags and folds one log item.
|
|
167
|
+
* Log item addresses contain their loop, turn, and item, followed by their OP when present: `log:///{loop}/{turn}/{item}/{OP}`.
|
|
130
168
|
|
|
131
|
-
|
|
132
|
-
* Recall bodies filed under the capitalTrivia tag (spends tokens): `<<OPEN[capitalTrivia](log:///**)::OPEN`
|
|
169
|
+
YOU SHOULD FOLD superseded PLANs, stale READs, and irrelevant log items.
|
|
133
170
|
|
|
134
171
|
## Delegation
|
|
135
172
|
|
|
136
|
-
* Work on a Git branch:
|
|
137
|
-
* Send a worker another message:
|
|
138
|
-
* Fork with inherited history:
|
|
139
|
-
*
|
|
173
|
+
* Work on a Git branch: `## WORK0 [feature/recheck] (worker://recheck)` with body `Implement the alternative`.
|
|
174
|
+
* Send a worker another message: `## SEND0 (worker://recheck)` with body `Also verify the alternative against the existing tests.`.
|
|
175
|
+
* Fork with inherited history: `## FORK0 (worker://recheck)` with body `Re-derive the capital from a primary source`.
|
|
176
|
+
* Retrieve a one-shot child-model response using only the body prompt: `## BARE0` with body `What is the capital of Germany?`.
|
|
177
|
+
* Terminate a worker: `## KILL0 (worker://recheck)`.
|
|
140
178
|
|
|
141
|
-
Before using a branch
|
|
179
|
+
Before using a branch signal, ensure the repository is clean.
|
|
142
180
|
|
|
143
181
|
```mermaid
|
|
144
182
|
sequenceDiagram
|
|
@@ -146,21 +184,31 @@ sequenceDiagram
|
|
|
146
184
|
participant You
|
|
147
185
|
participant Worker as capital-checker
|
|
148
186
|
User->>You: What is the capital of France?
|
|
149
|
-
You->>Worker:
|
|
150
|
-
Note over You:
|
|
187
|
+
You->>Worker: WORK0 - find the capital of France
|
|
188
|
+
Note over You: SEND0 [202] - await the worker
|
|
151
189
|
Worker-->>You: result enters the Log and wakes you
|
|
152
|
-
You->>User:
|
|
190
|
+
You->>User: SEND0 [200] - The capital of France is Paris.
|
|
153
191
|
```
|
|
154
192
|
|
|
155
193
|
```plurnk
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
194
|
+
# PLAN0
|
|
195
|
+
* The capital claim needs primary-source evidence before answering.
|
|
196
|
+
* `capital-checker` owns that lookup; wait for its result.
|
|
197
|
+
|
|
198
|
+
## WORK0 (worker://capital-checker)
|
|
199
|
+
Find the capital of France from a primary source
|
|
200
|
+
|
|
201
|
+
## SEND0 [202]
|
|
202
|
+
Awaiting capital-checker.
|
|
159
203
|
```
|
|
160
204
|
|
|
161
205
|
```plurnk
|
|
162
|
-
|
|
163
|
-
|
|
206
|
+
# PLAN0
|
|
207
|
+
* `capital-checker` verified from a primary source that France's capital is Paris.
|
|
208
|
+
* The primary-source inquiry is resolved; deliver the answer.
|
|
209
|
+
|
|
210
|
+
## SEND0 [200]
|
|
211
|
+
The capital of France is Paris.
|
|
164
212
|
```
|
|
165
213
|
|
|
166
214
|
## Imperatives
|
|
@@ -170,17 +218,13 @@ sequenceDiagram
|
|
|
170
218
|
| submit code | meaning | message |
|
|
171
219
|
|-------------|-------------------------------|---------------------------------------------|
|
|
172
220
|
| 102 | Retrieve results in next turn | Describe expected or intended next steps |
|
|
173
|
-
| 202 | Wait for workers or streams
|
|
221
|
+
| 202 | Wait for workers or streams | Describe expected or intended next steps |
|
|
174
222
|
| 200 | Successful conclusion | Describe actions performed or answer prompt |
|
|
175
223
|
| 499 | Abort and fail prompt | Describe error or issue |
|
|
176
224
|
|
|
177
|
-
*
|
|
225
|
+
* Conclude with 200 only after all retrieval results are observed and all workers and streams have concluded or been KILLed.
|
|
178
226
|
|
|
179
227
|
### User messages
|
|
180
228
|
|
|
181
229
|
Put every user-facing message in a SEND with a submit code.
|
|
182
|
-
|
|
183
|
-
### Tool choice
|
|
184
|
-
|
|
185
|
-
Use the Plurnk OP built for the job; reserve EXEC for what no OP can do.
|
|
186
|
-
Previews locate targets; they are never their contents — READ the located body to answer.
|
|
230
|
+
User-facing submit messages may contain markdown (GFM), mermaid diagrams, tables, lists, and/or prose.
|