@onchaindiligence/agent-evidence 0.1.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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -0
  3. package/conformance/README.md +31 -0
  4. package/conformance/duplicate-outer-key.json +1 -0
  5. package/conformance/manifest.json +74 -0
  6. package/conformance/missing-parent.json +31 -0
  7. package/conformance/noncanonical-payload.json +31 -0
  8. package/conformance/rfc8785-vectors.json +31 -0
  9. package/conformance/valid-full-graph.json +31 -0
  10. package/dist/canonical.d.ts +14 -0
  11. package/dist/canonical.d.ts.map +1 -0
  12. package/dist/canonical.js +249 -0
  13. package/dist/canonical.js.map +1 -0
  14. package/dist/constants.d.ts +9 -0
  15. package/dist/constants.d.ts.map +1 -0
  16. package/dist/constants.js +9 -0
  17. package/dist/constants.js.map +1 -0
  18. package/dist/dsse.d.ts +10 -0
  19. package/dist/dsse.d.ts.map +1 -0
  20. package/dist/dsse.js +85 -0
  21. package/dist/dsse.js.map +1 -0
  22. package/dist/errors.d.ts +16 -0
  23. package/dist/errors.d.ts.map +1 -0
  24. package/dist/errors.js +19 -0
  25. package/dist/errors.js.map +1 -0
  26. package/dist/graph.d.ts +3 -0
  27. package/dist/graph.d.ts.map +1 -0
  28. package/dist/graph.js +227 -0
  29. package/dist/graph.js.map +1 -0
  30. package/dist/index.d.ts +14 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +10 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/records.d.ts +14 -0
  35. package/dist/records.d.ts.map +1 -0
  36. package/dist/records.js +55 -0
  37. package/dist/records.js.map +1 -0
  38. package/dist/schema.d.ts +4 -0
  39. package/dist/schema.d.ts.map +1 -0
  40. package/dist/schema.js +45 -0
  41. package/dist/schema.js.map +1 -0
  42. package/dist/trust.d.ts +64 -0
  43. package/dist/trust.d.ts.map +1 -0
  44. package/dist/trust.js +254 -0
  45. package/dist/trust.js.map +1 -0
  46. package/dist/types.d.ts +83 -0
  47. package/dist/types.d.ts.map +1 -0
  48. package/dist/types.js +2 -0
  49. package/dist/types.js.map +1 -0
  50. package/dist/verifier.d.ts +5 -0
  51. package/dist/verifier.d.ts.map +1 -0
  52. package/dist/verifier.js +489 -0
  53. package/dist/verifier.js.map +1 -0
  54. package/examples/withheld-payment.mjs +67 -0
  55. package/package.json +65 -0
  56. package/schemas/attestation-key.schema.json +88 -0
  57. package/schemas/bundle-payload.schema.json +32 -0
  58. package/schemas/catalog.json +20 -0
  59. package/schemas/common.schema.json +35 -0
  60. package/schemas/dsse-envelope.schema.json +34 -0
  61. package/schemas/portable-file.schema.json +62 -0
  62. package/schemas/proof.schema.json +98 -0
  63. package/schemas/record.schema.json +286 -0
