@plurnk/plurnk-contracts 1.4.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.
Files changed (81) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -0
  3. package/SPEC.md +954 -0
  4. package/bin/plurnk-contracts.js +43 -0
  5. package/dist/plurnk.gbnf +394 -0
  6. package/dist/schema/ClientDisplayCapabilities.json +54 -0
  7. package/dist/schema/ClientStatement.json +68 -0
  8. package/dist/schema/EntryReadResult.json +101 -0
  9. package/dist/schema/LineMarker.json +16 -0
  10. package/dist/schema/LoopFlags.json +16 -0
  11. package/dist/schema/MatcherBody.json +84 -0
  12. package/dist/schema/Notice.json +67 -0
  13. package/dist/schema/OperationResult.json +44 -0
  14. package/dist/schema/ParsedPath.json +64 -0
  15. package/dist/schema/PlurnkStatement.json +264 -0
  16. package/dist/schema/Position.json +20 -0
  17. package/dist/schema/ProblemDetails.json +51 -0
  18. package/dist/schema/ProposalDisposition.json +26 -0
  19. package/dist/schema/ProposalProjection.json +44 -0
  20. package/dist/schema/ProviderCost.json +69 -0
  21. package/dist/schema/ResourceSelection.json +20 -0
  22. package/dist/schema/SendBody.json +13 -0
  23. package/dist/schema/TextRegion.json +31 -0
  24. package/dist/src/AstBuilder.d.ts +24 -0
  25. package/dist/src/AstBuilder.d.ts.map +1 -0
  26. package/dist/src/AstBuilder.js +609 -0
  27. package/dist/src/AstBuilder.js.map +1 -0
  28. package/dist/src/PathSyntax.d.ts +9 -0
  29. package/dist/src/PathSyntax.d.ts.map +1 -0
  30. package/dist/src/PathSyntax.js +36 -0
  31. package/dist/src/PathSyntax.js.map +1 -0
  32. package/dist/src/PlurnkErrorStrategy.d.ts +10 -0
  33. package/dist/src/PlurnkErrorStrategy.d.ts.map +1 -0
  34. package/dist/src/PlurnkErrorStrategy.js +147 -0
  35. package/dist/src/PlurnkErrorStrategy.js.map +1 -0
  36. package/dist/src/PlurnkParseError.d.ts +17 -0
  37. package/dist/src/PlurnkParseError.d.ts.map +1 -0
  38. package/dist/src/PlurnkParseError.js +24 -0
  39. package/dist/src/PlurnkParseError.js.map +1 -0
  40. package/dist/src/PlurnkParser.d.ts +9 -0
  41. package/dist/src/PlurnkParser.d.ts.map +1 -0
  42. package/dist/src/PlurnkParser.js +396 -0
  43. package/dist/src/PlurnkParser.js.map +1 -0
  44. package/dist/src/Problems.d.ts +8 -0
  45. package/dist/src/Problems.d.ts.map +1 -0
  46. package/dist/src/Problems.js +23 -0
  47. package/dist/src/Problems.js.map +1 -0
  48. package/dist/src/RecordingListener.d.ts +9 -0
  49. package/dist/src/RecordingListener.d.ts.map +1 -0
  50. package/dist/src/RecordingListener.js +19 -0
  51. package/dist/src/RecordingListener.js.map +1 -0
  52. package/dist/src/Validator.d.ts +49 -0
  53. package/dist/src/Validator.d.ts.map +1 -0
  54. package/dist/src/Validator.js +211 -0
  55. package/dist/src/Validator.js.map +1 -0
  56. package/dist/src/generated/plurnkLexer.d.ts +129 -0
  57. package/dist/src/generated/plurnkLexer.d.ts.map +1 -0
  58. package/dist/src/generated/plurnkLexer.js +808 -0
  59. package/dist/src/generated/plurnkLexer.js.map +1 -0
  60. package/dist/src/generated/plurnkParser.d.ts +525 -0
  61. package/dist/src/generated/plurnkParser.d.ts.map +1 -0
  62. package/dist/src/generated/plurnkParser.js +3896 -0
  63. package/dist/src/generated/plurnkParser.js.map +1 -0
  64. package/dist/src/generated/plurnkParserVisitor.d.ts +298 -0
  65. package/dist/src/generated/plurnkParserVisitor.d.ts.map +1 -0
  66. package/dist/src/generated/plurnkParserVisitor.js +257 -0
  67. package/dist/src/generated/plurnkParserVisitor.js.map +1 -0
  68. package/dist/src/index.d.ts +13 -0
  69. package/dist/src/index.d.ts.map +1 -0
  70. package/dist/src/index.js +10 -0
  71. package/dist/src/index.js.map +1 -0
  72. package/dist/src/types.d.ts +29 -0
  73. package/dist/src/types.d.ts.map +1 -0
  74. package/dist/src/types.generated.d.ts +450 -0
  75. package/dist/src/types.generated.d.ts.map +1 -0
  76. package/dist/src/types.generated.js +4 -0
  77. package/dist/src/types.generated.js.map +1 -0
  78. package/dist/src/types.js +23 -0
  79. package/dist/src/types.js.map +1 -0
  80. package/package.json +87 -0
  81. package/plurnk.md +220 -0
