@plurnk/plurnk-grammar 0.2.0 → 0.5.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 (77) hide show
  1. package/bin/plurnk.js +1 -1
  2. package/{schema → dist/schema}/LogEntry.json +1 -1
  3. package/{schema → dist/schema}/Packet.json +15 -2
  4. package/{schema → dist/schema}/Run.json +6 -1
  5. package/{schema → dist/schema}/SchemeRegistration.json +6 -0
  6. package/{schema → dist/schema}/Session.json +1 -1
  7. package/dist/src/AstBuilder.d.ts +19 -0
  8. package/dist/src/AstBuilder.d.ts.map +1 -0
  9. package/{src/AstBuilder.ts → dist/src/AstBuilder.js} +176 -161
  10. package/dist/src/AstBuilder.js.map +1 -0
  11. package/dist/src/PlurnkErrorStrategy.d.ts +10 -0
  12. package/dist/src/PlurnkErrorStrategy.d.ts.map +1 -0
  13. package/{src/PlurnkErrorStrategy.ts → dist/src/PlurnkErrorStrategy.js} +41 -49
  14. package/dist/src/PlurnkErrorStrategy.js.map +1 -0
  15. package/dist/src/PlurnkParseError.d.ts +14 -0
  16. package/dist/src/PlurnkParseError.d.ts.map +1 -0
  17. package/{src/PlurnkParseError.ts → dist/src/PlurnkParseError.js} +6 -9
  18. package/dist/src/PlurnkParseError.js.map +1 -0
  19. package/dist/src/PlurnkParser.d.ts +6 -0
  20. package/dist/src/PlurnkParser.d.ts.map +1 -0
  21. package/{src/PlurnkParser.ts → dist/src/PlurnkParser.js} +32 -40
  22. package/dist/src/PlurnkParser.js.map +1 -0
  23. package/dist/src/RecordingListener.d.ts +9 -0
  24. package/dist/src/RecordingListener.d.ts.map +1 -0
  25. package/dist/src/RecordingListener.js +19 -0
  26. package/dist/src/RecordingListener.js.map +1 -0
  27. package/dist/src/Validator.d.ts +28 -0
  28. package/dist/src/Validator.d.ts.map +1 -0
  29. package/dist/src/Validator.js +86 -0
  30. package/dist/src/Validator.js.map +1 -0
  31. package/dist/src/generated/plurnkLexer.d.ts +88 -0
  32. package/dist/src/generated/plurnkLexer.d.ts.map +1 -0
  33. package/dist/src/generated/plurnkLexer.js +440 -0
  34. package/dist/src/generated/plurnkLexer.js.map +1 -0
  35. package/dist/src/generated/plurnkParser.d.ts +274 -0
  36. package/dist/src/generated/plurnkParser.d.ts.map +1 -0
  37. package/dist/src/generated/plurnkParser.js +1833 -0
  38. package/dist/src/generated/plurnkParser.js.map +1 -0
  39. package/{src/generated/plurnkParserVisitor.ts → dist/src/generated/plurnkParserVisitor.d.ts} +2 -7
  40. package/dist/src/generated/plurnkParserVisitor.d.ts.map +1 -0
  41. package/dist/src/generated/plurnkParserVisitor.js +131 -0
  42. package/dist/src/generated/plurnkParserVisitor.js.map +1 -0
  43. package/dist/src/index.d.ts +10 -0
  44. package/dist/src/index.d.ts.map +1 -0
  45. package/dist/src/index.js +7 -0
  46. package/dist/src/index.js.map +1 -0
  47. package/dist/src/types.d.ts +23 -0
  48. package/dist/src/types.d.ts.map +1 -0
  49. package/dist/src/types.generated.d.ts +465 -0
  50. package/dist/src/types.generated.d.ts.map +1 -0
  51. package/dist/src/types.generated.js +4 -0
  52. package/dist/src/types.generated.js.map +1 -0
  53. package/dist/src/types.js +4 -0
  54. package/dist/src/types.js.map +1 -0
  55. package/package.json +10 -7
  56. package/plurnk.md +1 -1
  57. package/src/RecordingListener.ts +0 -34
  58. package/src/Validator.ts +0 -94
  59. package/src/generated/plurnkLexer.ts +0 -467
  60. package/src/generated/plurnkParser.ts +0 -1891
  61. package/src/index.ts +0 -29
  62. package/src/types.generated.ts +0 -491
  63. package/src/types.ts +0 -30
  64. /package/{schema → dist/schema}/Agent.json +0 -0
  65. /package/{schema → dist/schema}/ChannelContent.json +0 -0
  66. /package/{schema → dist/schema}/Entry.json +0 -0
  67. /package/{schema → dist/schema}/LineMarker.json +0 -0
  68. /package/{schema → dist/schema}/Loop.json +0 -0
  69. /package/{schema → dist/schema}/MatcherBody.json +0 -0
  70. /package/{schema → dist/schema}/Params.json +0 -0
  71. /package/{schema → dist/schema}/ParsedPath.json +0 -0
  72. /package/{schema → dist/schema}/PlurnkStatement.json +0 -0
  73. /package/{schema → dist/schema}/Position.json +0 -0
  74. /package/{schema → dist/schema}/ProviderDeclaration.json +0 -0
  75. /package/{schema → dist/schema}/SendBody.json +0 -0
  76. /package/{schema → dist/schema}/Turn.json +0 -0
  77. /package/{schema → dist/schema}/Visibility.json +0 -0