@@ -0,0 +1,286 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://onchaindiligence.com/schemas/agent-evidence/v0/record.schema.json",
4
+ "title": "Agent Evidence v0 graph record",
5
+ "type": "object",
6
+ "required": ["id", "record_version", "kind", "parents", "statement", "proofs"],
7
+ "properties": {
8
+ "id": { "$ref": "common.schema.json#/$defs/contentId" },
9
+ "record_version": { "const": "onchaindiligence.agent-evidence.record.v0" },
10
+ "kind": { "enum": ["principal", "agent", "mandate", "run", "evidence", "policy", "decision", "execution"] },
11
+ "parents": { "$ref": "common.schema.json#/$defs/idList" },
12
+ "statement": { "type": "object" },
13
+ "proofs": {
14
+ "type": "array",
15
+ "items": { "$ref": "proof.schema.json" },
16
+ "maxItems": 64
17
+ }
18
+ },
19
+ "oneOf": [
20
+ {
21
+ "type": "object",
22
+ "properties": {
23
+ "kind": { "const": "principal" },
24
+ "parents": { "type": "array", "maxItems": 0 },
25
+ "statement": { "$ref": "#/$defs/principalStatement" }
26
+ }
27
+ },
28
+ {
29
+ "type": "object",
30
+ "properties": {
31
+ "kind": { "const": "agent" },
32
+ "statement": { "$ref": "#/$defs/agentStatement" }
33
+ }
34
+ },
35
+ {
36
+ "type": "object",
37
+ "properties": {
38
+ "kind": { "const": "mandate" },
39
+ "parents": { "type": "array", "minItems": 1 },
40
+ "statement": { "$ref": "#/$defs/mandateStatement" }
41
+ }
42
+ },
43
+ {
44
+ "type": "object",
45
+ "properties": {
46
+ "kind": { "const": "run" },
47
+ "parents": { "type": "array", "minItems": 2 },
48
+ "statement": { "$ref": "#/$defs/runStatement" }
49
+ }
50
+ },
51
+ {
52
+ "type": "object",
53
+ "properties": {
54
+ "kind": { "const": "evidence" },
55
+ "parents": { "type": "array", "minItems": 1 },
56
+ "statement": { "$ref": "#/$defs/evidenceStatement" }
57
+ }
58
+ },
59
+ {
60
+ "type": "object",
61
+ "properties": {
62
+ "kind": { "const": "policy" },
63
+ "parents": { "type": "array", "minItems": 1 },
64
+ "statement": { "$ref": "#/$defs/policyStatement" }
65
+ }
66
+ },
67
+ {
68
+ "type": "object",
69
+ "properties": {
70
+ "kind": { "const": "decision" },
71
+ "parents": { "type": "array", "minItems": 3 },
72
+ "statement": { "$ref": "#/$defs/decisionStatement" }
73
+ }
74
+ },
75
+ {
76
+ "type": "object",
77
+ "properties": {
78
+ "kind": { "const": "execution" },
79
+ "parents": { "type": "array", "minItems": 1 },
80
+ "statement": { "$ref": "#/$defs/executionStatement" }
81
+ }
82
+ }
83
+ ],
84
+ "additionalProperties": false,
85
+ "$defs": {
86
+ "principalStatement": {
87
+ "type": "object",
88
+ "required": ["principal_id", "principal_type"],
89
+ "properties": {
90
+ "principal_id": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
91
+ "principal_type": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
92
+ "identity_refs": {
93
+ "type": "array",
94
+ "maxItems": 128,
95
+ "items": {
96
+ "type": "object",
97
+ "required": ["type", "issuer", "subject"],
98
+ "properties": {
99
+ "type": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
100
+ "issuer": { "type": "string", "format": "uri", "maxLength": 4096 },
101
+ "subject": { "$ref": "common.schema.json#/$defs/nonEmptyString" }
102
+ },
103
+ "additionalProperties": false
104
+ }
105
+ },
106
+ "display_name": { "type": "string", "maxLength": 1024 }
107
+ },
108
+ "additionalProperties": false
109
+ },
110
+ "agentStatement": {
111
+ "type": "object",
112
+ "required": ["agent_id", "agent_version"],
113
+ "properties": {
114
+ "agent_id": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
115
+ "agent_version": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
116
+ "framework": { "type": "string", "maxLength": 1024 },
117
+ "deployment_ref": { "type": "string", "maxLength": 4096 },
118
+ "model_ref": { "type": "string", "maxLength": 4096 },
119
+ "operator_ref": { "$ref": "common.schema.json#/$defs/contentId" }
120
+ },
121
+ "additionalProperties": false
122
+ },
123
+ "mandateStatement": {
124
+ "type": "object",
125
+ "required": ["mandate_id", "principal_ref", "scope", "valid_from", "valid_until"],
126
+ "properties": {
127
+ "mandate_id": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
128
+ "principal_ref": { "$ref": "common.schema.json#/$defs/contentId" },
129
+ "scope": { "type": "object" },
130
+ "valid_from": { "$ref": "common.schema.json#/$defs/timestamp" },
131
+ "valid_until": { "$ref": "common.schema.json#/$defs/timestamp" },
132
+ "limits": { "type": "object" },
133
+ "policy_refs": { "$ref": "common.schema.json#/$defs/idList" },
134
+ "authorization_ref": { "type": "string", "format": "uri", "maxLength": 8192 },
135
+ "authorization_digest": { "$ref": "common.schema.json#/$defs/sha256Digest" }
136
+ },
137
+ "additionalProperties": false
138
+ },
139
+ "runStatement": {
140
+ "type": "object",
141
+ "required": ["run_external_id", "agent_ref", "mandate_ref", "started_at"],
142
+ "properties": {
143
+ "run_external_id": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
144
+ "agent_ref": { "$ref": "common.schema.json#/$defs/contentId" },
145
+ "mandate_ref": { "$ref": "common.schema.json#/$defs/contentId" },
146
+ "started_at": { "$ref": "common.schema.json#/$defs/timestamp" },
147
+ "ended_at": { "$ref": "common.schema.json#/$defs/timestamp" }
148
+ },
149
+ "additionalProperties": false
150
+ },
151
+ "evidenceStatement": {
152
+ "type": "object",
153
+ "required": ["evidence_type", "run_ref", "trust_mode", "source", "tool", "request", "response", "observed_at", "expires_at", "scope"],
154
+ "properties": {
155
+ "evidence_type": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
156
+ "run_ref": { "$ref": "common.schema.json#/$defs/contentId" },
157
+ "trust_mode": { "enum": ["publisher-signed", "local-witness", "managed-witness", "agent-assertion"] },
158
+ "source": {
159
+ "type": "object",
160
+ "required": ["id", "type"],
161
+ "properties": {
162
+ "id": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
163
+ "type": { "$ref": "common.schema.json#/$defs/nonEmptyString" }
164
+ },
165
+ "additionalProperties": false
166
+ },
167
+ "tool": {
168
+ "type": "object",
169
+ "required": ["name", "version"],
170
+ "properties": {
171
+ "name": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
172
+ "version": { "$ref": "common.schema.json#/$defs/nonEmptyString" }
173
+ },
174
+ "additionalProperties": false
175
+ },
176
+ "request": {
177
+ "type": "object",
178
+ "required": ["digest", "media_type"],
179
+ "properties": {
180
+ "digest": { "$ref": "common.schema.json#/$defs/sha256Digest" },
181
+ "media_type": { "$ref": "common.schema.json#/$defs/nonEmptyString" }
182
+ },
183
+ "additionalProperties": false
184
+ },
185
+ "response": {
186
+ "type": "object",
187
+ "required": ["mode", "media_type", "digest"],
188
+ "properties": {
189
+ "mode": { "enum": ["embedded", "reference"] },
190
+ "media_type": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
191
+ "value": {},
192
+ "reference": { "type": "string", "format": "uri", "maxLength": 8192 },
193
+ "digest": { "$ref": "common.schema.json#/$defs/sha256Digest" }
194
+ },
195
+ "allOf": [
196
+ {
197
+ "if": { "type": "object", "properties": { "mode": { "const": "embedded" } }, "required": ["mode"] },
198
+ "then": {
199
+ "type": "object",
200
+ "required": ["value"],
201
+ "properties": { "value": {}, "reference": false }
202
+ }
203
+ },
204
+ {
205
+ "if": { "type": "object", "properties": { "mode": { "const": "reference" } }, "required": ["mode"] },
206
+ "then": {
207
+ "type": "object",
208
+ "required": ["reference"],
209
+ "properties": {
210
+ "reference": { "type": "string", "format": "uri", "maxLength": 8192 },
211
+ "value": false
212
+ }
213
+ }
214
+ }
215
+ ],
216
+ "additionalProperties": false
217
+ },
218
+ "observed_at": { "$ref": "common.schema.json#/$defs/timestamp" },
219
+ "expires_at": {
220
+ "anyOf": [
221
+ { "$ref": "common.schema.json#/$defs/timestamp" },
222
+ { "type": "null" }
223
+ ]
224
+ },
225
+ "scope": { "type": "object" }
226
+ },
227
+ "additionalProperties": false
228
+ },
229
+ "policyStatement": {
230
+ "type": "object",
231
+ "required": ["policy_id", "version", "digest", "source", "effective_from"],
232
+ "properties": {
233
+ "policy_id": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
234
+ "version": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
235
+ "digest": { "$ref": "common.schema.json#/$defs/sha256Digest" },
236
+ "source": { "type": "string", "format": "uri", "maxLength": 8192 },
237
+ "effective_from": { "$ref": "common.schema.json#/$defs/timestamp" },
238
+ "effective_until": { "$ref": "common.schema.json#/$defs/timestamp" },
239
+ "policy": {}
240
+ },
241
+ "additionalProperties": false
242
+ },
243
+ "decisionStatement": {
244
+ "type": "object",
245
+ "required": ["decision_id", "run_ref", "agent_ref", "decision_type", "outcome", "evidence_refs", "policy_ref", "policy_digest", "decided_at"],
246
+ "properties": {
247
+ "decision_id": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
248
+ "run_ref": { "$ref": "common.schema.json#/$defs/contentId" },
249
+ "agent_ref": { "$ref": "common.schema.json#/$defs/contentId" },
250
+ "decision_type": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
251
+ "outcome": {},
252
+ "evidence_refs": {
253
+ "allOf": [
254
+ { "$ref": "common.schema.json#/$defs/idList" },
255
+ { "type": "array", "minItems": 1 }
256
+ ]
257
+ },
258
+ "policy_ref": { "$ref": "common.schema.json#/$defs/contentId" },
259
+ "policy_digest": { "$ref": "common.schema.json#/$defs/sha256Digest" },
260
+ "decided_at": { "$ref": "common.schema.json#/$defs/timestamp" }
261
+ },
262
+ "additionalProperties": false
263
+ },
264
+ "executionStatement": {
265
+ "type": "object",
266
+ "required": ["execution_id", "decision_ref", "execution_type", "status", "submitted_at"],
267
+ "properties": {
268
+ "execution_id": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
269
+ "decision_ref": { "$ref": "common.schema.json#/$defs/contentId" },
270
+ "execution_type": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
271
+ "status": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
272
+ "submitted_at": { "$ref": "common.schema.json#/$defs/timestamp" },
273
+ "network": { "type": "string", "pattern": "^[a-z0-9-]+:[A-Za-z0-9._-]+$" },
274
+ "transaction_hash": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
275
+ "transaction_digest": { "$ref": "common.schema.json#/$defs/sha256Digest" },
276
+ "sender": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
277
+ "recipient": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
278
+ "asset": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
279
+ "amount": { "$ref": "common.schema.json#/$defs/decimalString" },
280
+ "confirmed_at": { "$ref": "common.schema.json#/$defs/timestamp" },
281
+ "block_number": { "type": "string", "pattern": "^(0|[1-9][0-9]*)$" }
282
+ },
283
+ "additionalProperties": false
284
+ }
285
+ }
286
+ }