@plurnk/plurnk-contracts 1.6.1 → 1.8.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 (51) hide show
  1. package/SPEC.md +133 -48
  2. package/dist/plurnk.gemma.gbnf +26 -22
  3. package/dist/plurnk.qwen.gbnf +26 -22
  4. package/dist/schema/ClientInteractionProjection.json +16 -0
  5. package/dist/schema/ClientInteractionRequest.json +15 -0
  6. package/dist/schema/ClientInteractionResolution.json +25 -0
  7. package/dist/schema/ClientStatement.json +9 -4
  8. package/dist/schema/McpConfigurationOverlay.json +25 -0
  9. package/dist/schema/McpServerDefinition.json +155 -0
  10. package/dist/schema/McpServerOptions.json +36 -0
  11. package/dist/schema/ModelCatalogPage.json +122 -0
  12. package/dist/schema/ModelCatalogQuery.json +32 -0
  13. package/dist/schema/ModelReadiness.json +47 -0
  14. package/dist/schema/ModelRoute.json +23 -0
  15. package/dist/schema/PlurnkStatement.json +48 -31
  16. package/dist/schema/ReasoningPolicy.json +7 -0
  17. package/dist/src/AstBuilder.d.ts.map +1 -1
  18. package/dist/src/AstBuilder.js +42 -21
  19. package/dist/src/AstBuilder.js.map +1 -1
  20. package/dist/src/PlurnkErrorStrategy.js +16 -16
  21. package/dist/src/PlurnkErrorStrategy.js.map +1 -1
  22. package/dist/src/PlurnkParser.js +3 -3
  23. package/dist/src/PlurnkParser.js.map +1 -1
  24. package/dist/src/Validator.d.ts +45 -1
  25. package/dist/src/Validator.d.ts.map +1 -1
  26. package/dist/src/Validator.js +193 -0
  27. package/dist/src/Validator.js.map +1 -1
  28. package/dist/src/generated/plurnkLexer.d.ts +30 -28
  29. package/dist/src/generated/plurnkLexer.d.ts.map +1 -1
  30. package/dist/src/generated/plurnkLexer.js +398 -381
  31. package/dist/src/generated/plurnkLexer.js.map +1 -1
  32. package/dist/src/generated/plurnkParser.d.ts +56 -39
  33. package/dist/src/generated/plurnkParser.d.ts.map +1 -1
  34. package/dist/src/generated/plurnkParser.js +644 -450
  35. package/dist/src/generated/plurnkParser.js.map +1 -1
  36. package/dist/src/generated/plurnkParserVisitor.d.ts +7 -7
  37. package/dist/src/generated/plurnkParserVisitor.d.ts.map +1 -1
  38. package/dist/src/generated/plurnkParserVisitor.js +6 -6
  39. package/dist/src/generated/plurnkParserVisitor.js.map +1 -1
  40. package/dist/src/index.d.ts +2 -2
  41. package/dist/src/index.d.ts.map +1 -1
  42. package/dist/src/index.js +2 -2
  43. package/dist/src/index.js.map +1 -1
  44. package/dist/src/types.d.ts +2 -1
  45. package/dist/src/types.d.ts.map +1 -1
  46. package/dist/src/types.generated.d.ts +214 -19
  47. package/dist/src/types.generated.d.ts.map +1 -1
  48. package/dist/src/types.js +4 -0
  49. package/dist/src/types.js.map +1 -1
  50. package/package.json +2 -3
  51. package/plurnk.md +91 -110
@@ -15,6 +15,9 @@
15
15
  { "type": "null" }
16
16
  ]
17
17
  },
