@plurnk/plurnk-grammar 0.64.0 → 0.67.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 +3 -5
- package/dist/plurnk.gbnf +13 -68
- package/dist/schema/SchemeRegistration.json +1 -1
- package/dist/src/Validator.d.ts +0 -8
- package/dist/src/Validator.d.ts.map +1 -1
- package/dist/src/Validator.js +0 -34
- package/dist/src/Validator.js.map +1 -1
- package/dist/src/types.generated.d.ts +112 -365
- package/dist/src/types.generated.d.ts.map +1 -1
- package/dist/src/types.generated.js +0 -3
- package/dist/src/types.generated.js.map +1 -1
- package/package.json +2 -3
- package/plurnk.md +10 -11
- package/dist/plurnk-free.gbnf +0 -827
- package/dist/schema/Agent.json +0 -18
- package/dist/schema/Entry.json +0 -51
- package/dist/schema/LogEntry.json +0 -118
- package/dist/schema/Loop.json +0 -20
- package/dist/schema/Packet.json +0 -72
- package/dist/schema/Run.json +0 -26
- package/dist/schema/Session.json +0 -20
- package/dist/schema/Turn.json +0 -39
package/README.md
CHANGED
|
@@ -199,16 +199,14 @@ Errors are JSON-serializable. Shape: `{ line, column, source, message }` where `
|
|
|
199
199
|
|
|
200
200
|
## gbnf
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
One generated [GBNF](https://github.com/ggml-org/llama.cpp/blob/master/grammars/README.md) grammar ships for llama.cpp constrained sampling, calibrated for the Fireworks/DeepSeek backend:
|
|
203
203
|
|
|
204
|
-
- **`plurnk.gbnf` (
|
|
205
|
-
- **`plurnk-free.gbnf` (free root, permissive)** — free reasoning text and statements interleave, `<<` escapable to text; no PLAN-first and no terminal-SEND enforcement. The fallback for models that need to think between ops without the strict rail.
|
|
204
|
+
- **`plurnk.gbnf` (think-optional root)** — `root ::= think? sep batch-step* send-final-any sep`. An optional `<think>…</think>` reasoning preamble (a reasoning model fills it natively; a non-reasoning model skips straight to ops — one grammar serves both), then a strict ops-only batch (bounded `WS{0,7}` separators, no free prose between), closed by exactly one terminal `SEND[102|200|202|300|499]` — structural termination (forced EOS), not an optional stop a near-greedy decoder can sail past. `PLAN` is allowed but inert (bare, never forced).
|
|
206
205
|
|
|
207
|
-
The parser remains the permissive contract
|
|
206
|
+
The grammar masks the **raw** token stream, reasoning included (the `reasoning_content`/`content` split is post-hoc and sampler-invisible), so `<think>` lives in the grammar to give the model's native reasoning tokens somewhere to go. Its body excludes only `</think>`, so the model may rehearse anything inside — complete ops and terminals included — because the provider separates reasoning from content before the parser runs. The parser remains the permissive contract over that `content`: everything the grammar can generate, the parser accepts (and much it doesn't: word suffixes, richer slot internals).
|
|
208
207
|
|
|
209
208
|
```ts
|
|
210
209
|
import.meta.resolve("@plurnk/plurnk-grammar/plurnk.gbnf")
|
|
211
|
-
import.meta.resolve("@plurnk/plurnk-grammar/plurnk-free.gbnf")
|
|
212
210
|
```
|
|
213
211
|
|
|
214
212
|
`npm run test:llama` validates the grammar against a live llama-server (`PLURNK_LLAMA_URL`, default `http://127.0.0.1:11435`) and demos constrained emission end-to-end. Opt-in; not part of `test:all`.
|
package/dist/plurnk.gbnf
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @generated by scriptify/generate-gbnf.ts — do not edit; run `npm run build:gbnf`.
|
|
2
|
-
root ::= root-
|
|
2
|
+
root ::= root-think
|
|
3
3
|
find-b0 ::= (":" find-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:] find-b0)?
|
|
4
4
|
find-b1 ::= ("F" find-b2 | ":" find-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:F] find-b0)?
|
|
5
5
|
find-b2 ::= ("I" find-b3 | ":" find-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:I] find-b0)?
|
|
@@ -706,76 +706,21 @@ plan-b2 ::= ("L" plan-b3 | ":" plan-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:L] pl
|
|
|
706
706
|
plan-b3 ::= ("A" plan-b4 | ":" plan-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:A] plan-b0)?
|
|
707
707
|
plan-b4 ::= (":" plan-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:N] plan-b0)?
|
|
708
708
|
plan ::= "<<PLAN" ":" plan-b0 ":PLAN"
|
|
709
|
-
plan-1-b0 ::= (":" plan-1-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:] plan-1-b0)?
|
|
710
|
-
plan-1-b1 ::= ("P" plan-1-b2 | ":" plan-1-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:P] plan-1-b0)?
|
|
711
|
-
plan-1-b2 ::= ("L" plan-1-b3 | ":" plan-1-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:L] plan-1-b0)?
|
|
712
|
-
plan-1-b3 ::= ("A" plan-1-b4 | ":" plan-1-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:A] plan-1-b0)?
|
|
713
|
-
plan-1-b4 ::= ("N" plan-1-b5 | ":" plan-1-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:N] plan-1-b0)?
|
|
714
|
-
plan-1-b5 ::= (":" plan-1-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:1] plan-1-b0)?
|
|
715
|
-
plan-1 ::= "<<PLAN1" ":" plan-1-b0 ":PLAN1"
|
|
716
|
-
plan-2-b0 ::= (":" plan-2-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:] plan-2-b0)?
|
|
717
|
-
plan-2-b1 ::= ("P" plan-2-b2 | ":" plan-2-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:P] plan-2-b0)?
|
|
718
|
-
plan-2-b2 ::= ("L" plan-2-b3 | ":" plan-2-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:L] plan-2-b0)?
|
|
719
|
-
plan-2-b3 ::= ("A" plan-2-b4 | ":" plan-2-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:A] plan-2-b0)?
|
|
720
|
-
plan-2-b4 ::= ("N" plan-2-b5 | ":" plan-2-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:N] plan-2-b0)?
|
|
721
|
-
plan-2-b5 ::= (":" plan-2-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:2] plan-2-b0)?
|
|
722
|
-
plan-2 ::= "<<PLAN2" ":" plan-2-b0 ":PLAN2"
|
|
723
|
-
plan-3-b0 ::= (":" plan-3-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:] plan-3-b0)?
|
|
724
|
-
plan-3-b1 ::= ("P" plan-3-b2 | ":" plan-3-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:P] plan-3-b0)?
|
|
725
|
-
plan-3-b2 ::= ("L" plan-3-b3 | ":" plan-3-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:L] plan-3-b0)?
|
|
726
|
-
plan-3-b3 ::= ("A" plan-3-b4 | ":" plan-3-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:A] plan-3-b0)?
|
|
727
|
-
plan-3-b4 ::= ("N" plan-3-b5 | ":" plan-3-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:N] plan-3-b0)?
|
|
728
|
-
plan-3-b5 ::= (":" plan-3-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:3] plan-3-b0)?
|
|
729
|
-
plan-3 ::= "<<PLAN3" ":" plan-3-b0 ":PLAN3"
|
|
730
|
-
plan-4-b0 ::= (":" plan-4-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:] plan-4-b0)?
|
|
731
|
-
plan-4-b1 ::= ("P" plan-4-b2 | ":" plan-4-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:P] plan-4-b0)?
|
|
732
|
-
plan-4-b2 ::= ("L" plan-4-b3 | ":" plan-4-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:L] plan-4-b0)?
|
|
733
|
-
plan-4-b3 ::= ("A" plan-4-b4 | ":" plan-4-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:A] plan-4-b0)?
|
|
734
|
-
plan-4-b4 ::= ("N" plan-4-b5 | ":" plan-4-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:N] plan-4-b0)?
|
|
735
|
-
plan-4-b5 ::= (":" plan-4-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:4] plan-4-b0)?
|
|
736
|
-
plan-4 ::= "<<PLAN4" ":" plan-4-b0 ":PLAN4"
|
|
737
|
-
plan-5-b0 ::= (":" plan-5-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:] plan-5-b0)?
|
|
738
|
-
plan-5-b1 ::= ("P" plan-5-b2 | ":" plan-5-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:P] plan-5-b0)?
|
|
739
|
-
plan-5-b2 ::= ("L" plan-5-b3 | ":" plan-5-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:L] plan-5-b0)?
|
|
740
|
-
plan-5-b3 ::= ("A" plan-5-b4 | ":" plan-5-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:A] plan-5-b0)?
|
|
741
|
-
plan-5-b4 ::= ("N" plan-5-b5 | ":" plan-5-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:N] plan-5-b0)?
|
|
742
|
-
plan-5-b5 ::= (":" plan-5-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:5] plan-5-b0)?
|
|
743
|
-
plan-5 ::= "<<PLAN5" ":" plan-5-b0 ":PLAN5"
|
|
744
|
-
plan-6-b0 ::= (":" plan-6-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:] plan-6-b0)?
|
|
745
|
-
plan-6-b1 ::= ("P" plan-6-b2 | ":" plan-6-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:P] plan-6-b0)?
|
|
746
|
-
plan-6-b2 ::= ("L" plan-6-b3 | ":" plan-6-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:L] plan-6-b0)?
|
|
747
|
-
plan-6-b3 ::= ("A" plan-6-b4 | ":" plan-6-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:A] plan-6-b0)?
|
|
748
|
-
plan-6-b4 ::= ("N" plan-6-b5 | ":" plan-6-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:N] plan-6-b0)?
|
|
749
|
-
plan-6-b5 ::= (":" plan-6-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:6] plan-6-b0)?
|
|
750
|
-
plan-6 ::= "<<PLAN6" ":" plan-6-b0 ":PLAN6"
|
|
751
|
-
plan-7-b0 ::= (":" plan-7-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:] plan-7-b0)?
|
|
752
|
-
plan-7-b1 ::= ("P" plan-7-b2 | ":" plan-7-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:P] plan-7-b0)?
|
|
753
|
-
plan-7-b2 ::= ("L" plan-7-b3 | ":" plan-7-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:L] plan-7-b0)?
|
|
754
|
-
plan-7-b3 ::= ("A" plan-7-b4 | ":" plan-7-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:A] plan-7-b0)?
|
|
755
|
-
plan-7-b4 ::= ("N" plan-7-b5 | ":" plan-7-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:N] plan-7-b0)?
|
|
756
|
-
plan-7-b5 ::= (":" plan-7-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:7] plan-7-b0)?
|
|
757
|
-
plan-7 ::= "<<PLAN7" ":" plan-7-b0 ":PLAN7"
|
|
758
|
-
plan-8-b0 ::= (":" plan-8-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:] plan-8-b0)?
|
|
759
|
-
plan-8-b1 ::= ("P" plan-8-b2 | ":" plan-8-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:P] plan-8-b0)?
|
|
760
|
-
plan-8-b2 ::= ("L" plan-8-b3 | ":" plan-8-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:L] plan-8-b0)?
|
|
761
|
-
plan-8-b3 ::= ("A" plan-8-b4 | ":" plan-8-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:A] plan-8-b0)?
|
|
762
|
-
plan-8-b4 ::= ("N" plan-8-b5 | ":" plan-8-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:N] plan-8-b0)?
|
|
763
|
-
plan-8-b5 ::= (":" plan-8-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:8] plan-8-b0)?
|
|
764
|
-
plan-8 ::= "<<PLAN8" ":" plan-8-b0 ":PLAN8"
|
|
765
|
-
plan-9-b0 ::= (":" plan-9-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:] plan-9-b0)?
|
|
766
|
-
plan-9-b1 ::= ("P" plan-9-b2 | ":" plan-9-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:P] plan-9-b0)?
|
|
767
|
-
plan-9-b2 ::= ("L" plan-9-b3 | ":" plan-9-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:L] plan-9-b0)?
|
|
768
|
-
plan-9-b3 ::= ("A" plan-9-b4 | ":" plan-9-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:A] plan-9-b0)?
|
|
769
|
-
plan-9-b4 ::= ("N" plan-9-b5 | ":" plan-9-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:N] plan-9-b0)?
|
|
770
|
-
plan-9-b5 ::= (":" plan-9-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:9] plan-9-b0)?
|
|
771
|
-
plan-9 ::= "<<PLAN9" ":" plan-9-b0 ":PLAN9"
|
|
772
709
|
sep ::= [ \t\r\n]? [ \t\r\n]? [ \t\r\n]? [ \t\r\n]? [ \t\r\n]? [ \t\r\n]? [ \t\r\n]?
|
|
773
710
|
batch-step ::= mid-statement sep
|
|
774
711
|
mid-statement ::= op-statement | send-mid-any
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
712
|
+
thinkbody-s0 ::= ("<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F<] thinkbody-s0)?
|
|
713
|
+
thinkbody-s1 ::= ("/" thinkbody-s2 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F/<] thinkbody-s0)?
|
|
714
|
+
thinkbody-s2 ::= ("t" thinkbody-s3 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7Ft<] thinkbody-s0)?
|
|
715
|
+
thinkbody-s3 ::= ("h" thinkbody-s4 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7Fh<] thinkbody-s0)?
|
|
716
|
+
thinkbody-s4 ::= ("i" thinkbody-s5 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7Fi<] thinkbody-s0)?
|
|
717
|
+
thinkbody-s5 ::= ("n" thinkbody-s6 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7Fn<] thinkbody-s0)?
|
|
718
|
+
thinkbody-s6 ::= ("k" thinkbody-s7 | "<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7Fk<] thinkbody-s0)?
|
|
719
|
+
thinkbody-s7 ::= ("<" thinkbody-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F><] thinkbody-s0)?
|
|
720
|
+
thinkbody ::= thinkbody-s0
|
|
721
|
+
think ::= "<think>" thinkbody "</think>"
|
|
722
|
+
root-think ::= think? sep batch-step* send-final-any sep
|
|
723
|
+
op-statement ::= find | find-1 | find-2 | find-3 | find-4 | find-5 | find-6 | find-7 | find-8 | find-9 | read | read-1 | read-2 | read-3 | read-4 | read-5 | read-6 | read-7 | read-8 | read-9 | edit | edit-1 | edit-2 | edit-3 | edit-4 | edit-5 | edit-6 | edit-7 | edit-8 | edit-9 | copy | copy-1 | copy-2 | copy-3 | copy-4 | copy-5 | copy-6 | copy-7 | copy-8 | copy-9 | move | move-1 | move-2 | move-3 | move-4 | move-5 | move-6 | move-7 | move-8 | move-9 | open | open-1 | open-2 | open-3 | open-4 | open-5 | open-6 | open-7 | open-8 | open-9 | fold | fold-1 | fold-2 | fold-3 | fold-4 | fold-5 | fold-6 | fold-7 | fold-8 | fold-9 | exec | exec-1 | exec-2 | exec-3 | exec-4 | exec-5 | exec-6 | exec-7 | exec-8 | exec-9 | kill | kill-1 | kill-2 | kill-3 | kill-4 | kill-5 | kill-6 | kill-7 | kill-8 | kill-9 | plan
|
|
779
724
|
send-mid-any ::= send-mid | send-1-mid | send-2-mid | send-3-mid | send-4-mid | send-5-mid | send-6-mid | send-7-mid | send-8-mid | send-9-mid
|
|
780
725
|
send-final-any ::= send-final | send-1-final | send-2-final | send-3-final | send-4-final | send-5-final | send-6-final | send-7-final | send-8-final | send-9-final
|
|
781
726
|
status-final ::= "102" | "200" | "202" | "300" | "499"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"model_visible": { "type": "boolean" },
|
|
16
16
|
"category": { "type": "string", "minLength": 1 },
|
|
17
|
-
"default_scope": { "enum": ["
|
|
17
|
+
"default_scope": { "enum": ["session", "run"] },
|
|
18
18
|
"default_channel": {
|
|
19
19
|
"type": "string",
|
|
20
20
|
"pattern": "^[a-z][a-z0-9_-]*$",
|
package/dist/src/Validator.d.ts
CHANGED
|
@@ -12,17 +12,9 @@ export default class Validator {
|
|
|
12
12
|
static validateParsedPath(obj: unknown): ValidationResult;
|
|
13
13
|
static validateMatcherBody(obj: unknown): ValidationResult;
|
|
14
14
|
static validateSendBody(obj: unknown): ValidationResult;
|
|
15
|
-
static validateEntry(obj: unknown): ValidationResult;
|
|
16
15
|
static validateSchemeRegistration(obj: unknown): ValidationResult;
|
|
17
16
|
static validateProviderDeclaration(obj: unknown): ValidationResult;
|
|
18
|
-
static validateLogEntry(obj: unknown): ValidationResult;
|
|
19
17
|
static validatePlurnkStatement(obj: unknown): ValidationResult;
|
|
20
|
-
static validateTurn(obj: unknown): ValidationResult;
|
|
21
|
-
static validateLoop(obj: unknown): ValidationResult;
|
|
22
|
-
static validateRun(obj: unknown): ValidationResult;
|
|
23
|
-
static validateSession(obj: unknown): ValidationResult;
|
|
24
|
-
static validateAgent(obj: unknown): ValidationResult;
|
|
25
|
-
static validatePacket(obj: unknown): ValidationResult;
|
|
26
18
|
static validateTelemetryEvent(obj: unknown): ValidationResult;
|
|
27
19
|
}
|
|
28
20
|
//# sourceMappingURL=Validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.d.ts","sourceRoot":"","sources":["../../src/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,UAAU,EAAe,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Validator.d.ts","sourceRoot":"","sources":["../../src/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,UAAU,EAAe,MAAM,uBAAuB,CAAC;AAa/F,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AAExE,MAAM,CAAC,OAAO,OAAO,SAAS;;IA2B1B,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACvD,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACzD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACrD,MAAM,CAAC,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IAC7D,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACzD,MAAM,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IAC1D,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACvD,MAAM,CAAC,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACjE,MAAM,CAAC,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IAClE,MAAM,CAAC,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IAC9D,MAAM,CAAC,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;CAMhE"}
|
package/dist/src/Validator.js
CHANGED
|
@@ -6,28 +6,10 @@ import channelContentSchema from "../schema/ChannelContent.json" with { type: "j
|
|
|
6
6
|
import parsedPathSchema from "../schema/ParsedPath.json" with { type: "json" };
|
|
7
7
|
import matcherBodySchema from "../schema/MatcherBody.json" with { type: "json" };
|
|
8
8
|
import sendBodySchema from "../schema/SendBody.json" with { type: "json" };
|
|
9
|
-
import entrySchema from "../schema/Entry.json" with { type: "json" };
|
|
10
9
|
import schemeRegistrationSchema from "../schema/SchemeRegistration.json" with { type: "json" };
|
|
11
10
|
import providerDeclarationSchema from "../schema/ProviderDeclaration.json" with { type: "json" };
|
|
12
|
-
import logEntrySchema from "../schema/LogEntry.json" with { type: "json" };
|
|
13
11
|
import plurnkStatementSchema from "../schema/PlurnkStatement.json" with { type: "json" };
|
|
14
|
-
import turnSchema from "../schema/Turn.json" with { type: "json" };
|
|
15
|
-
import loopSchema from "../schema/Loop.json" with { type: "json" };
|
|
16
|
-
import runSchema from "../schema/Run.json" with { type: "json" };
|
|
17
|
-
import sessionSchema from "../schema/Session.json" with { type: "json" };
|
|
18
|
-
import agentSchema from "../schema/Agent.json" with { type: "json" };
|
|
19
|
-
import packetSchema from "../schema/Packet.json" with { type: "json" };
|
|
20
12
|
import telemetryEventSchema from "../schema/TelemetryEvent.json" with { type: "json" };
|
|
21
|
-
// All foundational schemas — handy when a top-level shape transitively references many others.
|
|
22
|
-
const FOUNDATIONAL = [
|
|
23
|
-
positionSchema, lineMarkerSchema, paramsSchema, channelContentSchema,
|
|
24
|
-
parsedPathSchema, matcherBodySchema, sendBodySchema,
|
|
25
|
-
plurnkStatementSchema,
|
|
26
|
-
entrySchema, logEntrySchema,
|
|
27
|
-
schemeRegistrationSchema, providerDeclarationSchema,
|
|
28
|
-
telemetryEventSchema,
|
|
29
|
-
packetSchema,
|
|
30
|
-
];
|
|
31
13
|
export default class Validator {
|
|
32
14
|
static #position = new CfValidator(positionSchema, "2020-12");
|
|
33
15
|
static #lineMarker = new CfValidator(lineMarkerSchema, "2020-12");
|
|
@@ -36,17 +18,9 @@ export default class Validator {
|
|
|
36
18
|
static #parsedPath = Validator.#buildWithRefs(parsedPathSchema, [paramsSchema]);
|
|
37
19
|
static #matcherBody = new CfValidator(matcherBodySchema, "2020-12");
|
|
38
20
|
static #sendBody = new CfValidator(sendBodySchema, "2020-12");
|
|
39
|
-
static #entry = Validator.#buildWithRefs(entrySchema, [paramsSchema, channelContentSchema]);
|
|
40
21
|
static #schemeRegistration = new CfValidator(schemeRegistrationSchema, "2020-12");
|
|
41
22
|
static #providerDeclaration = new CfValidator(providerDeclarationSchema, "2020-12");
|
|
42
|
-
static #logEntry = Validator.#buildWithRefs(logEntrySchema, [paramsSchema, lineMarkerSchema]);
|
|
43
23
|
static #plurnkStatement = Validator.#buildWithRefs(plurnkStatementSchema, [positionSchema, lineMarkerSchema, paramsSchema, parsedPathSchema, matcherBodySchema, sendBodySchema]);
|
|
44
|
-
static #turn = Validator.#buildWithRefs(turnSchema, FOUNDATIONAL);
|
|
45
|
-
static #loop = new CfValidator(loopSchema, "2020-12");
|
|
46
|
-
static #run = new CfValidator(runSchema, "2020-12");
|
|
47
|
-
static #session = Validator.#buildWithRefs(sessionSchema, [schemeRegistrationSchema]);
|
|
48
|
-
static #agent = Validator.#buildWithRefs(agentSchema, [providerDeclarationSchema, schemeRegistrationSchema]);
|
|
49
|
-
static #packet = Validator.#buildWithRefs(packetSchema, FOUNDATIONAL);
|
|
50
24
|
static #telemetryEvent = new CfValidator(telemetryEventSchema, "2020-12");
|
|
51
25
|
static #buildWithRefs(mainSchema, refSchemas) {
|
|
52
26
|
const validator = new CfValidator(mainSchema, "2020-12");
|
|
@@ -66,17 +40,9 @@ export default class Validator {
|
|
|
66
40
|
static validateParsedPath(obj) { return Validator.#run_(Validator.#parsedPath, obj); }
|
|
67
41
|
static validateMatcherBody(obj) { return Validator.#run_(Validator.#matcherBody, obj); }
|
|
68
42
|
static validateSendBody(obj) { return Validator.#run_(Validator.#sendBody, obj); }
|
|
69
|
-
static validateEntry(obj) { return Validator.#run_(Validator.#entry, obj); }
|
|
70
43
|
static validateSchemeRegistration(obj) { return Validator.#run_(Validator.#schemeRegistration, obj); }
|
|
71
44
|
static validateProviderDeclaration(obj) { return Validator.#run_(Validator.#providerDeclaration, obj); }
|
|
72
|
-
static validateLogEntry(obj) { return Validator.#run_(Validator.#logEntry, obj); }
|
|
73
45
|
static validatePlurnkStatement(obj) { return Validator.#run_(Validator.#plurnkStatement, obj); }
|
|
74
|
-
static validateTurn(obj) { return Validator.#run_(Validator.#turn, obj); }
|
|
75
|
-
static validateLoop(obj) { return Validator.#run_(Validator.#loop, obj); }
|
|
76
|
-
static validateRun(obj) { return Validator.#run_(Validator.#run, obj); }
|
|
77
|
-
static validateSession(obj) { return Validator.#run_(Validator.#session, obj); }
|
|
78
|
-
static validateAgent(obj) { return Validator.#run_(Validator.#agent, obj); }
|
|
79
|
-
static validatePacket(obj) { return Validator.#run_(Validator.#packet, obj); }
|
|
80
46
|
static validateTelemetryEvent(obj) { return Validator.#run_(Validator.#telemetryEvent, obj); }
|
|
81
47
|
static #run_(validator, obj) {
|
|
82
48
|
const result = validator.validate(obj);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.js","sourceRoot":"","sources":["../../src/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,WAAW,EAAgC,MAAM,uBAAuB,CAAC;AAC/F,OAAO,cAAc,MAAM,yBAAyB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC3E,OAAO,gBAAgB,MAAM,2BAA2B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/E,OAAO,YAAY,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACvE,OAAO,oBAAoB,MAAM,+BAA+B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACvF,OAAO,gBAAgB,MAAM,2BAA2B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/E,OAAO,iBAAiB,MAAM,4BAA4B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACjF,OAAO,cAAc,MAAM,yBAAyB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC3E,OAAO,
|
|
1
|
+
{"version":3,"file":"Validator.js","sourceRoot":"","sources":["../../src/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,WAAW,EAAgC,MAAM,uBAAuB,CAAC;AAC/F,OAAO,cAAc,MAAM,yBAAyB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC3E,OAAO,gBAAgB,MAAM,2BAA2B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/E,OAAO,YAAY,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACvE,OAAO,oBAAoB,MAAM,+BAA+B,CAAC,OAAO,IAAI,EAAE,M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