veriguild 0.0.1__py3-none-any.whl

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.
veriguild/__init__.py ADDED
@@ -0,0 +1,4 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ """Veriguild draft protocol schemas (design phase)."""
3
+ __version__ = "0.0.1"
4
+ PROTOCOL_VERSION = "0.2-draft"
veriguild/cli.py ADDED
@@ -0,0 +1,48 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ """Minimal CLI: list bundled schemas and validate a JSON document against one."""
3
+ import json
4
+ import sys
5
+ from importlib import resources
6
+
7
+ from jsonschema import Draft202012Validator
8
+ from referencing import Registry, Resource
9
+
10
+ from . import PROTOCOL_VERSION, __version__
11
+
12
+
13
+ def _schemas():
14
+ out = {}
15
+ for entry in resources.files("veriguild").joinpath("schemas").iterdir():
16
+ if entry.name.endswith(".schema.json"):
17
+ s = json.loads(entry.read_text())
18
+ out[entry.name[: -len(".schema.json")]] = s
19
+ return out
20
+
21
+
22
+ def main(argv=None):
23
+ argv = sys.argv[1:] if argv is None else argv
24
+ schemas = _schemas()
25
+ if not argv or argv[0] in ("-h", "--help"):
26
+ print(f"veriguild {__version__} (protocol {PROTOCOL_VERSION}, design phase)")
27
+ print("usage: veriguild schemas | veriguild validate <schema> <file.json>")
28
+ return 0
29
+ if argv[0] == "schemas":
30
+ print("\n".join(sorted(schemas)))
31
+ return 0
32
+ if argv[0] == "validate" and len(argv) == 3:
33
+ name, path = argv[1], argv[2]
34
+ if name not in schemas:
35
+ print(f"unknown schema: {name}", file=sys.stderr)
36
+ return 4
37
+ reg = Registry().with_resources([(s["$id"], Resource.from_contents(s)) for s in schemas.values()])
38
+ errs = list(Draft202012Validator(schemas[name], registry=reg).iter_errors(json.load(open(path))))
39
+ for e in errs:
40
+ print(f"error: {e.message}")
41
+ print("valid" if not errs else f"{len(errs)} error(s)")
42
+ return 0 if not errs else 1
43
+ print("usage: veriguild schemas | veriguild validate <schema> <file.json>", file=sys.stderr)
44
+ return 4
45
+
46
+
47
+ if __name__ == "__main__":
48
+ sys.exit(main())
@@ -0,0 +1,51 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://veriguild.dev/schemas/v0.2/agent-record.schema.json",
4
+ "title": "AgentRecord predicate. metadata and ext are informational and never read by decide.",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "v": {
9
+ "$ref": "defs.schema.json#/$defs/version"
10
+ },
11
+ "agent": {
12
+ "$ref": "defs.schema.json#/$defs/did_key"
13
+ },
14
+ "operator_id": {
15
+ "$ref": "defs.schema.json#/$defs/operator_id"
16
+ },
17
+ "requested_modules": {
18
+ "type": "array",
19
+ "items": {
20
+ "$ref": "defs.schema.json#/$defs/module_name"
21
+ },
22
+ "uniqueItems": true
23
+ },
24
+ "metadata": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "properties": {
28
+ "a2a_card_url": {
29
+ "type": "string"
30
+ },
31
+ "model": {
32
+ "type": "string"
33
+ },
34
+ "description": {
35
+ "type": "string",
36
+ "maxLength": 512
37
+ }
38
+ },
39
+ "required": []
40
+ },
41
+ "ext": {
42
+ "$ref": "defs.schema.json#/$defs/ext"
43
+ }
44
+ },
45
+ "required": [
46
+ "v",
47
+ "agent",
48
+ "operator_id",
49
+ "requested_modules"
50
+ ]
51
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://veriguild.dev/schemas/v0.2/build-attestation.schema.json",
4
+ "title": "BuildAttestation predicate",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "v": {
9
+ "$ref": "defs.schema.json#/$defs/version"
10
+ },
11
+ "binding": {
12
+ "$ref": "defs.schema.json#/$defs/binding"
13
+ },
14
+ "result": {
15
+ "$ref": "defs.schema.json#/$defs/result"
16
+ },
17
+ "findings": {
18
+ "type": "array",
19
+ "items": {
20
+ "$ref": "defs.schema.json#/$defs/finding"
21
+ }
22
+ },
23
+ "log_digest": {
24
+ "$ref": "defs.schema.json#/$defs/digest"
25
+ },
26
+ "run_id": {
27
+ "$ref": "defs.schema.json#/$defs/nonce"
28
+ },
29
+ "node": {
30
+ "$ref": "defs.schema.json#/$defs/node_ref"
31
+ },
32
+ "recipe_digest": {
33
+ "$ref": "defs.schema.json#/$defs/digest"
34
+ },
35
+ "outputs": {
36
+ "type": "array",
37
+ "items": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "properties": {
41
+ "name": {
42
+ "type": "string"
43
+ },
44
+ "digest": {
45
+ "$ref": "defs.schema.json#/$defs/digest"
46
+ }
47
+ },
48
+ "required": [
49
+ "name",
50
+ "digest"
51
+ ]
52
+ }
53
+ },
54
+ "export_manifest_digest": {
55
+ "$ref": "defs.schema.json#/$defs/digest"
56
+ }
57
+ },
58
+ "required": [
59
+ "v",
60
+ "binding",
61
+ "recipe_digest",
62
+ "result",
63
+ "findings",
64
+ "outputs",
65
+ "export_manifest_digest",
66
+ "log_digest",
67
+ "run_id",
68
+ "node"
69
+ ]
70
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://veriguild.dev/schemas/v0.2/checkpoint.schema.json",
4
+ "title": "Checkpoint predicate. Cosignatures attest log consistency only, not decision correctness (P-50).",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "v": {
9
+ "$ref": "defs.schema.json#/$defs/version"
10
+ },
11
+ "ledger_head": {
12
+ "$ref": "defs.schema.json#/$defs/digest"
13
+ },
14
+ "seq": {
15
+ "$ref": "defs.schema.json#/$defs/seq"
16
+ },
17
+ "timestamp": {
18
+ "$ref": "defs.schema.json#/$defs/timestamp"
19
+ },
20
+ "c2sp_note_digest": {
21
+ "$ref": "defs.schema.json#/$defs/digest"
22
+ },
23
+ "cosignatures": {
24
+ "type": "array",
25
+ "items": {
26
+ "type": "object",
27
+ "additionalProperties": false,
28
+ "properties": {
29
+ "witness": {
30
+ "$ref": "defs.schema.json#/$defs/did_key"
31
+ },
32
+ "sig": {
33
+ "type": "string"
34
+ }
35
+ },
36
+ "required": [
37
+ "witness",
38
+ "sig"
39
+ ]
40
+ }
41
+ }
42
+ },
43
+ "required": [
44
+ "v",
45
+ "ledger_head",
46
+ "seq",
47
+ "timestamp"
48
+ ]
49
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://veriguild.dev/schemas/v0.2/contribution.schema.json",
4
+ "title": "Contribution predicate (P-23 to P-27)",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "v": {
9
+ "$ref": "defs.schema.json#/$defs/version"
10
+ },
11
+ "repo": {
12
+ "$ref": "defs.schema.json#/$defs/repo"
13
+ },
14
+ "agent": {
15
+ "$ref": "defs.schema.json#/$defs/did_key"
16
+ },
17
+ "base_commit": {
18
+ "$ref": "defs.schema.json#/$defs/git_oid"
19
+ },
20
+ "head_commit": {
21
+ "$ref": "defs.schema.json#/$defs/git_oid"
22
+ },
23
+ "spec_version": {
24
+ "$ref": "defs.schema.json#/$defs/spec_version"
25
+ },
26
+ "modules": {
27
+ "type": "array",
28
+ "items": {
29
+ "$ref": "defs.schema.json#/$defs/module_name"
30
+ },
31
+ "minItems": 1,
32
+ "uniqueItems": true
33
+ },
34
+ "changed_paths_digest": {
35
+ "$ref": "defs.schema.json#/$defs/digest"
36
+ },
37
+ "nonce": {
38
+ "$ref": "defs.schema.json#/$defs/nonce"
39
+ },
40
+ "created_seq": {
41
+ "$ref": "defs.schema.json#/$defs/seq"
42
+ },
43
+ "message": {
44
+ "type": "string",
45
+ "maxLength": 4096
46
+ },
47
+ "ext": {
48
+ "$ref": "defs.schema.json#/$defs/ext"
49
+ }
50
+ },
51
+ "required": [
52
+ "v",
53
+ "repo",
54
+ "agent",
55
+ "base_commit",
56
+ "head_commit",
57
+ "spec_version",
58
+ "modules",
59
+ "changed_paths_digest",
60
+ "nonce",
61
+ "created_seq"
62
+ ]
63
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://veriguild.dev/schemas/v0.2/cutoff-marker.schema.json",
4
+ "title": "Writer-signed evidence cutoff for evidence_wait = all-or-cutoff (P-32 step 9)",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "v": {
9
+ "$ref": "defs.schema.json#/$defs/version"
10
+ },
11
+ "contribution_id": {
12
+ "$ref": "defs.schema.json#/$defs/digest"
13
+ },
14
+ "at_seq": {
15
+ "$ref": "defs.schema.json#/$defs/seq"
16
+ }
17
+ },
18
+ "required": [
19
+ "v",
20
+ "contribution_id",
21
+ "at_seq"
22
+ ]
23
+ }
@@ -0,0 +1,111 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://veriguild.dev/schemas/v0.2/decision-bundle.schema.json",
4
+ "title": "Decision bundle manifest (P-39 to P-44). Bundle ID = Digest(JCS(manifest)). Items with role attestation MUST carry receipt_seq and class.",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "v": {
9
+ "$ref": "defs.schema.json#/$defs/version"
10
+ },
11
+ "contribution_id": {
12
+ "$ref": "defs.schema.json#/$defs/digest"
13
+ },
14
+ "decision": {
15
+ "enum": [
16
+ "accept",
17
+ "reject",
18
+ "pending",
19
+ "blocked"
20
+ ]
21
+ },
22
+ "reasons": {
23
+ "type": "array",
24
+ "items": {
25
+ "type": "string",
26
+ "pattern": "^R[0-9]{3}$"
27
+ }
28
+ },
29
+ "decision_seq": {
30
+ "$ref": "defs.schema.json#/$defs/seq"
31
+ },
32
+ "ledger_view_entry": {
33
+ "$ref": "defs.schema.json#/$defs/digest"
34
+ },
35
+ "spec_version": {
36
+ "$ref": "defs.schema.json#/$defs/spec_version"
37
+ },
38
+ "base_commit": {
39
+ "$ref": "defs.schema.json#/$defs/git_oid"
40
+ },
41
+ "candidate_commit": {
42
+ "$ref": "defs.schema.json#/$defs/git_oid"
43
+ },
44
+ "items": {
45
+ "type": "array",
46
+ "items": {
47
+ "type": "object",
48
+ "additionalProperties": false,
49
+ "properties": {
50
+ "role": {
51
+ "enum": [
52
+ "contribution",
53
+ "git-objects",
54
+ "policy-bundle",
55
+ "spec-objects",
56
+ "scope-manifest",
57
+ "attestation",
58
+ "resolution",
59
+ "cutoff",
60
+ "log",
61
+ "decision-report",
62
+ "previous-bundle"
63
+ ]
64
+ },
65
+ "digest": {
66
+ "$ref": "defs.schema.json#/$defs/digest"
67
+ },
68
+ "media_type": {
69
+ "type": "string"
70
+ },
71
+ "receipt_seq": {
72
+ "$ref": "defs.schema.json#/$defs/seq"
73
+ },
74
+ "class": {
75
+ "enum": [
76
+ "invalid",
77
+ "irrelevant",
78
+ "ineligible",
79
+ "inconclusive",
80
+ "pass",
81
+ "contradictory",
82
+ "fraudulent"
83
+ ]
84
+ }
85
+ },
86
+ "required": [
87
+ "role",
88
+ "digest",
89
+ "media_type"
90
+ ]
91
+ },
92
+ "minItems": 1
93
+ },
94
+ "writer": {
95
+ "$ref": "defs.schema.json#/$defs/node_ref"
96
+ }
97
+ },
98
+ "required": [
99
+ "v",
100
+ "contribution_id",
101
+ "decision",
102
+ "reasons",
103
+ "decision_seq",
104
+ "ledger_view_entry",
105
+ "spec_version",
106
+ "base_commit",
107
+ "candidate_commit",
108
+ "items",
109
+ "writer"
110
+ ]
111
+ }
@@ -0,0 +1,198 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://veriguild.dev/schemas/v0.2/defs.schema.json",
4
+ "title": "Shared definitions",
5
+ "$defs": {
6
+ "version": {
7
+ "const": "0.2"
8
+ },
9
+ "digest": {
10
+ "type": "string",
11
+ "pattern": "^sha256:[0-9a-f]{64}$"
12
+ },
13
+ "did_key": {
14
+ "type": "string",
15
+ "pattern": "^did:key:z6Mk[1-9A-HJ-NP-Za-km-z]{44,48}$"
16
+ },
17
+ "git_oid": {
18
+ "type": "string",
19
+ "pattern": "^([0-9a-f]{40}|[0-9a-f]{64})$",
20
+ "description": "Git object ID (commit, tree or blob). 40 hex for SHA-1 repositories, 64 hex for SHA-256 repositories."
21
+ },
22
+ "seq": {
23
+ "type": "integer",
24
+ "minimum": 0
25
+ },
26
+ "timestamp": {
27
+ "type": "string",
28
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
29
+ },
30
+ "module_name": {
31
+ "type": "string",
32
+ "pattern": "^[a-z][a-z0-9_-]{0,63}$"
33
+ },
34
+ "operator_id": {
35
+ "$ref": "#/$defs/digest"
36
+ },
37
+ "nonce": {
38
+ "type": "string",
39
+ "pattern": "^[0-9a-f]{32}$"
40
+ },
41
+ "repo": {
42
+ "type": "string",
43
+ "pattern": "^[a-z0-9.-]+/[A-Za-z0-9._/-]+$"
44
+ },
45
+ "rel_path": {
46
+ "type": "string",
47
+ "pattern": "^(?!/)(?!.*(^|/)\\.\\.(/|$)).+$"
48
+ },
49
+ "spec_version": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": [
53
+ "seq",
54
+ "spec_tree",
55
+ "policy_digest"
56
+ ],
57
+ "properties": {
58
+ "seq": {
59
+ "$ref": "#/$defs/seq"
60
+ },
61
+ "spec_tree": {
62
+ "$ref": "#/$defs/git_oid"
63
+ },
64
+ "policy_digest": {
65
+ "$ref": "#/$defs/digest"
66
+ }
67
+ }
68
+ },
69
+ "tool": {
70
+ "enum": [
71
+ "dafny",
72
+ "verus",
73
+ "lean"
74
+ ]
75
+ },
76
+ "result": {
77
+ "enum": [
78
+ "pass",
79
+ "fail",
80
+ "error",
81
+ "unknown"
82
+ ],
83
+ "description": "fail = definite verification failure attributed to the proof. error = crash, timeout or resource exhaustion. unknown = could not determine."
84
+ },
85
+ "ext": {
86
+ "type": "object",
87
+ "propertyNames": {
88
+ "pattern": "^ext/[a-z0-9-]+$"
89
+ },
90
+ "description": "Informational only. MUST NOT be read by decide (P-26)."
91
+ },
92
+ "node_ref": {
93
+ "type": "object",
94
+ "additionalProperties": false,
95
+ "required": [
96
+ "key",
97
+ "operator_id"
98
+ ],
99
+ "properties": {
100
+ "key": {
101
+ "$ref": "#/$defs/did_key"
102
+ },
103
+ "operator_id": {
104
+ "$ref": "#/$defs/operator_id"
105
+ }
106
+ }
107
+ },
108
+ "threshold_keys": {
109
+ "type": "object",
110
+ "additionalProperties": false,
111
+ "required": [
112
+ "threshold",
113
+ "keys"
114
+ ],
115
+ "properties": {
116
+ "threshold": {
117
+ "type": "integer",
118
+ "minimum": 1
119
+ },
120
+ "keys": {
121
+ "type": "array",
122
+ "minItems": 1,
123
+ "uniqueItems": true,
124
+ "items": {
125
+ "$ref": "#/$defs/did_key"
126
+ }
127
+ }
128
+ }
129
+ },
130
+ "finding": {
131
+ "type": "object",
132
+ "additionalProperties": false,
133
+ "required": [
134
+ "path",
135
+ "line",
136
+ "construct",
137
+ "source"
138
+ ],
139
+ "properties": {
140
+ "path": {
141
+ "$ref": "#/$defs/rel_path"
142
+ },
143
+ "line": {
144
+ "type": "integer",
145
+ "minimum": 1
146
+ },
147
+ "construct": {
148
+ "type": "string"
149
+ },
150
+ "source": {
151
+ "enum": [
152
+ "scanner",
153
+ "dafny-audit",
154
+ "axioms-check",
155
+ "binding-check"
156
+ ]
157
+ }
158
+ }
159
+ },
160
+ "binding": {
161
+ "type": "object",
162
+ "additionalProperties": false,
163
+ "description": "Fields every attestation binds to (P-28 steps E5 to E8).",
164
+ "required": [
165
+ "repo",
166
+ "contribution_id",
167
+ "candidate_commit",
168
+ "spec_version",
169
+ "toolchain_digest",
170
+ "module",
171
+ "scope_manifest_digest"
172
+ ],
173
+ "properties": {
174
+ "repo": {
175
+ "$ref": "#/$defs/repo"
176
+ },
177
+ "contribution_id": {
178
+ "$ref": "#/$defs/digest"
179
+ },
180
+ "candidate_commit": {
181
+ "$ref": "#/$defs/git_oid"
182
+ },
183
+ "spec_version": {
184
+ "$ref": "#/$defs/spec_version"
185
+ },
186
+ "toolchain_digest": {
187
+ "$ref": "#/$defs/digest"
188
+ },
189
+ "module": {
190
+ "$ref": "#/$defs/module_name"
191
+ },
192
+ "scope_manifest_digest": {
193
+ "$ref": "#/$defs/digest"
194
+ }
195
+ }
196
+ }
197
+ }
198
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://veriguild.dev/schemas/v0.2/dsse-envelope.schema.json",
4
+ "title": "DSSE envelope",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "payloadType": {
9
+ "const": "application/vnd.in-toto+json"
10
+ },
11
+ "payload": {
12
+ "type": "string",
13
+ "contentEncoding": "base64"
14
+ },
15
+ "signatures": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "properties": {
21
+ "keyid": {
22
+ "$ref": "defs.schema.json#/$defs/did_key"
23
+ },
24
+ "sig": {
25
+ "type": "string",
26
+ "contentEncoding": "base64"
27
+ }
28
+ },
29
+ "required": [
30
+ "keyid",
31
+ "sig"
32
+ ]
33
+ },
34
+ "minItems": 1
35
+ }
36
+ },
37
+ "required": [
38
+ "payloadType",
39
+ "payload",
40
+ "signatures"
41
+ ]
42
+ }