@consiliency/contract 0.0.1 → 0.2.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 (62) hide show
  1. package/README.md +44 -4
  2. package/conformance/vectors/adoption-absent-ungoverned.json +16 -0
  3. package/conformance/vectors/adoption-adopted-governed.json +18 -0
  4. package/conformance/vectors/adoption-declared-false-ungoverned.json +17 -0
  5. package/conformance/vectors/adoption-partial-scope.json +18 -0
  6. package/conformance/vectors/canonical-html-contract-loaded.json +15 -0
  7. package/conformance/vectors/coordination-announce-intent-does-not-lease.json +38 -0
  8. package/conformance/vectors/coordination-done-does-not-release-lease.json +38 -0
  9. package/conformance/vectors/coordination-handoff-does-not-transfer-holder.json +38 -0
  10. package/conformance/vectors/coordination-message-does-not-mutate-lease.json +38 -0
  11. package/conformance/vectors/doc-label-foreign-governed-false.json +19 -0
  12. package/conformance/vectors/doc-label-present-nonconforming.json +19 -0
  13. package/conformance/vectors/edge-label-unmanaged-cross-repo.json +30 -0
  14. package/conformance/vectors/governed-set-undeclared-ungoverned.json +18 -0
  15. package/conformance/vectors/ignore-set-nested-path-any-depth.json +19 -0
  16. package/conformance/vectors/ignore-set-scratch-never-governed.json +19 -0
  17. package/conformance/vectors/interface-invalid-host-path.json +26 -0
  18. package/conformance/vectors/interface-valid-realized-and-promised.json +36 -0
  19. package/conformance/vectors/lease-acquire.json +35 -0
  20. package/conformance/vectors/lease-event-carries-lease.json +28 -0
  21. package/conformance/vectors/lease-expire.json +25 -0
  22. package/conformance/vectors/lease-expiry-boundary.json +25 -0
  23. package/conformance/vectors/lease-hard-degrades-to-soft.json +35 -0
  24. package/conformance/vectors/lease-hard-mode-atomic.json +35 -0
  25. package/conformance/vectors/lease-release.json +26 -0
  26. package/conformance/vectors/lease-renew.json +36 -0
  27. package/conformance/vectors/loop-gate-invalid-blocking-default.json +15 -0
  28. package/conformance/vectors/loop-gate-missing-doc-warns.json +16 -0
  29. package/conformance/vectors/manifest-invalid-absolute-path.json +20 -0
  30. package/conformance/vectors/manifest-invalid-certified-maturity.json +20 -0
  31. package/conformance/vectors/manifest-invalid-path-and-ref.json +20 -0
  32. package/conformance/vectors/manifest-invalid-unknown-archetype.json +18 -0
  33. package/conformance/vectors/manifest-valid-baseline-only.json +20 -0
  34. package/conformance/vectors/manifest-valid-product.json +21 -0
  35. package/conformance/vectors/version-skew-compatible.json +15 -0
  36. package/conformance/vectors/version-skew-incompatible-warns.json +15 -0
  37. package/core/canonical-html/contract-v1.json +459 -0
  38. package/core/canonical-html/provenance.json +22 -0
  39. package/core/contract.json +55 -0
  40. package/core/registries/archetypes.json +62 -0
  41. package/core/registries/default-ignore-set.json +30 -0
  42. package/core/registries/document-classes.json +33 -0
  43. package/core/registries/maturity-labels.json +48 -0
  44. package/core/registries/required-documents.json +74 -0
  45. package/core/schemas/canonical-html-v1.schema.json +15 -0
  46. package/core/schemas/contract-version-status.schema.json +26 -0
  47. package/core/schemas/coordination-channel-protocol.schema.json +53 -0
  48. package/core/schemas/coordination-scenario.schema.json +67 -0
  49. package/core/schemas/decision.schema.json +31 -0
  50. package/core/schemas/governance-scope-scenario.schema.json +62 -0
  51. package/core/schemas/interface-declaration.schema.json +69 -0
  52. package/core/schemas/lease-event.schema.json +17 -0
  53. package/core/schemas/lease-store-protocol.schema.json +117 -0
  54. package/core/schemas/lease.schema.json +42 -0
  55. package/core/schemas/loop-gate-protocol.schema.json +25 -0
  56. package/core/schemas/loop-gate-scenario.schema.json +25 -0
  57. package/core/schemas/manifest.schema.json +140 -0
  58. package/core/schemas/version-skew-protocol.schema.json +32 -0
  59. package/core/schemas/version-skew-scenario.schema.json +13 -0
  60. package/package.json +8 -2
  61. package/src/index.d.ts +7 -1
  62. package/src/index.js +47 -7
