structured-context 0.12.0 → 0.13.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 (94) hide show
  1. package/README.md +29 -216
  2. package/dist/api.d.ts +17 -17
  3. package/dist/api.js +12 -12
  4. package/dist/commands/docs.js +1 -0
  5. package/dist/commands/providers.d.ts +4 -0
  6. package/dist/commands/providers.js +52 -0
  7. package/dist/commands/schemas.js +21 -2
  8. package/dist/commands/validate-file.d.ts +3 -0
  9. package/dist/commands/validate-file.js +17 -2
  10. package/dist/commands/validate.d.ts +4 -0
  11. package/dist/commands/validate.js +42 -3
  12. package/dist/config.d.ts +7 -0
  13. package/dist/config.js +26 -3
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +59 -18
  16. package/dist/judge/context.d.ts +20 -0
  17. package/dist/judge/context.js +105 -0
  18. package/dist/judge/factory.d.ts +44 -0
  19. package/dist/judge/factory.js +148 -0
  20. package/dist/judge/index.d.ts +13 -0
  21. package/dist/judge/index.js +8 -0
  22. package/dist/judge/judge-node.d.ts +27 -0
  23. package/dist/judge/judge-node.js +122 -0
  24. package/dist/judge/prompt.d.ts +10 -0
  25. package/dist/judge/prompt.js +92 -0
  26. package/dist/judge/provider/anthropic.d.ts +17 -0
  27. package/dist/judge/provider/anthropic.js +43 -0
  28. package/dist/judge/provider/fake.d.ts +26 -0
  29. package/dist/judge/provider/fake.js +56 -0
  30. package/dist/judge/provider/jev.d.ts +37 -0
  31. package/dist/judge/provider/jev.js +169 -0
  32. package/dist/judge/provider/openai-decisions.d.ts +21 -0
  33. package/dist/judge/provider/openai-decisions.js +84 -0
  34. package/dist/judge/provider/openai.d.ts +20 -0
  35. package/dist/judge/provider/openai.js +53 -0
  36. package/dist/judge/provider/per-rule.d.ts +10 -0
  37. package/dist/judge/provider/per-rule.js +18 -0
  38. package/dist/judge/trim.d.ts +27 -0
  39. package/dist/judge/trim.js +62 -0
  40. package/dist/judge/types.d.ts +92 -0
  41. package/dist/judge/types.js +9 -0
  42. package/dist/judge/verdicts.d.ts +24 -0
  43. package/dist/judge/verdicts.js +82 -0
  44. package/dist/load-space-graph.d.ts +3 -3
  45. package/dist/load-space-graph.js +4 -4
  46. package/dist/plugins/loader.js +1 -1
  47. package/dist/plugins/markdown/parse-embedded.d.ts +2 -0
  48. package/dist/plugins/markdown/parse-embedded.js +161 -24
  49. package/dist/plugins/markdown/read-space.js +4 -9
  50. package/dist/plugins/markdown/render-directory.js +5 -5
  51. package/dist/plugins/markdown/template-sync.js +3 -4
  52. package/dist/plugins/markdown/util.d.ts +26 -5
  53. package/dist/plugins/markdown/util.js +56 -15
  54. package/dist/render/render.d.ts +1 -1
  55. package/dist/render/render.js +1 -1
  56. package/dist/schema/evaluate-rule.d.ts +33 -2
  57. package/dist/schema/evaluate-rule.js +58 -4
  58. package/dist/schema/gating.d.ts +69 -0
  59. package/dist/schema/gating.js +253 -0
  60. package/dist/schema/metadata-contract.d.ts +625 -12
  61. package/dist/schema/metadata-contract.js +110 -4
  62. package/dist/schema/rule-filter.d.ts +12 -0
  63. package/dist/schema/rule-filter.js +46 -0
  64. package/dist/schema/rule-severity.d.ts +13 -0
  65. package/dist/schema/rule-severity.js +33 -0
  66. package/dist/schema/schema.js +31 -1
  67. package/dist/schema/validate-rules.d.ts +17 -8
  68. package/dist/schema/validate-rules.js +91 -48
  69. package/dist/schemas/_knowledge_wiki.json +4 -4
  70. package/dist/schemas/_okf.json +172 -0
  71. package/dist/schemas/_ost_strict.json +15 -6
  72. package/dist/schemas/_sctx_base.json +1 -1
  73. package/dist/schemas/generated/0.13.0/_structured_context_schema_meta.json +400 -0
  74. package/dist/schemas/generated/latest/_structured_context_schema_meta.json +177 -6
  75. package/dist/schemas/okf.json +8 -0
  76. package/dist/space-context.d.ts +2 -2
  77. package/dist/space-context.js +3 -3
  78. package/dist/space-graph.d.ts +1 -1
  79. package/dist/testing.d.ts +1 -1
  80. package/dist/types.d.ts +11 -4
  81. package/dist/validate.d.ts +59 -9
  82. package/dist/validate.js +225 -120
  83. package/docs/concepts.md +52 -6
  84. package/docs/config.md +70 -1
  85. package/docs/rules.md +140 -49
  86. package/docs/schemas.md +43 -18
  87. package/package.json +6 -5
  88. package/schemas/_knowledge_wiki.json +4 -4
  89. package/schemas/_okf.json +172 -0
  90. package/schemas/_ost_strict.json +15 -6
  91. package/schemas/_sctx_base.json +1 -1
  92. package/schemas/generated/0.13.0/_structured_context_schema_meta.json +400 -0
  93. package/schemas/generated/latest/_structured_context_schema_meta.json +177 -6
  94. package/schemas/okf.json +8 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/0.12.0/_structured_context_schema_meta.json",
3
+ "$id": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/0.13.0/_structured_context_schema_meta.json",
4
4
  "title": "structured-context schema dialect",
