@plurnk/plurnk-contracts 1.9.2 → 1.10.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.
Files changed (32) hide show
  1. package/SPEC.md +33 -6
  2. package/dist/conformance/agui-v1.json +32 -1
  3. package/dist/plurnk.gemma.gbnf +2 -1
  4. package/dist/plurnk.qwen.gbnf +2 -1
  5. package/dist/schema/PlurnkStatement.json +611 -161
  6. package/dist/src/ApplicationPort.d.ts +7 -0
  7. package/dist/src/ApplicationPort.d.ts.map +1 -1
  8. package/dist/src/AstBuilder.d.ts +2 -0
  9. package/dist/src/AstBuilder.d.ts.map +1 -1
  10. package/dist/src/AstBuilder.js +57 -13
  11. package/dist/src/AstBuilder.js.map +1 -1
  12. package/dist/src/PlurnkErrorStrategy.js +8 -8
  13. package/dist/src/PlurnkErrorStrategy.js.map +1 -1
  14. package/dist/src/PlurnkParser.d.ts.map +1 -1
  15. package/dist/src/PlurnkParser.js +18 -2
  16. package/dist/src/PlurnkParser.js.map +1 -1
  17. package/dist/src/generated/plurnkLexer.d.ts +12 -0
  18. package/dist/src/generated/plurnkLexer.d.ts.map +1 -1
  19. package/dist/src/generated/plurnkLexer.js +429 -367
  20. package/dist/src/generated/plurnkLexer.js.map +1 -1
  21. package/dist/src/generated/plurnkParser.d.ts +19 -9
  22. package/dist/src/generated/plurnkParser.d.ts.map +1 -1
  23. package/dist/src/generated/plurnkParser.js +564 -659
  24. package/dist/src/generated/plurnkParser.js.map +1 -1
  25. package/dist/src/generated/plurnkParserVisitor.d.ts +7 -0
  26. package/dist/src/generated/plurnkParserVisitor.d.ts.map +1 -1
  27. package/dist/src/generated/plurnkParserVisitor.js +6 -0
  28. package/dist/src/generated/plurnkParserVisitor.js.map +1 -1
  29. package/dist/src/types.generated.d.ts +1 -0
  30. package/dist/src/types.generated.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/plurnk.md +76 -141
package/SPEC.md CHANGED
@@ -224,7 +224,7 @@ framed-turn ::= turn | fence-open turn fence-close
224
224
  turn ::= plan sep tail-0
