@ixo/topic-protocol 0.8.0 → 1.0.0-rc.1

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 (54) hide show
  1. package/README.md +6 -1
  2. package/dist/schemas/decision-to-pay-template-v2.schema.json +301 -0
  3. package/dist/schemas/payable-obligation-v2.schema.json +319 -0
  4. package/dist/schemas/payment-terms-v2.schema.json +238 -0
  5. package/dist/schemas/topic-contract-body.schema.json +66 -0
  6. package/dist/schemas/topic-contract-state.schema.json +63 -295
  7. package/dist/schemas/topic-recipe.schema.json +19 -0
  8. package/dist/schemas/topic-root.schema.json +17 -1
  9. package/dist/schemas/topic-shape.schema.json +79 -0
  10. package/dist/src/contracts/schemas.d.ts +3417 -1822
  11. package/dist/src/contracts/schemas.js +12 -0
  12. package/dist/src/contracts/schemas.js.map +1 -1
  13. package/dist/src/contracts/topic-contract.d.ts +30 -5
  14. package/dist/src/contracts/topic-contract.js +3 -1
  15. package/dist/src/contracts/topic-contract.js.map +1 -1
  16. package/dist/src/errors.d.ts +1 -1
  17. package/dist/src/errors.js.map +1 -1
  18. package/dist/src/index.d.ts +10 -2
  19. package/dist/src/index.js +9 -1
  20. package/dist/src/index.js.map +1 -1
  21. package/dist/src/projector/types.d.ts +9 -1
  22. package/dist/src/projector/types.js.map +1 -1
  23. package/dist/src/shapes/canonical.d.ts +2 -0
  24. package/dist/src/shapes/canonical.js +20 -0
  25. package/dist/src/shapes/canonical.js.map +1 -0
  26. package/dist/src/shapes/claims.d.ts +12 -0
  27. package/dist/src/shapes/claims.js +20 -0
  28. package/dist/src/shapes/claims.js.map +1 -0
  29. package/dist/src/shapes/now.d.ts +2 -0
  30. package/dist/src/shapes/now.js +42 -0
  31. package/dist/src/shapes/now.js.map +1 -0
  32. package/dist/src/shapes/progress.d.ts +3 -0
  33. package/dist/src/shapes/progress.js +176 -0
  34. package/dist/src/shapes/progress.js.map +1 -0
  35. package/dist/src/shapes/recipes.d.ts +5 -0
  36. package/dist/src/shapes/recipes.js +337 -0
  37. package/dist/src/shapes/recipes.js.map +1 -0
  38. package/dist/src/shapes/resolver.d.ts +14 -0
  39. package/dist/src/shapes/resolver.js +111 -0
  40. package/dist/src/shapes/resolver.js.map +1 -0
  41. package/dist/src/shapes/state.d.ts +53 -0
  42. package/dist/src/shapes/state.js +2 -0
  43. package/dist/src/shapes/state.js.map +1 -0
  44. package/dist/src/shapes/types.d.ts +241 -0
  45. package/dist/src/shapes/types.js +42 -0
  46. package/dist/src/shapes/types.js.map +1 -0
  47. package/package.json +3 -1
  48. package/recipes/README.md +12 -0
  49. package/recipes/agent-delivery.json +607 -0
  50. package/recipes/registry.json +41 -0
  51. package/recipes/research-brief.json +460 -0
  52. package/recipes/verified-work-payment.json +663 -0
  53. package/templates/decision-to-pay/README.md +27 -19
  54. package/templates/decision-to-pay/verified-work-payment.v0.2.template.json +319 -0
package/README.md CHANGED
@@ -9,7 +9,10 @@ identity of a discussion.
9
9
 
10
10
  ## Status
11
11
 
12
- **Version:** 0.8.0
12
+ **Version:** 1.0.0-rc.1
13
+
14
+ The normative Topic Shape progression and Portal Now projection are defined in
15
+ [Topic Shape Framework v1](docs/topic-shape-framework.md).
13
16
 
14
17
  **Maturity:** Draft implementation candidate