@@ -0,0 +1,465 @@
1
+ export interface Agent {
2
+ version: number;
3
+ provider: ProviderDeclaration;
4
+ /**
5
+ * Agent-wide default scheme registrations. The v0 inventory ships with `plurnk`, `known`, `unknown`; everything else is plugin-registered.
6
+ */
7
+ scheme_registry: SchemeRegistration[];
8
+ }
9
+ /**
10
+ * Declaration of the active provider for an agent. The grammar package owns these four fields; auth/connection config lives in the agent repo.
11
+ */
12
+ export interface ProviderDeclaration {
13
+ /**
14
+ * API vendor identifier (e.g. "anthropic", "openai", "google", "local").
15
+ */
16
+ provider: string;
17
+ /**
18
+ * Model family (e.g. "claude", "gpt", "gemini", "llama").
19
+ */
20
+ family: string;
21
+ /**
22
+ * Specific model id (e.g. "claude-opus-4-7").
23
+ */
24
+ model: string;
25
+ /**
26
+ * Total context window in tokens.
27
+ */
28
+ contextSize: number;
29
+ /**
30
+ * ISO 4217 code; the unit `cost_pico` is denominated in.
31
+ */
32
+ currency: string;
33
+ }
34
+ /**
35
+ * A scheme entry in the agent's scheme registry. Defines what `<name>://` resolves to and how it's accessible.
36
+ */
37
+ export interface SchemeRegistration {
38
+ /**
39
+ * Scheme name without `://`. Matches the URL scheme character class.
40
+ */
41
+ name: string;
42
+ model_visible: boolean;
43
+ category: string;
44
+ default_scope: ("agent" | "session");
45
+ /**
46
+ * Channel name selected when an op against this scheme has no fragment. Conventionally `body`; exec schemes typically declare `stdout`.
47
+ */
48
+ default_channel: string;
49
+ /**
50
+ * Per-channel content-orientation hints. `head` = whole-document or front-anchored (readers care about the beginning); `tail` = append-temporal stream (readers care about the latest content). Channels not listed default to `head`. Renderers use this to pick truncation direction; the amount to render is a core/runtime concern, not a contract field.
51
+ */
52
+ channel_orientations?: {
53
+ [k: string]: ("head" | "tail");
54
+ };
55
+ writable_by: ("model" | "client" | "system" | "plugin")[];
56
+ volatile: boolean;
57
+ handler: (string | null);
58
+ }
59
+ export interface ChannelContent {
60
+ /**
61
+ * Raw content bytes/string for this channel. Binary content awaits a future encoding pass (see AGENTS.md).
62
+ */
63
+ content: string;
64
+ mimetype: string;
65
+ /**
66
+ * Token count of `content` under the active model's tokenizer.
67
+ */
68
+ tokens: number;
69
+ }
70
+ export type Entry = ({
71
+ [k: string]: unknown;
72
+ } & {
73
+ id: number;
74
+ version: number;
75
+ scope: ("agent" | "session");
76
+ session_id: (number | null);
77
+ scheme: (string | null);
78
+ username: (string | null);
79
+ password: (string | null);
80
+ hostname: (string | null);
81
+ port: (number | null);
82
+ pathname: string;
83
+ params: (Params | null);
84
+ /**
85
+ * Named channels on this entry. Keys are channel names (lowercase identifiers); values are ChannelContent. Must be non-empty. The scheme registry declares which channel is the default for unspecified ops.
86
+ */
87
+ channels: {
88
+ [k: string]: ChannelContent;
89
+ };
90
+ attributes: {};
91
+ tags: string[];
92
+ });
93
+ /**
94
+ * URL query parameters parsed into a JSON object. Single-value keys map to strings; multi-value keys (repeated in the original query string) map to arrays of strings. Empty object when the URL has no query string; nullable usages wrap this schema in a oneOf with null.
95
+ */
96
+ export interface Params {
97
+ [k: string]: (string | string[]);
98
+ }
99
+ /**
100
+ * One named stream of content on an entry. Channels carry distinct, parallel views of an entry (e.g. `stdout` and `stderr` on `exec://`; `body` and `headers` on `https://`; `body` and `symbols` on a code file). Each channel has its own content bytes, mimetype, and token count.
101
+ */
102
+ export interface LineMarker {
103
+ first: number;
104
+ last: (number | null);
105
+ }
106
+ export type LogEntry = ({
107
+ [k: string]: unknown;
108
+ } & {
109
+ id: number;
110
+ version: number;
111
+ run_id: number;
112
+ loop_id: number;
113
+ turn_id: number;
114
+ action_index: number;
115
+ at: string;
116
+ origin: ("model" | "client" | "system" | "plugin");
117
+ op: ("FIND" | "READ" | "EDIT" | "COPY" | "MOVE" | "SHOW" | "HIDE" | "SEND" | "EXEC");
118
+ suffix: string;
119
+ signal: (string[] | number | string | null);
120
+ target_scheme: (string | null);
121
+ target_username: (string | null);
122
+ target_password: (string | null);
123
+ target_hostname: (string | null);
124
+ target_port: (number | null);
125
+ target_pathname: (string | null);
126
+ target_params: (Params | null);
127
+ /**
128
+ * Channel selector at request time. Names the channel the op targeted; null when the op used the scheme's default channel.
129
+ */
130
+ target_fragment: (string | null);
131
+ lineMarker: (LineMarker | null);
132
+ /**
133
+ * Raw request payload. For origin=model: the literal plurnk DSL substring of assistant.content. For origin=system/client/plugin: whatever the originator emitted, with `mimetype_tx` declaring the structure.
134
+ */
135
+ tx: string;
136
+ /**
137
+ * Mimetype of `tx`. Typically `text/vnd.plurnk` for model-origin rows; arbitrary per-origin for system/client/plugin.
138
+ */
139
+ mimetype_tx: string;
140
+ /**
141
+ * Raw response payload bytes/string.
142
+ */
143
+ rx: string;
144
+ mimetype_rx: string;
145
+ status_rx: number;
146
+ tokens: number;
147
+ });
148
+ /**
149
+ * URL query parameters parsed into a JSON object. Single-value keys map to strings; multi-value keys (repeated in the original query string) map to arrays of strings. Empty object when the URL has no query string; nullable usages wrap this schema in a oneOf with null.
150
+ */
151
+ export interface Loop {
152
+ id: number;
153
+ version: number;
154
+ run_id: number;
155
+ /**
156
+ * 1-based within the run.
157
+ */
158
+ sequence: number;
159
+ /**
160
+ * 102 = continuing; 200 = terminal success; 499 = terminal cancellation.
161
+ */
162
+ status: (102 | 200 | 499);
163
+ /**
164
+ * The original user prompt for this loop, replayed on every turn.
165
+ */
166
+ prompt: string;
167
+ }
168
+ export type MatcherBody = (XPathBody | RegexBody | JsonPathBody | GlobBody);
169
+ /**
170
+ * XPath 1.0 expression. Validated at parse time via the xpath library.
171
+ */
172
+ export interface XPathBody {
173
+ dialect: "xpath";
174
+ raw: string;
175
+ }
176
+ /**
177
+ * JavaScript regex literal `/pattern/flags`. Pattern and flags are split out for direct use. `raw` preserves the literal form for round-tripping.
178
+ */
179
+ export interface RegexBody {
180
+ dialect: "regex";
181
+ raw: string;
182
+ pattern: string;
183
+ flags: string;
184
+ }
185
+ /**
186
+ * JSONPath expression. Validated at parse time via jsonpath-plus.
187
+ */
188
+ export interface JsonPathBody {
189
+ dialect: "jsonpath";
190
+ raw: string;
191
+ }
192
+ /**
193
+ * Pattern with no dialect prefix; treated as a glob/literal match.
194
+ */
195
+ export interface GlobBody {
196
+ dialect: "glob";
197
+ raw: string;
198
+ }
199
+ export type PlurnkStatement = (FindStatement | ReadStatement | ShowStatement | HideStatement | EditStatement | CopyStatement | MoveStatement | SendStatement | ExecStatement);
200
+ /**
201
+ * A parsed path slot from a plurnk statement. Discriminated on `kind`: either a bare local path (no scheme) or a fully decomposed URL.
202
+ */
203
+ export type ParsedPath = (LocalPath | UrlPath);
204
+ /**
205
+ * Parsed body of a FIND/READ/SHOW/HIDE statement, discriminated on `dialect`. The dialect is determined by the body's leading characters (`//` xpath, `/` regex, `$` jsonpath, else glob). The regex variant carries pattern/flags split out of the `/pattern/flags` literal; the compiled `RegExp` object on the in-memory AST is a runtime ergonomic only and is not part of the persisted/wire contract.
206
+ */
207
+ export interface Packet {
208
+ /**
209
+ * Total packet tokens — sum of section subtotals.
210
+ */
211
+ tokens: number;
212
+ system: {
213
+ tokens: number;
214
+ /**
215
+ * text/markdown — plurnk grammar + scheme registry refs.
216
+ */
217
+ system_definition: string;
218
+ /**
219
+ * text/markdown — identity / mission.
220
+ */
221
+ persona: string;
222
+ index: Entry[];
223
+ log: LogEntry[];
224
+ };
225
+ user: {
226
+ tokens: number;
227
+ /**
228
+ * Copy of loop.prompt — never null on a continuation turn.
229
+ */
230
+ prompt: string;
231
+ /**
232
+ * Per-turn instrumentation surfaced to the model. `budget` is renderer-provided markdown describing remaining context / cost / etc. `errors` carries actionless failures (parse errors and similar) that the model should confront on this turn. Inner shapes intentionally open at v0; consumers populate as needs solidify.
233
+ */
234
+ telemetry: {
235
+ /**
236
+ * text/markdown — budget surface (token/cost/etc. left to spend). Empty string when nothing to surface.
237
+ */
238
+ budget: string;
239
+ /**
240
+ * TelemetryError[] — element shape TBD. Empty array when no errors to surface.
241
+ */
242
+ errors: {}[];
243
+ };
244
+ /**
245
+ * text/markdown — per-turn rules.
246
+ */
247
+ system_requirements: string;
248
+ };
249
+ assistant: {
250
+ tokens: number;
251
+ /**
252
+ * Raw DSL string emitted by the model.
253
+ */
254
+ content: string;
255
+ /**
256
+ * Parsed PlurnkStatement[] derived from `content`.
257
+ */
258
+ ops: PlurnkStatement[];
259
+ /**
260
+ * text/plain — provider-exposed CoT when present, null otherwise.
261
+ */
262
+ reasoning: (string | null);
263
+ [k: string]: unknown;
264
+ };
265
+ assistantRaw: unknown;
266
+ }
267
+ /**
268
+ * URL query parameters parsed into a JSON object. Single-value keys map to strings; multi-value keys (repeated in the original query string) map to arrays of strings. Empty object when the URL has no query string; nullable usages wrap this schema in a oneOf with null.
269
+ */
270
+ export interface FindStatement {
271
+ op: "FIND";
272
+ suffix: string;
273
+ signal: (string[] | null);
274
+ path: (ParsedPath | null);
275
+ lineMarker: (LineMarker | null);
276
+ body: (MatcherBody | null);
277
+ position: Position;
278
+ }
279
+ /**
280
+ * A bare local path with no `scheme://` prefix. The raw string is stored verbatim; resolution is the runtime's job.
281
+ */
282
+ export interface LocalPath {
283
+ kind: "local";
284
+ raw: string;
285
+ }
286
+ /**
287
+ * A path with a `scheme://` prefix, fully decomposed via WHATWG URL.
288
+ */
289
+ export interface UrlPath {
290
+ kind: "url";
291
+ raw: string;
292
+ scheme: string;
293
+ username: (string | null);
294
+ password: (string | null);
295
+ hostname: (string | null);
296
+ port: (number | null);
297
+ pathname: string;
298
+ params: Params;
299
+ fragment: (string | null);
300
+ }
301
+ /**
302
+ * XPath 1.0 expression. Validated at parse time via the xpath library.
303
+ */
304
+ export interface Position {
305
+ line: number;
306
+ column: number;
307
+ }
308
+ export interface ReadStatement {
309
+ op: "READ";
310
+ suffix: string;
311
+ signal: (string[] | null);
312
+ path: (ParsedPath | null);
313
+ lineMarker: (LineMarker | null);
314
+ body: (MatcherBody | null);
315
+ position: Position;
316
+ }
317
+ export interface ShowStatement {
318
+ op: "SHOW";
319
+ suffix: string;
320
+ signal: (string[] | null);
321
+ path: (ParsedPath | null);
322
+ lineMarker: (LineMarker | null);
323
+ body: (MatcherBody | null);
324
+ position: Position;
325
+ }
326
+ export interface HideStatement {
327
+ op: "HIDE";
328
+ suffix: string;
329
+ signal: (string[] | null);
330
+ path: (ParsedPath | null);
331
+ lineMarker: (LineMarker | null);
332
+ body: (MatcherBody | null);
333
+ position: Position;
334
+ }
335
+ export interface EditStatement {
336
+ op: "EDIT";
337
+ suffix: string;
338
+ signal: (string[] | null);
339
+ path: (ParsedPath | null);
340
+ lineMarker: (LineMarker | null);
341
+ body: (string | null);
342
+ position: Position;
343
+ }
344
+ export interface CopyStatement {
345
+ op: "COPY";
346
+ suffix: string;
347
+ signal: (string[] | null);
348
+ path: (ParsedPath | null);
349
+ lineMarker: (LineMarker | null);
350
+ body: (ParsedPath | null);
351
+ position: Position;
352
+ }
353
+ export interface MoveStatement {
354
+ op: "MOVE";
355
+ suffix: string;
356
+ signal: (string[] | null);
357
+ path: (ParsedPath | null);
358
+ lineMarker: (LineMarker | null);
359
+ body: (ParsedPath | null);
360
+ position: Position;
361
+ }
362
+ export interface SendStatement {
363
+ op: "SEND";
364
+ suffix: string;
365
+ signal: (number | null);
366
+ path: (ParsedPath | null);
367
+ lineMarker: null;
368
+ body: (SendBody | null);
369
+ position: Position;
370
+ }
371
+ /**
372
+ * 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.
373
+ */
374
+ export interface SendBody {
375
+ raw: string;
376
+ json: unknown;
377
+ }
378
+ export interface ExecStatement {
379
+ op: "EXEC";
380
+ suffix: string;
381
+ signal: (string | null);
382
+ path: (ParsedPath | null);
383
+ lineMarker: null;
384
+ body: (string | null);
385
+ position: Position;
386
+ }
387
+ export type TagSignal = (string[] | null);
388
+ export type PathOrNull = (ParsedPath | null);
389
+ /**
390
+ * A parsed path slot from a plurnk statement. Discriminated on `kind`: either a bare local path (no scheme) or a fully decomposed URL.
391
+ */
392
+ export type LineMarkerOrNull = (LineMarker | null);
393
+ export type MatcherBodyOrNull = (MatcherBody | null);
394
+ /**
395
+ * Parsed body of a FIND/READ/SHOW/HIDE statement, discriminated on `dialect`. The dialect is determined by the body's leading characters (`//` xpath, `/` regex, `$` jsonpath, else glob). The regex variant carries pattern/flags split out of the `/pattern/flags` literal; the compiled `RegExp` object on the in-memory AST is a runtime ergonomic only and is not part of the persisted/wire contract.
396
+ */
397
+ export type SendBodyOrNull = (SendBody | null);
398
+ export interface Run {
399
+ id: number;
400
+ version: number;
401
+ session_id: number;
402
+ /**
403
+ * Unique within the session. Auto-populated default form `run-{unixtime}` until renamed. Clients display this; cross-table references use `id` so renames don't cascade-break.
404
+ */
405
+ name: string;
406
+ created_at: string;
407
+ /**
408
+ * FK to parent run when this is a fork; null for the trunk run.
409
+ */
410
+ parent_run_id: (number | null);
411
+ /**
412
+ * Cumulative cost across this run's turns, in pico-units of the active provider's currency.
413
+ */
414
+ cost_pico: number;
415
+ }
416
+ export interface Session {
417
+ id: number;
418
+ version: number;
419
+ /**
420
+ * Unique within the agent. Auto-populated default form `session-{unixtime}` until renamed. Clients display this; cross-table references use `id` so renames don't cascade-break.
421
+ */
422
+ name: string;
423
+ created_at: string;
424
+ /**
425
+ * Cumulative cost across this session's runs.
426
+ */
427
+ cost_pico: number;
428
+ scheme_registry_additions: SchemeRegistration[];
429
+ }
430
+ /**
431
+ * A scheme entry in the agent's scheme registry. Defines what `<name>://` resolves to and how it's accessible.
432
+ */
433
+ export interface Turn {
434
+ id: number;
435
+ version: number;
436
+ loop_id: number;
437
+ /**
438
+ * 1-based within the loop; resets at each new loop.
439
+ */
440
+ sequence: number;
441
+ timestamp: string;
442
+ status: number;
443
+ /**
444
+ * Provider-returned token counts and computed cost.
445
+ */
446
+ usage: {
447
+ prompt: number;
448
+ completion: number;
449
+ cached: number;
450
+ /**
451
+ * Per-turn cost in pico-units of the active provider's currency.
452
+ */
453
+ cost_pico: number;
454
+ };
455
+ packet: Packet;
456
+ }
457
+ /**
458
+ * One turn's full exchange with the provider: { system, user, assistant, assistantRaw }. system aggregates durable + accumulating context (definition, persona, indexed entries, in-scope log rows). user carries the per-turn ephemera. assistant is the provider-normalized output. assistantRaw is opaque.
459
+ */
460
+ export interface Visibility {
461
+ entry_id: number;
462
+ channel: string;
463
+ indexed: boolean;
464
+ }
465
+ //# sourceMappingURL=types.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.generated.d.ts","sourceRoot":"","sources":["../../src/types.generated.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,KAAK;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,mBAAmB,CAAA;IAC7B;;OAEG;IACH,eAAe,EAAE,kBAAkB,EAAE,CAAA;CACpC;AACD;;GAEG;AAEH,MAAM,WAAW,mBAAmB;IACpC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CACf;AACD;;GAEG;AAEH,MAAM,WAAW,kBAAkB;IACnC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,OAAO,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IACpC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,oBAAoB,CAAC,EAAE;QACvB,CAAC,CAAC,EAAE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AAA;KAChB,CAAA;IACD,MAAM,EAAE,MAAM,CAAA;CACb;AACD;;GAEG;AAEH,MAAM,WAAW,UAAU;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;CACf"}
@@ -0,0 +1,4 @@
1
+ // @generated by scriptify/generate-types.ts from schema/*.json
2
+ // DO NOT EDIT — run `npm run build:types` to regenerate.
3
+ export {};
4
+ //# sourceMappingURL=types.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.generated.js","sourceRoot":"","sources":["../../src/types.generated.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,yDAAyD"}
@@ -0,0 +1,4 @@
1
+ // Schema-derived types are generated from schema/*.json — re-exported here as
2
+ // the single import surface for consumers. Run `npm run build:types` to regenerate.
3
+ export * from "./types.generated.js";
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,oFAAoF;AACpF,cAAc,sBAAsB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plurnk/plurnk-grammar",
3
- "version": "0.2.0",
3
+ "version": "0.5.0",
4
4
  "description": "ANTLR4 grammar for the Plurnk LLM agent protocol",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -11,7 +11,10 @@