5
5
  "description": "Extends JSON Schema 2020-12 with top-level $metadata for imports, hierarchy, relationships, aliases and rules.",
6
6
  "type": "object",
@@ -203,23 +203,194 @@
203
203
  "type": "string",
204
204
  "minLength": 1
205
205
  },
206
- "check": {
206
+ "expression": {
207
207
  "type": "string",
208
208
  "minLength": 1
209
209
  },
210
+ "when": {
211
+ "type": "string",
212
+ "minLength": 1
213
+ },
214
+ "semantic": {
215
+ "oneOf": [
216
+ {
217
+ "const": true
218
+ },
219
+ {
220
+ "type": "object",
221
+ "properties": {
222
+ "rubric": {
223
+ "type": "string",
224
+ "minLength": 1
225
+ },
226
+ "verdicts": {
227
+ "type": "object",
228
+ "additionalProperties": {
229
+ "oneOf": [
230
+ {
231
+ "type": "string",
232
+ "minLength": 1
233
+ },
234
+ {
235
+ "type": "object",
236
+ "properties": {
237
+ "description": {
238
+ "type": "string",
239
+ "minLength": 1
240
+ },
241
+ "guidance": {
242
+ "type": "string",
243
+ "minLength": 1
244
+ }
245
+ },
246
+ "required": ["description"],
247
+ "additionalProperties": false
248
+ }
249
+ ]
250
+ },
251
+ "minProperties": 2
252
+ },
253
+ "severity": {
254
+ "type": "object",
255
+ "additionalProperties": {
256
+ "enum": ["error", "warning", "info", "ignore"]
257
+ },
258
+ "minProperties": 1
259
+ },
260
+ "scope": {
261
+ "type": "array",
262
+ "items": {
263
+ "enum": ["parent", "siblings", "children", "ancestors", "descendants", "branch"]
264
+ },
265
+ "uniqueItems": true
266
+ },
267
+ "includeContent": {
268
+ "enum": ["nodeOnly", "fullScope", true]
269
+ }
270
+ },
271
+ "additionalProperties": false
272
+ }
273
+ ]
274
+ },
210
275
  "type": {
211
276
  "type": "string",
212
277
  "minLength": 1
213
278
  },
214
- "scope": {
215
- "enum": ["global"]
279
+ "global": {
280
+ "type": "boolean"
216
281
  },
217
282
  "override": {
218
283
  "type": "boolean"
284
+ },
285
+ "gatesDescendants": {
286
+ "type": "boolean"
219
287
  }
220
288
  },
221
- "required": ["id", "category", "description", "check"],
222
- "additionalProperties": false
289
+ "required": ["id", "category", "description"],
290
+ "additionalProperties": false,
291
+ "allOf": [
292
+ {
293
+ "anyOf": [
294
+ {
295
+ "required": ["expression"]
296
+ },
297
+ {
298
+ "required": ["semantic"]
299
+ }
300
+ ]
301
+ },
302
+ {
303
+ "if": {
304
+ "required": ["global"],
305
+ "properties": {
306
+ "global": {
307
+ "const": true
308
+ }
309
+ }
310
+ },
311
+ "then": {
312
+ "not": {
313
+ "anyOf": [
314
+ {
315
+ "required": ["when"]
316
+ },
317
+ {
318
+ "required": ["type"]
319
+ },
320
+ {
321
+ "required": ["semantic"]
322
+ }
323
+ ]
324
+ }
325
+ }
326
+ },
327
+ {
328
+ "if": {
329
+ "required": ["semantic"],
330
+ "properties": {
331
+ "semantic": {
332
+ "type": "object",
333
+ "required": ["verdicts"]
334
+ }
335
+ }
336
+ },
337
+ "then": {
338
+ "properties": {
339
+ "semantic": {
340
+ "type": "object",
341
+ "required": ["severity"]
342
+ }
343
+ }
344
+ }
345
+ },
346
+ {
347
+ "if": {
348
+ "required": ["semantic"],
349
+ "properties": {
350
+ "semantic": {
351
+ "type": "object",
352
+ "not": {
353
+ "required": ["verdicts"]
354
+ }
355
+ }
356
+ }
357
+ },
358
+ "then": {
359
+ "properties": {
360
+ "semantic": {
361
+ "type": "object",
362
+ "properties": {
363
+ "severity": {
364
+ "type": "object",
365
+ "not": {
366
+ "required": ["fail"]
367
+ }
368
+ }
369
+ }
370
+ }
371
+ }
372
+ }
373
+ },
374
+ {
375
+ "if": {
376
+ "required": ["semantic"],
377
+ "properties": {
378
+ "semantic": {
379
+ "type": "object",
380
+ "required": ["verdicts"]
381
+ }
382
+ },
383
+ "not": {
384
+ "required": ["expression"]
385
+ }
386
+ },
387
+ "then": {
388
+ "not": {
389
+ "required": ["severity"]
390
+ }
391
+ }
392
+ }
393
+ ]
223
394
  }
224
395
  }
225
396
  },
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/latest/_structured_context_schema_meta.json",
3
+ "$id": "sctx://core/okf",
4
+ "title": "Open Knowledge Format",
5
+ "description": "Validates the frontmatter of Open Knowledge Format (OKF v0.2) concept documents in a bundle. Any `type` is accepted and unknown fields are tolerated; `Attested Computation` concepts additionally carry the computation contract.\n\nSpecification: https://github.com/GoogleCloudPlatform/open-knowledge-format",
6
+ "$metadata": { "imports": ["sctx://core/_okf"] },
7
+ "allOf": [{ "$ref": "sctx://core/_okf" }, { "$ref": "sctx://core/_okf#/$defs/concept" }]
8
+ }