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.
- wasmagent_protocol/__init__.py +76 -0
- wasmagent_protocol/schemas/aep/aep-record.schema.json +177 -0
- wasmagent_protocol/schemas/compliance/compliance-eval-record.schema.json +135 -0
- wasmagent_protocol/schemas/compliance/constraint-ir.schema.json +82 -0
- wasmagent_protocol/schemas/compliance/constraint-violation.schema.json +103 -0
- wasmagent_protocol/schemas/compliance/repair-trace.schema.json +73 -0
- wasmagent_protocol/schemas/compliance/rollout-wire.schema.json +267 -0
- wasmagent_protocol/schemas/compliance/task-spec.schema.json +119 -0
- wasmagent_protocol/schemas/index.json +85 -0
- wasmagent_protocol-0.1.0.dist-info/METADATA +126 -0
- wasmagent_protocol-0.1.0.dist-info/RECORD +13 -0
- wasmagent_protocol-0.1.0.dist-info/WHEEL +4 -0
- wasmagent_protocol-0.1.0.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""wasmagent-protocol — canonical AEP + compliance JSON Schemas.
|
|
2
|
+
|
|
3
|
+
Single source of truth across the WasmAgent org. Do not copy these schemas into
|
|
4
|
+
consumer repositories; depend on this package instead.
|
|
5
|
+
|
|
6
|
+
from wasmagent_protocol import get_schema, schema_path, INDEX
|
|
7
|
+
|
|
8
|
+
aep = get_schema("aep-record") # parsed dict
|
|
9
|
+
path = schema_path("aep-record") # pathlib.Path to the .json file
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
from functools import lru_cache
|
|
16
|
+
from importlib import resources
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
__all__ = ["INDEX", "get_schema", "schema_path", "schema_ids"]
|
|
21
|
+
|
|
22
|
+
_SCHEMAS_PKG = "wasmagent_protocol.schemas"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _read(rel_path: str) -> str:
|
|
26
|
+
# rel_path is e.g. "index.json" or "aep/aep-record.schema.json"
|
|
27
|
+
resource = resources.files(_SCHEMAS_PKG)
|
|
28
|
+
for part in rel_path.split("/"):
|
|
29
|
+
resource = resource / part
|
|
30
|
+
return resource.read_text(encoding="utf-8")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
INDEX: dict[str, Any] = json.loads(_read("index.json"))
|
|
34
|
+
|
|
35
|
+
# Map schema id -> path relative to the schemas/ directory.
|
|
36
|
+
_PATHS: dict[str, str] = {
|
|
37
|
+
s["id"]: s["path"].removeprefix("schemas/") for s in INDEX["schemas"]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def schema_ids() -> list[str]:
|
|
42
|
+
"""Return the ids of every registered canonical schema."""
|
|
43
|
+
return list(_PATHS)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@lru_cache(maxsize=None)
|
|
47
|
+
def get_schema(schema_id: str) -> dict[str, Any]:
|
|
48
|
+
"""Return the parsed JSON Schema for a registered id.
|
|
49
|
+
|
|
50
|
+
Raises KeyError on an unknown id.
|
|
51
|
+
"""
|
|
52
|
+
try:
|
|
53
|
+
rel = _PATHS[schema_id]
|
|
54
|
+
except KeyError:
|
|
55
|
+
raise KeyError(
|
|
56
|
+
f"unknown schema id {schema_id!r}; known: {', '.join(_PATHS)}"
|
|
57
|
+
) from None
|
|
58
|
+
return json.loads(_read(rel))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def schema_path(schema_id: str) -> Path:
|
|
62
|
+
"""Return a filesystem Path to the schema JSON for a registered id.
|
|
63
|
+
|
|
64
|
+
Raises KeyError on an unknown id.
|
|
65
|
+
"""
|
|
66
|
+
try:
|
|
67
|
+
rel = _PATHS[schema_id]
|
|
68
|
+
except KeyError:
|
|
69
|
+
raise KeyError(
|
|
70
|
+
f"unknown schema id {schema_id!r}; known: {', '.join(_PATHS)}"
|
|
71
|
+
) from None
|
|
72
|
+
resource = resources.files(_SCHEMAS_PKG)
|
|
73
|
+
for part in rel.split("/"):
|
|
74
|
+
resource = resource / part
|
|
75
|
+
with resources.as_file(resource) as p:
|
|
76
|
+
return Path(p)
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://wasmagent.dev/schemas/aep/aep-record.schema.json",
|
|
4
|
+
"title": "AEPRecord",
|
|
5
|
+
"description": "Agent Evidence Protocol record — runtime action evidence and run provenance. Canonical source for wasmagent-js, wasmagent-proxy, trace-pipeline, wasmagent-train-replay, and open-agent-audit.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["schema_version", "run_id", "created_at_ms"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schema_version": { "type": "string", "enum": ["aep/v0.1", "aep/v0.2"] },
|
|
10
|
+
"run_id": { "type": "string" },
|
|
11
|
+
"trace_id": { "type": "string" },
|
|
12
|
+
"parent_trace_id": { "type": ["string", "null"] },
|
|
13
|
+
"repo_commit": { "type": "string" },
|
|
14
|
+
"runtime_version": { "type": "string" },
|
|
15
|
+
"model_provider": { "type": "string" },
|
|
16
|
+
"model_id": { "type": "string" },
|
|
17
|
+
"policy_bundle_digest": { "type": "string" },
|
|
18
|
+
"tool_manifest_digest": { "type": "string" },
|
|
19
|
+
"mcp_server_card_digest": { "type": ["string", "null"] },
|
|
20
|
+
"input_refs": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"items": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"required": ["uri"],
|
|
25
|
+
"properties": {
|
|
26
|
+
"uri": { "type": "string" },
|
|
27
|
+
"digest": { "type": "string" },
|
|
28
|
+
"taint_labels": { "type": "array", "items": { "type": "string" } }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"output_refs": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"items": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"required": ["uri"],
|
|
37
|
+
"properties": {
|
|
38
|
+
"uri": { "type": "string" },
|
|
39
|
+
"digest": { "type": "string" },
|
|
40
|
+
"redaction_profile": { "type": "string" }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"capability_decisions": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"required": ["capability", "subject", "resource", "decision"],
|
|
49
|
+
"properties": {
|
|
50
|
+
"capability": { "type": "string" },
|
|
51
|
+
"subject": { "type": "string" },
|
|
52
|
+
"resource": { "type": "string" },
|
|
53
|
+
"decision": { "type": "string", "enum": ["allow", "deny", "ask_user", "dry_run"] },
|
|
54
|
+
"reason_code": { "type": "string" }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"actions": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"items": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"required": ["action_id", "tool_name", "state_changing", "timestamp_ms"],
|
|
63
|
+
"properties": {
|
|
64
|
+
"action_id": { "type": "string" },
|
|
65
|
+
"tool_name": { "type": "string" },
|
|
66
|
+
"state_changing": { "type": "boolean" },
|
|
67
|
+
"precondition_digest": { "type": "string" },
|
|
68
|
+
"result_digest": { "type": "string" },
|
|
69
|
+
"evidence_refs": { "type": "array", "items": { "type": "string" } },
|
|
70
|
+
"timestamp_ms": { "type": "number" },
|
|
71
|
+
"parent_action_id": { "type": "string" },
|
|
72
|
+
"causal_chain_id": { "type": "string" },
|
|
73
|
+
"tool_descriptor_digest": { "type": "string" },
|
|
74
|
+
"server_card_digest": { "type": "string" },
|
|
75
|
+
"scope_lease_id": { "type": "string" },
|
|
76
|
+
"approval_context_hash": { "type": "string" },
|
|
77
|
+
"input_taint_labels": { "type": "array", "items": { "type": "string" } },
|
|
78
|
+
"output_taint_labels": { "type": "array", "items": { "type": "string" } },
|
|
79
|
+
"memory_read_refs": { "type": "array", "items": { "type": "string" } },
|
|
80
|
+
"memory_write_refs": { "type": "array", "items": { "type": "string" } },
|
|
81
|
+
"pre_state_digest": { "type": "string" },
|
|
82
|
+
"post_state_digest": { "type": "string" }
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"verifier_results": {
|
|
87
|
+
"type": "array",
|
|
88
|
+
"items": {
|
|
89
|
+
"type": "object",
|
|
90
|
+
"required": ["verifier_id", "passed"],
|
|
91
|
+
"properties": {
|
|
92
|
+
"verifier_id": { "type": "string" },
|
|
93
|
+
"passed": { "type": "boolean" },
|
|
94
|
+
"score": { "type": "number" },
|
|
95
|
+
"claim_ids": { "type": "array", "items": { "type": "string" } }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"budget_ledger": {
|
|
100
|
+
"type": "object",
|
|
101
|
+
"description": "Per-run budget consumption vs limits",
|
|
102
|
+
"properties": {
|
|
103
|
+
"token_budget": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"required": ["spent"],
|
|
106
|
+
"properties": {
|
|
107
|
+
"limit": { "type": "number" },
|
|
108
|
+
"spent": { "type": "number" }
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"latency_budget": {
|
|
112
|
+
"type": "object",
|
|
113
|
+
"required": ["actual_ms"],
|
|
114
|
+
"properties": {
|
|
115
|
+
"limit_ms": { "type": "number" },
|
|
116
|
+
"actual_ms": { "type": "number" }
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"tool_budget": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"required": ["spent"],
|
|
122
|
+
"properties": {
|
|
123
|
+
"limit": { "type": "number" },
|
|
124
|
+
"spent": { "type": "number" }
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"risk_budget": {
|
|
128
|
+
"type": "object",
|
|
129
|
+
"required": ["spent"],
|
|
130
|
+
"properties": {
|
|
131
|
+
"limit": { "type": "number" },
|
|
132
|
+
"spent": { "type": "number" }
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"retry_budget": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"required": ["spent"],
|
|
138
|
+
"properties": {
|
|
139
|
+
"limit": { "type": "number" },
|
|
140
|
+
"spent": { "type": "number" }
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"human_approval_budget": {
|
|
144
|
+
"type": "object",
|
|
145
|
+
"required": ["spent"],
|
|
146
|
+
"properties": {
|
|
147
|
+
"limit": { "type": "number" },
|
|
148
|
+
"spent": { "type": "number" }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"created_at_ms": { "type": "number" },
|
|
154
|
+
"run_context": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"properties": {
|
|
157
|
+
"agent_id": { "type": "string" },
|
|
158
|
+
"agent_version": { "type": "string" },
|
|
159
|
+
"subagent_id": { "type": "string" },
|
|
160
|
+
"delegation_chain": { "type": "array", "items": { "type": "string" } },
|
|
161
|
+
"environment_digest": { "type": "string" },
|
|
162
|
+
"dependency_lock_digest": { "type": "string" }
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"signature": {
|
|
166
|
+
"type": "object",
|
|
167
|
+
"required": ["alg", "key_id", "sig"],
|
|
168
|
+
"properties": {
|
|
169
|
+
"alg": { "type": "string" },
|
|
170
|
+
"key_id": { "type": "string" },
|
|
171
|
+
"sig": { "type": "string" },
|
|
172
|
+
"bundle": { "type": "object" },
|
|
173
|
+
"transparency_log_ref": { "type": "string" }
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://wasmagent.dev/schemas/compliance/compliance-eval-record.schema.json",
|
|
4
|
+
"title": "ComplianceEvalRecord",
|
|
5
|
+
"description": "One record per compliance run (compliance-eval-record/v1). Single source of truth across wasmagent-js and trace-pipeline.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"task_id",
|
|
10
|
+
"task_spec_hash",
|
|
11
|
+
"model",
|
|
12
|
+
"mode",
|
|
13
|
+
"violations",
|
|
14
|
+
"repair_trace",
|
|
15
|
+
"final_pass",
|
|
16
|
+
"artifact"
|
|
17
|
+
],
|
|
18
|
+
"properties": {
|
|
19
|
+
"schema_version": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"const": "compliance-eval-record/v1",
|
|
22
|
+
"description": "Schema version identifier. Always 'compliance-eval-record/v1'."
|
|
23
|
+
},
|
|
24
|
+
"task_id": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"minLength": 1
|
|
27
|
+
},
|
|
28
|
+
"task_spec_hash": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Stable hash of the TaskSpec JSON (e.g. sha256). Groups runs of the same spec across models and time."
|
|
31
|
+
},
|
|
32
|
+
"model": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Identifier of the model under test (e.g. 'qwen2.5-1.5b')."
|
|
35
|
+
},
|
|
36
|
+
"mode": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"enum": [
|
|
39
|
+
"direct",
|
|
40
|
+
"prompt_retry",
|
|
41
|
+
"full_pcl"
|
|
42
|
+
],
|
|
43
|
+
"description": "Execution mode: direct = single pass; prompt_retry = retry with violation hints; full_pcl = Protocol-Constrained Local Repair."
|
|
44
|
+
},
|
|
45
|
+
"violations": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": {
|
|
48
|
+
"$ref": "constraint-violation.schema.json"
|
|
49
|
+
},
|
|
50
|
+
"description": "Initial violation list (before repair). Empty if first generation passed."
|
|
51
|
+
},
|
|
52
|
+
"repair_trace": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"items": {
|
|
55
|
+
"$ref": "repair-trace.schema.json"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"repair_rounds": {
|
|
59
|
+
"type": "integer",
|
|
60
|
+
"minimum": 0,
|
|
61
|
+
"default": 0
|
|
62
|
+
},
|
|
63
|
+
"final_pass": {
|
|
64
|
+
"type": "boolean",
|
|
65
|
+
"description": "True iff all hard constraints passed after repair."
|
|
66
|
+
},
|
|
67
|
+
"artifact": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "Final model output text (after all repair rounds)."
|
|
70
|
+
},
|
|
71
|
+
"token_cost": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"properties": {
|
|
74
|
+
"prompt": {
|
|
75
|
+
"type": "integer",
|
|
76
|
+
"minimum": 0
|
|
77
|
+
},
|
|
78
|
+
"generation": {
|
|
79
|
+
"type": "integer",
|
|
80
|
+
"minimum": 0
|
|
81
|
+
},
|
|
82
|
+
"repair": {
|
|
83
|
+
"type": "integer",
|
|
84
|
+
"minimum": 0
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"additionalProperties": false
|
|
88
|
+
},
|
|
89
|
+
"latency_ms": {
|
|
90
|
+
"type": "number",
|
|
91
|
+
"minimum": 0,
|
|
92
|
+
"description": "Wall-clock latency in milliseconds for the full run."
|
|
93
|
+
},
|
|
94
|
+
"trace_uri": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "Optional pointer to a fuller trace artifact (e.g. RolloutMemoryStore JSONL line)."
|
|
97
|
+
},
|
|
98
|
+
"error": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"description": "Non-null iff the run failed infrastructurally. When present, final_pass MUST be false.",
|
|
101
|
+
"required": [
|
|
102
|
+
"kind",
|
|
103
|
+
"message",
|
|
104
|
+
"stage"
|
|
105
|
+
],
|
|
106
|
+
"properties": {
|
|
107
|
+
"kind": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"enum": [
|
|
110
|
+
"model_error",
|
|
111
|
+
"verifier_error",
|
|
112
|
+
"repair_error",
|
|
113
|
+
"workspace_error",
|
|
114
|
+
"unknown"
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
"message": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"description": "Original error message, truncated to 1000 chars."
|
|
120
|
+
},
|
|
121
|
+
"stage": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"enum": [
|
|
124
|
+
"generate",
|
|
125
|
+
"verify",
|
|
126
|
+
"repair",
|
|
127
|
+
"write"
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"additionalProperties": false
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"additionalProperties": false
|
|
135
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://wasmagent.dev/schemas/compliance/constraint-ir.schema.json",
|
|
4
|
+
"title": "ConstraintIR",
|
|
5
|
+
"description": "Typed, repairable, prioritised superset of @wasmagent/core Criterion. Canonical source for wasmagent-js and trace-pipeline.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"id",
|
|
9
|
+
"description",
|
|
10
|
+
"verify_method",
|
|
11
|
+
"level",
|
|
12
|
+
"priority",
|
|
13
|
+
"category"
|
|
14
|
+
],
|
|
15
|
+
"properties": {
|
|
16
|
+
"id": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"minLength": 1
|
|
19
|
+
},
|
|
20
|
+
"description": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"verify_method": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"minLength": 1,
|
|
26
|
+
"description": "Open string union — built-in verifiers register their own method names at runtime."
|
|
27
|
+
},
|
|
28
|
+
"arg": {},
|
|
29
|
+
"path": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"level": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"enum": [
|
|
35
|
+
"hard",
|
|
36
|
+
"soft"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"priority": {
|
|
40
|
+
"type": "number",
|
|
41
|
+
"description": "Higher wins inside a priority class (see TaskSpec.priority_hierarchy). Conventional band 0-100."
|
|
42
|
+
},
|
|
43
|
+
"category": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"enum": [
|
|
46
|
+
"format",
|
|
47
|
+
"content",
|
|
48
|
+
"style",
|
|
49
|
+
"tool",
|
|
50
|
+
"state",
|
|
51
|
+
"security",
|
|
52
|
+
"semantic"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"repair": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"required": [
|
|
58
|
+
"strategy"
|
|
59
|
+
],
|
|
60
|
+
"properties": {
|
|
61
|
+
"strategy": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"enum": [
|
|
64
|
+
"patch",
|
|
65
|
+
"insert_section",
|
|
66
|
+
"regenerate_region",
|
|
67
|
+
"full"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"target_region": {
|
|
71
|
+
"type": "string"
|
|
72
|
+
},
|
|
73
|
+
"max_rounds": {
|
|
74
|
+
"type": "integer",
|
|
75
|
+
"minimum": 1
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"additionalProperties": false
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"additionalProperties": false
|
|
82
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://wasmagent.dev/schemas/compliance/constraint-violation.schema.json",
|
|
4
|
+
"title": "ConstraintViolation",
|
|
5
|
+
"description": "A failed constraint plus its location in the artifact. Consumed by RepairPlanner to choose a strategy.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"constraint_id",
|
|
9
|
+
"level",
|
|
10
|
+
"category",
|
|
11
|
+
"hint",
|
|
12
|
+
"detected_at"
|
|
13
|
+
],
|
|
14
|
+
"properties": {
|
|
15
|
+
"constraint_id": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"minLength": 1
|
|
18
|
+
},
|
|
19
|
+
"level": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"enum": [
|
|
22
|
+
"hard",
|
|
23
|
+
"soft"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"category": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": [
|
|
29
|
+
"format",
|
|
30
|
+
"content",
|
|
31
|
+
"style",
|
|
32
|
+
"tool",
|
|
33
|
+
"state",
|
|
34
|
+
"security",
|
|
35
|
+
"semantic"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"hint": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "Original Verifier hint — kept verbatim for round-trip debugging."
|
|
41
|
+
},
|
|
42
|
+
"evidence_span": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"description": "Locator into the artifact. At least one field MUST be set.",
|
|
45
|
+
"properties": {
|
|
46
|
+
"region_id": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
},
|
|
49
|
+
"json_pointer": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"char_range": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"items": {
|
|
55
|
+
"type": "integer"
|
|
56
|
+
},
|
|
57
|
+
"minItems": 2,
|
|
58
|
+
"maxItems": 2
|
|
59
|
+
},
|
|
60
|
+
"line_range": {
|
|
61
|
+
"type": "array",
|
|
62
|
+
"items": {
|
|
63
|
+
"type": "integer"
|
|
64
|
+
},
|
|
65
|
+
"minItems": 2,
|
|
66
|
+
"maxItems": 2
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"anyOf": [
|
|
70
|
+
{
|
|
71
|
+
"required": [
|
|
72
|
+
"region_id"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"required": [
|
|
77
|
+
"json_pointer"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"required": [
|
|
82
|
+
"char_range"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"required": [
|
|
87
|
+
"line_range"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"additionalProperties": false
|
|
92
|
+
},
|
|
93
|
+
"detected_at": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"enum": [
|
|
96
|
+
"pre_decode",
|
|
97
|
+
"post_decode",
|
|
98
|
+
"post_tool_call"
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"additionalProperties": false
|
|
103
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://wasmagent.dev/schemas/compliance/repair-trace.schema.json",
|
|
4
|
+
"title": "RepairTrace",
|
|
5
|
+
"description": "Per-round repair record. One RepairTrace per repair attempt; multiple per run when escalation occurs.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"round",
|
|
9
|
+
"violation_ids",
|
|
10
|
+
"strategy",
|
|
11
|
+
"ok"
|
|
12
|
+
],
|
|
13
|
+
"properties": {
|
|
14
|
+
"round": {
|
|
15
|
+
"type": "integer",
|
|
16
|
+
"minimum": 1
|
|
17
|
+
},
|
|
18
|
+
"violation_ids": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"minItems": 1,
|
|
24
|
+
"description": "constraint_id list this round attempted to repair."
|
|
25
|
+
},
|
|
26
|
+
"strategy": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": [
|
|
29
|
+
"patch",
|
|
30
|
+
"insert_section",
|
|
31
|
+
"regenerate_region",
|
|
32
|
+
"full"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"target_region": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"ok": {
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"description": "True iff post-repair re-verification cleared the targeted violations."
|
|
41
|
+
},
|
|
42
|
+
"rolled_back": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "True when the strategy's artifact re-broke a previously-passing constraint and the planner discarded it. Implies ok=false; artifact state matches pre-round."
|
|
45
|
+
},
|
|
46
|
+
"remaining_violation_ids": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "string"
|
|
50
|
+
},
|
|
51
|
+
"description": "Violations still failing after this round (may be subset of input)."
|
|
52
|
+
},
|
|
53
|
+
"token_cost": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"prompt": {
|
|
57
|
+
"type": "integer",
|
|
58
|
+
"minimum": 0
|
|
59
|
+
},
|
|
60
|
+
"generation": {
|
|
61
|
+
"type": "integer",
|
|
62
|
+
"minimum": 0
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"additionalProperties": false
|
|
66
|
+
},
|
|
67
|
+
"latency_ms": {
|
|
68
|
+
"type": "integer",
|
|
69
|
+
"minimum": 0
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"additionalProperties": false
|
|
73
|
+
}
|