@clowder-ai/plugin-contract 0.1.0-beta.11 → 0.1.0-beta.13

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 (33) hide show
  1. package/dist/codegen/generate-contract.d.ts +4 -0
  2. package/dist/codegen/generate-contract.d.ts.map +1 -1
  3. package/dist/codegen/generate-contract.js +171 -17
  4. package/dist/codegen/generate-contract.js.map +1 -1
  5. package/dist/conformance/runner.d.ts.map +1 -1
  6. package/dist/conformance/runner.js +2 -0
  7. package/dist/conformance/runner.js.map +1 -1
  8. package/dist/generated/contract.generated.d.ts +418 -8
  9. package/dist/generated/contract.generated.d.ts.map +1 -1
  10. package/dist/generated/contract.generated.js +1 -1
  11. package/dist/generated/contract.generated.js.map +1 -1
  12. package/dist/validation/catalog.d.ts +21 -0
  13. package/dist/validation/catalog.d.ts.map +1 -0
  14. package/dist/validation/catalog.js +140 -0
  15. package/dist/validation/catalog.js.map +1 -0
  16. package/dist/validation/index.d.ts +1 -0
  17. package/dist/validation/index.d.ts.map +1 -1
  18. package/dist/validation/index.js +1 -0
  19. package/dist/validation/index.js.map +1 -1
  20. package/dist/validation/manifest.d.ts.map +1 -1
  21. package/dist/validation/manifest.js +104 -0
  22. package/dist/validation/manifest.js.map +1 -1
  23. package/dist/wire/grants.d.ts +1 -1
  24. package/dist/wire/grants.js +1 -1
  25. package/dist/wire/signal-byte-bounds.d.ts +3 -3
  26. package/fixtures/behavior/messaging/adversarial-invariants.json +85 -0
  27. package/fixtures/manifest/invalid/icon-package-escape.json +22 -0
  28. package/fixtures/manifest/valid/localized-product-metadata.json +27 -0
  29. package/package.json +3 -1
  30. package/src/schemas/behavior-fixture.schema.json +262 -2
  31. package/src/schemas/catalog.schema.json +91 -0
  32. package/src/schemas/manifest.schema.json +388 -3
  33. package/src/schemas/plugin-metadata.schema.json +62 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clowder-ai/plugin-contract",
3
- "version": "0.1.0-beta.11",
3
+ "version": "0.1.0-beta.13",
4
4
  "private": false,
5
5
  "description": "Clowder AI plugin contract — the single machine-readable truth source for plugin schema, types, capability table, and conformance fixtures (P15)",
6
6
  "license": "MIT",
@@ -16,6 +16,8 @@
16
16
  },
17
17
  "./schemas/messaging": "./src/schemas/messaging.schema.json",
18
18
  "./schemas/manifest": "./src/schemas/manifest.schema.json",
19
+ "./schemas/catalog": "./src/schemas/catalog.schema.json",
20
+ "./schemas/plugin-metadata": "./src/schemas/plugin-metadata.schema.json",
19
21
  "./schemas/signals": "./src/schemas/signal.schema.json",
20
22
  "./schemas/physical-limb": "./src/schemas/physical-limb.schema.json",
21
23
  "./schemas/behavior-fixture": "./src/schemas/behavior-fixture.schema.json",
@@ -178,6 +178,78 @@
178
178
  }
179
179
  ]
180
180
  },