225
225
  ```
226
226
 
227
- §gbnf-turn-shape The `gemma` transport root samples one complete
227
+ §gbnf-turn-shape Neither rail admits an empty thought: the `gemma` channel body and the `qwen` think body each begin with at least one character, so a constrained call reasons before it acts. The `gemma` transport root samples one complete
228
228
  `<|channel>thought\n … <channel|>` enclosure. A Qwen-style chat template has
229
229
  already supplied `<think>\n` when the `qwen` transport root begins, so that root
230
230
  samples the body and required `</think>` closer. Each generated artifact declares
@@ -330,6 +330,15 @@ more horizontal whitespace characters before each slot and any permutation of
330
330
  the slots admitted by that operation, at most once each. Accepted spacing and
331
331
  permutation are not second canonical spellings.
332
332
 
333
+ §heading-inline-body Text that follows the last slot on a heading line — after
334
+ horizontal whitespace, beginning with a character that cannot open a slot (not `[`,
335
+ `(`, or `<`) — is the first body line: `## EXEC0 [crm] (crm_query) {"soql": "…"}` and
336
+ `## FIND0 (src/**) /createCoder/i` parse as their canonical two-line forms. Nothing is
337
+ lost and the stored statement is canonical; the spelling is tolerated and announced:
338
+ one warning-severity advisory follows the statement, naming the heading and the rule
339
+ (body content goes immediately beneath the OP heading line), so the model learns
340
+ the form from the packet and never from silent acceptance.
341
+
333
342
  §operation-annotation A heading may end with one single-line Markdown HTML
334
343
  comment. AstBuilder strips the delimiters and surrounding horizontal whitespace
335
344
  into the statement's fixed `annotation: string | null` field. The annotation is
@@ -421,6 +430,12 @@ to ACP v1
421
430
  [`schema-v1.21.0`](https://github.com/agentclientprotocol/agent-client-protocol/tree/schema-v1.21.0)
422
431
  commit `272bf799f35a258c6a4107a0410ed361e83683d3`.
423
432
 
433
+ §exec-tag-signal EXEC's bracket slot names its runtime. A bracket whose first character is
434
+ a sign is a tag signal instead — a runtime never starts with `+` or `-` — so
435
+ `## EXEC0 [+fetch] (.)` and `## EXEC0 [crm] [+schema] (crm_describe)` admit: the tags
436
+ classify the log row exactly as on FIND or READ, the runtime is the explicit one or the
437
+ default shell, and each slot appears at most once.
438
+
424
439
  §log-tag-signal FIND, READ, EDIT, COPY, MOVE, and BARE canonically express additions
425
440
  as `+tag`. Because those operations have no tag-selection semantics, ANTLR also
426
441
  tolerates unsigned `tag` as an equivalent addition; `-tag` is invalid. Core
@@ -1142,7 +1157,9 @@ explicit `null` means roots. Singular and plural cardinalities are distinct
1142
1157
  contracts. Observation is not a client binding or permission grant.
1143
1158
 
1144
1159
  §application-loop-observation Loop observation exposes the durable scheduler
1145
- state and exact terminal `OperationResult` for one owned Worker. Exterior
1160
+ state, exact terminal `OperationResult`, and exact count of packet-bearing
1161
+ Turns for one owned Worker. Packetless producer Turns and physical provider
1162
+ retries do not contribute to `packetCount`. Exterior
1146
1163
  adapters consume this projection instead of reconstructing lifecycle from
1147
1164
  events or persistence; events remain the live notification edge.
1148
1165
 
@@ -1208,10 +1225,11 @@ turn-shape imperatives (begin with `# PLAN0`, end with a terminal
1208
1225
  `## EXEC0 <-1,300>`” instead of a raw `unrecognized character`. The redirect is
1209
1226
  EXEC-scoped because its signal mode is exclusive; SEND/KILL are untouched.
1210
1227
  - §matcher-body-redirect **Matcher body in the slot region.** When the
1211
- post-target header region begins with `$`, `~`, or `@`, the lexer redirects
1212
- the unambiguous matcher to the first body line instead of returning the
1213
- generic slot list. Slash-led regex and XPath are excluded because `/` can be
1214
- target data.
1228
+ post-target header region begins with `$`, `~`, or `@` with no whitespace
1229
+ before it, the lexer redirects the unambiguous matcher to body content below the
1230
+ OP heading instead of returning the generic slot list (after whitespace it is
1231
+ already the inline body, {§heading-inline-body}). Slash-led regex and XPath are
1232
+ excluded because `/` can be target data.
1215
1233
  - §combined-anchor-line-redirect **Combined anchor and line number in a scope.**
1216
1234
  A text-coordinate scope containing `@hash:L` or `@hash L` is one bounded hard
1217
1235
  error: `a scope position accepts one line coordinate; use the \`@hash\` anchor
@@ -1225,6 +1243,15 @@ turn-shape imperatives (begin with `# PLAN0`, end with a terminal
1225
1243
  \`[…]\` tag slot; a target goes in \`(…)\`. Try \`## EDIT0 (path)\``). It is
1226
1244
  gated on a path-shaped signal so a genuine additive-tag signal is not mis-steered
1227
1245
  toward a path it lacks.
1246
+ - §misplaced-annotation-advisory **Annotation in the body.** A READ or FIND whose
1247
+ body is solely an HTML comment (`<!-- … -->`) can never carry a matcher: it is
1248
+ the annotation the model put on the line below the heading. The builder takes
1249
+ the comment as the annotation when the heading has none, builds the operation
1250
+ with no body, and raises one warning-severity advisory naming what happened
1251
+ and the correct form (`## READ0 (…) <…> <!-- … -->`); the parser places the
1252
+ advisory right after its statement and the service delivers it as a
1253
+ `parse_advisory` notice with its position. A body with any other content is a
1254
+ matcher, as before.
1228
1255
 
1229
1256
  §error-shape The diagnostic class determines how much guidance the parser may
1230
1257
  provide:
@@ -61,6 +61,29 @@
61
61
  "name": "ordinary-run",
62
62
  "events": [
63
63
  { "type": "RUN_STARTED", "threadId": "fixture", "runId": "run" },
64
+ {
65
+ "type": "STATE_SNAPSHOT",
66
+ "snapshot": {
67
+ "plurnk": {
68
+ "status": {
69
+ "lifecycle": "idle",
70
+ "model": null,
71
+ "loopId": null,
72
+ "packetCount": 0,
73
+ "activity": null
74
+ }
75
+ },
76
+ "budget": {}
77
+ }
78
+ },
79
+ {
80
+ "type": "STATE_DELTA",
81
+ "delta": [
82
+ { "op": "replace", "path": "/plurnk/status/lifecycle", "value": "running" },
83
+ { "op": "replace", "path": "/plurnk/status/loopId", "value": 1 },
84
+ { "op": "replace", "path": "/plurnk/status/packetCount", "value": 1 }
85
+ ]
86
+ },
64
87
  {
65
88
  "type": "CUSTOM",
66
89
  "name": "plurnk.row",
@@ -73,6 +96,14 @@
73
96
  "tx": { "body": "Work." }
74
97
  }
75
98
  },
99
+ {
100
+ "type": "STATE_DELTA",
101
+ "delta": [
102
+ { "op": "replace", "path": "/plurnk/status/lifecycle", "value": "completed" },
103
+ { "op": "replace", "path": "/plurnk/status/loopId", "value": 1 },
104
+ { "op": "replace", "path": "/plurnk/status/activity", "value": null }
105
+ ]
106
+ },
76
107
  {
77
108
  "type": "CUSTOM",
78
109
  "name": "plurnk.terminated",
@@ -103,7 +134,7 @@
103
134
  ],
104
135
  "expect": {
105
136
  "completion": "success",
106
- "families": ["log/entry", "loop/terminated"],
137
+ "families": ["log/entry", "loop/packet", "loop/terminated"],
107
138
  "status": 200
108
139
  }
109
140
  },
@@ -114,7 +114,8 @@ rz-chan-b22 ::= ("<" rz-chan-b1 | [|chanl>toug\n] rz-chan-b0 | "e" rz-chan-b23 |
114
114
  rz-chan-b23 ::= ("<" rz-chan-b1 | [|chane>toug\n] rz-chan-b0 | "l" rz-chan-b24 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F<|chanel>toug\n] rz-chan-b0)?
115
115
  rz-chan-b24 ::= ("<" rz-chan-b1 | "|" rz-chan-b25 | [chanel>toug\n] rz-chan-b0 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F<|chanel>toug\n] rz-chan-b0)?
116
116
  rz-chan-b25 ::= ("<" rz-chan-b1 | [|chaneltoug\n] rz-chan-b0 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F<|chanel>toug\n] rz-chan-b0)?