15
18
  **Execution source of truth:** [Linear Topic Protocol project](https://linear.app/ixo-world/project/topic-protocol-4ea58bc7910d)
@@ -25,6 +28,7 @@ and external action execution require their dedicated conformance evidence.
25
28
  - [Why Topics matter](docs/topics-feature-guide.md) — a non-technical feature guide
26
29
  - [Extending Topic Kinds](docs/extending-topic-kinds.md) — third-party custom Kind and Kind Profile guide
27
30
  - [Decision-to-Pay templates](templates/decision-to-pay/README.md) — governed payment decision contract pack
31
+ - [Topic Outcome Achievement evaluation kit](evaluation-kits/topic-outcome-achievement/README.md) — ledger-ready deterministic outcome evaluation release
28
32
  - [Protocol chapters](docs/protocol/README.md)
29
33
  - [Machine-readable contracts](contracts/README.md)
30
34
  - [Reference implementation](docs/reference-implementation.md)
@@ -149,6 +153,7 @@ api/ OpenAPI and MCP contract surfaces
149
153
  scripts/ Dependency-free validation and integrity tooling
150
154
  checksums/ Reproducible SHA-256 manifest
151
155
  templates/ Machine-readable Topic Template packs
156
+ evaluation-kits/ Ledger-ready governed evaluation releases
152
157
  src/ TypeScript contract and projection reference library
153
158
  test/ TDD contract, behavior, and edge-case tests
154
159
  ```
@@ -0,0 +1,301 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/decision-to-pay-template-v2.schema.json",
4
+ "title": "IXO Decision-to-Pay Topic Template manifest v2",
5
+ "description": "A Claims-native Decision-to-Pay template. The Topic binds and projects the work case; the Deed and IXO Claims module remain authoritative.",
6
+ "type": "object",
7
+ "required": [
8
+ "$schema",
9
+ "version",
10
+ "id",
11
+ "templateVersion",
12
+ "label",
13
+ "description",
14
+ "maturity",
15
+ "compatibility",
16
+ "topic",
17
+ "authorities",
18
+ "actors",
19
+ "resources",
20
+ "lifecycle",
21
+ "capabilityPolicy",
22
+ "pilotPolicy",
23
+ "settlement",
24
+ "privacy",
25
+ "acceptanceCriteria"
26
+ ],
27
+ "properties": {
28
+ "$schema": { "type": "string", "minLength": 1 },
29
+ "version": { "const": 2 },
30
+ "id": { "type": "string", "pattern": "^urn:ixo:decision-to-pay:template:[a-z0-9-]+$" },
31
+ "templateVersion": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
32
+ "label": { "type": "string", "minLength": 1, "maxLength": 120 },
33
+ "description": { "type": "string", "minLength": 1, "maxLength": 1000 },
34
+ "maturity": { "enum": ["draft", "incubating", "candidate", "stable"] },
35
+ "compatibility": { "$ref": "#/$defs/compatibility" },
36
+ "topic": { "$ref": "#/$defs/topic" },
37
+ "authorities": { "$ref": "#/$defs/authorities" },
38
+ "actors": {
39
+ "type": "array",
40
+ "minItems": 4,
41
+ "items": { "$ref": "#/$defs/actor" }
42
+ },
43
+ "resources": {
44
+ "type": "array",
45
+ "minItems": 7,
46
+ "items": { "$ref": "#/$defs/resource" }
47
+ },
48
+ "lifecycle": {
49
+ "type": "array",
50
+ "minItems": 10,
51
+ "items": { "$ref": "#/$defs/lifecycleStep" }
52
+ },
53
+ "capabilityPolicy": { "$ref": "#/$defs/capabilityPolicy" },
54
+ "pilotPolicy": { "$ref": "#/$defs/pilotPolicy" },
55
+ "settlement": { "$ref": "#/$defs/settlement" },
56
+ "privacy": { "$ref": "#/$defs/privacy" },
57
+ "acceptanceCriteria": {
58
+ "type": "array",
59
+ "minItems": 1,
60
+ "items": { "$ref": "#/$defs/acceptanceCriterion" }
61
+ }
62
+ },
63
+ "additionalProperties": false,
64
+ "$defs": {
65
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
66
+ "jsonPointer": { "type": "string", "pattern": "^/" },
67
+ "compatibility": {
68
+ "type": "object",
69
+ "required": ["protocolPackage", "protocolVersion", "sourceCommit", "claimsModule", "sdkVersion", "implementationStatus", "requiredExtensions"],
70
+ "properties": {
71
+ "protocolPackage": { "const": "@ixo/topic-protocol" },
72
+ "protocolVersion": { "const": "0.8.0" },
73
+ "sourceCommit": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
74
+ "claimsModule": { "enum": ["v7", "v8"] },
75
+ "sdkVersion": { "const": "3.0.0" },
76
+ "implementationStatus": { "enum": ["design_ready", "candidate_contract", "implemented"] },
77
+ "requiredExtensions": {
78
+ "type": "array",
79
+ "minItems": 2,
80
+ "uniqueItems": true,
81
+ "items": { "type": "string", "minLength": 1 }
82
+ },
83
+ "constraints": { "type": "array", "items": { "type": "string", "minLength": 1 } }
84
+ },
85
+ "additionalProperties": false
86
+ },
87
+ "topic": {
88
+ "type": "object",
89
+ "required": ["kind", "profile", "domain", "role", "bindingPaths", "lifecyclePolicy"],
90
+ "properties": {
91
+ "kind": { "const": "org.ixo.job-card" },
92
+ "profile": { "const": "https://topic-protocol.ixo.world/profiles/job-card" },
93
+ "domain": { "const": "deed" },
94
+ "role": { "const": "contract_binder_and_message_thread" },
95
+ "bindingPaths": {
96
+ "type": "object",
97
+ "required": ["deed", "claimCollection", "manifest", "claimSchema", "rubric"],
98
+ "properties": {
99
+ "deed": { "const": "/bindings/deed" },
100
+ "claimCollection": { "const": "/bindings/claimCollection" },
101
+ "manifest": { "const": "/bindings/verifiedWorkPaymentManifest" },
102
+ "claimSchema": { "const": "/bindings/claimSchema" },
103
+ "rubric": { "const": "/bindings/rubric" }
104
+ },
105
+ "additionalProperties": false
106
+ },
107
+ "lifecyclePolicy": {
108
+ "type": "object",
109
+ "required": ["topicIsProjection", "chainStateIsAuthoritative", "resolveRule"],
110
+ "properties": {
111
+ "topicIsProjection": { "const": true },
112
+ "chainStateIsAuthoritative": { "const": true },
113
+ "resolveRule": { "type": "string", "minLength": 1 }
114
+ },
115
+ "additionalProperties": false
116
+ }
117
+ },
118
+ "additionalProperties": false
119
+ },
120
+ "authorities": {
121
+ "type": "object",
122
+ "required": ["workPackage", "conversation", "claims", "evaluation", "orchestration"],
123
+ "properties": {
124
+ "workPackage": { "const": "deed" },
125
+ "conversation": { "const": "job_topic" },
126
+ "claims": { "const": "ixo.claims.v1beta1" },
127
+ "evaluation": { "const": "ixo_evaluation_engine" },
128
+ "orchestration": { "const": "ixo_portal" }
129
+ },
130
+ "additionalProperties": false
131
+ },
132
+ "actor": {
133
+ "type": "object",
134
+ "required": ["role", "identity", "capabilities"],
135
+ "properties": {
136
+ "role": { "enum": ["deed_owner", "payer", "service_agent", "evaluation_engine", "human_evaluator", "adjudicator"] },
137
+ "identity": { "const": "did" },
138
+ "required": { "type": "boolean" },
139
+ "capabilities": {
140
+ "type": "array",
141
+ "minItems": 1,
142
+ "uniqueItems": true,
143
+ "items": { "type": "string", "minLength": 1 }
144
+ },
145
+ "constraints": { "type": "array", "items": { "type": "string", "minLength": 1 } }
146
+ },
147
+ "additionalProperties": false
148
+ },
149
+ "resource": {
150
+ "type": "object",
151
+ "required": ["role", "type", "required", "authority", "binding", "confidentiality"],
152
+ "properties": {
153
+ "role": { "enum": ["deed", "payment_terms", "payable_obligation", "bid_schema", "claim_schema", "claim_collection", "rubric", "evaluation_receipt", "evidence"] },
154
+ "type": { "type": "string", "minLength": 1 },
155
+ "required": { "type": "boolean" },
156
+ "authority": { "enum": ["deed", "bound_resource", "ixo_claims_module", "evaluation_engine"] },
157
+ "binding": { "enum": ["topic_binding", "deed_linked_resource", "claims_record", "content_addressed_receipt", "vfs_attachment"] },
158
+ "schemaRef": { "type": "string", "format": "uri-reference" },
159
+ "confidentiality": { "enum": ["public", "room_encrypted", "vfs_ucan", "claims_module"] },
160
+ "notes": { "type": "string", "minLength": 1 }
161
+ },
162
+ "additionalProperties": false
163
+ },
164
+ "lifecycleStep": {
165
+ "type": "object",
166
+ "required": ["sequence", "id", "authority", "result"],
167
+ "properties": {
168
+ "sequence": { "type": "integer", "minimum": 1, "maximum": 20 },
169
+ "id": { "enum": ["validate-deed", "create-job-topic", "submit-bid", "accept-bid-and-grant", "claim-intent", "submit-claim", "evaluate-evidence", "record-evaluation", "project-payment", "dispute-and-adjudicate"] },
170
+ "authority": { "enum": ["deed", "job_topic", "bids_service", "cosmos_authz", "ixo_claims_module", "evaluation_engine", "ixo_portal"] },
171
+ "messageType": {
172
+ "enum": [
173
+ "/ixo.claims.v1beta1.MsgClaimIntent",
174
+ "/ixo.claims.v1beta1.MsgSubmitClaim",
175
+ "/ixo.claims.v1beta1.MsgEvaluateClaim",
176
+ "/ixo.claims.v1beta1.MsgDisputeClaim",
177
+ "/ixo.claims.v1beta1.MsgAdjudicateDispute",
178
+ "/cosmos.authz.v1beta1.MsgGrant"
179
+ ]
180
+ },
181
+ "preconditions": { "type": "array", "items": { "type": "string", "minLength": 1 } },
182
+ "result": { "type": "string", "minLength": 1 }
183
+ },
184
+ "additionalProperties": false
185
+ },
186
+ "capabilityPolicy": {
187
+ "type": "object",
188
+ "required": ["submitClaimAuthorization", "evaluateClaimAuthorization", "engineUcan", "revocationTriggers"],
189
+ "properties": {
190
+ "submitClaimAuthorization": {
191
+ "type": "object",
192
+ "required": ["typeUrl", "requiredConstraints", "deriveFromAcceptedBid", "expiryBound"],
193
+ "properties": {
194
+ "typeUrl": { "const": "/ixo.claims.v1beta1.SubmitClaimAuthorization" },
195
+ "requiredConstraints": {
196
+ "type": "array",
197
+ "minItems": 5,
198
+ "uniqueItems": true,
199
+ "items": { "enum": ["collectionId", "agentQuota", "maxAmount", "intentDurationNs", "memberAddress"] }
200
+ },
201
+ "deriveFromAcceptedBid": { "const": true },
202
+ "expiryBound": { "const": "min(job_end,collection_end)" }
203
+ },
204
+ "additionalProperties": false
205
+ },
206
+ "evaluateClaimAuthorization": {
207
+ "type": "object",
208
+ "required": ["typeUrl", "requiredConstraints", "expiryBound"],
209
+ "properties": {
210
+ "typeUrl": { "const": "/ixo.claims.v1beta1.EvaluateClaimAuthorization" },
211
+ "requiredConstraints": {
212
+ "type": "array",
213
+ "minItems": 4,
214
+ "uniqueItems": true,
215
+ "items": { "enum": ["collectionId", "claimIds", "agentQuota", "beforeDate", "maxCustomAmount"] }
216
+ },
217
+ "expiryBound": { "const": "collection_end" }
218
+ },
219
+ "additionalProperties": false
220
+ },
221
+ "engineUcan": {
222
+ "type": "object",
223
+ "required": ["abilities", "audienceBound", "resourceBound", "timeBound", "revocable", "environmentBound"],
224
+ "properties": {
225
+ "abilities": {
226
+ "type": "array",
227
+ "minItems": 1,
228
+ "uniqueItems": true,
229
+ "items": { "enum": ["ixo:matrix-claims-bot", "subscriptions/read"] }
230
+ },
231
+ "audienceBound": { "const": true },
232
+ "resourceBound": { "const": true },
233
+ "timeBound": { "const": true },
234
+ "revocable": { "const": true },
235
+ "environmentBound": { "const": true }
236
+ },
237
+ "additionalProperties": false
238
+ },
239
+ "revocationTriggers": {
240
+ "type": "array",
241
+ "minItems": 4,
242
+ "uniqueItems": true,
243
+ "items": { "enum": ["job_cancelled", "job_completed", "job_expired", "bidder_removed", "security_incident"] }
244
+ }
245
+ },
246
+ "additionalProperties": false
247
+ },
248
+ "pilotPolicy": {
249
+ "type": "object",
250
+ "required": ["intentPolicy", "assetType", "payoutTimeoutNs", "mainnetEvaluationMode", "testnetAutomation", "deferredFeatures"],
251
+ "properties": {
252
+ "intentPolicy": { "const": "REQUIRED" },
253
+ "assetType": { "const": "native" },
254
+ "payoutTimeoutNs": { "const": "0" },
255
+ "mainnetEvaluationMode": { "const": "HUMAN_SIGNED" },
256
+ "testnetAutomation": { "const": "CAPPED" },
257
+ "deferredFeatures": {
258
+ "type": "array",
259
+ "minItems": 4,
260
+ "uniqueItems": true,
261
+ "items": { "enum": ["cw20", "cw1155", "team_budgets", "delayed_withdrawal", "mainnet_automation", "other_decision_to_pay_templates"] }
262
+ }
263
+ },
264
+ "additionalProperties": false
265
+ },
266
+ "settlement": {
267
+ "type": "object",
268
+ "required": ["templateMovesFunds", "claimsModuleMovesFunds", "authority", "adapter", "approvalTrigger", "disputeRecourse"],
269
+ "properties": {
270
+ "templateMovesFunds": { "const": false },
271
+ "claimsModuleMovesFunds": { "const": true },
272
+ "authority": { "const": "ixo.claims.v1beta1" },
273
+ "adapter": { "const": "canonical_impactxclient_sdk" },
274
+ "approvalTrigger": { "const": "MsgEvaluateClaim(APPROVED)" },
275
+ "disputeRecourse": { "const": "deposit_slashing_and_adjudication_not_payment_reversal" }
276
+ },
277
+ "additionalProperties": false
278
+ },
279
+ "privacy": {
280
+ "type": "object",
281
+ "required": ["topicIsConfidentialityBoundary", "topicCapabilityGrantsVfsAccess", "sensitiveResourceStorage", "receiptExcludesPii"],
282
+ "properties": {
283
+ "topicIsConfidentialityBoundary": { "const": false },
284
+ "topicCapabilityGrantsVfsAccess": { "const": false },
285
+ "sensitiveResourceStorage": { "const": "encrypted_room_or_ucan_vfs" },
286
+ "receiptExcludesPii": { "const": true }
287
+ },
288
+ "additionalProperties": false
289
+ },
290
+ "acceptanceCriterion": {
291
+ "type": "object",
292
+ "required": ["id", "statement", "verification"],
293
+ "properties": {
294
+ "id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
295
+ "statement": { "type": "string", "minLength": 1 },
296
+ "verification": { "type": "string", "minLength": 1 }
297
+ },
298
+ "additionalProperties": false
299
+ }
300
+ }
301
+ }
@@ -0,0 +1,319 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/payable-obligation-v2.schema.json",
4
+ "title": "IXO Claims-native Payable Obligation projection v2",
5
+ "description": "A read-only projection of authoritative Deed, AuthZ and IXO Claims module state. It cannot approve, evaluate, settle or reverse payment.",
6
+ "type": "object",
7
+ "required": [
8
+ "$schema",
9
+ "version",
10
+ "type",
11
+ "id",
12
+ "projectionAuthority",
13
+ "observedAt",
14
+ "observedHeight",
15
+ "deedDid",
16
+ "topicId",
17
+ "state",
18
+ "paymentTerms",
19
+ "collection",
20
+ "acceptedBid",
21
+ "submitAuthorization",
22
+ "intent",
23
+ "claim",
24
+ "evaluation",
25
+ "payment",
26
+ "disputes",
27
+ "sourceRefs"
28
+ ],
29
+ "properties": {
30
+ "$schema": { "type": "string", "minLength": 1 },
31
+ "version": { "const": 2 },
32
+ "type": { "const": "org.ixo.payable-obligation" },
33
+ "id": { "type": "string", "pattern": "^urn:ixo:payable-obligation:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
34
+ "projectionAuthority": { "const": "ixo_claims_module" },
35
+ "observedAt": { "type": "string", "format": "date-time" },
36
+ "observedHeight": { "$ref": "#/$defs/positiveUint" },
37
+ "deedDid": { "$ref": "#/$defs/did" },
38
+ "topicId": { "$ref": "#/$defs/topicId" },
39
+ "state": {
40
+ "enum": [
41
+ "awaiting_authorization",
42
+ "awaiting_intent",
43
+ "intent_active",
44
+ "claim_submitted",
45
+ "awaiting_evaluation",
46
+ "flagged",
47
+ "approved",
48
+ "rejected",
49
+ "invalidated",
50
+ "paid",
51
+ "payment_failed",
52
+ "disputed"
53
+ ]
54
+ },
55
+ "paymentTerms": { "$ref": "#/$defs/resourceRef" },
56
+ "collection": { "$ref": "#/$defs/collectionProjection" },
57
+ "acceptedBid": { "$ref": "#/$defs/bidProjection" },
58
+ "submitAuthorization": { "$ref": "#/$defs/authorizationProjection" },
59
+ "intent": { "$ref": "#/$defs/intentProjection" },
60
+ "claim": { "$ref": "#/$defs/claimProjection" },
61
+ "evaluation": { "$ref": "#/$defs/evaluationProjection" },
62
+ "payment": { "$ref": "#/$defs/paymentProjection" },
63
+ "disputes": { "type": "array", "items": { "$ref": "#/$defs/disputeProjection" } },
64
+ "sourceRefs": {
65
+ "type": "array",
66
+ "minItems": 3,
67
+ "items": { "$ref": "#/$defs/resourceRef" }
68
+ }
69
+ },
70
+ "additionalProperties": false,
71
+ "allOf": [
72
+ {
73
+ "if": {
74
+ "type": "object",
75
+ "properties": {
76
+ "evaluation": {
77
+ "type": "object",
78
+ "properties": { "status": { "enum": ["APPROVED", "REJECTED", "FLAGGED", "INVALIDATED"] } },
79
+ "required": ["status"]
80
+ }
81
+ },
82
+ "required": ["evaluation"]
83
+ },
84
+ "then": {
85
+ "type": "object",
86
+ "properties": {
87
+ "evaluation": {
88
+ "type": "object",
89
+ "properties": {
90
+ "chain": { "$ref": "#/$defs/chainRef" },
91
+ "receipt": { "$ref": "#/$defs/receiptProjection" }
92
+ },
93
+ "required": ["chain", "receipt"]
94
+ }
95
+ }
96
+ }
97
+ },
98
+ {
99
+ "if": {
100
+ "type": "object",
101
+ "properties": {
102
+ "evaluation": {
103
+ "type": "object",
104
+ "properties": { "status": { "const": "FLAGGED" } },
105
+ "required": ["status"]
106
+ }
107
+ }
108
+ },
109
+ "then": {
110
+ "type": "object",
111
+ "properties": {
112
+ "state": { "const": "flagged" },
113
+ "payment": {
114
+ "type": "object",
115
+ "properties": { "status": { "enum": ["NO_PAYMENT", "PROMISED", "GUARANTEED"] } }
116
+ }
117
+ }
118
+ }
119
+ },
120
+ {
121
+ "if": {
122
+ "type": "object",
123
+ "properties": {
124
+ "payment": {
125
+ "type": "object",
126
+ "properties": { "status": { "const": "PAID" } },
127
+ "required": ["status"]
128
+ }
129
+ }
130
+ },
131
+ "then": {
132
+ "type": "object",
133
+ "properties": {
134
+ "state": { "const": "paid" },
135
+ "evaluation": {
136
+ "type": "object",
137
+ "properties": { "status": { "const": "APPROVED" } },
138
+ "required": ["status"]
139
+ },
140
+ "payment": {
141
+ "type": "object",
142
+ "properties": { "chain": { "$ref": "#/$defs/chainRef" } },
143
+ "required": ["chain"]
144
+ }
145
+ }
146
+ }
147
+ },
148
+ {
149
+ "if": {
150
+ "type": "object",
151
+ "properties": { "state": { "const": "disputed" } },
152
+ "required": ["state"]
153
+ },
154
+ "then": {
155
+ "type": "object",
156
+ "properties": { "disputes": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/disputeProjection" } } }
157
+ }
158
+ }
159
+ ],
160
+ "$defs": {
161
+ "did": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
162
+ "topicId": { "type": "string", "pattern": "^ixo:topic:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
163
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
164
+ "positiveUint": { "type": "string", "pattern": "^[1-9][0-9]*$" },
165
+ "uint": { "type": "string", "pattern": "^(0|[1-9][0-9]*)$" },
166
+ "address": { "type": "string", "minLength": 1, "maxLength": 256 },
167
+ "chainRef": {
168
+ "type": "object",
169
+ "required": ["txHash", "height"],
170
+ "properties": {
171
+ "txHash": { "type": "string", "pattern": "^[0-9A-Fa-f]{64}$" },
172
+ "height": { "$ref": "#/$defs/positiveUint" }
173
+ },
174
+ "additionalProperties": false
175
+ },
176
+ "resourceRef": {
177
+ "type": "object",
178
+ "required": ["type", "ref", "digest"],
179
+ "properties": {
180
+ "type": { "type": "string", "minLength": 1 },
181
+ "ref": { "type": "string", "format": "uri-reference" },
182
+ "digest": { "$ref": "#/$defs/digest" }
183
+ },
184
+ "additionalProperties": false
185
+ },
186
+ "nativeAmount": {
187
+ "type": "object",
188
+ "required": ["denom", "amount"],
189
+ "properties": {
190
+ "denom": { "type": "string", "minLength": 1 },
191
+ "amount": { "$ref": "#/$defs/positiveUint" }
192
+ },
193
+ "additionalProperties": false
194
+ },
195
+ "collectionProjection": {
196
+ "type": "object",
197
+ "required": ["collectionId", "entityDid", "protocolDid", "state", "intentPolicy", "configurationDigest", "created"],
198
+ "properties": {
199
+ "collectionId": { "$ref": "#/$defs/positiveUint" },
200
+ "entityDid": { "$ref": "#/$defs/did" },
201
+ "protocolDid": { "$ref": "#/$defs/did" },
202
+ "state": { "enum": ["OPEN", "PAUSED", "CLOSED"] },
203
+ "intentPolicy": { "enum": ["ALLOW", "DENY", "REQUIRED"] },
204
+ "configurationDigest": { "$ref": "#/$defs/digest" },
205
+ "created": { "$ref": "#/$defs/chainRef" }
206
+ },
207
+ "additionalProperties": false
208
+ },
209
+ "bidProjection": {
210
+ "type": "object",
211
+ "required": ["bidId", "serviceAgentDid", "serviceAgentAddress", "acceptedAt", "termsDigest"],
212
+ "properties": {
213
+ "bidId": { "type": "string", "minLength": 1 },
214
+ "serviceAgentDid": { "$ref": "#/$defs/did" },
215
+ "serviceAgentAddress": { "$ref": "#/$defs/address" },
216
+ "acceptedAt": { "type": "string", "format": "date-time" },
217
+ "termsDigest": { "$ref": "#/$defs/digest" }
218
+ },
219
+ "additionalProperties": false
220
+ },
221
+ "authorizationProjection": {
222
+ "type": "object",
223
+ "required": ["typeUrl", "granter", "grantee", "collectionId", "agentQuota", "maxNativeAmount", "intentDurationNs", "expiresAt", "grant"],
224
+ "properties": {
225
+ "typeUrl": { "const": "/ixo.claims.v1beta1.SubmitClaimAuthorization" },
226
+ "granter": { "$ref": "#/$defs/address" },
227
+ "grantee": { "$ref": "#/$defs/address" },
228
+ "collectionId": { "$ref": "#/$defs/positiveUint" },
229
+ "agentQuota": { "$ref": "#/$defs/positiveUint" },
230
+ "maxNativeAmount": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/nativeAmount" } },
231
+ "intentDurationNs": { "$ref": "#/$defs/uint" },
232
+ "memberAddress": { "$ref": "#/$defs/address" },
233
+ "expiresAt": { "type": "string", "format": "date-time" },
234
+ "grant": { "$ref": "#/$defs/chainRef" },
235
+ "revoked": { "$ref": "#/$defs/chainRef" }
236
+ },
237
+ "additionalProperties": false
238
+ },
239
+ "intentProjection": {
240
+ "type": "object",
241
+ "required": ["required", "status"],
242
+ "properties": {
243
+ "required": { "type": "boolean" },
244
+ "intentId": { "$ref": "#/$defs/positiveUint" },
245
+ "status": { "enum": ["NOT_CREATED", "ACTIVE", "FULFILLED", "EXPIRED"] },
246
+ "amount": { "type": "array", "items": { "$ref": "#/$defs/nativeAmount" } },
247
+ "expiresAt": { "type": "string", "format": "date-time" },
248
+ "chain": { "$ref": "#/$defs/chainRef" }
249
+ },
250
+ "additionalProperties": false
251
+ },
252
+ "claimProjection": {
253
+ "type": "object",
254
+ "required": ["claimId", "collectionId", "agentDid", "agentAddress", "useIntent", "evidenceDigest", "chain"],
255
+ "properties": {
256
+ "claimId": { "type": "string", "minLength": 1 },
257
+ "collectionId": { "$ref": "#/$defs/positiveUint" },
258
+ "agentDid": { "$ref": "#/$defs/did" },
259
+ "agentAddress": { "$ref": "#/$defs/address" },
260
+ "useIntent": { "type": "boolean" },
261
+ "evidenceDigest": { "$ref": "#/$defs/digest" },
262
+ "chain": { "$ref": "#/$defs/chainRef" }
263
+ },
264
+ "additionalProperties": false
265
+ },
266
+ "receiptProjection": {
267
+ "type": "object",
268
+ "required": ["udid", "cid", "digest", "issuerDid", "signatureVerified", "claimDigest", "rubricDigest"],
269
+ "properties": {
270
+ "udid": { "type": "string", "minLength": 1 },
271
+ "cid": { "type": "string", "minLength": 1 },
272
+ "digest": { "$ref": "#/$defs/digest" },
273
+ "issuerDid": { "$ref": "#/$defs/did" },
274
+ "signatureVerified": { "const": true },
275
+ "claimDigest": { "$ref": "#/$defs/digest" },
276
+ "rubricDigest": { "$ref": "#/$defs/digest" }
277
+ },
278
+ "additionalProperties": false
279
+ },
280
+ "evaluationProjection": {
281
+ "type": "object",
282
+ "required": ["status"],
283
+ "properties": {
284
+ "status": { "enum": ["PENDING", "APPROVED", "REJECTED", "FLAGGED", "INVALIDATED"] },
285
+ "evaluatorDid": { "$ref": "#/$defs/did" },
286
+ "oracleDid": { "$ref": "#/$defs/did" },
287
+ "reason": { "type": "integer", "minimum": 0 },
288
+ "receipt": { "$ref": "#/$defs/receiptProjection" },
289
+ "chain": { "$ref": "#/$defs/chainRef" },
290
+ "history": { "type": "array", "items": { "$ref": "#/$defs/chainRef" } }
291
+ },
292
+ "additionalProperties": false
293
+ },
294
+ "paymentProjection": {
295
+ "type": "object",
296
+ "required": ["status", "amount"],
297
+ "properties": {
298
+ "status": { "enum": ["NO_PAYMENT", "PROMISED", "AUTHORIZED", "GUARANTEED", "PAID", "FAILED", "DISPUTED_PAYMENT"] },
299
+ "amount": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/nativeAmount" } },
300
+ "chain": { "$ref": "#/$defs/chainRef" }
301
+ },
302
+ "additionalProperties": false
303
+ },
304
+ "disputeProjection": {
305
+ "type": "object",
306
+ "required": ["proof", "targetRole", "status", "deposit", "opened"],
307
+ "properties": {
308
+ "proof": { "type": "string", "minLength": 1 },
309
+ "targetRole": { "enum": ["SUBMITTER", "EVALUATOR"] },
310
+ "status": { "enum": ["OPEN", "AWARDED", "DISMISSED"] },
311
+ "deposit": { "$ref": "#/$defs/nativeAmount" },
312
+ "opened": { "$ref": "#/$defs/chainRef" },
313
+ "resolved": { "$ref": "#/$defs/chainRef" },
314
+ "adjudicatorDid": { "$ref": "#/$defs/did" }
315
+ },
316
+ "additionalProperties": false
317
+ }
318
+ }
319
+ }