11
11
  "node": ">=25"
12
12
  },
13
13
  "exports": {
14
- ".": "./src/index.ts",
14
+ ".": {
15
+ "types": "./dist/src/index.d.ts",
16
+ "default": "./dist/src/index.js"
17
+ },
15
18
  "./package.json": "./package.json"
16
19
  },
17
20
  "bin": {
@@ -19,15 +22,14 @@
19
22
  },
20
23
  "files": [
21
24
  "bin/plurnk.js",
22
- "src/*.ts",
23
- "src/generated/*.ts",
24
- "schema/*.json",
25
+ "dist/**/*",
25
26
  "plurnk.md"
26
27
  ],
27
28
  "scripts": {
28
29
  "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",
29
30
  "build:types": "node scriptify/generate-types.ts",
30
- "build": "npm run build:grammar && npm run build:types",
31
+ "build:dist": "tsc -p tsconfig.build.json",
32
+ "build": "npm run build:grammar && npm run build:types && npm run build:dist",
31
33
  "antlr:tokens": "testrig src/generated/plurnk document --tokens",
32
34
  "antlr:trace": "testrig src/generated/plurnk document --trace",
33
35
  "antlr:parse": "testrig src/generated/plurnk document --tree",
@@ -35,9 +37,10 @@
35
37
  "test:unit": "node --test test/unit/*.test.ts",
36
38
  "test:intg": "node --test test/integration/*.test.ts",
37
39
  "test:demo": "node --test test/demo/*.test.ts",
40
+ "test:smoke": "node scriptify/smoke-test.ts",
38
41
  "test:all": "npm run test:lint && npm run test:unit && npm run test:intg && npm run test:demo",
39
42
  "prepare": "npm run build",
40
- "prepublishOnly": "npm run build && npm run test:all"
43
+ "prepublishOnly": "npm run build && npm run test:all && npm run test:smoke"
41
44
  },