117
- channel ::= "<|channel>thought\n" rz-chan-b0 "<channel|>"
117
+ rz-chan-first ::= [0-9A-Za-z]
118
+ channel ::= "<|channel>thought\n" rz-chan-first rz-chan-b0 "<channel|>"
118
119
  turn ::= plan tail-0
119
120
  framed-turn ::= turn | "```plurnk\n" turn "\n```"
120
121
  root-gemma ::= channel sep framed-turn
@@ -102,7 +102,8 @@ rz-think-b10 ::= ("<" rz-think-b1 | [thnk>\n/] rz-think-b0 | "i" rz-think-b11 |
102
102
  rz-think-b11 ::= ("<" rz-think-b1 | [thik>\n/] rz-think-b0 | "n" rz-think-b12 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F<think>\n/] rz-think-b0)?
103
103
  rz-think-b12 ::= ("<" rz-think-b1 | [thin>\n/] rz-think-b0 | "k" rz-think-b13 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F<think>\n/] rz-think-b0)?
104
104
  rz-think-b13 ::= ("<" rz-think-b1 | [think\n/] rz-think-b0 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F<think>\n/] rz-think-b0)?
105
- qwen-tail ::= rz-think-b0 "</think>"
105
+ rz-think-first ::= [0-9A-Za-z]
106
+ qwen-tail ::= rz-think-first rz-think-b0 "</think>"
106
107
  turn ::= plan tail-0
107
108
  framed-turn ::= turn | "```plurnk\n" turn "\n```"
108
109
  root-qwen ::= qwen-tail sep framed-turn