181
+ "PluginToHostMethod": {
182
+ "type": "string",
183
+ "enum": [
184
+ "messaging.send",
185
+ "messaging.appendElements",
186
+ "messaging.subscribe",
187
+ "messaging.read",
188
+ "messaging.ack",
189
+ "messaging.snapshot"
190
+ ]
191
+ },
192
+ "BehaviorExpectationOracle": {
193
+ "type": "object",
194
+ "properties": {
195
+ "kind": { "const": "behavior-expectation" }
196
+ },
197
+ "required": ["kind"],
198
+ "additionalProperties": false
199
+ },
200
+ "JsonRpcAdmissionOracle": {
201
+ "type": "object",
202
+ "properties": {
203
+ "kind": { "const": "json-rpc-error" },
204
+ "code": { "const": -32602 },
205
+ "sideEffects": { "const": "behavior-expectation" }
206
+ },
207
+ "required": ["kind", "code", "sideEffects"],
208
+ "additionalProperties": false
209
+ },
210
+ "BehaviorExecution": {
211
+ "oneOf": [
212
+ {
213
+ "type": "object",
214
+ "properties": {
215
+ "plane": { "const": "plugin-to-host-wire" },
216
+ "method": { "$ref": "#/$defs/PluginToHostMethod" },
217
+ "verdictOracle": { "$ref": "#/$defs/BehaviorExpectationOracle" }
218
+ },
219
+ "required": ["plane", "method", "verdictOracle"],
220
+ "additionalProperties": false
221
+ },
222
+ {
223
+ "type": "object",
224
+ "properties": {
225
+ "plane": { "const": "wire-admission" },
226
+ "method": { "$ref": "#/$defs/PluginToHostMethod" },
227
+ "verdictOracle": { "$ref": "#/$defs/JsonRpcAdmissionOracle" }
228
+ },
229
+ "required": ["plane", "method", "verdictOracle"],
230
+ "additionalProperties": false
231
+ },
232
+ {
233
+ "type": "object",
234
+ "properties": {
235
+ "plane": { "const": "host-to-plugin-delivery" },
236
+ "method": { "const": "host.messaging.deliver" },
237
+ "verdictOracle": { "$ref": "#/$defs/BehaviorExpectationOracle" }
238
+ },
239
+ "required": ["plane", "method", "verdictOracle"],
240
+ "additionalProperties": false
241
+ },
242
+ {
243
+ "type": "object",
244
+ "properties": {
245
+ "plane": { "const": "host-control" },
246
+ "verdictOracle": { "$ref": "#/$defs/BehaviorExpectationOracle" }
247
+ },
248
+ "required": ["plane", "verdictOracle"],
249
+ "additionalProperties": false
250
+ }
251
+ ]
252
+ },
181
253
  "SendOperationInput": {
182
254
  "type": "object",
183
255
  "properties": {
@@ -359,12 +431,200 @@
359
431
  "properties": {
360
432
  "id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" },
361
433
  "invariant": { "type": "string", "minLength": 1 },
434
+ "execution": { "$ref": "#/$defs/BehaviorExecution" },
362
435
  "given": { "$ref": "#/$defs/FixtureSetup" },
363
436
  "when": { "$ref": "#/$defs/FixtureOperation" },
364
437
  "expect": { "$ref": "#/$defs/ExpectedVerdict" }
365
438
  },
366
- "required": ["id", "invariant", "given", "when", "expect"],
367
- "additionalProperties": false
439
+ "required": ["id", "invariant", "execution", "given", "when", "expect"],
440
+ "additionalProperties": false,
441
+ "allOf": [
442
+ {
443
+ "if": {
444
+ "properties": {
445
+ "when": {
446
+ "properties": { "operation": { "const": "send" } },
447
+ "required": ["operation"]
448
+ }
449
+ },
450
+ "required": ["when"]
451
+ },
452
+ "then": {
453
+ "properties": {
454
+ "execution": {
455
+ "type": "object",
456
+ "properties": {
457
+ "plane": { "enum": ["plugin-to-host-wire", "wire-admission"] },
458
+ "method": { "const": "messaging.send" }
459
+ },
460
+ "required": ["plane", "method"]
461
+ }
462
+ }
463
+ }
464
+ },
465
+ {
466
+ "if": {
467
+ "properties": {
468
+ "when": {
469
+ "properties": { "operation": { "const": "appendElements" } },
470
+ "required": ["operation"]
471
+ }
472
+ },
473
+ "required": ["when"]
474
+ },
475
+ "then": {
476
+ "properties": {
477
+ "execution": {
478
+ "type": "object",
479
+ "properties": {
480
+ "plane": { "enum": ["plugin-to-host-wire", "wire-admission"] },
481
+ "method": { "const": "messaging.appendElements" }
482
+ },
483
+ "required": ["plane", "method"]
484
+ }
485
+ }
486
+ }
487
+ },
488
+ {
489
+ "if": {
490
+ "properties": {
491
+ "when": {
492
+ "properties": { "operation": { "const": "subscribe" } },
493
+ "required": ["operation"]
494
+ }
495
+ },
496
+ "required": ["when"]
497
+ },
498
+ "then": {
499
+ "properties": {
500
+ "execution": {
501
+ "type": "object",
502
+ "properties": {
503
+ "plane": { "enum": ["plugin-to-host-wire", "wire-admission"] },
504
+ "method": { "const": "messaging.subscribe" }
505
+ },
506
+ "required": ["plane", "method"]
507
+ }
508
+ }
509
+ }
510
+ },
511
+ {
512
+ "if": {
513
+ "properties": {
514
+ "when": {
515
+ "properties": { "operation": { "const": "read" } },
516
+ "required": ["operation"]
517
+ }
518
+ },
519
+ "required": ["when"]
520
+ },
521
+ "then": {
522
+ "properties": {
523
+ "execution": {
524
+ "type": "object",
525
+ "properties": {
526
+ "plane": { "enum": ["plugin-to-host-wire", "wire-admission"] },
527
+ "method": { "const": "messaging.read" }
528
+ },
529
+ "required": ["plane", "method"]
530
+ }
531
+ }
532
+ }
533
+ },
534
+ {
535
+ "if": {
536
+ "properties": {
537
+ "when": {
538
+ "properties": { "operation": { "const": "ack" } },
539
+ "required": ["operation"]
540
+ }
541
+ },
542
+ "required": ["when"]
543
+ },
544
+ "then": {
545
+ "properties": {
546
+ "execution": {
547
+ "type": "object",
548
+ "properties": {
549
+ "plane": { "enum": ["plugin-to-host-wire", "wire-admission"] },
550
+ "method": { "const": "messaging.ack" }
551
+ },
552
+ "required": ["plane", "method"]
553
+ }
554
+ }
555
+ }
556
+ },
557
+ {
558
+ "if": {
559
+ "properties": {
560
+ "when": {
561
+ "properties": { "operation": { "const": "snapshot" } },
562
+ "required": ["operation"]
563
+ }
564
+ },
565
+ "required": ["when"]
566
+ },
567
+ "then": {
568
+ "properties": {
569
+ "execution": {
570
+ "type": "object",
571
+ "properties": {
572
+ "plane": { "enum": ["plugin-to-host-wire", "wire-admission"] },
573
+ "method": { "const": "messaging.snapshot" }
574
+ },
575
+ "required": ["plane", "method"]
576
+ }
577
+ }
578
+ }
579
+ },
580
+ {
581
+ "if": {
582
+ "properties": {
583
+ "when": {
584
+ "properties": { "operation": { "const": "deliverOnMessage" } },
585
+ "required": ["operation"]
586
+ }
587
+ },
588
+ "required": ["when"]
589
+ },
590
+ "then": {
591
+ "properties": {
592
+ "execution": {
593
+ "type": "object",
594
+ "properties": {
595
+ "plane": { "const": "host-to-plugin-delivery" },
596
+ "method": { "const": "host.messaging.deliver" }
597
+ },
598
+ "required": ["plane", "method"]
599
+ }
600
+ }
601
+ }
602
+ },
603
+ {
604
+ "if": {
605
+ "properties": {
606
+ "when": {
607
+ "properties": {
608
+ "operation": {
609
+ "enum": ["applyGrantPreset", "revokeGrant", "checkPermissionMatrix", "deleteReplayEvents"]
610
+ }
611
+ },
612
+ "required": ["operation"]
613
+ }
614
+ },
615
+ "required": ["when"]
616
+ },
617
+ "then": {
618
+ "properties": {
619
+ "execution": {
620
+ "type": "object",
621
+ "properties": { "plane": { "const": "host-control" } },
622
+ "required": ["plane"]
623
+ }
624
+ }
625
+ }
626
+ }
627
+ ]
368
628
  }