@@ -0,0 +1,48 @@
1
+ {
2
+ "schema": "consiliency.maturity_labels.v1",
3
+ "labels": [
4
+ {
5
+ "id": "presence-only",
6
+ "kind": "evidence",
7
+ "description": "The artifact or edge is declared and can be checked for existence only."
8
+ },
9
+ {
10
+ "id": "hash-checked",
11
+ "kind": "evidence",
12
+ "description": "The artifact bytes are checked against a recorded digest."
13
+ },
14
+ {
15
+ "id": "realized-edge-observed",
16
+ "kind": "evidence",
17
+ "description": "The edge was observed from a declared pin, package coordinate, copied literal, or repo-relative source reference."
18
+ },
19
+ {
20
+ "id": "certified",
21
+ "kind": "evidence",
22
+ "description": "Reserved for post-XG-1 evidence attested by the certificate path; invalid for CS-0.2 Phase 0 vectors."
23
+ },
24
+ {
25
+ "id": "present-nonconforming",
26
+ "kind": "governance",
27
+ "governed": true,
28
+ "description": "The artifact is declared in the governed set and is present, but does not conform to its declared class or contract shape."
29
+ },
30
+ {
31
+ "id": "foreign",
32
+ "kind": "governance",
33
+ "governed": false,
34
+ "description": "A present artifact that is not declared in the governed set (governed:false). Ingestion must never treat it as authoritative or governed; it is neither owed nor checked."
35
+ },
36
+ {
37
+ "id": "unmanaged",
38
+ "kind": "governance",
39
+ "governed": false,
40
+ "description": "A cross-repo edge whose counterpart repo has not adopted the contract (governed:false at the far end). The edge may be observed locally, but the far end is ungoverned and carries no adoption profile."
41
+ }
42
+ ],
43
+ "label_kinds": {
44
+ "evidence": "Evidence-strength axis: how strongly the artifact/edge is attested (presence -> hash -> realized -> certified).",
45
+ "governance": "Governance-status axis: whether and how an artifact/edge is governed. Orthogonal to evidence strength."
46
+ },
47
+ "phase0_disallowed": ["certified"]
48
+ }
@@ -0,0 +1,74 @@
1
+ {
2
+ "schema": "consiliency.required_documents.v1",
3
+ "document_id_conflict_policy": "conflict",
4
+ "baseline": [
5
+ {"id": "readme", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": false},
6
+ {"id": "doc-contract-index", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
7
+ {"id": "service-catalog-ownership", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
8
+ {"id": "contract-version-status", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": false},
9
+ {"id": "contributing", "class": "static", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
10
+ {"id": "license", "class": "static", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": false},
11
+ {"id": "changelog", "class": "intent-plan", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
12
+ {"id": "glossary", "class": "proj-S", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true, "l0_note": "Presence stub with authored zone only; not a fake projection."},
13
+ {"id": "adr-index", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
14
+ {"id": "sbom", "class": "proj-code", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
15
+ {"id": "dev-setup", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
16
+ {"id": "codeowners", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
17
+ {"id": "interface-declaration", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": false}
18
+ ],
19
+ "archetypes": {
20
+ "product": [
21
+ {"id": "prd", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
22
+ {"id": "product-roadmap", "class": "intent-plan", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
23
+ {"id": "end-user-docs", "class": "proj-S", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
24
+ ],
25
+ "service": [
26
+ {"id": "slo-policy", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
27
+ {"id": "runbook", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
28
+ {"id": "dr-bcp", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
29
+ {"id": "incident-response", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
30
+ {"id": "deployment", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
31
+ {"id": "env-secrets-inventory", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
32
+ {"id": "release-policy", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
33
+ ],
34
+ "library": [
35
+ {"id": "api-spec", "class": "proj-code", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
36
+ {"id": "release-policy", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
37
+ ],
38
+ "infra": [
39
+ {"id": "deployment", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
40
+ {"id": "dr-bcp", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
41
+ ],
42
+ "tooling-meta": [
43
+ {"id": "configured-surfaces", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
44
+ {"id": "compatibility-policy", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
45
+ ],
46
+ "experiment": [
47
+ {"id": "hypothesis", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
48
+ {"id": "method", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
49
+ {"id": "findings", "class": "intent-plan", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
50
+ ],
51
+ "document": [
52
+ {"id": "document-index", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": false},
53
+ {"id": "provenance-index", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
54
+ {"id": "version-structure", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
55
+ ]
56
+ },
57
+ "modifiers": {
58
+ "data-bearing": [
59
+ {"id": "data-privacy-retention", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
60
+ {"id": "data-inventory", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
61
+ ],
62
+ "public": [
63
+ {"id": "code-of-conduct", "class": "static", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
64
+ {"id": "support", "class": "static", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
65
+ {"id": "security", "class": "static", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
66
+ ],
67
+ "regulated": [
68
+ {"id": "compliance-audit-index", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
69
+ ],
70
+ "user-facing": [
71
+ {"id": "threat-model", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
72
+ ]
73
+ }
74
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/canonical-html-v1.schema.json",
4
+ "title": "canonical_html.v1 package pointer",
5
+ "type": "object",
6
+ "required": ["contract_id", "schemas", "dialect", "document_identity", "document_type_catalog"],
7
+ "additionalProperties": true,
8
+ "properties": {
9
+ "contract_id": {"const": "canonicalHtmlContract.v1"},
10
+ "schemas": {"type": "object"},
11
+ "dialect": {"type": "object"},
12
+ "document_identity": {"type": "object"},
13
+ "document_type_catalog": {"type": "object"}
14
+ }
15
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/contract-version-status.schema.json",
4
+ "title": "Consiliency contract version status",
5
+ "type": "object",
6
+ "required": ["schema", "package", "repo_contract_version", "compatibility", "maturity", "checked_at", "evidence"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.contract_version_status.v1"},
10
+ "package": {
11
+ "type": "object",
12
+ "required": ["name", "version"],
13
+ "additionalProperties": false,
14
+ "properties": {
15
+ "name": {"type": "string"},
16
+ "version": {"type": "string", "pattern": "^0\\.1\\.0$"}
17
+ }
18
+ },
19
+ "repo_contract_version": {"type": "string", "pattern": "^0\\.1\\.0$"},
20
+ "consumer": {"type": "object"},
21
+ "compatibility": {"enum": ["compatible", "negotiated", "incompatible", "unknown"]},
22
+ "maturity": {"enum": ["presence-only", "hash-checked", "realized-edge-observed"]},
23
+ "checked_at": {"type": "string"},
24
+ "evidence": {"type": "array"}
25
+ }
26
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/coordination-channel-protocol.schema.json",
4
+ "title": "Consiliency coordination channel protocol",
5
+ "description": "The CoordinationChannel (inbox) interface. GUARDRAIL: the inbox is NEVER authoritative for lock state. Lease state is defined solely by projecting the LeaseStore event stream: current_lease = project(LeaseStore events, now), computed independently of inbox contents. A coordination message is not a lease event and never becomes one: it may PROMPT an actor to CALL a LeaseStore operation (acquire/renew/release), but the message itself never mutates, transfers, or transitions a lease. Excluding messages from the projection is normative, not incidental.",
6
+ "type": "object",
7
+ "required": ["schema", "operations", "message_types", "delivery", "authority", "lease_state_projection"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "schema": {"const": "consiliency.coordination_channel_protocol.v1"},
11
+ "lease_state_projection": {
12
+ "type": "object",
13
+ "additionalProperties": false,
14
+ "required": ["formula", "inbox_included_in_projection"],
15
+ "properties": {
16
+ "formula": {"const": "current_lease = project(lease-store events, now)"},
17
+ "inbox_included_in_projection": {"const": false}
18
+ }
19
+ },
20
+ "operations": {
21
+ "type": "array",
22
+ "uniqueItems": true,
23
+ "items": {"enum": ["send", "subscribe"]}
24
+ },
25
+ "message_types": {
26
+ "type": "array",
27
+ "uniqueItems": true,
28
+ "items": {"enum": ["request-yield", "announce-intent", "handoff", "done"]}
29
+ },
30
+ "delivery": {"const": "append-only"},
31
+ "authority": {
32
+ "type": "object",
33
+ "required": ["inbox_authoritative", "message_may_mutate_lease", "message_prompts_actor_to_call_store_op"],
34
+ "additionalProperties": false,
35
+ "properties": {
36
+ "inbox_authoritative": {"const": false},
37
+ "message_may_mutate_lease": {"const": false},
38
+ "message_prompts_actor_to_call_store_op": {
39
+ "const": true,
40
+ "description": "A message may cause an actor (a human or agent) to CALL a LeaseStore operation. It does not itself become or trigger a store mutation; the actor's explicit acquire/renew/release is the only thing that changes lease state."
41
+ }
42
+ }
43
+ },
44
+ "omniagent_plus_mapping": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "properties": {
48
+ "worktree_lease": {"const": "consiliency.lease.v1"},
49
+ "handoff_packet": {"const": "handoff"}
50
+ }
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/coordination-scenario.schema.json",
4
+ "title": "Consiliency coordination conformance scenario",
5
+ "description": "A lease/inbox scenario: an ordered append-only lease-event stream, optional advisory inbox messages, and the evaluation clock. The current-lease VIEW is the projection of the event stream evaluated at `now`. Inbox messages are advisory and MUST NOT change the projected lease state.",
6
+ "type": "object",
7
+ "required": ["schema", "now", "events"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "schema": {"const": "consiliency.coordination_scenario.v1"},
11
+ "now": {"$ref": "#/$defs/isoTimestamp"},
12
+ "requested_mode": {"enum": ["soft", "hard"]},
13
+ "backend": {"enum": ["local-file", "portal", "coordinator", "none"]},
14
+ "atomic_backend": {"type": "boolean"},
15
+ "events": {
16
+ "type": "array",
17
+ "items": {"$ref": "#/$defs/event"}
18
+ },
19
+ "messages": {
20
+ "type": "array",
21
+ "items": {"$ref": "#/$defs/message"}
22
+ }
23
+ },
24
+ "$defs": {
25
+ "isoTimestamp": {
26
+ "type": "string",
27
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
28
+ },
29
+ "event": {
30
+ "type": "object",
31
+ "required": ["event", "lease_id", "holder", "at"],
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "event": {"enum": ["acquire", "renew", "release", "expire"]},
35
+ "lease_id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.:-]*$"},
36
+ "holder": {"type": "string", "minLength": 1},
37
+ "at": {"$ref": "#/$defs/isoTimestamp"},
38
+ "ttl_seconds": {"type": "integer", "minimum": 1, "maximum": 7200},
39
+ "mode": {"enum": ["soft", "hard"]},
40
+ "scope": {
41
+ "type": "object",
42
+ "required": ["granularity", "selector"],
43
+ "additionalProperties": false,
44
+ "properties": {
45
+ "granularity": {"enum": ["repo", "path-set", "symbol"]},
46
+ "selector": {
47
+ "type": "array",
48
+ "uniqueItems": true,
49
+ "items": {"type": "string", "minLength": 1}
50
+ }
51
+ }
52
+ },
53
+ "phase": {"type": "string", "minLength": 1}
54
+ }
55
+ },
56
+ "message": {
57
+ "type": "object",
58
+ "required": ["type", "from", "target_lease"],
59
+ "additionalProperties": false,
60
+ "properties": {
61
+ "type": {"enum": ["request-yield", "announce-intent", "handoff", "done"]},
62
+ "from": {"type": "string", "minLength": 1},
63
+ "target_lease": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.:-]*$"}
64
+ }
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/decision.schema.json",
4
+ "title": "Consiliency conformance decision",
5
+ "type": "object",
6
+ "required": ["schema", "status", "maturity", "findings"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.conformance_decision.v1"},
10
+ "status": {"enum": ["accepted", "rejected", "warn"]},
11
+ "maturity": {"enum": ["presence-only", "hash-checked", "realized-edge-observed"]},
12
+ "labels": {
13
+ "type": "array",
14
+ "uniqueItems": true,
15
+ "items": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"}
16
+ },
17
+ "findings": {
18
+ "type": "array",
19
+ "items": {
20
+ "type": "object",
21
+ "required": ["code", "severity", "message"],
22
+ "additionalProperties": false,
23
+ "properties": {
24
+ "code": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
25
+ "severity": {"enum": ["info", "warn", "block"]},
26
+ "message": {"type": "string", "minLength": 1}
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/governance-scope-scenario.schema.json",
4
+ "title": "Consiliency governance scope conformance scenario",
5
+ "type": "object",
6
+ "required": ["schema", "subject"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.governance_scope_scenario.v1"},
10
+ "adoption": {
11
+ "type": "object",
12
+ "required": ["adopted", "adopted_scope"],
13
+ "additionalProperties": false,
14
+ "properties": {
15
+ "adopted": {"type": "boolean"},
16
+ "adopted_scope": {
17
+ "type": "array",
18
+ "uniqueItems": true,
19
+ "items": {"enum": ["layout", "gates", "projections", "cert"]}
20
+ }
21
+ }
22
+ },
23
+ "governed_set": {
24
+ "type": "array",
25
+ "uniqueItems": true,
26
+ "items": {
27
+ "type": "object",
28
+ "required": ["by", "value"],
29
+ "additionalProperties": false,
30
+ "properties": {
31
+ "by": {"enum": ["path", "glob", "class"]},
32
+ "value": {
33
+ "type": "string",
34
+ "minLength": 1,
35
+ "not": {"anyOf": [{"pattern": "^/"}, {"pattern": "(^|/)\\.\\.(/|$)"}, {"pattern": "^[A-Za-z]:[\\\\/]"}]}
36
+ }
37
+ }
38
+ }
39
+ },
40
+ "ignore_set": {
41
+ "type": "array",
42
+ "uniqueItems": true,
43
+ "items": {"type": "string", "minLength": 1}
44
+ },
45
+ "facet": {"enum": ["layout", "gates", "projections", "cert"]},
46
+ "subject": {
47
+ "type": "object",
48
+ "required": ["kind", "path"],
49
+ "additionalProperties": false,
50
+ "properties": {
51
+ "kind": {"const": "doc"},
52
+ "path": {
53
+ "type": "string",
54
+ "minLength": 1,
55
+ "not": {"anyOf": [{"pattern": "^/"}, {"pattern": "(^|/)\\.\\.(/|$)"}, {"pattern": "^[A-Za-z]:[\\\\/]"}]}
56
+ },
57
+ "class": {"enum": ["intent-ground", "intent-plan", "proj-S", "proj-code", "ops-fact", "static", "index"]},
58
+ "observed_label": {"type": "string"}
59
+ }
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/interface-declaration.schema.json",
4
+ "title": "Consiliency interface declaration",
5
+ "type": "object",
6
+ "required": ["schema", "repo_id", "realized_edges", "promised_edges"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.interface_declaration.v1"},
10
+ "repo_id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
11
+ "realized_edges": {"type": "array", "items": {"$ref": "#/$defs/edge"}},
12
+ "promised_edges": {"type": "array", "items": {"$ref": "#/$defs/edge"}}
13
+ },
14
+ "$defs": {
15
+ "repoRelativePath": {
16
+ "type": "string",
17
+ "minLength": 1,
18
+ "not": {"anyOf": [{"pattern": "^/"}, {"pattern": "(^|/)\\.\\.(/|$)"}, {"pattern": "^[A-Za-z]:[\\\\/]"}]}
19
+ },
20
+ "ref": {
21
+ "type": "object",
22
+ "required": ["kind", "value"],
23
+ "additionalProperties": false,
24
+ "allOf": [
25
+ {
26
+ "if": {
27
+ "properties": {"kind": {"const": "repo-relative-path"}},
28
+ "required": ["kind"]
29
+ },
30
+ "then": {
31
+ "properties": {"value": {"$ref": "#/$defs/repoRelativePath"}}
32
+ }
33
+ }
34
+ ],
35
+ "properties": {
36
+ "kind": {"enum": ["git-ref", "package-coordinate", "repo-relative-path", "copied-literal", "opaque-external-ref"]},
37
+ "value": {"type": "string", "minLength": 1},
38
+ "path": {"$ref": "#/$defs/repoRelativePath"},
39
+ "digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"}
40
+ }
41
+ },
42
+ "evidence": {
43
+ "type": "object",
44
+ "required": ["ref", "digest"],
45
+ "additionalProperties": false,
46
+ "properties": {
47
+ "ref": {"$ref": "#/$defs/repoRelativePath"},
48
+ "digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"}
49
+ }
50
+ },
51
+ "edge": {
52
+ "type": "object",
53
+ "required": ["id", "provider_repo", "consumer_repo", "interface_id", "ref", "maturity", "evidence"],
54
+ "additionalProperties": false,
55
+ "properties": {
56
+ "id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
57
+ "provider_repo": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
58
+ "consumer_repo": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
59
+ "interface_id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
60
+ "ref": {"$ref": "#/$defs/ref"},
61
+ "maturity": {"enum": ["presence-only", "hash-checked", "realized-edge-observed"]},
62
+ "governed": {"type": "boolean"},
63
+ "governance_label": {"enum": ["unmanaged", "foreign"]},
64
+ "evidence": {"type": "array", "items": {"$ref": "#/$defs/evidence"}},
65
+ "upstream_pin": {"type": "string"}
66
+ }
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/lease-event.schema.json",
4
+ "title": "Consiliency lease event",
5
+ "description": "One entry in the append-only lease-event stream. The current-lease VIEW is a projection of this stream; the lease store is the sole source of truth for lease state.",
6
+ "type": "object",
7
+ "required": ["schema", "event", "lease_id", "holder", "at"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "schema": {"const": "consiliency.lease_event.v1"},
11
+ "event": {"enum": ["acquire", "renew", "release", "expire"]},
12
+ "lease_id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.:-]*$"},
13
+ "holder": {"type": "string", "minLength": 1},
14
+ "at": {"type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"},
15
+ "lease": {"$ref": "https://consiliency.io/contracts/lease.schema.json"}
16
+ }
17
+ }
@@ -0,0 +1,117 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/lease-store-protocol.schema.json",
4
+ "title": "Consiliency lease store protocol",
5
+ "description": "The LeaseStore interface contract. The store is the SOLE source of truth for lease state; the coordination channel (inbox) is never authoritative. A lease is not a lock: it carries a TTL, a heartbeat, and auto-expiry.",
6
+ "type": "object",
7
+ "required": ["schema", "operations", "operation_semantics", "failure_modes", "source_of_truth", "atomicity", "expiry", "granularity_ladder", "backends"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "schema": {"const": "consiliency.lease_store_protocol.v1"},
11
+ "operations": {
12
+ "type": "array",
13
+ "uniqueItems": true,
14
+ "items": {"enum": ["acquire", "renew", "release", "query"]}
15
+ },
16
+ "source_of_truth": {"const": "lease-store"},
17
+ "atomicity": {
18
+ "type": "object",
19
+ "required": ["hard_requires_atomic_acquire", "degrade_without_atomic_backend"],
20
+ "additionalProperties": false,
21
+ "properties": {
22
+ "hard_requires_atomic_acquire": {"const": true},
23
+ "degrade_without_atomic_backend": {"const": "soft"}
24
+ }
25
+ },
26
+ "expiry": {
27
+ "type": "object",
28
+ "required": ["ttl_authoritative", "heartbeat_renews", "auto_expiry", "expires_at_formula", "boundary"],
29
+ "additionalProperties": false,
30
+ "properties": {
31
+ "ttl_authoritative": {"const": true},
32
+ "heartbeat_renews": {"const": true},
33
+ "auto_expiry": {"const": true},
34
+ "expires_at_formula": {"const": "heartbeat_at + ttl_seconds"},
35
+ "boundary": {
36
+ "const": "exclusive",
37
+ "description": "A lease is held over [acquired_at, expires_at); the expires_at instant itself is NOT held. A lease is expired iff now >= heartbeat_at + ttl_seconds. This makes the contention instant deterministic across vendoring consumers."
38
+ }
39
+ }
40
+ },
41
+ "operation_semantics": {
42
+ "type": "object",
43
+ "required": ["acquire", "renew", "release", "query"],
44
+ "additionalProperties": false,
45
+ "properties": {
46
+ "acquire": {
47
+ "type": "object",
48
+ "required": ["request", "response", "idempotent", "holder_only", "rejects"],
49
+ "additionalProperties": false,
50
+ "properties": {
51
+ "request": {"const": "lease_id, holder, ttl_seconds, mode, scope, phase"},
52
+ "response": {"const": "granted-lease | conflict"},
53
+ "idempotent": {"const": false},
54
+ "holder_only": {"const": false},
55
+ "rejects": {"type": "array", "uniqueItems": true, "items": {"enum": ["conflict", "not-holder", "not-found", "expired"]}}
56
+ }
57
+ },
58
+ "renew": {
59
+ "type": "object",
60
+ "required": ["request", "response", "idempotent", "holder_only", "rejects"],
61
+ "additionalProperties": false,
62
+ "properties": {
63
+ "request": {"const": "lease_id, holder"},
64
+ "response": {"const": "renewed-lease | rejected"},
65
+ "idempotent": {"const": true},
66
+ "holder_only": {"const": true},
67
+ "rejects": {"type": "array", "uniqueItems": true, "items": {"enum": ["conflict", "not-holder", "not-found", "expired"]}}
68
+ }
69
+ },
70
+ "release": {
71
+ "type": "object",
72
+ "required": ["request", "response", "idempotent", "holder_only", "rejects"],
73
+ "additionalProperties": false,
74
+ "properties": {
75
+ "request": {"const": "lease_id, holder"},
76
+ "response": {"const": "released | rejected"},
77
+ "idempotent": {"const": true},
78
+ "holder_only": {"const": true},
79
+ "rejects": {"type": "array", "uniqueItems": true, "items": {"enum": ["conflict", "not-holder", "not-found", "expired"]}}
80
+ }
81
+ },
82
+ "query": {
83
+ "type": "object",
84
+ "required": ["request", "response", "idempotent", "holder_only", "rejects"],
85
+ "additionalProperties": false,
86
+ "properties": {
87
+ "request": {"const": "lease_id | scope"},
88
+ "response": {"const": "current-lease | empty"},
89
+ "idempotent": {"const": true},
90
+ "holder_only": {"const": false},
91
+ "rejects": {"type": "array", "uniqueItems": true, "items": {"enum": ["conflict", "not-holder", "not-found", "expired"]}}
92
+ }
93
+ }
94
+ }
95
+ },
96
+ "failure_modes": {
97
+ "type": "array",
98
+ "uniqueItems": true,
99
+ "items": {"enum": ["conflict", "not-holder", "not-found", "expired"]}
100
+ },
101
+ "granularity_ladder": {
102
+ "type": "object",
103
+ "required": ["default", "opt_in", "out_of_scope"],
104
+ "additionalProperties": false,
105
+ "properties": {
106
+ "default": {"const": "path-set"},
107
+ "opt_in": {"const": "symbol"},
108
+ "out_of_scope": {"const": "line"}
109
+ }
110
+ },
111
+ "backends": {
112
+ "type": "array",
113
+ "uniqueItems": true,
114
+ "items": {"enum": ["local-file", "portal", "coordinator"]}
115
+ }
116
+ }
117
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/lease.schema.json",
4
+ "title": "Consiliency coordination lease",
5
+ "type": "object",
6
+ "required": ["schema", "lease_id", "holder", "acquired_at", "ttl_seconds", "heartbeat_at", "mode", "scope", "phase"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.lease.v1"},
10
+ "lease_id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.:-]*$"},
11
+ "holder": {"type": "string", "minLength": 1},
12
+ "acquired_at": {"$ref": "#/$defs/isoTimestamp"},
13
+ "ttl_seconds": {"type": "integer", "minimum": 1, "maximum": 7200},
14
+ "heartbeat_at": {"$ref": "#/$defs/isoTimestamp"},
15
+ "mode": {"enum": ["soft", "hard"]},
16
+ "scope": {"$ref": "#/$defs/scope"},
17
+ "phase": {"type": "string", "minLength": 1}
18
+ },
19
+ "$defs": {
20
+ "isoTimestamp": {
21
+ "type": "string",
22
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
23
+ },
24
+ "scope": {
25
+ "type": "object",
26
+ "required": ["granularity", "selector"],
27
+ "additionalProperties": false,
28
+ "properties": {
29
+ "granularity": {"enum": ["repo", "path-set", "symbol"]},
30
+ "selector": {
31
+ "type": "array",
32
+ "uniqueItems": true,
33
+ "items": {
34
+ "type": "string",
35
+ "minLength": 1,
36
+ "not": {"anyOf": [{"pattern": "^/"}, {"pattern": "(^|/)\\.\\.(/|$)"}, {"pattern": "^[A-Za-z]:[\\\\/]"}]}
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }