compose-plugins 0.3.0__tar.gz → 0.4.0__tar.gz

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 (79) hide show
  1. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/PKG-INFO +12 -6
  2. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/README.md +11 -5
  3. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/__init__.py +4 -3
  4. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/manifest.py +39 -8
  5. compose_plugins-0.4.0/compose_plugins/schema/manifest-0.4.schema.json +269 -0
  6. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/version.py +1 -1
  7. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/web.py +3 -0
  8. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins.egg-info/PKG-INFO +12 -6
  9. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins.egg-info/SOURCES.txt +2 -0
  10. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/pyproject.toml +1 -1
  11. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_schema_file.py +4 -1
  12. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v02_install_log.py +2 -1
  13. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v02_license_eula.py +8 -6
  14. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v02_schema_by_contract.py +6 -3
  15. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v03_manifest.py +13 -9
  16. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v03_reads_0_2.py +12 -5
  17. compose_plugins-0.4.0/tests/test_v04_may_not_embed.py +416 -0
  18. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_version.py +5 -4
  19. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/LICENSE +0 -0
  20. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/_child.py +0 -0
  21. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/_probe.py +0 -0
  22. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/config.py +0 -0
  23. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/conformance.py +0 -0
  24. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/consent.py +0 -0
  25. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/derive.py +0 -0
  26. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/errors.py +0 -0
  27. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/__init__.py +0 -0
  28. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_eula/EULA.txt +0 -0
  29. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_eula/__init__.py +0 -0
  30. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_eula/hello_world/__init__.py +0 -0
  31. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_eula/hello_world/plugin.py +0 -0
  32. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_eula/manifest.json +0 -0
  33. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_v1/__init__.py +0 -0
  34. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_v1/hello_world/__init__.py +0 -0
  35. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_v1/hello_world/plugin.py +0 -0
  36. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_v1/manifest.json +0 -0
  37. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_v2/__init__.py +0 -0
  38. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_v2/hello_world/__init__.py +0 -0
  39. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_v2/hello_world/plugin.py +0 -0
  40. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/fixtures/hello_world_v2/manifest.json +0 -0
  41. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/host.py +0 -0
  42. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/lifecycle.py +0 -0
  43. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/package.py +0 -0
  44. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/probe_client.py +0 -0
  45. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/runner.py +0 -0
  46. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/schema/__init__.py +0 -0
  47. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/schema/manifest-0.1.schema.json +0 -0
  48. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/schema/manifest-0.2.schema.json +0 -0
  49. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/schema/manifest-0.3.schema.json +0 -0
  50. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins/store.py +0 -0
  51. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins.egg-info/dependency_links.txt +0 -0
  52. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins.egg-info/entry_points.txt +0 -0
  53. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins.egg-info/requires.txt +0 -0
  54. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/compose_plugins.egg-info/top_level.txt +0 -0
  55. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/setup.cfg +0 -0
  56. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_consent.py +0 -0
  57. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_consent_record_r9.py +0 -0
  58. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_host_name_r10.py +0 -0
  59. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_manifest.py +0 -0
  60. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_package.py +0 -0
  61. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_qa_wave1_rulings.py +0 -0
  62. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_r21_permissions.py +0 -0
  63. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_r24_conformance_hooks.py +0 -0
  64. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v02_record_decline.py +0 -0
  65. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v02_uninstall_confirm.py +0 -0
  66. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v03_lifecycle.py +0 -0
  67. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v03_r27.py +0 -0
  68. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v03_r27_round3.py +0 -0
  69. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v03_uninstall_data.py +0 -0
  70. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v03_warnings.py +0 -0
  71. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_v03_web.py +0 -0
  72. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_validator_readings.py +0 -0
  73. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_wave2_build.py +0 -0
  74. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_wave2_conformance.py +0 -0
  75. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_wave2_lifecycle.py +0 -0
  76. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_wave2_r18.py +0 -0
  77. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_wave2_r19.py +0 -0
  78. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_wave2_runner.py +0 -0
  79. {compose_plugins-0.3.0 → compose_plugins-0.4.0}/tests/test_wave2_web.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compose-plugins
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: The shared plug-in contract library (manifest, consent, version rule) for ComposeIO and Gnomon hosts
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
@@ -12,10 +12,16 @@ Dynamic: license-file
12
12
  # compose-plugins
13
13
 
14
14
  The shared plug-in contract library for ComposeIO's ComposeServer and for
15
- Gnomon, implementing the Shared Plug-in Contract v0.3 (ComposeIO spec 95,
16
- `[SPEC:CXC-PLUGIN-CONTRACT]`, revision r24 plus its v0.2 delta plus the v0.3 delta,
17
- section 18). It is the layer a plug-in is INSTALLED and CONSENTED to, plus the shared
18
- manager that drives it. See `CHANGELOG.md` for what 0.3.0 changes and what was measured.
15
+ Gnomon, implementing the Shared Plug-in Contract v0.4 (ComposeIO spec 95,
16
+ `[SPEC:CXC-PLUGIN-CONTRACT]`, revision r24 plus its v0.2 delta plus the v0.3 and v0.4 deltas,
17
+ sections 18 and 20). It is the layer a plug-in is INSTALLED and CONSENTED to, plus the shared
18
+ manager that drives it. See `CHANGELOG.md` for what 0.4.0 changes and what was measured.
19
+
20
+ Contract 0.4 is an additive MINOR over 0.3 that adds one optional manifest field,
21
+ `may_not_embed` (a boolean, default false; valid only in a manifest that states 0.4): when
22
+ true, a host that embeds plug-in apps opens that plug-in's app only in a separate window. The
23
+ library records and shows it and never verifies it; changing it in an upgrade asks for no
24
+ consent.
19
25
 
20
26
  Contract 0.3 is an additive MINOR over 0.2 that FREEZES the manifest schema: optional
