@qijenchen/governance 0.1.0-beta.94

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 (40) hide show
  1. package/README.md +89 -0
  2. package/bin/attest.mjs +4 -0
  3. package/bin/check.mjs +4 -0
  4. package/bin/doctor.mjs +4 -0
  5. package/bin/generate.mjs +4 -0
  6. package/bin/governance.mjs +4 -0
  7. package/bin/hook.mjs +4 -0
  8. package/bin/upgrade.mjs +4 -0
  9. package/canonical/gates.json +42 -0
  10. package/canonical/manifest.json +476 -0
  11. package/canonical/plugin-aliases.json +25 -0
  12. package/canonical/provider-lifecycle.json +48 -0
  13. package/canonical/providers.json +455 -0
  14. package/canonical/roles.json +12 -0
  15. package/canonical/rules.json +81 -0
  16. package/canonical/schemas/attestation.schema.json +61 -0
  17. package/canonical/schemas/diagnostic.schema.json +37 -0
  18. package/canonical/schemas/gates.schema.json +27 -0
  19. package/canonical/schemas/lock.schema.json +189 -0
  20. package/canonical/schemas/manifest.schema.json +103 -0
  21. package/canonical/schemas/plugin-aliases.schema.json +59 -0
  22. package/canonical/schemas/provider-hook-coverage.schema.json +173 -0
  23. package/canonical/schemas/provider-lifecycle.schema.json +126 -0
  24. package/canonical/schemas/providers.schema.json +917 -0
  25. package/canonical/schemas/roles.schema.json +27 -0
  26. package/canonical/schemas/rules.schema.json +46 -0
  27. package/canonical/schemas/upgrade-plan.schema.json +31 -0
  28. package/package.json +42 -0
  29. package/src/authority-decision-evidence.mjs +413 -0
  30. package/src/canonical-order.mjs +8 -0
  31. package/src/carrier-projection.mjs +407 -0
  32. package/src/cli.mjs +114 -0
  33. package/src/closed-tool-execution.mjs +1001 -0
  34. package/src/common.mjs +278 -0
  35. package/src/contract.mjs +760 -0
  36. package/src/hook-api.mjs +107 -0
  37. package/src/index.mjs +14 -0
  38. package/src/provider-hook-normalization.mjs +1646 -0
  39. package/src/provider-review-binding.mjs +2377 -0
  40. package/src/snapshot.mjs +520 -0
