wasmagent-protocol 0.1.0__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.
@@ -0,0 +1,267 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://wasmagent.dev/schemas/compliance/rollout-wire.schema.json",
4
+ "title": "Rollout Wire Format",
5
+ "description": "Intermediate JSONL formats in the wasmagent → evomerge data pipeline. Contains three related record types at different pipeline stages. NOT the final training record format — see training-record.schema.json. Validate individual records against the named entry schemas below: rollout-wire/v1/branch, rollout-wire/v1/dpo, rollout-wire/v1/ppo.",
6
+ "oneOf": [
7
+ {
8
+ "$ref": "#/$defs/RolloutBranchRecord"
9
+ },
10
+ {
11
+ "$ref": "#/$defs/DpoRecord"
12
+ },
13
+ {
14
+ "$ref": "#/$defs/PpoRecord"
15
+ }
16
+ ],
17
+ "$defs": {
18
+ "RolloutBranchRecord": {
19
+ "description": "Layer 1: RolloutBranchResult serialized to JSONL by RolloutForkRunner. Consumed by evomerge load_rollouts().",
20
+ "type": "object",
21
+ "required": [
22
+ "rollout_id",
23
+ "task",
24
+ "branch_index",
25
+ "temperature",
26
+ "session_id",
27
+ "tool_call_sequence",
28
+ "final_answer"
29
+ ],
30
+ "additionalProperties": true,
31
+ "properties": {
32
+ "rollout_id": {
33
+ "type": "string",
34
+ "minLength": 1
35
+ },
36
+ "task": {
37
+ "type": "string",
38
+ "minLength": 1
39
+ },
40
+ "branch_index": {
41
+ "type": "integer",
42
+ "minimum": 0
43
+ },
44
+ "temperature": {
45
+ "type": "number"
46
+ },
47
+ "session_id": {
48
+ "type": "string"
49
+ },
50
+ "tool_call_sequence": {
51
+ "type": "array",
52
+ "items": {
53
+ "type": "object"
54
+ }
55
+ },
56
+ "final_answer": {
57
+ "type": "string"
58
+ },
59
+ "build_result": {
60
+ "type": [
61
+ "object",
62
+ "null"
63
+ ]
64
+ },
65
+ "objective_score": {
66
+ "type": "integer",
67
+ "enum": [
68
+ 0,
69
+ 1
70
+ ]
71
+ },
72
+ "objective_status": {
73
+ "type": "string",
74
+ "enum": [
75
+ "pass",
76
+ "fail",
77
+ "unknown"
78
+ ],
79
+ "description": "Semantic label for objective_score. unknown = build not triggered (do not use in DPO pairs)."
80
+ },
81
+ "rank": {
82
+ "type": "integer",
83
+ "minimum": 0
84
+ },
85
+ "total_score": {
86
+ "type": "number",
87
+ "description": "Raw RolloutRanker totalScore, NOT normalized to [0,1]. Normalized by evomerge _compute_reward()."
88
+ }
89
+ }
90
+ },
91
+ "DpoProvenance": {
92
+ "description": "Layer 2 DPO: provenance block from toDpoRecord().",
93
+ "type": "object",
94
+ "required": [
95
+ "source",
96
+ "rollout_id",
97
+ "chosen_branch",
98
+ "rejected_branch",
99
+ "objective_score",
100
+ "exported_at_ms",
101
+ "n_gram_hash"
102
+ ],
103
+ "additionalProperties": false,
104
+ "properties": {
105
+ "source": {
106
+ "type": "string",
107
+ "const": "wasmagent-rollout"
108
+ },
109
+ "rollout_id": {
110
+ "type": "string",
111
+ "minLength": 1
112
+ },
113
+ "chosen_branch": {
114
+ "type": "integer",
115
+ "minimum": 0
116
+ },
117
+ "rejected_branch": {
118
+ "type": "integer",
119
+ "minimum": 0
120
+ },
121
+ "objective_score": {
122
+ "type": "object",
123
+ "required": [
124
+ "chosen",
125
+ "rejected"
126
+ ],
127
+ "additionalProperties": false,
128
+ "properties": {
129
+ "chosen": {
130
+ "type": "integer",
131
+ "enum": [
132
+ 0,
133
+ 1
134
+ ]
135
+ },
136
+ "rejected": {
137
+ "type": "integer",
138
+ "enum": [
139
+ 0,
140
+ 1
141
+ ]
142
+ }
143
+ }
144
+ },
145
+ "exported_at_ms": {
146
+ "type": "integer",
147
+ "minimum": 0
148
+ },
149
+ "n_gram_hash": {
150
+ "type": "string",
151
+ "pattern": "^[0-9a-f]{16}$"
152
+ }
153
+ }
154
+ },
155
+ "PpoProvenance": {
156
+ "description": "Layer 2 PPO: provenance block from toPpoRecords().",
157
+ "type": "object",
158
+ "required": [
159
+ "source",
160
+ "rollout_id",
161
+ "branch_index",
162
+ "objective_score",
163
+ "exported_at_ms",
164
+ "n_gram_hash"
165
+ ],
166
+ "additionalProperties": false,
167
+ "properties": {
168
+ "source": {
169
+ "type": "string",
170
+ "const": "wasmagent-rollout"
171
+ },
172
+ "rollout_id": {
173
+ "type": "string",
174
+ "minLength": 1
175
+ },
176
+ "branch_index": {
177
+ "type": "integer",
178
+ "minimum": 0
179
+ },
180
+ "objective_score": {
181
+ "type": "integer",
182
+ "enum": [
183
+ 0,
184
+ 1
185
+ ]
186
+ },
187
+ "exported_at_ms": {
188
+ "type": "integer",
189
+ "minimum": 0
190
+ },
191
+ "n_gram_hash": {
192
+ "type": "string",
193
+ "pattern": "^[0-9a-f]{16}$"
194
+ }
195
+ }
196
+ },
197
+ "DpoRecord": {
198
+ "description": "Layer 2 DPO: output of toDpoRecord(). Intermediate format before evomerge rebuilds messages.",
199
+ "type": "object",
200
+ "required": [
201
+ "prompt",
202
+ "chosen",
203
+ "rejected",
204
+ "tool_call_sequence",
205
+ "provenance"
206
+ ],
207
+ "additionalProperties": true,
208
+ "properties": {
209
+ "prompt": {
210
+ "type": "string",
211
+ "minLength": 1
212
+ },
213
+ "chosen": {
214
+ "type": "string",
215
+ "minLength": 1
216
+ },
217
+ "rejected": {
218
+ "type": "string",
219
+ "minLength": 1
220
+ },
221
+ "tool_call_sequence": {
222
+ "type": "array",
223
+ "items": {
224
+ "type": "object"
225
+ }
226
+ },
227
+ "provenance": {
228
+ "$ref": "#/$defs/DpoProvenance"
229
+ }
230
+ }
231
+ },
232
+ "PpoRecord": {
233
+ "description": "Layer 2 PPO: output of toPpoRecords(). Intermediate format before evomerge rebuilds messages.",
234
+ "type": "object",
235
+ "required": [
236
+ "prompt",
237
+ "completion",
238
+ "reward",
239
+ "tool_call_sequence",
240
+ "provenance"
241
+ ],
242
+ "additionalProperties": true,
243
+ "properties": {
244
+ "prompt": {
245
+ "type": "string",
246
+ "minLength": 1
247
+ },
248
+ "completion": {
249
+ "type": "string"
250
+ },
251
+ "reward": {
252
+ "type": "number",
253
+ "description": "Raw totalScore from RolloutRanker, NOT normalized. Normalized to [0,1] by evomerge _compute_reward()."
254
+ },
255
+ "tool_call_sequence": {
256
+ "type": "array",
257
+ "items": {
258
+ "type": "object"
259
+ }
260
+ },
261
+ "provenance": {
262
+ "$ref": "#/$defs/PpoProvenance"
263
+ }
264
+ }
265
+ }
266
+ }
267
+ }
@@ -0,0 +1,119 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://wasmagent.dev/schemas/compliance/task-spec.schema.json",
4
+ "title": "TaskSpec",
5
+ "description": "Public contract for a compliance run. One TaskSpec → one run → one ComplianceEvalRecord.",
6
+ "type": "object",
7
+ "required": [
8
+ "id",
9
+ "intent",
10
+ "language",
11
+ "constraints",
12
+ "priority_hierarchy"
13
+ ],
14
+ "properties": {
15
+ "id": {
16
+ "type": "string",
17
+ "minLength": 1
18
+ },
19
+ "intent": {
20
+ "type": "string",
21
+ "minLength": 1
22
+ },
23
+ "language": {
24
+ "type": "string",
25
+ "minLength": 1,
26
+ "description": "BCP-47 language tag (e.g. 'zh-CN', 'en')."
27
+ },
28
+ "audience": {
29
+ "type": "string"
30
+ },
31
+ "constraints": {
32
+ "type": "array",
33
+ "minItems": 1,
34
+ "items": {
35
+ "$ref": "constraint-ir.schema.json"
36
+ }
37
+ },
38
+ "priority_hierarchy": {
39
+ "type": "array",
40
+ "minItems": 1,
41
+ "items": {
42
+ "type": "string",
43
+ "enum": [
44
+ "system_policy",
45
+ "user_explicit_constraints",
46
+ "task_package_constraints",
47
+ "tool_output_constraints",
48
+ "history_constraints",
49
+ "style_preferences"
50
+ ]
51
+ }
52
+ },
53
+ "tools": {
54
+ "type": "object",
55
+ "required": [
56
+ "allowed"
57
+ ],
58
+ "properties": {
59
+ "allowed": {
60
+ "type": "array",
61
+ "items": {
62
+ "type": "string"
63
+ }
64
+ },
65
+ "denied": {
66
+ "type": "array",
67
+ "items": {
68
+ "type": "string"
69
+ }
70
+ }
71
+ },
72
+ "additionalProperties": false
73
+ },
74
+ "repair": {
75
+ "type": "object",
76
+ "required": [
77
+ "max_rounds",
78
+ "default_strategy"
79
+ ],
80
+ "properties": {
81
+ "max_rounds": {
82
+ "type": "integer",
83
+ "minimum": 0
84
+ },
85
+ "default_strategy": {
86
+ "type": "string",
87
+ "enum": [
88
+ "patch",
89
+ "insert_section",
90
+ "regenerate_region",
91
+ "full"
92
+ ]
93
+ }
94
+ },
95
+ "additionalProperties": false
96
+ },
97
+ "trace": {
98
+ "type": "object",
99
+ "required": [
100
+ "record_constraint_eval",
101
+ "record_tool_calls",
102
+ "record_repairs"
103
+ ],
104
+ "properties": {
105
+ "record_constraint_eval": {
106
+ "type": "boolean"
107
+ },
108
+ "record_tool_calls": {
109
+ "type": "boolean"
110
+ },
111
+ "record_repairs": {
112
+ "type": "boolean"
113
+ }
114
+ },
115
+ "additionalProperties": false
116
+ }
117
+ },
118
+ "additionalProperties": false
119
+ }
@@ -0,0 +1,85 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "protocol": "AEP",
4
+ "description": "Registry of canonical WasmAgent protocol schemas. This is the single source of truth for every cross-repository contract in the org. Downstream repos consume these via the versioned npm (@wasmagent/protocol) and pip (wasmagent-protocol) packages and MUST NOT keep local copies.",
5
+ "canonical_host": "https://wasmagent.dev/schemas/",
6
+ "schemas": [
7
+ {
8
+ "id": "aep-record",
9
+ "title": "AEPRecord",
10
+ "path": "schemas/aep/aep-record.schema.json",
11
+ "canonical_id": "https://wasmagent.dev/schemas/aep/aep-record.schema.json",
12
+ "version": "aep/v0.2",
13
+ "stability": "evolving",
14
+ "owners": ["wasmagent-protocol"],
15
+ "consumers": ["wasmagent-js", "wasmagent-proxy", "trace-pipeline", "wasmagent-train-replay", "open-agent-audit"],
16
+ "summary": "Runtime action evidence and run provenance record — the core Agent Evidence Protocol contract."
17
+ },
18
+ {
19
+ "id": "constraint-ir",
20
+ "title": "ConstraintIR",
21
+ "path": "schemas/compliance/constraint-ir.schema.json",
22
+ "canonical_id": "https://wasmagent.dev/schemas/compliance/constraint-ir.schema.json",
23
+ "version": "compliance/v1",
24
+ "stability": "evolving",
25
+ "owners": ["wasmagent-protocol"],
26
+ "consumers": ["wasmagent-js", "trace-pipeline"],
27
+ "summary": "Typed, repairable, prioritised constraint — superset of @wasmagent/core Criterion."
28
+ },
29
+ {
30
+ "id": "constraint-violation",
31
+ "title": "ConstraintViolation",
32
+ "path": "schemas/compliance/constraint-violation.schema.json",
33
+ "canonical_id": "https://wasmagent.dev/schemas/compliance/constraint-violation.schema.json",
34
+ "version": "compliance/v1",
35
+ "stability": "evolving",
36
+ "owners": ["wasmagent-protocol"],
37
+ "consumers": ["wasmagent-js", "trace-pipeline"],
38
+ "summary": "A failed constraint plus its location in the artifact."
39
+ },
40
+ {
41
+ "id": "repair-trace",
42
+ "title": "RepairTrace",
43
+ "path": "schemas/compliance/repair-trace.schema.json",
44
+ "canonical_id": "https://wasmagent.dev/schemas/compliance/repair-trace.schema.json",
45
+ "version": "compliance/v1",
46
+ "stability": "evolving",
47
+ "owners": ["wasmagent-protocol"],
48
+ "consumers": ["wasmagent-js", "trace-pipeline"],
49
+ "summary": "Per-round repair record. Supersedes trace-pipeline's repair-trace-entry naming."
50
+ },
51
+ {
52
+ "id": "task-spec",
53
+ "title": "TaskSpec",
54
+ "path": "schemas/compliance/task-spec.schema.json",
55
+ "canonical_id": "https://wasmagent.dev/schemas/compliance/task-spec.schema.json",
56
+ "version": "compliance/v1",
57
+ "stability": "evolving",
58
+ "owners": ["wasmagent-protocol"],
59
+ "consumers": ["wasmagent-js", "trace-pipeline"],
60
+ "summary": "Public contract for a compliance run. One TaskSpec -> one run -> one ComplianceEvalRecord."
61
+ },
62
+ {
63
+ "id": "compliance-eval-record",
64
+ "title": "ComplianceEvalRecord",
65
+ "path": "schemas/compliance/compliance-eval-record.schema.json",
66
+ "canonical_id": "https://wasmagent.dev/schemas/compliance/compliance-eval-record.schema.json",
67
+ "version": "compliance-eval-record/v1",
68
+ "stability": "evolving",
69
+ "owners": ["wasmagent-protocol"],
70
+ "consumers": ["wasmagent-js", "trace-pipeline"],
71
+ "summary": "One record per compliance run."
72
+ },
73
+ {
74
+ "id": "rollout-wire",
75
+ "title": "Rollout Wire Format",
76
+ "path": "schemas/compliance/rollout-wire.schema.json",
77
+ "canonical_id": "https://wasmagent.dev/schemas/compliance/rollout-wire.schema.json",
78
+ "version": "rollout-wire/v1",
79
+ "stability": "evolving",
80
+ "owners": ["wasmagent-protocol"],
81
+ "consumers": ["wasmagent-js", "trace-pipeline"],
82
+ "summary": "Intermediate JSONL formats in the wasmagent -> evomerge data pipeline (branch/dpo/ppo records)."
83
+ }
84
+ ]
85
+ }
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.4
2
+ Name: wasmagent-protocol
3
+ Version: 0.1.0
4
+ Summary: Canonical JSON Schemas for the WasmAgent Agent Evidence Protocol (AEP) and compliance contracts. Single source of truth across the WasmAgent org.
5
+ Project-URL: Homepage, https://github.com/WasmAgent/wasmagent-protocol
6
+ Project-URL: Issues, https://github.com/WasmAgent/wasmagent-protocol/issues
7
+ Author: WasmAgent
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: aep,agent-evidence-protocol,compliance,json-schema,provenance,wasmagent
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Libraries
16
+ Requires-Python: >=3.9
17
+ Provides-Extra: validate
18
+ Requires-Dist: jsonschema>=4.0; extra == 'validate'
19
+ Description-Content-Type: text/markdown
20
+
21
+ # wasmagent-protocol
22
+
23
+ > **Canonical source of truth for every cross-repository contract in the
24
+ > [WasmAgent](https://github.com/WasmAgent) org.** One public schema → one
25
+ > canonical source.
26
+
27
+ WasmAgent is open infrastructure for _provable_ AI agents. Proving an agent ran
28
+ correctly requires that every repository — the runtime, the gateway, the
29
+ evidence pipelines, the audit product — speak the **same** evidence and
30
+ compliance vocabulary. `wasmagent-protocol` is where that vocabulary is defined,
31
+ versioned, and published, so no repository has to keep its own copy.
32
+
33
+ This repository holds **specifications only**. It contains no business logic,
34
+ no runtime, and no product code — only JSON Schemas, conformance fixtures, and
35
+ thin loader packages that expose the schemas to JavaScript and Python
36
+ consumers.
37
+
38
+ ## Why this repository exists
39
+
40
+ The Agent Evidence Protocol (AEP) and the compliance schemas were originally
41
+ authored inside `wasmagent-js` and independently copied into `trace-pipeline`.
42
+ By the time this repository was extracted, those copies had **drifted**: five
43
+ shared schemas differed (one had a copy-paste `title` bug, and the same logical
44
+ schema carried two conflicting `$id` URLs). Drift in a shared contract silently
45
+ breaks cross-repo evidence validation — exactly the failure mode WasmAgent
46
+ exists to prevent.
47
+
48
+ Per the org [repository boundary policy](https://github.com/WasmAgent/.github/blob/main/docs/repository-boundaries.md):
49
+ **one public schema has exactly one canonical source.** That source is here.
50
+
51
+ ## What's in scope
52
+
53
+ Only contracts that genuinely cross a repository boundary:
54
+
55
+ | Schema | Version | Consumers |
56
+ | --- | --- | --- |
57
+ | `aep-record` | `aep/v0.2` | wasmagent-js, wasmagent-proxy, trace-pipeline, wasmagent-train-replay, open-agent-audit |
58
+ | `constraint-ir` | `compliance/v1` | wasmagent-js, trace-pipeline |
59
+ | `constraint-violation` | `compliance/v1` | wasmagent-js, trace-pipeline |
60
+ | `repair-trace` | `compliance/v1` | wasmagent-js, trace-pipeline |
61
+ | `task-spec` | `compliance/v1` | wasmagent-js, trace-pipeline |
62
+ | `compliance-eval-record` | `compliance-eval-record/v1` | wasmagent-js, trace-pipeline |
63
+ | `rollout-wire` | `rollout-wire/v1` | wasmagent-js, trace-pipeline |
64
+
65
+ The machine-readable registry is [`schemas/index.json`](schemas/index.json).
66
+
67
+ **Out of scope:** schemas owned by a single repository (e.g. trace-pipeline's
68
+ `*-training-record` output formats, open-agent-audit's `audit-run`). A schema
69
+ belongs here only when two or more repositories must agree on it.
70
+
71
+ ## Consuming the schemas
72
+
73
+ Downstream repositories **must not** copy schema JSON. Depend on the published
74
+ package instead.
75
+
76
+ ### JavaScript / TypeScript
77
+
78
+ ```bash
79
+ npm install @wasmagent/protocol
80
+ ```
81
+
82
+ ```ts
83
+ import { schemas, getSchema } from "@wasmagent/protocol";
84
+
85
+ const aep = getSchema("aep-record"); // parsed JSON Schema object
86
+ ```
87
+
88
+ ### Python
89
+
90
+ ```bash
91
+ pip install wasmagent-protocol
92
+ ```
93
+
94
+ ```python
95
+ from wasmagent_protocol import get_schema, schema_path
96
+
97
+ aep = get_schema("aep-record") # parsed dict
98
+ path = schema_path("aep-record") # pathlib.Path to the .json file
99
+ ```
100
+
101
+ ## Versioning & stability
102
+
103
+ - Each schema carries a `version` string (see the registry).
104
+ - **Additive** changes (new optional field) → minor package bump.
105
+ - **Breaking** changes (removed/renamed field, tightened `required`) → major
106
+ package bump **and** a new `version` value, announced in the
107
+ [org release ledger](https://github.com/WasmAgent/.github/blob/main/releases/public-release-ledger.yml)
108
+ before merge.
109
+ - Every schema has at least one valid and one invalid conformance fixture under
110
+ [`tests/fixtures/`](tests/fixtures/). CI rejects any schema without both.
111
+
112
+ See [`docs/CONTRACT-CHANGE-PROCESS.md`](docs/CONTRACT-CHANGE-PROCESS.md) for the
113
+ full change workflow and [`docs/GOVERNANCE.md`](docs/GOVERNANCE.md) for
114
+ maintainer and exit-condition policy.
115
+
116
+ ## Development
117
+
118
+ ```bash
119
+ # validate every schema is well-formed and every fixture conforms
120
+ python3 -m pip install jsonschema
121
+ python3 tests/conformance.py
122
+ ```
123
+
124
+ ## License
125
+
126
+ [Apache-2.0](LICENSE).
@@ -0,0 +1,13 @@
1
+ wasmagent_protocol/__init__.py,sha256=17K8zv8lkaUXFLVVg25gCUlefGl6lJYAyzA2uVfkJvU,2194
2
+ wasmagent_protocol/schemas/index.json,sha256=NRz2NUyS6_rNfyMSPTMp5xr3cGKpoVQMN_WXwJ0Xt74,3928
3
+ wasmagent_protocol/schemas/aep/aep-record.schema.json,sha256=moZThjKP89UaKcoaHdyHE1l_xh3uXpd0imoM3NVhpoU,6125
4
+ wasmagent_protocol/schemas/compliance/compliance-eval-record.schema.json,sha256=IfMVP2fxO_x4agSGwYAQb1Cx-YyKl0nJeOrvRxaK-GM,3624
5
+ wasmagent_protocol/schemas/compliance/constraint-ir.schema.json,sha256=yPplwECbtlOP7rkeHHy1k6LXURTVVxP3OY7CiCNjA9o,1839
6
+ wasmagent_protocol/schemas/compliance/constraint-violation.schema.json,sha256=2Cn5hqlCXk885wPJjYAxhrQlYq2UsmBCKiwj2PzfsRY,2171
7
+ wasmagent_protocol/schemas/compliance/repair-trace.schema.json,sha256=X1Yub2AQS8rI9Go9SHcSjz16cOxF6VLVI-sOlJ4QvDY,1856
8
+ wasmagent_protocol/schemas/compliance/rollout-wire.schema.json,sha256=WTHzm5_SM-09vuO0CEd0u7mYnfw9J22u_GwLeO6mRGU,6731
9
+ wasmagent_protocol/schemas/compliance/task-spec.schema.json,sha256=t3tzPxNJlvAlOjunHrzJI6cve3H17VdxWOIwgR8_F_g,2597
10
+ wasmagent_protocol-0.1.0.dist-info/METADATA,sha256=NdTKlwsZTc2N4U9sHjs3EYAcxpABDFvheAj8Dj0Uhls,4984
11
+ wasmagent_protocol-0.1.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
12
+ wasmagent_protocol-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
13
+ wasmagent_protocol-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.31.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any