21
27
  `capabilities` (`agent-messaging` is defined) and `warnings` (`{id, title, text}`, each
@@ -47,7 +53,7 @@ that is not ComposeIO can use the library on its own.
47
53
 
48
54
  | module | what |
49
55
  |---|---|
50
- | `compose_plugins.manifest` | the v0.1 manifest validator (authoritative) and the shipped JSON Schemas, one per contract (`schema/manifest-0.1.schema.json` and `schema/manifest-0.2.schema.json`, both byte-identical to the compose-plugins 0.2.0 files, and `schema/manifest-0.3.schema.json`, frozen at the tag; `schema_for(manifest)` picks by the manifest's `contract`), generated from the validator's own patterns |
56
+ | `compose_plugins.manifest` | the v0.1 manifest validator (authoritative) and the shipped JSON Schemas, one per contract (`schema/manifest-0.1.schema.json` and `schema/manifest-0.2.schema.json`, both byte-identical to the compose-plugins 0.2.0 files, `schema/manifest-0.3.schema.json`, byte-identical to the compose-plugins 0.3.0 file, and `schema/manifest-0.4.schema.json`, frozen at the tag; `schema_for(manifest)` picks by the manifest's `contract`), generated from the validator's own patterns |
51
57
  | `compose_plugins.package` | reading `manifest.json` from a directory or a wheel WITHOUT executing anything, and the `manifest_sha256` rule (exact bytes, no canonicalization) |
52
58
  | `compose_plugins.version` | the contract version rule: a host accepts the same MAJOR and a MINOR at or below its own, and refuses anything newer, naming both versions |
53
59
  | `compose_plugins.consent` | consent content rendered from the manifest alone, the granted set, the widening rule, and the append-only consent-record store |
@@ -1,10 +1,16 @@
1
1
  # compose-plugins
2
2
 
3
3
  The shared plug-in contract library for ComposeIO's ComposeServer and for
4
- Gnomon, implementing the Shared Plug-in Contract v0.3 (ComposeIO spec 95,
5
- `[SPEC:CXC-PLUGIN-CONTRACT]`, revision r24 plus its v0.2 delta plus the v0.3 delta,
6
- section 18). It is the layer a plug-in is INSTALLED and CONSENTED to, plus the shared
7
- manager that drives it. See `CHANGELOG.md` for what 0.3.0 changes and what was measured.
4
+ Gnomon, implementing the Shared Plug-in Contract v0.4 (ComposeIO spec 95,
5
+ `[SPEC:CXC-PLUGIN-CONTRACT]`, revision r24 plus its v0.2 delta plus the v0.3 and v0.4 deltas,
6
+ sections 18 and 20). It is the layer a plug-in is INSTALLED and CONSENTED to, plus the shared
7
+ manager that drives it. See `CHANGELOG.md` for what 0.4.0 changes and what was measured.
8
+
9
+ Contract 0.4 is an additive MINOR over 0.3 that adds one optional manifest field,
10
+ `may_not_embed` (a boolean, default false; valid only in a manifest that states 0.4): when
11
+ true, a host that embeds plug-in apps opens that plug-in's app only in a separate window. The
12
+ library records and shows it and never verifies it; changing it in an upgrade asks for no
13
+ consent.
8
14
 
9
15
  Contract 0.3 is an additive MINOR over 0.2 that FREEZES the manifest schema: optional
10
16
  `capabilities` (`agent-messaging` is defined) and `warnings` (`{id, title, text}`, each
@@ -36,7 +42,7 @@ that is not ComposeIO can use the library on its own.
36
42
 
37
43
  | module | what |
38
44
  |---|---|
39
- | `compose_plugins.manifest` | the v0.1 manifest validator (authoritative) and the shipped JSON Schemas, one per contract (`schema/manifest-0.1.schema.json` and `schema/manifest-0.2.schema.json`, both byte-identical to the compose-plugins 0.2.0 files, and `schema/manifest-0.3.schema.json`, frozen at the tag; `schema_for(manifest)` picks by the manifest's `contract`), generated from the validator's own patterns |
45
+ | `compose_plugins.manifest` | the v0.1 manifest validator (authoritative) and the shipped JSON Schemas, one per contract (`schema/manifest-0.1.schema.json` and `schema/manifest-0.2.schema.json`, both byte-identical to the compose-plugins 0.2.0 files, `schema/manifest-0.3.schema.json`, byte-identical to the compose-plugins 0.3.0 file, and `schema/manifest-0.4.schema.json`, frozen at the tag; `schema_for(manifest)` picks by the manifest's `contract`), generated from the validator's own patterns |
40
46
  | `compose_plugins.package` | reading `manifest.json` from a directory or a wheel WITHOUT executing anything, and the `manifest_sha256` rule (exact bytes, no canonicalization) |
41
47
  | `compose_plugins.version` | the contract version rule: a host accepts the same MAJOR and a MINOR at or below its own, and refuses anything newer, naming both versions |
42
48
  | `compose_plugins.consent` | consent content rendered from the manifest alone, the granted set, the widening rule, and the append-only consent-record store |
@@ -1,6 +1,7 @@
1
1
  """compose_plugins — the shared plug-in contract library ([SPEC:CXC-PLUGIN-CONTRACT],
2
- contract 0.3: spec 95 r24 plus its v0.2 delta, [DELTA:CXC-PLUGIN-CONTRACT-V0-2-DELTA],
3
- plus the v0.3 delta, section 18 of spec 95 ([CXC-PC-V03-BASIS])).
2
+ contract 0.4: spec 95 r24 plus its v0.2 delta, [DELTA:CXC-PLUGIN-CONTRACT-V0-2-DELTA],
3
+ plus the v0.3 delta, section 18 of spec 95 ([CXC-PC-V03-BASIS]), plus the v0.4 delta,
4
+ section 20 ([CXC-PC-V04-BASIS])).
4
5
 
5
6
  The manifest validator and JSON Schema (``manifest``), the no-execution manifest
6
7
  and EULA reader and the manifest_sha256 rule (``package``), the version rule
@@ -17,7 +18,7 @@ contract 0.3 adds ``OperatorDeclined``, ``PolicyRefused`` and ``WarningAckRefuse
17
18
  ([CXC-PC-V03-STORES-COMPAT] manager-signatures).
18
19
  """
19
20
 
20
- __version__ = "0.3.0"
21
+ __version__ = "0.4.0"
21
22
 
22
23
  from .consent import eula_text_shown # noqa: E402
23
24
  from .errors import ( # noqa: E402
@@ -56,7 +56,7 @@ REQUIRED_FIELDS = ("contract", "domain", "name", "version", "description",
56
56
  "documentation", "requirements", "run", "hosts")
57
57
  OPTIONAL_FIELDS = ("issue_tracker", "codeowners", "isolation_floor", "bus",
58
58
  "standard_questions", "permissions", "license", "eula",
59
- "capabilities", "warnings")
59
+ "capabilities", "warnings", "may_not_embed")
60
60
  #: [CXC-PC-V02-VERSION-0-2] rule (3): fields defined from contract 0.2. A
61
61
  #: manifest is read by the contract it STATES, so one that states an earlier
62
62
  #: contract and carries any of these is refused naming the key.
@@ -64,6 +64,9 @@ FIELDS_FROM_0_2 = ("license", "eula")
64
64
  #: [CXC-PC-V03-VERSION-0-3] rule (3): fields defined from contract 0.3, read by
65
65
  #: the contract the manifest STATES, exactly as the 0.2 fields above
66
66
  FIELDS_FROM_0_3 = ("capabilities", "warnings")
67
+ #: [CXC-PC-V04-MAY-NOT-EMBED] rule (3): the one field defined from contract 0.4,
68
+ #: read by the contract the manifest STATES, like the 0.2 and 0.3 fields above
69
+ FIELDS_FROM_0_4 = ("may_not_embed",)
67
70
  #: [CXC-PC-V03-CAPABILITIES] rule (2) and [CXC-PC-V03-WARNINGS] rules (2) to (5)
68
71
  CAPABILITIES_MAX = 16
69
72
  WARNINGS_MAX = 8
@@ -478,7 +481,7 @@ class Advisory:
478
481
  class Manifest:
479
482
  """A manifest that passed :func:`validate_manifest`. ``data`` is the parsed
480
483
  JSON, unchanged. (0.3) ``advisories`` is a read-only tuple of
481
- :class:`Advisory`, empty unless the manifest states contract 0.3."""
484
+ :class:`Advisory`, empty unless the manifest states contract 0.3 or later."""
482
485
 
483
486
  data: dict
484
487
  advisories: "tuple[Advisory, ...]" = field(default=(), compare=False, repr=False)
@@ -488,6 +491,13 @@ class Manifest:
488
491
  """The declared capability tokens, in declared order; () when none."""
489
492
  return tuple(self.data.get("capabilities", ()))
490
493
 
494
+ @property
495
+ def may_not_embed(self) -> bool:
496
+ """(0.4) True iff the plug-in declares that its app must not be embedded
497
+ in a host's own UI; False when the field is absent. Recorded and exposed,
498
+ never verified ([CXC-PC-V04-MAY-NOT-EMBED])."""
499
+ return self.data.get("may_not_embed", False) is True
500
+
491
501
  @property
492
502
  def warnings(self) -> "tuple[dict, ...]":
493
503
  """The plug-in's declared warnings ``{id, title, text}``; () when none."""
@@ -592,6 +602,14 @@ def validate_manifest(manifest: Any, *, host: str,
592
602
  f"{stated!r}, which does not define it (a manifest is read by "
593
603
  "the contract it states)")
594
604
 
605
+ # (0.4) [CXC-PC-V04-MAY-NOT-EMBED] rule (3): the same reading for the 0.4 key
606
+ from_0_4 = parse_contract(stated) >= (0, 4) if stated is not None else False
607
+ for key in FIELDS_FROM_0_4:
608
+ if key in manifest and not from_0_4:
609
+ refuse(key, f"defined from contract 0.4; this manifest states contract "
610
+ f"{stated!r}, which does not define it (a manifest is read by "
611
+ "the contract it states)")
612
+
595
613
  # 2. Unknown / reserved top-level keys.
596
614
  for key in manifest:
597
615
  if key not in CORE_FIELDS:
@@ -760,6 +778,12 @@ def validate_manifest(manifest: Any, *, host: str,
760
778
  if "warnings" in manifest and from_0_3:
761
779
  _validate_warnings(manifest["warnings"], refuse)
762
780
 
781
+ # (0.4) [CXC-PC-V04-MAY-NOT-EMBED] rule (4): a JSON boolean and nothing else
782
+ if "may_not_embed" in manifest and from_0_4:
783
+ v = manifest["may_not_embed"]
784
+ if not isinstance(v, bool):
785
+ refuse("may_not_embed", f"{v!r} must be a JSON boolean (true or false)")
786
+
763
787
  if "hosts" in manifest:
764
788
  v = manifest["hosts"]
765
789
  if not isinstance(v, dict):
@@ -1185,12 +1209,13 @@ def config_advisories(config_schema: Any) -> "tuple[Advisory, ...]":
1185
1209
  #: (a manifest is read by the contract it states). The 0.1 file is
1186
1210
  #: byte-identical to compose-plugins 0.1.0's.
1187
1211
  SCHEMA_RESOURCES = {"0.1": "manifest-0.1.schema.json", "0.2": "manifest-0.2.schema.json",
1188
- "0.3": "manifest-0.3.schema.json"}
1212
+ "0.3": "manifest-0.3.schema.json", "0.4": "manifest-0.4.schema.json"}
1189
1213
  #: the schema of the contract this library implements
1190
1214
  SCHEMA_RESOURCE = SCHEMA_RESOURCES[HOST_CONTRACT]
1191
1215
  #: the fields each shipped schema carries beyond contract 0.1's
1192
1216
  _SCHEMA_FIELDS_FROM = {"0.1": (), "0.2": FIELDS_FROM_0_2,
1193
- "0.3": FIELDS_FROM_0_2 + FIELDS_FROM_0_3}
1217
+ "0.3": FIELDS_FROM_0_2 + FIELDS_FROM_0_3,
1218
+ "0.4": FIELDS_FROM_0_2 + FIELDS_FROM_0_3 + FIELDS_FROM_0_4}
1194
1219
 
1195
1220
  #: the rules a JSON Schema cannot express; the validator alone enforces them
1196
1221
  SCHEMA_INEXPRESSIBLE = (
@@ -1229,15 +1254,20 @@ SCHEMA_INEXPRESSIBLE = (
1229
1254
  "code points (maxLength counts code points; the validator counts them the same "
1230
1255
  "way), a warning id unique within warnings (uniqueItems compares whole "
1231
1256
  "objects), and a capability token not repeated",
1257
+ # ---- (0.4) the rule below is in the 0.4 schema only ----
1258
+ "may_not_embed is defined from contract 0.4: a manifest that states an "
1259
+ "earlier contract and carries it is refused naming the key (a cross-field "
1260
+ "rule)",
1232
1261
  )
1233
1262
 
1234
1263
 
1235
1264
  #: how many SCHEMA_INEXPRESSIBLE entries each contract's schema lists
1236
- _INEXPRESSIBLE_COUNT = {"0.1": 8, "0.2": 11, "0.3": len(SCHEMA_INEXPRESSIBLE)}
1265
+ _INEXPRESSIBLE_COUNT = {"0.1": 8, "0.2": 11, "0.3": len(SCHEMA_INEXPRESSIBLE) - 1,
1266
+ "0.4": len(SCHEMA_INEXPRESSIBLE)}
1237
1267
 
1238
1268
 
1239
1269
  def build_schema(contract: str = HOST_CONTRACT) -> dict:
1240
- """The manifest JSON Schema of ``contract`` ("0.1", "0.2" or "0.3"), from
1270
+ """The manifest JSON Schema of ``contract`` ("0.1" to "0.4"), from
1241
1271
  :data:`PATTERNS` and the field tuples. The 0.1 schema is exactly the one
1242
1272
  compose-plugins 0.1.0 shipped."""
1243
1273
  if contract not in SCHEMA_RESOURCES:
@@ -1329,7 +1359,8 @@ def build_schema(contract: str = HOST_CONTRACT) -> dict:
1329
1359
  "title": pat("warning_title",
1330
1360
  maxLength=WARNING_TITLE_MAX),
1331
1361
  "text": pat("warning_text",
1332
- maxLength=WARNING_TEXT_MAX)}}}}
1362
+ maxLength=WARNING_TEXT_MAX)}}},
1363
+ "may_not_embed": {"type": "boolean"}}
1333
1364
  if extra_fields:
1334
1365
  # after standard_questions, as the 0.2 schema has always placed them
1335
1366
  props = {}
@@ -1387,7 +1418,7 @@ def schema_for(manifest: Any) -> dict:
1387
1418
  __all__ = [
1388
1419
  "BUS_TYPES_ALLOWED", "BUS_TYPES_RESERVED", "CORE_FIELDS", "GENERATED_FIELDS",
1389
1420
  "HA_OTHER_NAMES_RESERVED", "HA_RESERVED_KEYS", "HOST_PROVIDED_PACKAGES",
1390
- "FIELDS_FROM_0_2", "FIELDS_FROM_0_3", "Advisory", "config_advisories", "warning_problem",
1421
+ "FIELDS_FROM_0_2", "FIELDS_FROM_0_3", "FIELDS_FROM_0_4", "Advisory", "config_advisories", "warning_problem",
1391
1422
  "name_tokens", "GRANT_NAME_TOKENS", "GRANT_FORMATS", "CAPABILITY_AGENT_MESSAGING",
1392
1423
  "CAPABILITIES_MAX", "WARNINGS_MAX", "WARNING_KEYS", "LICENSE_MAX_CHARS", "LICENSE_RESERVED_WORDS", "license_problem",
1393
1424
  "Manifest", "NO_PACKAGE", "OPTIONAL_FIELDS", "OTHER_RESERVED_KEYS",
@@ -0,0 +1,269 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "compose-plugins manifest.json, contract 0.4",
4
+ "description": "The static, host-neutral plug-in manifest of [SPEC:CXC-PLUGIN-CONTRACT] v0.4. GENERATED from compose_plugins.manifest (build_schema); the validator there is AUTHORITATIVE and uses the same patterns. Patterns are written to mean the same under ECMA-262 (with the u flag) and Python re; whitespace and Unicode format (Cf) sets are frozen at Unicode 15.1.0. Rules this schema cannot express: (1) bus namespaces under plugins/<THIS manifest's domain>/ (needs the domain value); (2) the installing host's own key in hosts, and that host's validation of its own section (needs the installing host); (3) standard_questions naming a directory that exists inside the package, case-exactly and without leaving it through a symlink (needs the package); (4) which refusal text a refused key gets (reserved vs unknown); (5) reader rules applied before JSON exists: UTF-8, no duplicate keys, finite numbers only, at most 256 KiB, nesting at most 64 levels, manifest.json not a symlink; (6) a bracketed IPv6 permissions.network target in RFC 5952 canonical form (needs an address parse; the schema checks lowercase hex and ':' only); (7) a permissions.filesystem path of at most 4096 bytes in UTF-8 (maxLength counts code points); (8) no duplicate permissions entry (the same direction and target within network; the same path, whatever its access, within filesystem); (9) license and eula are defined from contract 0.2: a manifest that states an earlier contract and carries either is refused naming the key (a cross-field rule); (10) license holding an SPDX license expression of ASCII characters (the expression grammar is a function, not one pattern; ids are not looked up in the SPDX License List); (11) eula naming, in at most 255 bytes of UTF-8, a regular file inside the package, not a symlink and not reached through one, holding 1 to 262144 bytes of UTF-8 text with no byte-order mark, no control character other than tab, line feed and carriage return, no bidirectional control character, and not only whitespace (needs the package); (12) capabilities and warnings are defined from contract 0.3: a manifest that states an earlier contract and carries either is refused naming the key (a cross-field rule); (13) a warning title of at most 120 code points and a warning text of at most 2000 code points (maxLength counts code points; the validator counts them the same way), a warning id unique within warnings (uniqueItems compares whole objects), and a capability token not repeated; (14) may_not_embed is defined from contract 0.4: a manifest that states an earlier contract and carries it is refused naming the key (a cross-field rule).",
5
+ "x-compose-plugins-contract": "0.4",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "contract",
10
+ "domain",
11
+ "name",
12
+ "version",
13
+ "description",
14
+ "documentation",
15
+ "requirements",
16
+ "run",
17
+ "hosts",
18
+ "config_schema"
19
+ ],
20
+ "properties": {
21
+ "contract": {
22
+ "type": "string",
23
+ "enum": [
24
+ "0.0",
25
+ "0.1",
26
+ "0.2",
27
+ "0.3",
28
+ "0.4"
29
+ ]
30
+ },
31
+ "domain": {
32
+ "type": "string",
33
+ "pattern": "^[a-z][a-z0-9_]*(?![\\s\\S])"
34
+ },
35
+ "name": {
36
+ "type": "string",
37
+ "pattern": "[^\\u0009-\\u000d\\u001c-\\u0020\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028-\\u2029\\u202f\\u205f\\u3000\\u00ad\\u0600-\\u0605\\u061c\\u06dd\\u070f\\u0890-\\u0891\\u08e2\\u180e\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\u2066-\\u206f\\ufeff\\ufff9-\\ufffb\ud804\udcbd\ud804\udccd\ud80d\udc30-\ud80d\udc3f\ud82f\udca0-\ud82f\udca3\ud834\udd73-\ud834\udd7a\udb40\udc01\udb40\udc20-\udb40\udc7f]"
38
+ },
39
+ "version": {
40
+ "type": "string",
41
+ "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-]+)*)?(?![\\s\\S])"
42
+ },
43
+ "description": {
44
+ "type": "string",
45
+ "pattern": "^[^\\u000a-\\u000d\\u001c-\\u001e\\u0085\\u2028-\\u2029]*[^\\u0009-\\u000d\\u001c-\\u0020\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028-\\u2029\\u202f\\u205f\\u3000\\u00ad\\u0600-\\u0605\\u061c\\u06dd\\u070f\\u0890-\\u0891\\u08e2\\u180e\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\u2066-\\u206f\\ufeff\\ufff9-\\ufffb\ud804\udcbd\ud804\udccd\ud80d\udc30-\ud80d\udc3f\ud82f\udca0-\ud82f\udca3\ud834\udd73-\ud834\udd7a\udb40\udc01\udb40\udc20-\udb40\udc7f][^\\u000a-\\u000d\\u001c-\\u001e\\u0085\\u2028-\\u2029]*(?![\\s\\S])"
46
+ },
47
+ "documentation": {
48
+ "type": "string",
49
+ "pattern": "^https://[^\\u0009-\\u000d\\u001c-\\u0020\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028-\\u2029\\u202f\\u205f\\u3000/?#]+[^\\u0009-\\u000d\\u001c-\\u0020\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028-\\u2029\\u202f\\u205f\\u3000]*(?![\\s\\S])"
50
+ },
51
+ "issue_tracker": {
52
+ "type": "string",
53
+ "pattern": "^[Hh][Tt][Tt][Pp][Ss]?://[^\\u0009-\\u000d\\u001c-\\u0020\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028-\\u2029\\u202f\\u205f\\u3000/?#]+[^\\u0009-\\u000d\\u001c-\\u0020\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028-\\u2029\\u202f\\u205f\\u3000]*(?![\\s\\S])"
54
+ },
55
+ "codeowners": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "string",
59
+ "pattern": "^@[A-Za-z0-9_.-]+(?:/[A-Za-z0-9_.-]+)?(?![\\s\\S])"
60
+ }
61
+ },
62
+ "requirements": {
63
+ "type": "array",
64
+ "items": {
65
+ "type": "string",
66
+ "pattern": "^(?!(?:[Cc][Oo][Mm][Pp][Oo][Ss][Ee][Bb][Uu][Ss]|[Cc][Oo][Mm][Pp][Oo][Ss][Ee][-_.]+[Pp][Ll][Uu][Gg][Ii][Nn][Ss]|[Cc][Oo][Mm][Pp][Oo][Ss][Ee][Ii][Oo])==)[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?==[A-Za-z0-9][A-Za-z0-9.+!_-]*(?![\\s\\S])"
67
+ }
68
+ },
69
+ "run": {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "required": [
73
+ "form",
74
+ "entry"
75
+ ],
76
+ "properties": {
77
+ "form": {
78
+ "const": "python"
79
+ },
80
+ "entry": {
81
+ "type": "string",
82
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*:[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*(?![\\s\\S])"
83
+ }
84
+ }
85
+ },
86
+ "isolation_floor": {
87
+ "enum": [
88
+ "inprocess",
89
+ "subprocess"
90
+ ]
91
+ },
92
+ "config_schema": {
93
+ "type": "object"
94
+ },
95
+ "bus": {
96
+ "type": "object",
97
+ "additionalProperties": false,
98
+ "required": [
99
+ "publishes",
100
+ "subscribes"
101
+ ],
102
+ "properties": {
103
+ "publishes": {
104
+ "$ref": "#/$defs/busList"
105
+ },
106
+ "subscribes": {
107
+ "$ref": "#/$defs/busList"
108
+ }
109
+ }
110
+ },
111
+ "standard_questions": {
112
+ "type": "string",
113
+ "pattern": "^(?![/\\\\])(?![A-Za-z]:)(?!(?:[\\s\\S]*[/\\\\])?\\.\\.(?:[/\\\\]|(?![\\s\\S])))[\\s\\S]+(?![\\s\\S])"
114
+ },
115
+ "license": {
116
+ "type": "string",
117
+ "minLength": 1,
118
+ "maxLength": 256
119
+ },
120
+ "eula": {
121
+ "type": "string",
122
+ "pattern": "^(?![A-Za-z]:)(?:(?!\\.\\.?(?:/|(?![\\s\\S])))[^/\\\\\\u0000-\\u001f\\u007f-\\u009f]+/)*(?!\\.\\.?(?:/|(?![\\s\\S])))[^/\\\\\\u0000-\\u001f\\u007f-\\u009f]+(?![\\s\\S])"
123
+ },
124
+ "capabilities": {
125
+ "type": "array",
126
+ "maxItems": 16,
127
+ "uniqueItems": true,
128
+ "items": {
129
+ "type": "string",
130
+ "pattern": "^[a-z][a-z0-9-]{0,63}(?![\\s\\S])"
131
+ }
132
+ },
133
+ "warnings": {
134
+ "type": "array",
135
+ "maxItems": 8,
136
+ "items": {
137
+ "type": "object",
138
+ "additionalProperties": false,
139
+ "required": [
140
+ "id",
141
+ "title",
142
+ "text"
143
+ ],
144
+ "properties": {
145
+ "id": {
146
+ "type": "string",
147
+ "pattern": "^[a-z][a-z0-9_-]{0,63}(?![\\s\\S])"
148
+ },
149
+ "title": {
150
+ "type": "string",
151
+ "pattern": "^[^\\u000a-\\u000d\\u001c-\\u001e\\u0085\\u2028-\\u2029]*[^\\u0009-\\u000d\\u001c-\\u0020\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028-\\u2029\\u202f\\u205f\\u3000\\u00ad\\u0600-\\u0605\\u061c\\u06dd\\u070f\\u0890-\\u0891\\u08e2\\u180e\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\u2066-\\u206f\\ufeff\\ufff9-\\ufffb\ud804\udcbd\ud804\udccd\ud80d\udc30-\ud80d\udc3f\ud82f\udca0-\ud82f\udca3\ud834\udd73-\ud834\udd7a\udb40\udc01\udb40\udc20-\udb40\udc7f][^\\u000a-\\u000d\\u001c-\\u001e\\u0085\\u2028-\\u2029]*(?![\\s\\S])",
152
+ "maxLength": 120
153
+ },
154
+ "text": {
155
+ "type": "string",
156
+ "pattern": "^[^\\u0000-\\u0009\\u000b-\\u001f\\u007f-\\u009f]*[^\\u0009-\\u000d\\u001c-\\u0020\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028-\\u2029\\u202f\\u205f\\u3000\\u00ad\\u0600-\\u0605\\u061c\\u06dd\\u070f\\u0890-\\u0891\\u08e2\\u180e\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\u2066-\\u206f\\ufeff\\ufff9-\\ufffb\ud804\udcbd\ud804\udccd\ud80d\udc30-\ud80d\udc3f\ud82f\udca0-\ud82f\udca3\ud834\udd73-\ud834\udd7a\udb40\udc01\udb40\udc20-\udb40\udc7f\\u0000-\\u0009\\u000b-\\u001f\\u007f-\\u009f][^\\u0000-\\u0009\\u000b-\\u001f\\u007f-\\u009f]*(?![\\s\\S])",
157
+ "maxLength": 2000
158
+ }
159
+ }
160
+ }
161
+ },
162
+ "may_not_embed": {
163
+ "type": "boolean"
164
+ },
165
+ "permissions": {
166
+ "type": "object",
167
+ "additionalProperties": false,
168
+ "properties": {
169
+ "network": {
170
+ "type": "array",
171
+ "items": {
172
+ "$ref": "#/$defs/networkPermission"
173
+ }
174
+ },
175
+ "filesystem": {
176
+ "type": "array",
177
+ "items": {
178
+ "$ref": "#/$defs/filesystemPermission"
179
+ }
180
+ }
181
+ }
182
+ },
183
+ "hosts": {
184
+ "type": "object",
185
+ "minProperties": 1,
186
+ "propertyNames": {
187
+ "pattern": "^(?!(?:bus|code|permission)(?![\\s\\S]))[a-z][a-z0-9_]*(?![\\s\\S])"
188
+ }
189
+ }
190
+ },
191
+ "$defs": {
192
+ "busList": {
193
+ "type": "array",
194
+ "uniqueItems": true,
195
+ "items": {
196
+ "type": "object",
197
+ "additionalProperties": false,
198
+ "required": [
199
+ "namespace",
200
+ "type"
201
+ ],
202
+ "properties": {
203
+ "namespace": {
204
+ "type": "string",
205
+ "pattern": "^plugins/[a-z][a-z0-9_]*(?:/[A-Za-z0-9_-]+)+(?![\\s\\S])"
206
+ },
207
+ "type": {
208
+ "enum": [
209
+ "STATE",
210
+ "EVENT"
211
+ ]
212
+ }
213
+ }
214
+ }
215
+ },
216
+ "networkPermission": {
217
+ "type": "object",
218
+ "additionalProperties": false,
219
+ "required": [
220
+ "direction",
221
+ "target",
222
+ "purpose"
223
+ ],
224
+ "properties": {
225
+ "direction": {
226
+ "enum": [
227
+ "outbound",
228
+ "inbound"
229
+ ]
230
+ },
231
+ "target": {
232
+ "type": "string",
233
+ "pattern": "^(?:any|(?!any:)(?:(?=[a-z0-9.-]{1,253}(?::|(?![\\s\\S])))(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)*(?=[0-9]*[a-z-])[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?|(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}|\\[[0-9a-f:]{2,39}\\])(?::(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?)(?![\\s\\S])"
234
+ },
235
+ "purpose": {
236
+ "type": "string",
237
+ "pattern": "^[^\\u000a-\\u000d\\u001c-\\u001e\\u0085\\u2028-\\u2029]*[^\\u0009-\\u000d\\u001c-\\u0020\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028-\\u2029\\u202f\\u205f\\u3000\\u00ad\\u0600-\\u0605\\u061c\\u06dd\\u070f\\u0890-\\u0891\\u08e2\\u180e\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\u2066-\\u206f\\ufeff\\ufff9-\\ufffb\ud804\udcbd\ud804\udccd\ud80d\udc30-\ud80d\udc3f\ud82f\udca0-\ud82f\udca3\ud834\udd73-\ud834\udd7a\udb40\udc01\udb40\udc20-\udb40\udc7f][^\\u000a-\\u000d\\u001c-\\u001e\\u0085\\u2028-\\u2029]*(?![\\s\\S])",
238
+ "maxLength": 200
239
+ }
240
+ }
241
+ },
242
+ "filesystemPermission": {
243
+ "type": "object",
244
+ "additionalProperties": false,
245
+ "required": [
246
+ "path",
247
+ "access",
248
+ "purpose"
249
+ ],
250
+ "properties": {
251
+ "path": {
252
+ "type": "string",
253
+ "pattern": "^/(?:(?!\\.\\.?(?:/|(?![\\s\\S])))[^/~*?\\[\\u0000-\\u001f\\u007f-\\u009f]+(?:/(?!\\.\\.?(?:/|(?![\\s\\S])))[^/~*?\\[\\u0000-\\u001f\\u007f-\\u009f]+)*)?(?![\\s\\S])"
254
+ },
255
+ "access": {
256
+ "enum": [
257
+ "read",
258
+ "read-write"
259
+ ]
260
+ },
261
+ "purpose": {
262
+ "type": "string",
263
+ "pattern": "^[^\\u000a-\\u000d\\u001c-\\u001e\\u0085\\u2028-\\u2029]*[^\\u0009-\\u000d\\u001c-\\u0020\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028-\\u2029\\u202f\\u205f\\u3000\\u00ad\\u0600-\\u0605\\u061c\\u06dd\\u070f\\u0890-\\u0891\\u08e2\\u180e\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\u2066-\\u206f\\ufeff\\ufff9-\\ufffb\ud804\udcbd\ud804\udccd\ud80d\udc30-\ud80d\udc3f\ud82f\udca0-\ud82f\udca3\ud834\udd73-\ud834\udd7a\udb40\udc01\udb40\udc20-\udb40\udc7f][^\\u000a-\\u000d\\u001c-\\u001e\\u0085\\u2028-\\u2029]*(?![\\s\\S])",
264
+ "maxLength": 200
265
+ }
266
+ }
267
+ }
268
+ }
269
+ }
@@ -12,7 +12,7 @@ import re
12
12
  from .errors import ContractVersionRefused
13
13
 
14
14
  #: The ONE contract version this library (and so a host built on it) implements.
15
- HOST_CONTRACT = "0.3"
15
+ HOST_CONTRACT = "0.4"
16
16
 
17
17
  _CONTRACT_RE = re.compile(r"(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)")
18
18
 
@@ -345,12 +345,15 @@ class PluginManagerApp:
345
345
  base = f"{e(prefix)}/plugin/{e(quote(domain))}"
346
346
  import json
347
347
  cfg = e(json.dumps(m.configs.get(domain)))
348
+ may_not_embed = "true" if (rec.get("manifest") or {}).get("may_not_embed") is True else "false"
348
349
 
349
350
  def button(op: str, label: str) -> str:
350
351
  return (f"<form method='post' action='{base}/{op}'>{self._csrf_input(csrf)}"
351
352
  f"<button>{label}</button></form>")
352
353
  body = (f"<p>state: {e(m.state(domain))}; status: {e(m.status(domain))}; "
353
354
  f"runs as: {e(str(rec.get('runs_as', '')))}</p>"
355
+ # (0.4) [CXC-PC-V04-MAY-NOT-EMBED] rule (7): shown, never verified
356
+ f"<p class='may-not-embed'>may not embed: {e(may_not_embed)}</p>"
354
357
  + button("enable", "enable") + button("disable", "disable")
355
358
  + button("uninstall/prepare", "uninstall")
356
359
  + f"<form method='post' action='{base}/configure'>{self._csrf_input(csrf)}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compose-plugins
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: The shared plug-in contract library (manifest, consent, version rule) for ComposeIO and Gnomon hosts
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
@@ -12,10 +12,16 @@ Dynamic: license-file
12
12
  # compose-plugins
13
13
 
14
14
  The shared plug-in contract library for ComposeIO's ComposeServer and for
15
- Gnomon, implementing the Shared Plug-in Contract v0.3 (ComposeIO spec 95,
16
- `[SPEC:CXC-PLUGIN-CONTRACT]`, revision r24 plus its v0.2 delta plus the v0.3 delta,
17
- section 18). It is the layer a plug-in is INSTALLED and CONSENTED to, plus the shared
18
- manager that drives it. See `CHANGELOG.md` for what 0.3.0 changes and what was measured.
15
+ Gnomon, implementing the Shared Plug-in Contract v0.4 (ComposeIO spec 95,
16
+ `[SPEC:CXC-PLUGIN-CONTRACT]`, revision r24 plus its v0.2 delta plus the v0.3 and v0.4 deltas,
17
+ sections 18 and 20). It is the layer a plug-in is INSTALLED and CONSENTED to, plus the shared
18
+ manager that drives it. See `CHANGELOG.md` for what 0.4.0 changes and what was measured.
19
+
20
+ Contract 0.4 is an additive MINOR over 0.3 that adds one optional manifest field,
21
+ `may_not_embed` (a boolean, default false; valid only in a manifest that states 0.4): when
22
+ true, a host that embeds plug-in apps opens that plug-in's app only in a separate window. The
23
+ library records and shows it and never verifies it; changing it in an upgrade asks for no
24
+ consent.
19
25
 
20
26
  Contract 0.3 is an additive MINOR over 0.2 that FREEZES the manifest schema: optional
21
27
  `capabilities` (`agent-messaging` is defined) and `warnings` (`{id, title, text}`, each
@@ -47,7 +53,7 @@ that is not ComposeIO can use the library on its own.
47
53
 
48
54
  | module | what |
49
55
  |---|---|
50
- | `compose_plugins.manifest` | the v0.1 manifest validator (authoritative) and the shipped JSON Schemas, one per contract (`schema/manifest-0.1.schema.json` and `schema/manifest-0.2.schema.json`, both byte-identical to the compose-plugins 0.2.0 files, and `schema/manifest-0.3.schema.json`, frozen at the tag; `schema_for(manifest)` picks by the manifest's `contract`), generated from the validator's own patterns |
56
+ | `compose_plugins.manifest` | the v0.1 manifest validator (authoritative) and the shipped JSON Schemas, one per contract (`schema/manifest-0.1.schema.json` and `schema/manifest-0.2.schema.json`, both byte-identical to the compose-plugins 0.2.0 files, `schema/manifest-0.3.schema.json`, byte-identical to the compose-plugins 0.3.0 file, and `schema/manifest-0.4.schema.json`, frozen at the tag; `schema_for(manifest)` picks by the manifest's `contract`), generated from the validator's own patterns |
51
57
  | `compose_plugins.package` | reading `manifest.json` from a directory or a wheel WITHOUT executing anything, and the `manifest_sha256` rule (exact bytes, no canonicalization) |
52
58
  | `compose_plugins.version` | the contract version rule: a host accepts the same MAJOR and a MINOR at or below its own, and refuses anything newer, naming both versions |
53
59
  | `compose_plugins.consent` | consent content rendered from the manifest alone, the granted set, the widening rule, and the append-only consent-record store |
@@ -42,6 +42,7 @@ compose_plugins/schema/__init__.py
42
42
  compose_plugins/schema/manifest-0.1.schema.json
43
43
  compose_plugins/schema/manifest-0.2.schema.json
44
44
  compose_plugins/schema/manifest-0.3.schema.json
45
+ compose_plugins/schema/manifest-0.4.schema.json
45
46
  tests/test_consent.py
46
47
  tests/test_consent_record_r9.py
47
48
  tests/test_host_name_r10.py
@@ -64,6 +65,7 @@ tests/test_v03_reads_0_2.py
64
65
  tests/test_v03_uninstall_data.py
65
66
  tests/test_v03_warnings.py
66
67
  tests/test_v03_web.py
68
+ tests/test_v04_may_not_embed.py
67
69
  tests/test_validator_readings.py
68
70
  tests/test_version.py
69
71
  tests/test_wave2_build.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "compose-plugins"
7
- version = "0.3.0"
7
+ version = "0.4.0"
8
8
  description = "The shared plug-in contract library (manifest, consent, version rule) for ComposeIO and Gnomon hosts"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -40,7 +40,8 @@ def test_schema_is_valid_draft_2020_12_and_accepts_the_valid_manifest():
40
40
  def test_schema_carries_the_contract_version():
41
41
  s = schema()
42
42
  assert s["x-compose-plugins-contract"] == HOST_CONTRACT
43
- assert s["properties"]["contract"]["enum"] == ["0.0", "0.1", "0.2", "0.3"]
43
+ # [CXC-PC-V04-VERSION-0-4] rules (1) and (6): the host schema is the 0.4 one
44
+ assert s["properties"]["contract"]["enum"] == ["0.0", "0.1", "0.2", "0.3", "0.4"]
44
45
 
45
46
 
46
47
  def test_schema_field_set_equals_the_validators():
@@ -82,6 +83,8 @@ DEDICATED_TESTS = {
82
83
  "test_CXC_PC_V03_T_CAPABILITIES_WARNINGS_TABLE_capabilities_refused"),
83
84
  "warnings": ("test_v03_manifest",
84
85
  "test_CXC_PC_V03_T_CAPABILITIES_WARNINGS_TABLE_warnings_refused"),
86
+ # (0.4) [CXC-PC-V04-MANIFEST-FROZEN-HOLDS] rule (2): the one field 0.4 adds
87
+ "may_not_embed": ("test_v04_may_not_embed", "test_CXC_PC_V04_T_MAY_NOT_EMBED_FIELD"),
85
88
  }
86
89
 
87
90
 
@@ -374,7 +374,8 @@ def test_CXC_PC_V02_T_INSTALL_LOG_DIVERGENCE(tmp_path):
374
374
  st, h, clean = wsgi(app, "", "/")
375
375
  norm = clean.replace(app.csrf_token("op"), "{CSRF}")
376
376
  golden = (GOLDEN / "index_hello_world_installed.html").read_text()
377
- assert norm == golden.replace(", contract 0.1</footer>", ", contract 0.3</footer>")
377
+ # [CXC-PC-V04-READS-0-3-UNCHANGED] rule (3): the footer names contract 0.4
378
+ assert norm == golden.replace(", contract 0.1</footer>", ", contract 0.4</footer>")
378
379
  assert "Install log findings" not in clean
379
380
  # event N in the log, the record at N-1
380
381
  _append_raw(pm, line(2, event="enable", from_state="installed", to_state="enabled",