@@ -0,0 +1,917 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://qijenchen.dev/schemas/governance/providers-v9.json",
4
+ "title": "Data-driven governance provider adapter registry",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "canonical", "providers"],
8
+ "properties": {
9
+ "$schema": { "type": "string" },
10
+ "schemaVersion": { "const": 9 },
11
+ "canonical": {
12
+ "type": "object",
13
+ "additionalProperties": false,
14
+ "required": ["roots", "hookRegistrations", "skillSemantics", "productSharedInstructionSource", "reviewSelectionPolicies", "materializers", "compatibilityProjections", "reservedDiscovery", "retiredProviders"],
15
+ "properties": {
16
+ "roots": {
17
+ "type": "object",
18
+ "additionalProperties": false,
19
+ "required": ["contextForkAgents", "commands", "hooks", "references", "rules", "skills"],
20
+ "properties": {
21
+ "contextForkAgents": { "$ref": "#/$defs/repositoryPath" },
22
+ "commands": { "$ref": "#/$defs/repositoryPath" },
23
+ "hooks": { "$ref": "#/$defs/repositoryPath" },
24
+ "references": { "$ref": "#/$defs/repositoryPath" },
25
+ "rules": { "$ref": "#/$defs/repositoryPath" },
26
+ "skills": { "$ref": "#/$defs/repositoryPath" }
27
+ }
28
+ },
29
+ "hookRegistrations": { "$ref": "#/$defs/repositoryPath" },
30
+ "skillSemantics": { "$ref": "#/$defs/repositoryPath" },
31
+ "productSharedInstructionSource": { "$ref": "#/$defs/repositoryPath" },
32
+ "reviewSelectionPolicies": {
33
+ "type": "object",
34
+ "minProperties": 1,
35
+ "additionalProperties": { "$ref": "#/$defs/reviewSelectionPolicy" }
36
+ },
37
+ "materializers": { "$ref": "#/$defs/materializerCatalog" },
38
+ "compatibilityProjections": { "$ref": "#/$defs/compatibilityProjections" },
39
+ "reservedDiscovery": { "$ref": "#/$defs/discoveryInventory" },
40
+ "retiredProviders": {
41
+ "type": "array",
42
+ "uniqueItems": true,
43
+ "items": { "$ref": "#/$defs/retiredProvider" }
44
+ }
45
+ }
46
+ },
47
+ "providers": {
48
+ "type": "array",
49
+ "minItems": 1,
50
+ "items": { "$ref": "#/$defs/provider" }
51
+ }
52
+ },
53
+ "$defs": {
54
+ "repositoryPath": {
55
+ "type": "string",
56
+ "minLength": 1,
57
+ "not": { "pattern": "^(?:/|[A-Za-z]:|.*(?:^|/)\\.\\.(?:/|$))" }
58
+ },
59
+ "adapterOutputPath": {
60
+ "type": "string",
61
+ "pattern": "^\\.(?!git(?:hub)?(?:/|$))[A-Za-z0-9_-]+/[A-Za-z0-9_.@/-]+$",
62
+ "not": { "pattern": "(?:^|/)\\.{1,2}(?:/|$)" }
63
+ },
64
+ "stringArray": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
65
+ "materializerId": {
66
+ "type": "string",
67
+ "pattern": "^[a-z][a-z0-9-]*-v[1-9][0-9]*$"
68
+ },
69
+ "providerId": {
70
+ "type": "string",
71
+ "pattern": "^[a-z][a-z0-9-]*$"
72
+ },
73
+ "compatibilityProjections": {
74
+ "type": "object",
75
+ "additionalProperties": false,
76
+ "required": ["legacyClaudeInstruction", "legacyCodexCorpus", "marketplacePluginTransport"],
77
+ "properties": {
78
+ "legacyClaudeInstruction": {
79
+ "type": "object",
80
+ "additionalProperties": false,
81
+ "required": ["schemaVersion", "providerId", "discoveryCategories", "legacyProductTreeTombstones"],
82
+ "properties": {
83
+ "schemaVersion": { "const": 1 },
84
+ "providerId": { "$ref": "#/$defs/providerId" },
85
+ "discoveryCategories": {
86
+ "type": "array",
87
+ "items": { "$ref": "#/$defs/compatibilityDiscoveryCategory" }
88
+ },
89
+ "legacyProductTreeTombstones": {
90
+ "type": "array",
91
+ "uniqueItems": true,
92
+ "items": { "$ref": "#/$defs/adapterOutputPath" }
93
+ }
94
+ }
95
+ },
96
+ "legacyCodexCorpus": {
97
+ "type": "object",
98
+ "additionalProperties": false,
99
+ "required": ["schemaVersion", "providerId", "hookArtifact", "skillArtifactRoot"],
100
+ "properties": {
101
+ "schemaVersion": { "const": 1 },
102
+ "providerId": { "$ref": "#/$defs/providerId" },
103
+ "hookArtifact": { "$ref": "#/$defs/repositoryPath" },
104
+ "skillArtifactRoot": { "$ref": "#/$defs/repositoryPath" }
105
+ }
106
+ },
107
+ "marketplacePluginTransport": {
108
+ "type": "object",
109
+ "additionalProperties": false,
110
+ "required": ["schemaVersion", "profileId", "pluginFullId", "providerId", "hookOutput", "aliasRegistry", "repositoryRole", "governanceRole", "projection", "targetRoleManifest"],
111
+ "properties": {
112
+ "schemaVersion": { "const": 2 },
113
+ "profileId": { "const": "claude-authority-full" },
114
+ "pluginFullId": { "const": "design-system@qijenchen-ds" },
115
+ "providerId": { "$ref": "#/$defs/providerId" },
116
+ "hookOutput": { "$ref": "#/$defs/repositoryPath" },
117
+ "aliasRegistry": { "$ref": "#/$defs/repositoryPath" },
118
+ "repositoryRole": { "const": "authority" },
119
+ "governanceRole": { "const": "ds-author" },
120
+ "projection": { "const": "full-canonical-registrations" },
121
+ "targetRoleManifest": { "const": "packages/governance/canonical/manifest.json" }
122
+ }
123
+ }
124
+ }
125
+ },
126
+ "compatibilityDiscoveryCategory": {
127
+ "type": "object",
128
+ "additionalProperties": false,
129
+ "required": ["name", "sourceRoot", "artifactRoot", "destinationRoot", "entries"],
130
+ "properties": {
131
+ "name": { "enum": ["agents", "commands"] },
132
+ "sourceRoot": { "$ref": "#/$defs/repositoryPath" },
133
+ "artifactRoot": {
134
+ "type": "string",
135
+ "pattern": "^[a-z][a-z0-9-]*$"
136
+ },
137
+ "destinationRoot": { "$ref": "#/$defs/adapterOutputPath" },
138
+ "entries": {
139
+ "type": "array",
140
+ "uniqueItems": true,
141
+ "items": {
142
+ "type": "string",
143
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.@-]*\\.md$"
144
+ }
145
+ }
146
+ }
147
+ },
148
+ "jsonField": {
149
+ "type": "string",
150
+ "pattern": "^[A-Za-z_][A-Za-z0-9_-]*$"
151
+ },
152
+ "instructionMaterializer": {
153
+ "oneOf": [
154
+ {
155
+ "type": "object",
156
+ "additionalProperties": false,
157
+ "required": ["engine", "ownershipPolicy", "supplementPolicy"],
158
+ "properties": {
159
+ "engine": { "const": "markdown-relative-at-import-v1" },
160
+ "ownershipPolicy": { "const": "provider-generated-projection" },
161
+ "supplementPolicy": { "enum": ["optional", "required"] }
162
+ }
163
+ },
164
+ {
165
+ "type": "object",
166
+ "additionalProperties": false,
167
+ "required": ["engine", "ownershipPolicy", "supplementPolicy"],
168
+ "properties": {
169
+ "engine": { "const": "shared-instruction-v1" },
170
+ "ownershipPolicy": { "const": "common-authority-consumer" },
171
+ "supplementPolicy": { "const": "forbidden" }
172
+ }
173
+ }
174
+ ]
175
+ },
176
+ "hookMapMaterializer": {
177
+ "type": "object",
178
+ "additionalProperties": false,
179
+ "required": ["engine", "hooksField", "descriptionField", "mergeStrategy", "baseTemplateContract"],
180
+ "properties": {
181
+ "engine": { "const": "json-hook-map-v1" },
182
+ "hooksField": { "$ref": "#/$defs/jsonField" },
183
+ "descriptionField": {
184
+ "oneOf": [
185
+ { "$ref": "#/$defs/jsonField" },
186
+ { "type": "null" }
187
+ ]
188
+ },
189
+ "mergeStrategy": { "enum": ["merge-hook-map-into-base-v1", "replace-document-v1"] },
190
+ "baseTemplateContract": {
191
+ "oneOf": [
192
+ { "$ref": "#/$defs/materializerId" },
193
+ { "type": "null" }
194
+ ]
195
+ }
196
+ },
197
+ "allOf": [
198
+ {
199
+ "if": { "properties": { "mergeStrategy": { "const": "merge-hook-map-into-base-v1" } }, "required": ["mergeStrategy"] },
200
+ "then": { "properties": { "baseTemplateContract": { "$ref": "#/$defs/materializerId" } } },
201
+ "else": { "properties": { "baseTemplateContract": { "type": "null" } } }
202
+ }
203
+ ]
204
+ },
205
+ "hookEventListMaterializer": {
206
+ "type": "object",
207
+ "additionalProperties": false,
208
+ "required": ["engine", "eventsField", "eventField", "groupsField", "matcherField", "handlersField", "handlerArgvField", "descriptionField", "mergeStrategy", "baseTemplateContract"],
209
+ "properties": {
210
+ "engine": { "const": "json-hook-event-list-v1" },
211
+ "eventsField": { "$ref": "#/$defs/jsonField" },
212
+ "eventField": { "$ref": "#/$defs/jsonField" },
213
+ "groupsField": { "$ref": "#/$defs/jsonField" },
214
+ "matcherField": { "$ref": "#/$defs/jsonField" },
215
+ "handlersField": { "$ref": "#/$defs/jsonField" },
216
+ "handlerArgvField": { "$ref": "#/$defs/jsonField" },
217
+ "descriptionField": { "$ref": "#/$defs/jsonField" },
218
+ "mergeStrategy": { "const": "replace-document-v1" },
219
+ "baseTemplateContract": { "type": "null" }
220
+ }
221
+ },
222
+ "hookBaseTemplateContract": {
223
+ "oneOf": [
224
+ {
225
+ "type": "object",
226
+ "additionalProperties": false,
227
+ "required": ["engine", "source", "schema"],
228
+ "properties": {
229
+ "engine": { "const": "claude-permission-policy-v1" },
230
+ "source": { "$ref": "#/$defs/repositoryPath" },
231
+ "schema": { "$ref": "#/$defs/repositoryPath" }
232
+ }
233
+ },
234
+ {
235
+ "type": "object",
236
+ "additionalProperties": false,
237
+ "required": ["engine"],
238
+ "properties": {
239
+ "engine": { "const": "static-json-object-v1" }
240
+ }
241
+ }
242
+ ]
243
+ },
244
+ "hookMaterializer": {
245
+ "oneOf": [
246
+ { "$ref": "#/$defs/hookMapMaterializer" },
247
+ { "$ref": "#/$defs/hookEventListMaterializer" }
248
+ ]
249
+ },
250
+ "skillMaterializer": {
251
+ "type": "object",
252
+ "additionalProperties": false,
253
+ "required": ["engine", "entryFile"],
254
+ "properties": {
255
+ "engine": { "const": "skill-directory-v1" },
256
+ "entryFile": {
257
+ "type": "string",
258
+ "pattern": "^[A-Z][A-Z0-9_-]*\\.md$"
259
+ }
260
+ }
261
+ },
262
+ "treeMaterializer": {
263
+ "type": "object",
264
+ "additionalProperties": false,
265
+ "required": ["engine", "transformPolicies"],
266
+ "properties": {
267
+ "engine": { "const": "closed-tree-copy-v1" },
268
+ "transformPolicies": {
269
+ "type": "array",
270
+ "prefixItems": [{ "const": "byte-exact" }],
271
+ "items": false,
272
+ "minItems": 1,
273
+ "maxItems": 1
274
+ }
275
+ }
276
+ },
277
+ "productManagedTree": {
278
+ "type": "object",
279
+ "additionalProperties": false,
280
+ "required": ["sourceRoot", "destination", "materializerId", "transformPolicy"],
281
+ "properties": {
282
+ "sourceRoot": { "$ref": "#/$defs/repositoryPath" },
283
+ "destination": { "$ref": "#/$defs/adapterOutputPath" },
284
+ "materializerId": { "$ref": "#/$defs/materializerId" },
285
+ "transformPolicy": { "const": "byte-exact" }
286
+ }
287
+ },
288
+ "materializerCatalog": {
289
+ "type": "object",
290
+ "additionalProperties": false,
291
+ "required": ["instructionViews", "hookBaseTemplateContracts", "hookViews", "skillViews", "treeViews"],
292
+ "properties": {
293
+ "instructionViews": {
294
+ "type": "object",
295
+ "minProperties": 1,
296
+ "propertyNames": { "$ref": "#/$defs/materializerId" },
297
+ "additionalProperties": { "$ref": "#/$defs/instructionMaterializer" }
298
+ },
299
+ "hookViews": {
300
+ "type": "object",
301
+ "minProperties": 1,
302
+ "propertyNames": { "$ref": "#/$defs/materializerId" },
303
+ "additionalProperties": { "$ref": "#/$defs/hookMaterializer" }
304
+ },
305
+ "hookBaseTemplateContracts": {
306
+ "type": "object",
307
+ "minProperties": 1,
308
+ "propertyNames": { "$ref": "#/$defs/materializerId" },
309
+ "additionalProperties": { "$ref": "#/$defs/hookBaseTemplateContract" }
310
+ },
311
+ "skillViews": {
312
+ "type": "object",
313
+ "minProperties": 1,
314
+ "propertyNames": { "$ref": "#/$defs/materializerId" },
315
+ "additionalProperties": { "$ref": "#/$defs/skillMaterializer" }
316
+ },
317
+ "treeViews": {
318
+ "type": "object",
319
+ "minProperties": 1,
320
+ "propertyNames": { "$ref": "#/$defs/materializerId" },
321
+ "additionalProperties": { "$ref": "#/$defs/treeMaterializer" }
322
+ }
323
+ }
324
+ },
325
+ "discoveryRootName": {
326
+ "type": "string",
327
+ "pattern": "^\\.(?!git(?:hub)?$)[A-Za-z0-9][A-Za-z0-9_-]*$"
328
+ },
329
+ "discoveryInstructionName": {
330
+ "type": "string",
331
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.@-]*\\.md$"
332
+ },
333
+ "discoveryConfigPath": {
334
+ "type": "string",
335
+ "pattern": "^\\.(?:[A-Za-z0-9][A-Za-z0-9_.@-]*|[A-Za-z0-9][A-Za-z0-9_-]*/[A-Za-z0-9_.@/-]+)$",
336
+ "not": { "pattern": "(?:^|/)\\.{1,2}(?:/|$)" }
337
+ },
338
+ "discoveryInventory": {
339
+ "type": "object",
340
+ "additionalProperties": false,
341
+ "required": ["providerRootNames", "instructionNames", "instructionOverrideNames", "configPaths", "pluginRootNames"],
342
+ "properties": {
343
+ "providerRootNames": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/discoveryRootName" } },
344
+ "instructionNames": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/discoveryInstructionName" } },
345
+ "instructionOverrideNames": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/discoveryInstructionName" } },
346
+ "configPaths": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/discoveryConfigPath" } },
347
+ "pluginRootNames": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/discoveryRootName" } }
348
+ }
349
+ },
350
+ "retiredSurface": {
351
+ "type": "object",
352
+ "additionalProperties": false,
353
+ "required": ["path", "kind"],
354
+ "properties": {
355
+ "path": { "$ref": "#/$defs/repositoryPath" },
356
+ "kind": { "enum": ["file", "tree"] }
357
+ }
358
+ },
359
+ "retiredProvider": {
360
+ "type": "object",
361
+ "additionalProperties": false,
362
+ "required": ["id", "replacementProviderId", "retiredInVersion", "reasonCode", "discovery", "surfaces"],
363
+ "properties": {
364
+ "id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
365
+ "replacementProviderId": {
366
+ "oneOf": [
367
+ { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
368
+ { "type": "null" }
369
+ ]
370
+ },
371
+ "retiredInVersion": {
372
+ "type": "string",
373
+ "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z][0-9A-Za-z.-]*)?(?:\\+[0-9A-Za-z][0-9A-Za-z.-]*)?$"
374
+ },
375
+ "reasonCode": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" },
376
+ "discovery": { "$ref": "#/$defs/discoveryInventory" },
377
+ "surfaces": {
378
+ "type": "array",
379
+ "uniqueItems": true,
380
+ "items": { "$ref": "#/$defs/retiredSurface" }
381
+ },
382
+ "transfers": {
383
+ "type": "array",
384
+ "minItems": 1,
385
+ "uniqueItems": true,
386
+ "items": { "$ref": "#/$defs/retiredSurface" }
387
+ }
388
+ },
389
+ "allOf": [
390
+ {
391
+ "anyOf": [
392
+ { "properties": { "surfaces": { "type": "array", "minItems": 1 } } },
393
+ {
394
+ "required": ["transfers"],
395
+ "properties": { "transfers": { "type": "array", "minItems": 1 } }
396
+ }
397
+ ]
398
+ },
399
+ {
400
+ "if": {
401
+ "properties": { "replacementProviderId": { "type": "null" } },
402
+ "required": ["replacementProviderId"]
403
+ },
404
+ "then": { "properties": { "transfers": false } }
405
+ }
406
+ ]
407
+ },
408
+ "writeTransportId": {
409
+ "type": "string",
410
+ "pattern": "^[a-z][a-z0-9-]*-v[1-9][0-9]*$"
411
+ },
412
+ "rawToolName": {
413
+ "type": "string",
414
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]*$"
415
+ },
416
+ "payloadField": {
417
+ "type": "string",
418
+ "pattern": "^[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
419
+ },
420
+ "writeTransport": {
421
+ "type": "object",
422
+ "additionalProperties": false,
423
+ "required": ["id", "rawTools", "engine", "payloadFields"],
424
+ "properties": {
425
+ "id": { "$ref": "#/$defs/writeTransportId" },
426
+ "rawTools": {
427
+ "type": "array",
428
+ "minItems": 1,
429
+ "uniqueItems": true,
430
+ "items": { "$ref": "#/$defs/rawToolName" }
431
+ },
432
+ "engine": {
433
+ "enum": ["full-file-v1", "exact-replace-v1", "exact-replace-list-v1", "codex-apply-patch-v1", "unified-diff-v1"]
434
+ },
435
+ "payloadFields": {
436
+ "type": "array",
437
+ "items": { "$ref": "#/$defs/payloadField" }
438
+ }
439
+ },
440
+ "allOf": [
441
+ {
442
+ "if": {
443
+ "properties": { "engine": { "const": "full-file-v1" } },
444
+ "required": ["engine"]
445
+ },
446
+ "then": {
447
+ "properties": {
448
+ "payloadFields": {
449
+ "type": "array",
450
+ "prefixItems": [
451
+ { "$ref": "#/$defs/payloadField" },
452
+ { "$ref": "#/$defs/payloadField" }
453
+ ],
454
+ "items": false,
455
+ "minItems": 2,
456
+ "maxItems": 2
457
+ }
458
+ }
459
+ }
460
+ },
461
+ {
462
+ "if": {
463
+ "properties": { "engine": { "const": "exact-replace-v1" } },
464
+ "required": ["engine"]
465
+ },
466
+ "then": {
467
+ "properties": {
468
+ "payloadFields": {
469
+ "type": "array",
470
+ "prefixItems": [
471
+ { "$ref": "#/$defs/payloadField" },
472
+ { "$ref": "#/$defs/payloadField" },
473
+ { "$ref": "#/$defs/payloadField" },
474
+ { "$ref": "#/$defs/payloadField" }
475
+ ],
476
+ "items": false,
477
+ "minItems": 4,
478
+ "maxItems": 4
479
+ }
480
+ }
481
+ }
482
+ },
483
+ {
484
+ "if": {
485
+ "properties": { "engine": { "const": "exact-replace-list-v1" } },
486
+ "required": ["engine"]
487
+ },
488
+ "then": {
489
+ "properties": {
490
+ "payloadFields": {
491
+ "type": "array",
492
+ "prefixItems": [
493
+ { "$ref": "#/$defs/payloadField" },
494
+ { "$ref": "#/$defs/payloadField" },
495
+ { "$ref": "#/$defs/payloadField" },
496
+ { "$ref": "#/$defs/payloadField" },
497
+ { "$ref": "#/$defs/payloadField" }
498
+ ],
499
+ "items": false,
500
+ "minItems": 5,
501
+ "maxItems": 5
502
+ }
503
+ }
504
+ }
505
+ },
506
+ {
507
+ "if": {
508
+ "properties": { "engine": { "const": "codex-apply-patch-v1" } },
509
+ "required": ["engine"]
510
+ },
511
+ "then": {
512
+ "properties": {
513
+ "payloadFields": {
514
+ "type": "array",
515
+ "prefixItems": [{ "$ref": "#/$defs/payloadField" }],
516
+ "items": false,
517
+ "minItems": 1,
518
+ "maxItems": 1
519
+ }
520
+ }
521
+ }
522
+ },
523
+ {
524
+ "if": {
525
+ "properties": { "engine": { "const": "unified-diff-v1" } },
526
+ "required": ["engine"]
527
+ },
528
+ "then": {
529
+ "properties": {
530
+ "payloadFields": {
531
+ "type": "array",
532
+ "prefixItems": [{ "$ref": "#/$defs/payloadField" }],
533
+ "items": false,
534
+ "minItems": 1,
535
+ "maxItems": 1
536
+ }
537
+ }
538
+ }
539
+ }
540
+ ]
541
+ },
542
+ "normalization": {
543
+ "type": "object",
544
+ "additionalProperties": false,
545
+ "required": ["eventFields", "toolFields", "pathFields", "pathArrayFields", "writeTools", "writeTransports", "eventAliases", "toolAliases"],
546
+ "properties": {
547
+ "eventFields": { "$ref": "#/$defs/stringArray" },
548
+ "toolFields": { "$ref": "#/$defs/stringArray" },
549
+ "pathFields": { "$ref": "#/$defs/stringArray" },
550
+ "pathArrayFields": { "$ref": "#/$defs/stringArray" },
551
+ "writeTools": { "$ref": "#/$defs/stringArray" },
552
+ "writeTransports": {
553
+ "type": "array",
554
+ "minItems": 1,
555
+ "items": { "$ref": "#/$defs/writeTransport" }
556
+ },
557
+ "eventAliases": { "type": "object", "additionalProperties": { "type": "string" } },
558
+ "toolAliases": { "type": "object", "additionalProperties": { "type": "string" } }
559
+ }
560
+ },
561
+ "skillInvocation": {
562
+ "oneOf": [
563
+ {
564
+ "type": "object",
565
+ "additionalProperties": false,
566
+ "required": ["strategy"],
567
+ "properties": { "strategy": { "const": "main-context" } }
568
+ },
569
+ {
570
+ "type": "object",
571
+ "additionalProperties": false,
572
+ "required": ["strategy", "context", "agent"],
573
+ "properties": {
574
+ "strategy": { "const": "native-context-fork" },
575
+ "context": { "const": "fork" },
576
+ "agent": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" }
577
+ }
578
+ }
579
+ ]
580
+ },
581
+ "reviewSelectionPolicy": {
582
+ "type": "object",
583
+ "additionalProperties": false,
584
+ "required": [
585
+ "schemaVersion",
586
+ "assuranceTierOrder",
587
+ "reasoningTierOrder",
588
+ "computeTierOrder",
589
+ "reviewClasses",
590
+ "eligibility",
591
+ "ranking",
592
+ "costPolicy",
593
+ "bindingPolicy",
594
+ "unavailableOutcome"
595
+ ],
596
+ "properties": {
597
+ "schemaVersion": { "const": 1 },
598
+ "assuranceTierOrder": {
599
+ "const": ["standard", "high", "maximum"]
600
+ },
601
+ "reasoningTierOrder": {
602
+ "const": ["standard", "high", "maximum"]
603
+ },
604
+ "computeTierOrder": {
605
+ "const": ["standard", "high", "maximum"]
606
+ },
607
+ "reviewClasses": {
608
+ "type": "object",
609
+ "additionalProperties": false,
610
+ "required": ["tier-0-governance"],
611
+ "properties": {
612
+ "tier-0-governance": {
613
+ "type": "object",
614
+ "additionalProperties": false,
615
+ "required": ["assuranceTier", "reasoningTier", "computeTier"],
616
+ "properties": {
617
+ "assuranceTier": { "const": "maximum" },
618
+ "reasoningTier": { "const": "maximum" },
619
+ "computeTier": { "const": "maximum" }
620
+ }
621
+ }
622
+ }
623
+ },
624
+ "eligibility": {
625
+ "type": "object",
626
+ "additionalProperties": false,
627
+ "required": [
628
+ "independentProvider",
629
+ "independentContext",
630
+ "immutableTarget",
631
+ "identicalEvidence",
632
+ "completeEvidenceVisibility",
633
+ "certifiedCapability",
634
+ "policyAllowed",
635
+ "noSelfReview",
636
+ "failClosed"
637
+ ],
638
+ "properties": {
639
+ "independentProvider": { "const": true },
640
+ "independentContext": { "const": true },
641
+ "immutableTarget": { "const": true },
642
+ "identicalEvidence": { "const": true },
643
+ "completeEvidenceVisibility": { "const": true },
644
+ "certifiedCapability": { "const": true },
645
+ "policyAllowed": { "const": true },
646
+ "noSelfReview": { "const": true },
647
+ "failClosed": { "const": true }
648
+ }
649
+ },
650
+ "ranking": {
651
+ "const": [
652
+ "assurance-tier-desc",
653
+ "reasoning-tier-desc",
654
+ "compute-tier-desc",
655
+ "available-required-entitlement-route-first",
656
+ "provider-local-capability-rank-desc",
657
+ "provider-id-utf8-asc",
658
+ "review-profile-id-utf8-asc",
659
+ "model-release-id-utf8-asc"
660
+ ]
661
+ },
662
+ "costPolicy": { "const": "batch-or-stop-never-capability-downgrade" },
663
+ "bindingPolicy": { "const": "freeze-exact-provider-profile-model-and-registry-digests-after-selection" },
664
+ "unavailableOutcome": { "const": "REVIEW-BLOCKED" }
665
+ }
666
+ },
667
+ "skillBinding": {
668
+ "type": "object",
669
+ "additionalProperties": false,
670
+ "required": ["self", "selectionPolicy", "reviewClass", "transport", "invocation"],
671
+ "properties": {
672
+ "self": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
673
+ "selectionPolicy": { "type": "string", "pattern": "^[a-z][a-z0-9-]*-v[1-9][0-9]*$" },
674
+ "reviewClass": { "const": "tier-0-governance" },
675
+ "transport": { "type": "string", "minLength": 1 },
676
+ "invocation": { "$ref": "#/$defs/skillInvocation" },
677
+ "certificationContract": { "const": "exact-provider-runtime-surface-role-target-v1" }
678
+ },
679
+ "allOf": [
680
+ {
681
+ "if": {
682
+ "properties": { "certificationContract": {} },
683
+ "required": ["certificationContract"]
684
+ },
685
+ "then": {
686
+ "properties": {
687
+ "transport": { "const": "content-addressed-model-broker-exchange-v1" }
688
+ }
689
+ }
690
+ }
691
+ ]
692
+ },
693
+ "providerRuntime": {
694
+ "type": ["object", "null"],
695
+ "additionalProperties": false,
696
+ "required": ["cli", "transcript", "contextOutputTransport", "stopDecisionTransport", "branchNamespace", "memorySyncScript"],
697
+ "properties": {
698
+ "cli": {
699
+ "type": "object",
700
+ "additionalProperties": false,
701
+ "required": ["executable", "localExecutable", "briefInvocationMarkers", "discoveryMarkers", "replyArtifactPrefix"],
702
+ "properties": {
703
+ "executable": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
704
+ "localExecutable": { "$ref": "#/$defs/repositoryPath" },
705
+ "briefInvocationMarkers": {
706
+ "type": "array",
707
+ "minItems": 1,
708
+ "uniqueItems": true,
709
+ "items": { "type": "string", "pattern": "^(?:[a-z][a-z0-9-]*|--?[a-z][a-z0-9-]*)$" }
710
+ },
711
+ "discoveryMarkers": {
712
+ "type": "array",
713
+ "minItems": 1,
714
+ "uniqueItems": true,
715
+ "items": { "type": "string", "minLength": 1 }
716
+ },
717
+ "replyArtifactPrefix": { "type": "string", "pattern": "^[a-z][a-z0-9-]*-reply$" }
718
+ }
719
+ },
720
+ "transcript": {
721
+ "type": "object",
722
+ "additionalProperties": false,
723
+ "required": ["contract", "stability", "fixture", "access"],
724
+ "properties": {
725
+ "contract": { "type": ["string", "null"], "pattern": "^[a-z][a-z0-9-]*-jsonl-v[0-9]+$" },
726
+ "stability": { "enum": ["tested-versioned", "unstable-opaque", "unavailable"] },
727
+ "fixture": {
728
+ "oneOf": [
729
+ { "$ref": "#/$defs/repositoryPath" },
730
+ { "type": "null" }
731
+ ]
732
+ },
733
+ "access": {
734
+ "oneOf": [
735
+ {
736
+ "type": "object",
737
+ "additionalProperties": false,
738
+ "required": ["strategy", "pathPolicy", "recordFormat", "emptyState", "maximumRetainedRecordCount", "maximumRecordBytes", "maximumMaterializedBytes"],
739
+ "properties": {
740
+ "strategy": { "const": "validated-jsonl-tail-v2" },
741
+ "pathPolicy": { "const": "canonical-unique-regular-file-no-name-assumption" },
742
+ "recordFormat": { "const": "json-lines" },
743
+ "emptyState": { "const": "allowed-zero-byte" },
744
+ "maximumRetainedRecordCount": { "type": "integer", "minimum": 1, "maximum": 10000 },
745
+ "maximumRecordBytes": {
746
+ "type": "integer",
747
+ "minimum": 1024,
748
+ "maximum": 16777216,
749
+ "description": "Maximum UTF-8 bytes in one serialized JSON object, excluding its CRLF or LF line terminator."
750
+ },
751
+ "maximumMaterializedBytes": {
752
+ "type": "integer",
753
+ "minimum": 4096,
754
+ "maximum": 67108864,
755
+ "description": "Maximum snapshot bytes after every retained record is normalized to exactly one trailing LF."
756
+ }
757
+ }
758
+ },
759
+ { "type": "null" }
760
+ ]
761
+ }
762
+ }
763
+ },
764
+ "contextOutputTransport": { "enum": ["claude-hook-specific", "system-message", "stderr"] },
765
+ "stopDecisionTransport": { "enum": ["claude-decision-json", "continue-json", "blocking-exit"] },
766
+ "branchNamespace": { "type": "string", "pattern": "^[a-z][a-z0-9-]*/$" },
767
+ "memorySyncScript": {
768
+ "oneOf": [
769
+ { "$ref": "#/$defs/repositoryPath" },
770
+ { "type": "null" }
771
+ ]
772
+ }
773
+ }
774
+ },
775
+ "adapter": {
776
+ "type": "object",
777
+ "additionalProperties": false,
778
+ "required": ["generate", "repositoryInstructionSource", "instructionView", "productInstructionSource", "repositoryManagedTrees", "productManagedTrees", "skillView", "hookView", "environmentMap", "skillBindings", "skillAliases", "discovery"],
779
+ "properties": {
780
+ "generate": { "type": "boolean" },
781
+ "repositoryInstructionSource": {
782
+ "oneOf": [
783
+ { "$ref": "#/$defs/repositoryPath" },
784
+ { "type": "null" }
785
+ ]
786
+ },
787
+ "instructionView": {
788
+ "type": "object",
789
+ "additionalProperties": false,
790
+ "required": ["materializerId"],
791
+ "properties": {
792
+ "materializerId": { "$ref": "#/$defs/materializerId" }
793
+ }
794
+ },
795
+ "productInstructionSource": {
796
+ "oneOf": [
797
+ { "$ref": "#/$defs/repositoryPath" },
798
+ { "type": "null" }
799
+ ]
800
+ },
801
+ "repositoryManagedTrees": { "type": "object", "additionalProperties": { "$ref": "#/$defs/adapterOutputPath" } },
802
+ "productManagedTrees": { "type": "object", "additionalProperties": { "$ref": "#/$defs/productManagedTree" } },
803
+ "skillView": {
804
+ "type": ["object", "null"],
805
+ "additionalProperties": false,
806
+ "required": ["directory", "materializerId"],
807
+ "properties": {
808
+ "directory": { "$ref": "#/$defs/adapterOutputPath" },
809
+ "materializerId": { "$ref": "#/$defs/materializerId" }
810
+ }
811
+ },
812
+ "hookView": {
813
+ "type": ["object", "null"],
814
+ "additionalProperties": false,
815
+ "required": ["output", "materializerId", "settingsTemplate", "supportedEvents", "eventBindings", "matcherAliases", "workingDirectoryPolicy"],
816
+ "properties": {
817
+ "output": { "$ref": "#/$defs/adapterOutputPath" },
818
+ "materializerId": { "$ref": "#/$defs/materializerId" },
819
+ "settingsTemplate": { "type": ["string", "null"] },
820
+ "supportedEvents": { "$ref": "#/$defs/stringArray" },
821
+ "eventBindings": {
822
+ "type": "object",
823
+ "propertyNames": { "type": "string", "minLength": 1 },
824
+ "additionalProperties": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_.:@/-]*$" }
825
+ },
826
+ "matcherAliases": { "type": "object", "additionalProperties": { "$ref": "#/$defs/stringArray" } },
827
+ "workingDirectoryPolicy": { "const": "repository-root" }
828
+ }
829
+ },
830
+ "environmentMap": {
831
+ "type": "object",
832
+ "propertyNames": { "pattern": "^[A-Z][A-Z0-9_]*$" },
833
+ "additionalProperties": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" }
834
+ },
835
+ "skillBindings": { "type": "object", "additionalProperties": { "$ref": "#/$defs/skillBinding" } },
836
+ "skillAliases": {
837
+ "type": "array",
838
+ "items": {
839
+ "type": "object",
840
+ "additionalProperties": false,
841
+ "required": ["name", "sourceSkill"],
842
+ "properties": {
843
+ "name": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
844
+ "sourceSkill": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" }
845
+ }
846
+ }
847
+ },
848
+ "discovery": { "$ref": "#/$defs/discoveryInventory" },
849
+ "exclusions": {
850
+ "type": "array",
851
+ "items": {
852
+ "type": "object",
853
+ "additionalProperties": false,
854
+ "required": ["scope", "reasonCode", "detail"],
855
+ "properties": {
856
+ "scope": { "type": "string", "minLength": 1 },
857
+ "reasonCode": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" },
858
+ "detail": { "type": "string", "minLength": 1 }
859
+ }
860
+ }
861
+ }
862
+ },
863
+ "allOf": [
864
+ {
865
+ "if": {
866
+ "properties": { "generate": { "const": true } },
867
+ "required": ["generate"]
868
+ },
869
+ "then": {
870
+ "properties": { "skillView": { "type": "object" } }
871
+ }
872
+ }
873
+ ]
874
+ },
875
+ "provider": {
876
+ "type": "object",
877
+ "additionalProperties": false,
878
+ "required": ["id", "displayName", "providerKind", "instructionEntry", "sharedInstructionEntry", "skillDirectory", "hookConfig", "hookConfigFormat", "hookEntrypoint", "blockingExitCode", "capabilities", "runtime", "normalization", "adapter"],
879
+ "properties": {
880
+ "id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
881
+ "displayName": { "type": "string", "minLength": 1 },
882
+ "providerKind": { "enum": ["concrete-runtime", "headless-protocol"] },
883
+ "instructionEntry": { "$ref": "#/$defs/repositoryPath" },
884
+ "sharedInstructionEntry": { "$ref": "#/$defs/repositoryPath" },
885
+ "skillDirectory": { "$ref": "#/$defs/adapterOutputPath" },
886
+ "hookConfig": {
887
+ "oneOf": [
888
+ { "$ref": "#/$defs/adapterOutputPath" },
889
+ { "type": "null" }
890
+ ]
891
+ },
892
+ "hookConfigFormat": { "enum": ["json", null] },
893
+ "hookEntrypoint": { "type": ["string", "null"] },
894
+ "blockingExitCode": {
895
+ "type": "integer",
896
+ "minimum": 1,
897
+ "maximum": 255,
898
+ "not": { "const": 70 }
899
+ },
900
+ "capabilities": {
901
+ "type": "object",
902
+ "additionalProperties": false,
903
+ "required": ["nativeHooks", "hookTrustRequired", "hardGateComplete", "hookEnforcement"],
904
+ "properties": {
905
+ "nativeHooks": { "type": "boolean" },
906
+ "hookTrustRequired": { "type": "boolean" },
907
+ "hardGateComplete": { "type": "boolean" },
908
+ "hookEnforcement": { "enum": ["native-feedback-plus-ci", "ci-only"] }
909
+ }
910
+ },
911
+ "runtime": { "$ref": "#/$defs/providerRuntime" },
912
+ "normalization": { "$ref": "#/$defs/normalization" },
913
+ "adapter": { "$ref": "#/$defs/adapter" }
914
+ }
915
+ }
916
+ }
917
+ }