18
+ "AnnotationOrNull": {
19
+ "type": ["string", "null"]
20
+ },
18
21
  "PathOrNull": {
19
22
  "oneOf": [
20
23
  { "$ref": "https://schemas.plurnk.dev/v0/ParsedPath.json" },
@@ -44,11 +47,12 @@
44
47
  },
45
48
  "LookStatement": {
46
49
  "type": "object",
47
- "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
50
+ "required": ["op", "delimiter", "annotation", "signal", "target", "lineMarker", "body", "position"],
48
51
  "additionalProperties": false,
49
52
  "properties": {
50
53
  "op": { "const": "LOOK" },
51
- "suffix": { "type": "string" },
54
+ "delimiter": { "type": "string" },
55
+ "annotation": { "$ref": "#/$defs/AnnotationOrNull" },
52
56
  "signal": { "$ref": "#/$defs/TagSignal" },
53
57
  "target": { "$ref": "#/$defs/PathOrNull" },
54
58
  "lineMarker": { "$ref": "#/$defs/TextLineMarkerOrNull" },
@@ -58,11 +62,12 @@
58
62
  },
59
63
  "BuffStatement": {
60
64
  "type": "object",
61
- "required": ["op", "suffix", "signal", "target", "lineMarker", "body", "position"],
65
+ "required": ["op", "delimiter", "annotation", "signal", "target", "lineMarker", "body", "position"],
62
66
  "additionalProperties": false,
63
67
  "properties": {
64
68
  "op": { "const": "BUFF" },
65
- "suffix": { "type": "string" },
69
+ "delimiter": { "type": "string" },
70
+ "annotation": { "$ref": "#/$defs/AnnotationOrNull" },
66
71
  "signal": { "$ref": "#/$defs/TagSignal" },
67
72
  "target": { "$ref": "#/$defs/PathOrNull" },
68
73
  "lineMarker": { "$ref": "#/$defs/LineMarkerOrNull" },
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/McpConfigurationOverlay.json",
4
+ "title": "McpConfigurationOverlay",
5
+ "type": "object",
6
+ "propertyNames": {
7
+ "allOf": [
8
+ {
9
+ "pattern": "^PLURNK_MCP_[A-Za-z0-9_.+-]+$"
10
+ },
11
+ {
12
+ "not": {
13
+ "enum": [
14
+ "PLURNK_MCP_CONNECT_TIMEOUT",
15
+ "PLURNK_MCP_REQUEST_TIMEOUT",
16
+ "PLURNK_MCP_ENABLED"
17
+ ]
18
+ }
19
+ }
20
+ ]
21
+ },
22
+ "additionalProperties": {
23
+ "type": "string"
24
+ }
25
+ }
@@ -0,0 +1,155 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/McpServerDefinition.json",
4
+ "title": "McpServerDefinition",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["name", "transport"],
8
+ "properties": {
9
+ "name": {
10
+ "type": "string",
11
+ "pattern": "^[a-z][a-z0-9-]*$"
12
+ },
13
+ "transport": {
14
+ "enum": ["stdio", "http"]
15
+ },
16
+ "command": {
17
+ "type": "string",
18
+ "minLength": 1
19
+ },
20
+ "args": {
21
+ "type": "array",
22
+ "items": { "type": "string" }
23
+ },
24
+ "cwd": {
25
+ "type": "string",
26
+ "minLength": 1
27
+ },
28
+ "env": {
29
+ "type": "object",
30
+ "additionalProperties": { "type": "string" }
31
+ },
32
+ "url": {
33
+ "type": "string",
34
+ "format": "uri",
35
+ "pattern": "^https?://"
36
+ },
37
+ "headers": {
38
+ "type": "object",
39
+ "additionalProperties": { "type": "string" }
40
+ },
41
+ "authorization": {
42
+ "oneOf": [
43
+ {
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "required": ["type", "token"],
47
+ "properties": {
48
+ "type": { "const": "bearer" },
49
+ "token": { "$ref": "#/$defs/environmentReference" }
50
+ }
51
+ },
52
+ {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["type", "redirectUrl", "clientMetadataUrl"],
56
+ "properties": {
57
+ "type": { "const": "oauth" },
58
+ "redirectUrl": { "type": "string", "format": "uri" },
59
+ "clientMetadataUrl": {
60
+ "type": "string",
61
+ "format": "uri",
62
+ "pattern": "^https://.+/.+"
63
+ },
64
+ "scope": { "type": "string", "minLength": 1 }
65
+ }
66
+ },
67
+ {
68
+ "type": "object",
69
+ "additionalProperties": false,
70
+ "required": ["type", "redirectUrl", "clientId", "clientSecret"],
71
+ "properties": {
72
+ "type": { "const": "oauth" },
73
+ "redirectUrl": { "type": "string", "format": "uri" },
74
+ "clientId": { "type": "string", "minLength": 1 },
75
+ "clientSecret": { "$ref": "#/$defs/environmentReference" },
76
+ "scope": { "type": "string", "minLength": 1 }
77
+ }
78
+ },
79
+ {
80
+ "type": "object",
81
+ "additionalProperties": false,
82
+ "required": ["type", "redirectUrl"],
83
+ "properties": {
84
+ "type": { "const": "oauth" },
85
+ "redirectUrl": { "type": "string", "format": "uri" },
86
+ "scope": { "type": "string", "minLength": 1 }
87
+ }
88
+ },
89
+ {
90
+ "type": "object",
91
+ "additionalProperties": false,
92
+ "required": ["type", "clientId", "clientSecret"],
93
+ "properties": {
94
+ "type": { "const": "client-credentials" },
95
+ "clientId": { "type": "string", "minLength": 1 },
96
+ "clientSecret": { "$ref": "#/$defs/environmentReference" },
97
+ "scope": { "type": "string", "minLength": 1 },
98
+ "issuer": { "type": "string", "minLength": 1 }
99
+ }
100
+ }
101
+ ]
102
+ },
103
+ "tools": {
104
+ "type": "array",
105
+ "uniqueItems": true,
106
+ "items": { "type": "string", "minLength": 1 }
107
+ },
108
+ "read": {
109
+ "type": "array",
110
+ "uniqueItems": true,
111
+ "items": { "type": "string", "minLength": 1 }
112
+ }
113
+ },
114
+ "$defs": {
115
+ "environmentReference": {
116
+ "type": "string",
117
+ "pattern": "^\\$\\{[A-Za-z_][A-Za-z0-9_]*\\}$"
118
+ }
119
+ },
120
+ "allOf": [
121
+ {
122
+ "if": {
123
+ "properties": { "transport": { "const": "stdio" } },
124
+ "required": ["transport"]
125
+ },
126
+ "then": {
127
+ "required": ["command"],
128
+ "not": {
129
+ "anyOf": [
130
+ { "required": ["url"] },
131
+ { "required": ["headers"] },
132
+ { "required": ["authorization"] }
133
+ ]
134
+ }
135
+ }
136
+ },
137
+ {
138
+ "if": {
139
+ "properties": { "transport": { "const": "http" } },
140
+ "required": ["transport"]
141
+ },
142
+ "then": {
143
+ "required": ["url"],
144
+ "not": {
145
+ "anyOf": [
146
+ { "required": ["command"] },
147
+ { "required": ["args"] },
148
+ { "required": ["cwd"] },
149
+ { "required": ["env"] }
150
+ ]
151
+ }
152
+ }
153
+ }
154
+ ]
155
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/McpServerOptions.json",
4
+ "title": "McpServerOptions",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "args": {
9
+ "title": "McpServerArguments",
10
+ "$ref": "https://schemas.plurnk.dev/v0/McpServerDefinition.json#/properties/args"
11
+ },
12
+ "cwd": {
13
+ "$ref": "https://schemas.plurnk.dev/v0/McpServerDefinition.json#/properties/cwd"
14
+ },
15
+ "env": {
16
+ "title": "McpServerEnvironment",
17
+ "$ref": "https://schemas.plurnk.dev/v0/McpServerDefinition.json#/properties/env"
18
+ },
19
+ "headers": {
20
+ "title": "McpServerHeaders",
21
+ "$ref": "https://schemas.plurnk.dev/v0/McpServerDefinition.json#/properties/headers"
22
+ },
23
+ "authorization": {
24
+ "title": "McpServerAuthorization",
25
+ "$ref": "https://schemas.plurnk.dev/v0/McpServerDefinition.json#/properties/authorization"
26
+ },
27
+ "tools": {
28
+ "title": "McpServerToolNames",
29
+ "$ref": "https://schemas.plurnk.dev/v0/McpServerDefinition.json#/properties/tools"
30
+ },
31
+ "read": {
32
+ "title": "McpServerReadTools",
33
+ "$ref": "https://schemas.plurnk.dev/v0/McpServerDefinition.json#/properties/read"
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,122 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/ModelCatalogPage.json",
4
+ "title": "ModelCatalogPage",
5
+ "description": "One deterministic bounded page from the release-pinned model catalog.",
6
+ "type": "object",
7
+ "required": ["items", "offset", "total"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "items": {
11
+ "type": "array",
12
+ "maxItems": 100,
13
+ "items": {
14
+ "$ref": "#/$defs/model"
15
+ }
16
+ },
17
+ "offset": {
18
+ "type": "integer",
19
+ "minimum": 0,
20
+ "maximum": 9007199254740991
21
+ },
22
+ "total": {
23
+ "type": "integer",
24
+ "minimum": 0,
25
+ "maximum": 9007199254740991
26
+ },
27
+ "nextOffset": {
28
+ "type": "integer",
29
+ "minimum": 1,
30
+ "maximum": 9007199254740991
31
+ }
32
+ },
33
+ "$defs": {
34
+ "model": {
35
+ "title": "ModelCatalogEntry",
36
+ "type": "object",
37
+ "required": [
38
+ "selector",
39
+ "provider",
40
+ "providerName",
41
+ "model",
42
+ "modelName",
43
+ "limits",
44
+ "capabilities",
45
+ "readiness"
46
+ ],
47
+ "additionalProperties": false,
48
+ "properties": {
49
+ "selector": {
50
+ "type": "string",
51
+ "minLength": 3
52
+ },
53
+ "provider": {
54
+ "type": "string",
55
+ "minLength": 1
56
+ },
57
+ "providerName": {
58
+ "type": "string",
59
+ "minLength": 1
60
+ },
61
+ "model": {
62
+ "type": "string",
63
+ "minLength": 1
64
+ },
65
+ "modelName": {
66
+ "type": "string",
67
+ "minLength": 1
68
+ },
69
+ "limits": {
70
+ "$ref": "#/$defs/limits"
71
+ },
72
+ "capabilities": {
73
+ "$ref": "#/$defs/capabilities"
74
+ },
75
+ "readiness": {
76
+ "$ref": "https://schemas.plurnk.dev/v0/ModelReadiness.json"
77
+ }
78
+ }
79
+ },
80
+ "limits": {
81
+ "title": "ModelCatalogLimits",
82
+ "type": "object",
83
+ "required": ["contextTokens"],
84
+ "additionalProperties": false,
85
+ "properties": {
86
+ "contextTokens": {
87
+ "type": "integer",
88
+ "minimum": 1
89
+ },
90
+ "inputTokens": {
91
+ "type": "integer",
92
+ "minimum": 1
93
+ },
94
+ "outputTokens": {
95
+ "type": "integer",
96
+ "minimum": 1
97
+ }
98
+ }
99
+ },
100
+ "capabilities": {
101
+ "title": "ModelCatalogCapabilities",
102
+ "type": "object",
103
+ "required": ["attachment", "reasoning", "toolCall", "inputModalities", "outputModalities"],
104
+ "additionalProperties": false,
105
+ "properties": {
106
+ "attachment": { "type": "boolean" },
107
+ "reasoning": { "type": "boolean" },
108
+ "toolCall": { "type": "boolean" },
109
+ "structuredOutput": { "type": "boolean" },
110
+ "temperature": { "type": "boolean" },
111
+ "inputModalities": {
112
+ "type": "array",
113
+ "items": { "type": "string", "minLength": 1 }
114
+ },
115
+ "outputModalities": {
116
+ "type": "array",
117
+ "items": { "type": "string", "minLength": 1 }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/ModelCatalogQuery.json",
4
+ "title": "ModelCatalogQuery",
5
+ "description": "A bounded query over the release-pinned Models.dev catalog.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "provider": {
10
+ "type": "string",
11
+ "minLength": 1,
12
+ "maxLength": 128
13
+ },
14
+ "search": {
15
+ "type": "string",
16
+ "maxLength": 256
17
+ },
18
+ "availability": {
19
+ "enum": ["configured", "all"]
20
+ },
21
+ "offset": {
22
+ "type": "integer",
23
+ "minimum": 0,
24
+ "maximum": 9007199254740991
25
+ },
26
+ "limit": {
27
+ "type": "integer",
28
+ "minimum": 1,
29
+ "maximum": 100
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/ModelReadiness.json",
4
+ "title": "ModelReadiness",
5
+ "description": "Local configuration evidence that a catalog provider is ready to attempt a request, without probing or validating credentials.",
6
+ "type": "object",
7
+ "required": ["ready", "causes"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "ready": {
11
+ "type": "boolean"
12
+ },
13
+ "causes": {
14
+ "type": "array",
15
+ "items": {
16
+ "$ref": "#/$defs/cause"
17
+ }
18
+ }
19
+ },
20
+ "$defs": {
21
+ "cause": {
22
+ "title": "ModelReadinessCause",
23
+ "type": "object",
24
+ "required": ["kind", "alternatives"],
25
+ "additionalProperties": false,
26
+ "properties": {
27
+ "kind": {
28
+ "enum": ["credential", "configuration"]
29
+ },
30
+ "alternatives": {
31
+ "description": "Alternative environment-variable sets. Every name in one inner array is required; satisfying any inner array resolves this cause.",
32
+ "type": "array",
33
+ "minItems": 1,
34
+ "items": {
35
+ "type": "array",
36
+ "minItems": 1,
37
+ "uniqueItems": true,
38
+ "items": {
39
+ "type": "string",
40
+ "pattern": "^[A-Z0-9_]+$"
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.dev/v0/ModelRoute.json",
4
+ "title": "ModelRoute",
5
+ "description": "A client-visible resolved provider/model identity. Alias is present only when a declared alias supplied the route; provider configuration remains private to the daemon.",
6
+ "type": "object",
7
+ "required": ["provider", "model"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "alias": {
11
+ "type": "string",
12
+ "minLength": 1
13
+ },
14
+ "provider": {
15
+ "type": "string",
16
+ "minLength": 1
17
+ },
18
+ "model": {
19
+ "type": "string",
20
+ "minLength": 1
21
+ }
22
+ }
23
+ }