369
629
  }
370
630
  }
@@ -0,0 +1,91 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://clowder-ai.dev/schemas/catalog/v1",
4
+ "title": "Clowder AI Plugin Catalog (v1)",
5
+ "description": "Repository-owned immutable discovery coordinates. Installed/configured/enabled/live state is deliberately absent because it belongs to the local Host inventory.",
6
+ "$defs": {
7
+ "CatalogSemVer": {
8
+ "type": "string",
9
+ "minLength": 1,
10
+ "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\\.(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
11
+ },
12
+ "CatalogPublisher": {
13
+ "type": "object",
14
+ "properties": {
15
+ "id": { "type": "string", "minLength": 1 },
16
+ "name": { "type": "string", "minLength": 1 }
17
+ },
18
+ "required": ["id", "name"],
19
+ "additionalProperties": false
20
+ },
21
+ "ArtifactProvenance": {
22
+ "type": "object",
23
+ "properties": {
24
+ "repository": { "type": "string", "format": "uri", "pattern": "^https://" },
25
+ "sourceDirectory": { "type": "string", "pattern": "^packages/[a-z0-9-]+$" }
26
+ },
27
+ "required": ["repository", "sourceDirectory"],
28
+ "additionalProperties": false
29
+ },
30
+ "NpmArtifact": {
31
+ "type": "object",
32
+ "properties": {
33
+ "kind": { "const": "npm" },
34
+ "packageName": {
35
+ "type": "string",
36
+ "pattern": "^@[a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._-]*$"
37
+ },
38
+ "version": { "$ref": "#/$defs/CatalogSemVer" },
39
+ "tarballUrl": { "type": "string", "format": "uri", "pattern": "^https://registry\\.npmjs\\.org/" },
40
+ "integrity": { "type": "string", "pattern": "^sha512-[A-Za-z0-9+/]{86}==$" },
41
+ "shasum": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
42
+ "provenance": { "$ref": "#/$defs/ArtifactProvenance" }
43
+ },
44
+ "required": ["kind", "packageName", "version", "tarballUrl", "integrity", "shasum", "provenance"],
45
+ "additionalProperties": false
46
+ },
47
+ "CatalogPluginVersion": {
48
+ "type": "object",
49
+ "properties": {
50
+ "version": { "$ref": "#/$defs/CatalogSemVer" },
51
+ "contractVersion": { "$ref": "#/$defs/CatalogSemVer" },
52
+ "manifestPath": { "const": "plugin.yaml" },
53
+ "artifact": { "$ref": "#/$defs/NpmArtifact" }
54
+ },
55
+ "required": ["version", "contractVersion", "manifestPath", "artifact"],
56
+ "additionalProperties": false
57
+ },
58
+ "CatalogPluginEntry": {
59
+ "type": "object",
60
+ "properties": {
61
+ "pluginId": { "type": "string", "minLength": 1 },
62
+ "name": { "type": "string", "minLength": 1 },
63
+ "description": { "$ref": "https://clowder-ai.dev/schemas/plugin-metadata/v1#/$defs/LocalizedDescription" },
64
+ "icon": { "$ref": "https://clowder-ai.dev/schemas/plugin-metadata/v1#/$defs/PluginIcon" },
65
+ "publisher": { "$ref": "#/$defs/CatalogPublisher" },
66
+ "keywords": {
67
+ "type": "array",
68
+ "items": { "type": "string", "minLength": 1 },
69
+ "uniqueItems": true
70
+ },
71
+ "versions": {
72
+ "type": "array",
73
+ "items": { "$ref": "#/$defs/CatalogPluginVersion" },
74
+ "minItems": 1
75
+ }
76
+ },
77
+ "required": ["pluginId", "name", "description", "icon", "publisher", "versions"],
78
+ "additionalProperties": false
79
+ }
80
+ },
81
+ "type": "object",
82
+ "properties": {
83
+ "schemaVersion": { "const": "1" },
84
+ "plugins": {
85
+ "type": "array",
86
+ "items": { "$ref": "#/$defs/CatalogPluginEntry" }
87
+ }
88
+ },
89
+ "required": ["schemaVersion", "plugins"],
90
+ "additionalProperties": false
91
+ }