42
45
  "dependencies": {
43
46
  "@cfworker/json-schema": "^4.1.1",
package/plurnk.md CHANGED
@@ -24,7 +24,7 @@ Slots between `<<OPsuffix` and `:body:` are all optional. `:body:` fences are re
24
24
  | SEND | HTTP status | recipient | — | message (JSON for data) |
25
25
  | EXEC | Runtime Tag | cwd | — | command or code |
26
26
 
27
- SEND signal is a single integer. EXEC signal is a single Runtime Tag (`sh`, `node`, `python`, etc.). All other signals are CSV.
27
+ SEND signal is a single integer. SEND broadcasts when path is omitted; with a path it is directed (path must be a URI). EXEC signal is a single Runtime Tag (`sh`, `node`, `python`, etc.). All other signals are tags.
28
28
 
29
29
  ## `<L>`
30
30
 
@@ -1,34 +0,0 @@
1
- import {
2
- BaseErrorListener,
3
- type RecognitionException,
4
- type Recognizer,
5
- type Token,
6
- } from "antlr4ng";
7
- import { plurnkLexer } from "./generated/plurnkLexer.ts";
8
- import PlurnkParseError from "./PlurnkParseError.ts";
9
- import PlurnkErrorStrategy from "./PlurnkErrorStrategy.ts";
10
-
11
- export default class RecordingListener extends BaseErrorListener {
12
- readonly errors: PlurnkParseError[];
13
- readonly source: "lexer" | "parser";
14
-
15
- constructor(source: "lexer" | "parser", errors: PlurnkParseError[]) {
16
- super();
17
- this.source = source;
18
- this.errors = errors;
19
- }
20
-
21
- override syntaxError(
22
- recognizer: Recognizer<any>,
23
- _offendingSymbol: Token | null,
24
- line: number,
25
- column: number,
26
- msg: string,
27
- _e: RecognitionException | null,
28
- ): void {
29
- const translated = this.source === "lexer"
30
- ? PlurnkErrorStrategy.translateLexerMessage(recognizer as plurnkLexer, msg)
31
- : msg;
32
- this.errors.push(new PlurnkParseError(line, column, this.source, translated));
33
- }
34
- }