@@ -0,0 +1,264 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/PlurnkStatement.json",
4
+ "title": "PlurnkStatement",
5
+ "description": "The parsed AST union for one protocol statement, discriminated by `op`. Every variant has fixed signal, target, lineMarker, body, suffix, and source-position fields; operation-specific schemas constrain their types. A null field records an omitted tolerated slot and does not satisfy runtime requirements by itself.",
6
+ "oneOf": [
7
+ { "$ref": "#/$defs/FindStatement" },
8
+ { "$ref": "#/$defs/ReadStatement" },
9
+ { "$ref": "#/$defs/OpenStatement" },
10
+ { "$ref": "#/$defs/FoldStatement" },
11
+ { "$ref": "#/$defs/EditStatement" },
12
+ { "$ref": "#/$defs/CopyStatement" },
13
+ { "$ref": "#/$defs/MoveStatement" },
14
+ { "$ref": "#/$defs/SendStatement" },
15
+ { "$ref": "#/$defs/ExecStatement" },
16
+ { "$ref": "#/$defs/WorkStatement" },
17
+ { "$ref": "#/$defs/ForkStatement" },
18
+ { "$ref": "#/$defs/KillStatement" },
19
+ { "$ref": "#/$defs/PlanStatement" }
20
+ ],
21
+ "$defs": {
22
+ "TagSignal": {
23
+ "oneOf": [
24
+ { "type": "array", "items": { "type": "string" } },
25
+ { "type": "null" }
26
+ ]
27
+ },
28
+ "PathOrNull": {
29
+ "oneOf": [
30
+ { "$ref": "https://schemas.plurnk.dev/v0/ParsedPath.json" },
31
+ { "type": "null" }
32
+ ]
33
+ },
34
+ "LineMarkerOrNull": {
35
+ "oneOf": [
36
+ { "$ref": "https://schemas.plurnk.dev/v0/LineMarker.json" },
37
+ { "type": "null" }
38
+ ]
39
+ },
40
+ "MatcherBodyOrNull": {
41
+ "oneOf": [
42
+ { "$ref": "https://schemas.plurnk.dev/v0/MatcherBody.json" },
43
+ { "type": "null" }
44
+ ]
45
+ },
46
+ "SendBodyOrNull": {
47
+ "oneOf": [
48
+ { "$ref": "https://schemas.plurnk.dev/v0/SendBody.json" },
49
+ { "type": "null" }
50
+ ]
51
+ },
52
+ "ResourceSelectionOrNull": {
53
+ "oneOf": [
54
+ { "$ref": "https://schemas.plurnk.dev/v0/ResourceSelection.json" },
55
+ { "type": "null" }
56
+ ]
57
+ },
58
+ "PositionRef": {
59
+ "$ref": "https://schemas.plurnk.dev/v0/Position.json"
60
+ },
61
+ "FindStatement": {
62
+ "type": "object",
63
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
64
+ "additionalProperties": false,
65
+ "properties": {
66
+ "op": { "const": "FIND" },
67
+ "suffix": { "type": "string" },
68
+ "signal": { "$ref": "#/$defs/TagSignal" },
69
+ "target": { "$ref": "#/$defs/PathOrNull" },
70
+ "lineMarker": { "$ref": "#/$defs/LineMarkerOrNull" },
71
+ "body": { "$ref": "#/$defs/MatcherBodyOrNull" },
72
+ "position": { "$ref": "#/$defs/PositionRef" }
73
+ }
74
+ },
75
+ "ReadStatement": {
76
+ "type": "object",
77
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
78
+ "additionalProperties": false,
79
+ "properties": {
80
+ "op": { "const": "READ" },
81
+ "suffix": { "type": "string" },
82
+ "signal": { "$ref": "#/$defs/TagSignal" },
83
+ "target": { "$ref": "#/$defs/PathOrNull" },
84
+ "lineMarker": { "$ref": "#/$defs/LineMarkerOrNull" },
85
+ "body": { "$ref": "#/$defs/MatcherBodyOrNull" },
86
+ "position": { "$ref": "#/$defs/PositionRef" }
87
+ }
88
+ },
89
+ "OpenStatement": {
90
+ "type": "object",
91
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
92
+ "additionalProperties": false,
93
+ "properties": {
94
+ "op": { "const": "OPEN" },
95
+ "suffix": { "type": "string" },
96
+ "signal": { "$ref": "#/$defs/TagSignal" },
97
+ "target": { "$ref": "#/$defs/PathOrNull" },
98
+ "lineMarker": { "type": "null" },
99
+ "body": { "$ref": "#/$defs/MatcherBodyOrNull" },
100
+ "position": { "$ref": "#/$defs/PositionRef" }
101
+ }
102
+ },
103
+ "FoldStatement": {
104
+ "type": "object",
105
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
106
+ "additionalProperties": false,
107
+ "properties": {
108
+ "op": { "const": "FOLD" },
109
+ "suffix": { "type": "string" },
110
+ "signal": { "$ref": "#/$defs/TagSignal" },
111
+ "target": { "$ref": "#/$defs/PathOrNull" },
112
+ "lineMarker": { "type": "null" },
113
+ "body": { "$ref": "#/$defs/MatcherBodyOrNull" },
114
+ "position": { "$ref": "#/$defs/PositionRef" }
115
+ }
116
+ },
117
+ "EditStatement": {
118
+ "type": "object",
119
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
120
+ "additionalProperties": false,
121
+ "properties": {
122
+ "op": { "const": "EDIT" },
123
+ "suffix": { "type": "string" },
124
+ "signal": { "$ref": "#/$defs/TagSignal" },
125
+ "target": { "$ref": "#/$defs/PathOrNull" },
126
+ "lineMarker": { "$ref": "#/$defs/LineMarkerOrNull" },
127
+ "body": { "type": ["string", "null"] },
128
+ "position": { "$ref": "#/$defs/PositionRef" }
129
+ }
130
+ },
131
+ "CopyStatement": {
132
+ "type": "object",
133
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
134
+ "additionalProperties": false,
135
+ "properties": {
136
+ "op": { "const": "COPY" },
137
+ "suffix": { "type": "string" },
138
+ "signal": { "$ref": "#/$defs/TagSignal" },
139
+ "target": { "$ref": "#/$defs/PathOrNull" },
140
+ "lineMarker": { "$ref": "#/$defs/LineMarkerOrNull" },
141
+ "body": { "$ref": "#/$defs/ResourceSelectionOrNull" },
142
+ "position": { "$ref": "#/$defs/PositionRef" }
143
+ }
144
+ },
145
+ "MoveStatement": {
146
+ "type": "object",
147
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
148
+ "additionalProperties": false,
149
+ "properties": {
150
+ "op": { "const": "MOVE" },
151
+ "suffix": { "type": "string" },
152
+ "signal": { "$ref": "#/$defs/TagSignal" },
153
+ "target": { "$ref": "#/$defs/PathOrNull" },
154
+ "lineMarker": { "$ref": "#/$defs/LineMarkerOrNull" },
155
+ "body": { "$ref": "#/$defs/ResourceSelectionOrNull" },
156
+ "position": { "$ref": "#/$defs/PositionRef" }
157
+ }
158
+ },
159
+ "SendStatement": {
160
+ "type": "object",
161
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
162
+ "additionalProperties": false,
163
+ "properties": {
164
+ "op": { "const": "SEND" },
165
+ "suffix": { "type": "string" },
166
+ "signal": {
167
+ "oneOf": [
168
+ { "type": "number" },
169
+ { "type": "null" }
170
+ ]
171
+ },
172
+ "target": { "$ref": "#/$defs/PathOrNull" },
173
+ "lineMarker": { "$ref": "#/$defs/LineMarkerOrNull" },
174
+ "body": { "$ref": "#/$defs/SendBodyOrNull" },
175
+ "position": { "$ref": "#/$defs/PositionRef" }
176
+ }
177
+ },
178
+ "ExecStatement": {
179
+ "type": "object",
180
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
181
+ "additionalProperties": false,
182
+ "properties": {
183
+ "op": { "const": "EXEC" },
184
+ "suffix": { "type": "string" },
185
+ "signal": { "type": ["string", "null"] },
186
+ "target": { "$ref": "#/$defs/PathOrNull" },
187
+ "lineMarker": { "$ref": "#/$defs/LineMarkerOrNull" },
188
+ "body": { "type": ["string", "null"] },
189
+ "position": { "$ref": "#/$defs/PositionRef" }
190
+ }
191
+ },
192
+ "PlanStatement": {
193
+ "type": "object",
194
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
195
+ "additionalProperties": false,
196
+ "properties": {
197
+ "op": { "const": "PLAN" },
198
+ "suffix": { "type": "string" },
199
+ "signal": { "$ref": "#/$defs/TagSignal" },
200
+ "target": { "$ref": "#/$defs/PathOrNull" },
201
+ "lineMarker": { "$ref": "#/$defs/LineMarkerOrNull" },
202
+ "body": { "type": ["string", "null"] },
203
+ "position": { "$ref": "#/$defs/PositionRef" }
204
+ }
205
+ },
206
+ "KillStatement": {
207
+ "type": "object",
208
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
209
+ "additionalProperties": false,
210
+ "properties": {
211
+ "op": { "const": "KILL" },
212
+ "suffix": { "type": "string" },
213
+ "signal": {
214
+ "oneOf": [
215
+ { "type": "number" },
216
+ { "type": "null" }
217
+ ]
218
+ },
219
+ "target": { "$ref": "#/$defs/PathOrNull" },
220
+ "lineMarker": { "type": "null" },
221
+ "body": { "type": ["string", "null"] },
222
+ "position": { "$ref": "#/$defs/PositionRef" }
223
+ }
224
+ },
225
+ "WorkStatement": {
226
+ "type": "object",
227
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
228
+ "additionalProperties": false,
229
+ "properties": {
230
+ "op": { "const": "WORK" },
231
+ "suffix": { "type": "string" },
232
+ "signal": {
233
+ "oneOf": [
234
+ { "type": "string", "minLength": 1 },
235
+ { "type": "null" }
236
+ ]
237
+ },
238
+ "target": { "$ref": "#/$defs/PathOrNull" },
239
+ "lineMarker": { "type": "null" },
240
+ "body": { "type": "string", "minLength": 1 },
241
+ "position": { "$ref": "#/$defs/PositionRef" }
242
+ }
243
+ },
244
+ "ForkStatement": {
245
+ "type": "object",
246
+ "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
247
+ "additionalProperties": false,
248
+ "properties": {
249
+ "op": { "const": "FORK" },
250
+ "suffix": { "type": "string" },
251
+ "signal": {
252
+ "oneOf": [
253
+ { "type": "string", "minLength": 1 },
254
+ { "type": "null" }
255
+ ]
256
+ },
257
+ "target": { "$ref": "#/$defs/PathOrNull" },
258
+ "lineMarker": { "type": "null" },
259
+ "body": { "type": "string", "minLength": 1 },
260
+ "position": { "$ref": "#/$defs/PositionRef" }
261
+ }
262
+ }
263
+ }
264
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/Position.json",
4
+ "title": "Position",
5
+ "description": "A source point in parsed PLURNK input. Lines are 1-based; columns are 0-based Unicode code points. LF and CRLF delimit lines, while a lone CR occupies one column. The exact pair {line: 0, column: 0} is the sole unknown/degraded position.",
6
+ "type": "object",
7
+ "required": ["line", "column"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "line": { "type": "integer", "minimum": 0 },
11
+ "column": { "type": "integer", "minimum": 0 }
12
+ },
13
+ "if": {
14
+ "properties": { "line": { "const": 0 } },
15
+ "required": ["line"]
16
+ },
17
+ "then": {
18
+ "properties": { "column": { "const": 0 } }
19
+ }
20
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/ProblemDetails.json",
4
+ "title": "ProblemDetails",
5
+ "description": "PLURNK operation failure using RFC 9457 Problem Details. Extension members are permitted so an owning boundary can add structured causal and recovery facts without inventing a second error envelope.",
6
+ "type": "object",
7
+ "required": ["type", "title", "status", "detail"],
8
+ "additionalProperties": true,
9
+ "properties": {
10
+ "type": {
11
+ "type": "string",
12
+ "pattern": "^[a-zA-Z][a-zA-Z0-9+.-]*:",
13
+ "description": "Absolute URI identifying the stable problem class."
14
+ },
15
+ "title": {
16
+ "type": "string",
17
+ "minLength": 1,
18
+ "description": "Short, stable summary for this problem type."
19
+ },
20
+ "status": {
21
+ "type": "integer",
22
+ "minimum": 400,
23
+ "maximum": 599,
24
+ "description": "Operation status. It must equal the containing result status."
25
+ },
26
+ "detail": {
27
+ "type": "string",
28
+ "minLength": 1,
29
+ "description": "Specific, causal explanation of this occurrence."
30
+ },
31
+ "instance": {
32
+ "type": "string",
33
+ "pattern": "^[a-zA-Z][a-zA-Z0-9+.-]*:",
34
+ "description": "Absolute URI identifying the failed durable operation, normally its log URI. Core adds it at persistence when a plugin cannot know the durable coordinate."
35
+ },
36
+ "stage": {
37
+ "type": "string",
38
+ "minLength": 1,
39
+ "description": "Stable producer-owned stage at which the operation failed, when the operation has multiple independently recoverable stages."
40
+ },
41
+ "recovery": {
42
+ "type": "string",
43
+ "minLength": 1,
44
+ "description": "One generally valid next action. It is omitted when recovery depends on facts the producer does not know."
45
+ },
46
+ "retryable": {
47
+ "type": "boolean",
48
+ "description": "Whether the producer recommends automatically retrying the identical request."
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/ProposalDisposition.json",
4
+ "title": "ProposalDisposition",
5
+ "description": "The one core-owned settlement decision for a pending proposal. Client-owned proposals require an external resolution; loop-owned proposals carry the exact automatic resolution core applies.",
6
+ "oneOf": [
7
+ {
8
+ "type": "object",
9
+ "required": ["owner"],
10
+ "additionalProperties": false,
11
+ "properties": {
12
+ "owner": { "const": "client" }
13
+ }
14
+ },
15
+ {
16
+ "type": "object",
17
+ "required": ["owner", "decision"],
18
+ "additionalProperties": false,
19
+ "properties": {
20
+ "owner": { "const": "loop" },
21
+ "decision": { "enum": ["accept", "reject"] },
22
+ "outcome": { "type": "string", "minLength": 1 }
23
+ }
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/ProposalProjection.json",
4
+ "title": "ProposalProjection",
5
+ "description": "The runtime-neutral client-interface projection of one durable stopped-world proposal. Live delivery and reconnect discovery expose this same shape.",
6
+ "type": "object",
7
+ "required": [
8
+ "logEntryId",
9
+ "workerId",
10
+ "loopId",
11
+ "turnId",
12
+ "op",
13
+ "target",
14
+ "body",
15
+ "attrs",
16
+ "flags",
17
+ "staleClobberRisk",
18
+ "disposition"
19
+ ],
20
+ "additionalProperties": false,
21
+ "properties": {
22
+ "logEntryId": { "type": "integer", "minimum": 1 },
23
+ "workerId": { "type": "integer", "minimum": 1 },
24
+ "loopId": { "type": "integer", "minimum": 1 },
25
+ "turnId": { "type": "integer", "minimum": 1 },
26
+ "op": {
27
+ "enum": ["FIND", "READ", "EDIT", "COPY", "MOVE", "OPEN", "FOLD", "SEND", "EXEC", "WORK", "FORK", "KILL", "PLAN"]
28
+ },
29
+ "target": {
30
+ "type": "object",
31
+ "required": ["scheme", "pathname"],
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "scheme": { "type": ["string", "null"] },
35
+ "pathname": { "type": ["string", "null"] }
36
+ }
37
+ },
38
+ "body": { "type": "string" },
39
+ "attrs": { "type": "object", "additionalProperties": true },
40
+ "flags": { "$ref": "https://schemas.plurnk.dev/v0/LoopFlags.json" },
41
+ "staleClobberRisk": { "type": "boolean" },
42
+ "disposition": { "$ref": "https://schemas.plurnk.dev/v0/ProposalDisposition.json" }
43
+ }
44
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://plurnk.dev/schema/ProviderCost.json",
4
+ "title": "ProviderCost",
5
+ "description": "Validated monetary evidence for one provider attempt. Unknown is never represented as zero.",
6
+ "oneOf": [
7
+ {
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "required": ["kind", "amount", "usdEquivalent", "source"],
11
+ "properties": {
12
+ "kind": { "const": "authoritative" },
13
+ "amount": { "$ref": "#/$defs/MonetaryAmount" },
14
+ "usdEquivalent": { "$ref": "#/$defs/DecimalAmount" },
15
+ "source": { "$ref": "#/$defs/NonEmptyString" }
16
+ }
17
+ },
18
+ {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "required": ["kind", "usd", "source"],
22
+ "properties": {
23
+ "kind": { "const": "estimated" },
24
+ "usd": { "$ref": "#/$defs/DecimalAmount" },
25
+ "source": { "$ref": "#/$defs/NonEmptyString" }
26
+ }
27
+ },
28
+ {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": ["kind", "source"],
32
+ "properties": {
33
+ "kind": { "const": "free" },
34
+ "source": { "$ref": "#/$defs/NonEmptyString" }
35
+ }
36
+ },
37
+ {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "required": ["kind", "reason"],
41
+ "properties": {
42
+ "kind": { "const": "unknown" },
43
+ "reason": { "$ref": "#/$defs/NonEmptyString" }
44
+ }
45
+ }
46
+ ],
47
+ "$defs": {
48
+ "DecimalAmount": {
49
+ "type": "string",
50
+ "pattern": "^(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$"
51
+ },
52
+ "NonEmptyString": {
53
+ "type": "string",
54
+ "minLength": 1
55
+ },
56
+ "MonetaryAmount": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "required": ["amount", "currency"],
60
+ "properties": {
61
+ "amount": { "$ref": "#/$defs/DecimalAmount" },
62
+ "currency": {
63
+ "type": "string",
64
+ "pattern": "^[A-Z][A-Z0-9]{2,11}$"
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/ResourceSelection.json",
4
+ "title": "ResourceSelection",
5
+ "description": "A COPY/MOVE destination target and optional text scope. A target without a fragment selects the scheme's default channel; a fragment selects a named channel; lineMarker scopes the selected destination content.",
6
+ "type": "object",
7
+ "required": ["target", "lineMarker"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "target": {
11
+ "$ref": "https://schemas.plurnk.dev/v0/ParsedPath.json"
12
+ },
13
+ "lineMarker": {
14
+ "oneOf": [
15
+ { "$ref": "https://schemas.plurnk.dev/v0/LineMarker.json" },
16
+ { "type": "null" }
17
+ ]
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/SendBody.json",
4
+ "title": "SendBody",
5
+ "description": "Parsed body of a SEND statement. `raw` is the literal body text; `json` is the best-effort `JSON.parse(raw)` result, or null when the body isn't valid JSON.",
6
+ "type": "object",
7
+ "required": ["raw", "json"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "raw": { "type": "string" },
11
+ "json": true
12
+ }
13
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/TextRegion.json",
4
+ "title": "TextRegion",
5
+ "description": "A contiguous region of text. Lines and Unicode code-point columns are 1-based; the start is included and the end is excluded.",
6
+ "type": "object",
7
+ "required": ["startLine", "startColumn", "endLine", "endColumn"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "startLine": {
11
+ "type": "integer",
12
+ "minimum": 1,
13
+ "maximum": 9007199254740991
14
+ },
15
+ "startColumn": {
16
+ "type": "integer",
17
+ "minimum": 1,
18
+ "maximum": 9007199254740991
19
+ },
20
+ "endLine": {
21
+ "type": "integer",
22
+ "minimum": 1,
23
+ "maximum": 9007199254740991
24
+ },
25
+ "endColumn": {
26
+ "type": "integer",
27
+ "minimum": 1,
28
+ "maximum": 9007199254740991
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,24 @@
1
+ import type { ClientStatement, ResourceSelection, ParsedPath, PlurnkStatement, Position } from "./types.ts";
2
+ import type { ClientStatementContext, StatementContext, MidStatementContext } from "./generated/plurnkParser.ts";
3
+ import { PlanStatementContext, SendStatementContext } from "./generated/plurnkParser.ts";
4
+ declare module "xpath" {
5
+ function parse(expression: string): unknown;
6
+ }
7
+ export default class AstBuilder {
8
+ #private;
9
+ static build(ctx: StatementContext | MidStatementContext | PlanStatementContext | SendStatementContext): PlurnkStatement;
10
+ static buildClient(ctx: ClientStatementContext): ClientStatement;
11
+ /**
12
+ * Parse a COPY/MOVE body into its destination target and optional trailing
13
+ * scope. The scope is adjacent to the destination it selects:
14
+ * `destination.txt<12,5,12,5>`.
15
+ */
16
+ static parseResourceSelection(raw: string, pos?: Position): ResourceSelection | null;
17
+ /**
18
+ * Apply target-slot decomposition without round-tripping through a statement.
19
+ * Returns null for empty input and throws PlurnkParseError when a scheme URL
20
+ * fails WHATWG admission. {§path-syntax}
21
+ */
22
+ static parsePath(raw: string, pos?: Position): ParsedPath | null;
23
+ }
24
+ //# sourceMappingURL=AstBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AstBuilder.d.ts","sourceRoot":"","sources":["../../src/AstBuilder.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAGR,eAAe,EAaf,iBAAiB,EACjB,UAAU,EAGV,eAAe,EACf,QAAQ,EAMX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAER,sBAAsB,EAgBtB,gBAAgB,EAChB,mBAAmB,EAGtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGH,oBAAoB,EACpB,oBAAoB,EAIvB,MAAM,6BAA6B,CAAC;AAMrC,OAAO,QAAQ,OAAO,CAAC;IACnB,SAAgB,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;CACtD;AASD,MAAM,CAAC,OAAO,OAAO,UAAU;;IAK3B,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,gBAAgB,GAAG,mBAAmB,GAAG,oBAAoB,GAAG,oBAAoB,GAAG,eAAe,CA4BvH;IAmBD,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,sBAAsB,GAAG,eAAe,CAK/D;IAmVD;;;;OAIG;IACH,MAAM,CAAC,sBAAsB,CACzB,GAAG,EAAE,MAAM,EACX,GAAG,GAAE,QAAiC,GACvC,iBAAiB,GAAG,IAAI,CAW1B;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,QAAiC,GAAG,UAAU,GAAG,IAAI,CAoCvF;CAuHJ"}