@ixo/topic-protocol 0.7.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 (77) hide show
  1. package/README.md +9 -2
  2. package/dist/schemas/action-receipt.schema.json +105 -11
  3. package/dist/schemas/decision-to-pay-template-v2.schema.json +301 -0
  4. package/dist/schemas/decision-to-pay-template.schema.json +346 -0
  5. package/dist/schemas/payable-obligation-v2.schema.json +319 -0
  6. package/dist/schemas/payable-obligation.schema.json +312 -0
  7. package/dist/schemas/payment-terms-v2.schema.json +238 -0
  8. package/dist/schemas/payment-terms.schema.json +287 -0
  9. package/dist/schemas/topic-action-request.schema.json +30 -0
  10. package/dist/schemas/topic-contract-body.schema.json +66 -0
  11. package/dist/schemas/topic-contract-state.schema.json +70 -276
  12. package/dist/schemas/topic-flow-binding.schema.json +28 -0
  13. package/dist/schemas/topic-kind-profile.schema.json +32 -2
  14. package/dist/schemas/topic-operation.schema.json +2 -2
  15. package/dist/schemas/topic-recipe.schema.json +19 -0
  16. package/dist/schemas/topic-root.schema.json +17 -1
  17. package/dist/schemas/topic-shape.schema.json +79 -0
  18. package/dist/src/action-runtime/types.d.ts +101 -0
  19. package/dist/src/action-runtime/types.js +12 -0
  20. package/dist/src/action-runtime/types.js.map +1 -0
  21. package/dist/src/contracts/schemas.d.ts +4706 -966
  22. package/dist/src/contracts/schemas.js +22 -0
  23. package/dist/src/contracts/schemas.js.map +1 -1
  24. package/dist/src/contracts/topic-contract.d.ts +38 -6
  25. package/dist/src/contracts/topic-contract.js +3 -1
  26. package/dist/src/contracts/topic-contract.js.map +1 -1
  27. package/dist/src/contracts/topic-kind-profile.d.ts +29 -0
  28. package/dist/src/contracts/topic-kind-profile.js +31 -0
  29. package/dist/src/contracts/topic-kind-profile.js.map +1 -1
  30. package/dist/src/errors.d.ts +1 -1
  31. package/dist/src/errors.js.map +1 -1
  32. package/dist/src/index.d.ts +12 -3
  33. package/dist/src/index.js +11 -2
  34. package/dist/src/index.js.map +1 -1
  35. package/dist/src/projector/payload.d.ts +18 -0
  36. package/dist/src/projector/payload.js +57 -1
  37. package/dist/src/projector/payload.js.map +1 -1
  38. package/dist/src/projector/state.js +144 -0
  39. package/dist/src/projector/state.js.map +1 -1
  40. package/dist/src/projector/types.d.ts +22 -4
  41. package/dist/src/projector/types.js.map +1 -1
  42. package/dist/src/shapes/canonical.d.ts +2 -0
  43. package/dist/src/shapes/canonical.js +20 -0
  44. package/dist/src/shapes/canonical.js.map +1 -0
  45. package/dist/src/shapes/claims.d.ts +12 -0
  46. package/dist/src/shapes/claims.js +20 -0
  47. package/dist/src/shapes/claims.js.map +1 -0
  48. package/dist/src/shapes/now.d.ts +2 -0
  49. package/dist/src/shapes/now.js +42 -0
  50. package/dist/src/shapes/now.js.map +1 -0
  51. package/dist/src/shapes/progress.d.ts +3 -0
  52. package/dist/src/shapes/progress.js +176 -0
  53. package/dist/src/shapes/progress.js.map +1 -0
  54. package/dist/src/shapes/recipes.d.ts +5 -0
  55. package/dist/src/shapes/recipes.js +337 -0
  56. package/dist/src/shapes/recipes.js.map +1 -0
  57. package/dist/src/shapes/resolver.d.ts +14 -0
  58. package/dist/src/shapes/resolver.js +111 -0
  59. package/dist/src/shapes/resolver.js.map +1 -0
  60. package/dist/src/shapes/state.d.ts +53 -0
  61. package/dist/src/shapes/state.js +2 -0
  62. package/dist/src/shapes/state.js.map +1 -0
  63. package/dist/src/shapes/types.d.ts +241 -0
  64. package/dist/src/shapes/types.js +42 -0
  65. package/dist/src/shapes/types.js.map +1 -0
  66. package/package.json +6 -2
  67. package/recipes/README.md +12 -0
  68. package/recipes/agent-delivery.json +607 -0
  69. package/recipes/registry.json +41 -0
  70. package/recipes/research-brief.json +460 -0
  71. package/recipes/verified-work-payment.json +663 -0
  72. package/templates/decision-to-pay/README.md +67 -0
  73. package/templates/decision-to-pay/milestone-payment-release.template.json +195 -0
  74. package/templates/decision-to-pay/outcome-payment-claim.template.json +198 -0
  75. package/templates/decision-to-pay/payment-on-delivery.template.json +198 -0
  76. package/templates/decision-to-pay/verified-work-payment.template.json +283 -0
  77. package/templates/decision-to-pay/verified-work-payment.v0.2.template.json +319 -0
@@ -0,0 +1,238 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/payment-terms-v2.schema.json",
4
+ "title": "IXO Claims-native Payment Terms resource v2",
5
+ "description": "Immutable authoring terms mapped to an IXO Claims Collection. The deployed collection remains authoritative for execution and payment.",
6
+ "type": "object",
7
+ "required": [
8
+ "$schema",
9
+ "version",
10
+ "type",
11
+ "id",
12
+ "revision",
13
+ "status",
14
+ "deedDid",
15
+ "topicTemplate",
16
+ "collectionConfiguration",
17
+ "submitAuthorizationPolicy",
18
+ "evaluationPolicy",
19
+ "disputePolicy",
20
+ "authoredBy",
21
+ "authoredAt"
22
+ ],
23
+ "properties": {
24
+ "$schema": { "type": "string", "minLength": 1 },
25
+ "version": { "const": 2 },
26
+ "type": { "const": "org.ixo.payment-terms" },
27
+ "id": { "type": "string", "pattern": "^urn:ixo:payment-terms:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
28
+ "revision": { "type": "string", "minLength": 1, "maxLength": 128 },
29
+ "status": { "enum": ["draft", "accepted", "superseded"] },
30
+ "deedDid": { "$ref": "#/$defs/did" },
31
+ "topicTemplate": { "$ref": "#/$defs/templateRef" },
32
+ "collectionConfiguration": { "$ref": "#/$defs/collectionConfiguration" },
33
+ "collectionBinding": { "$ref": "#/$defs/collectionBinding" },
34
+ "submitAuthorizationPolicy": { "$ref": "#/$defs/submitAuthorizationPolicy" },
35
+ "evaluationPolicy": { "$ref": "#/$defs/evaluationPolicy" },
36
+ "disputePolicy": { "$ref": "#/$defs/disputePolicy" },
37
+ "authoredBy": { "$ref": "#/$defs/did" },
38
+ "authoredAt": { "type": "string", "format": "date-time" },
39
+ "extensions": { "type": "object" }
40
+ },
41
+ "additionalProperties": false,
42
+ "allOf": [
43
+ {
44
+ "if": { "type": "object", "properties": { "status": { "const": "accepted" } }, "required": ["status"] },
45
+ "then": {
46
+ "type": "object",
47
+ "properties": { "collectionBinding": { "$ref": "#/$defs/collectionBinding" } },
48
+ "required": ["collectionBinding"]
49
+ }
50
+ },
51
+ {
52
+ "if": {
53
+ "type": "object",
54
+ "properties": {
55
+ "collectionConfiguration": {
56
+ "type": "object",
57
+ "properties": { "intentPolicy": { "const": "REQUIRED" } },
58
+ "required": ["intentPolicy"]
59
+ }
60
+ },
61
+ "required": ["collectionConfiguration"]
62
+ },
63
+ "then": {
64
+ "type": "object",
65
+ "properties": {
66
+ "submitAuthorizationPolicy": {
67
+ "type": "object",
68
+ "properties": { "intentDurationNs": { "not": { "const": "0" } } },
69
+ "required": ["intentDurationNs"]
70
+ }
71
+ }
72
+ }
73
+ }
74
+ ],
75
+ "$defs": {
76
+ "did": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
77
+ "address": { "type": "string", "minLength": 1, "maxLength": 256 },
78
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
79
+ "uint": { "type": "string", "pattern": "^(0|[1-9][0-9]*)$" },
80
+ "positiveUint": { "type": "string", "pattern": "^[1-9][0-9]*$" },
81
+ "nativeAmount": {
82
+ "type": "object",
83
+ "required": ["denom", "amount"],
84
+ "properties": {
85
+ "denom": { "type": "string", "minLength": 1, "maxLength": 128 },
86
+ "amount": { "$ref": "#/$defs/positiveUint" }
87
+ },
88
+ "additionalProperties": false
89
+ },
90
+ "templateRef": {
91
+ "type": "object",
92
+ "required": ["id", "version", "ref", "digest"],
93
+ "properties": {
94
+ "id": { "const": "urn:ixo:decision-to-pay:template:verified-work-payment" },
95
+ "version": { "const": "0.2.0" },
96
+ "ref": { "type": "string", "format": "uri-reference" },
97
+ "digest": { "$ref": "#/$defs/digest" }
98
+ },
99
+ "additionalProperties": false
100
+ },
101
+ "paymentSlot": {
102
+ "type": "object",
103
+ "required": ["account", "native", "timeoutNs"],
104
+ "properties": {
105
+ "account": { "$ref": "#/$defs/address" },
106
+ "native": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/nativeAmount" } },
107
+ "timeoutNs": { "$ref": "#/$defs/uint" },
108
+ "isOraclePayment": { "type": "boolean" }
109
+ },
110
+ "additionalProperties": false
111
+ },
112
+ "payments": {
113
+ "type": "object",
114
+ "required": ["approval"],
115
+ "properties": {
116
+ "submission": { "$ref": "#/$defs/paymentSlot" },
117
+ "evaluation": { "$ref": "#/$defs/paymentSlot" },
118
+ "approval": { "$ref": "#/$defs/paymentSlot" },
119
+ "rejection": { "$ref": "#/$defs/paymentSlot" }
120
+ },
121
+ "additionalProperties": false
122
+ },
123
+ "depositRequirement": {
124
+ "type": "object",
125
+ "required": ["amount"],
126
+ "properties": {
127
+ "amount": { "$ref": "#/$defs/nativeAmount" }
128
+ },
129
+ "additionalProperties": false
130
+ },
131
+ "collectionConfiguration": {
132
+ "type": "object",
133
+ "required": [
134
+ "authority",
135
+ "entityDid",
136
+ "protocolDid",
137
+ "startsAt",
138
+ "endsAt",
139
+ "quota",
140
+ "state",
141
+ "intentPolicy",
142
+ "payments",
143
+ "serviceAgentDeposit",
144
+ "evaluationAgentDeposit",
145
+ "disputeDeposit",
146
+ "minDepositPeriodNs",
147
+ "adjudicatorDids"
148
+ ],
149
+ "properties": {
150
+ "authority": { "const": "ixo.claims.v1beta1.Collection" },
151
+ "entityDid": { "$ref": "#/$defs/did" },
152
+ "protocolDid": { "$ref": "#/$defs/did" },
153
+ "startsAt": { "type": "string", "format": "date-time" },
154
+ "endsAt": { "type": "string", "format": "date-time" },
155
+ "quota": { "$ref": "#/$defs/positiveUint" },
156
+ "state": { "const": "OPEN" },
157
+ "intentPolicy": { "enum": ["ALLOW", "DENY", "REQUIRED"] },
158
+ "payments": { "$ref": "#/$defs/payments" },
159
+ "serviceAgentDeposit": { "$ref": "#/$defs/depositRequirement" },
160
+ "evaluationAgentDeposit": { "$ref": "#/$defs/depositRequirement" },
161
+ "disputeDeposit": { "$ref": "#/$defs/nativeAmount" },
162
+ "minDepositPeriodNs": { "$ref": "#/$defs/uint" },
163
+ "adjudicatorDids": {
164
+ "type": "array",
165
+ "minItems": 1,
166
+ "uniqueItems": true,
167
+ "items": { "$ref": "#/$defs/did" }
168
+ }
169
+ },
170
+ "additionalProperties": false
171
+ },
172
+ "chainRef": {
173
+ "type": "object",
174
+ "required": ["txHash", "height"],
175
+ "properties": {
176
+ "txHash": { "type": "string", "pattern": "^[0-9A-Fa-f]{64}$" },
177
+ "height": { "$ref": "#/$defs/positiveUint" }
178
+ },
179
+ "additionalProperties": false
180
+ },
181
+ "collectionBinding": {
182
+ "type": "object",
183
+ "required": ["collectionId", "configurationDigest", "created"],
184
+ "properties": {
185
+ "collectionId": { "$ref": "#/$defs/positiveUint" },
186
+ "configurationDigest": { "$ref": "#/$defs/digest" },
187
+ "created": { "$ref": "#/$defs/chainRef" }
188
+ },
189
+ "additionalProperties": false
190
+ },
191
+ "submitAuthorizationPolicy": {
192
+ "type": "object",
193
+ "required": ["typeUrl", "agentQuota", "maxNativeAmount", "intentDurationNs", "expiresAt", "deriveGranteeFromAcceptedBid"],
194
+ "properties": {
195
+ "typeUrl": { "const": "/ixo.claims.v1beta1.SubmitClaimAuthorization" },
196
+ "agentQuota": { "$ref": "#/$defs/positiveUint" },
197
+ "maxNativeAmount": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/nativeAmount" } },
198
+ "intentDurationNs": { "$ref": "#/$defs/uint" },
199
+ "memberAddress": { "$ref": "#/$defs/address" },
200
+ "expiresAt": { "type": "string", "format": "date-time" },
201
+ "deriveGranteeFromAcceptedBid": { "const": true }
202
+ },
203
+ "additionalProperties": false
204
+ },
205
+ "evaluationPolicy": {
206
+ "type": "object",
207
+ "required": ["mode", "engineDid", "evaluatorDids", "allowedStatuses", "grantExpiresAt", "maxCustomNativeAmount", "humanOverrideRequiresNewReceipt"],
208
+ "properties": {
209
+ "mode": { "enum": ["HUMAN_SIGNED", "CAPPED_AUTOMATIC"] },
210
+ "engineDid": { "$ref": "#/$defs/did" },
211
+ "evaluatorDids": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/did" } },
212
+ "allowedStatuses": {
213
+ "type": "array",
214
+ "minItems": 4,
215
+ "uniqueItems": true,
216
+ "items": { "enum": ["APPROVED", "REJECTED", "FLAGGED", "INVALIDATED"] }
217
+ },
218
+ "grantExpiresAt": { "type": "string", "format": "date-time" },
219
+ "maxCustomNativeAmount": { "type": "array", "items": { "$ref": "#/$defs/nativeAmount" } },
220
+ "humanOverrideRequiresNewReceipt": { "const": true }
221
+ },
222
+ "additionalProperties": false
223
+ },
224
+ "disputePolicy": {
225
+ "type": "object",
226
+ "required": ["messageType", "targetRoles", "requiresRegisteredIid", "requiresDeposit", "adjudicationMessageType", "recourse"],
227
+ "properties": {
228
+ "messageType": { "const": "/ixo.claims.v1beta1.MsgDisputeClaim" },
229
+ "targetRoles": { "type": "array", "minItems": 2, "uniqueItems": true, "items": { "enum": ["SUBMITTER", "EVALUATOR"] } },
230
+ "requiresRegisteredIid": { "const": true },
231
+ "requiresDeposit": { "const": true },
232
+ "adjudicationMessageType": { "const": "/ixo.claims.v1beta1.MsgAdjudicateDispute" },
233
+ "recourse": { "const": "deposit_slashing_and_adjudication_not_payment_reversal" }
234
+ },
235
+ "additionalProperties": false
236
+ }
237
+ }
238
+ }
@@ -0,0 +1,287 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/payment-terms.schema.json",
4
+ "title": "IXO Payment Terms resource v1",
5
+ "type": "object",
6
+ "required": [
7
+ "version",
8
+ "type",
9
+ "id",
10
+ "revision",
11
+ "status",
12
+ "payer",
13
+ "payee",
14
+ "asset",
15
+ "calculation",
16
+ "paymentCondition",
17
+ "timing",
18
+ "approvalPolicy",
19
+ "settlementPolicy",
20
+ "disputePolicy",
21
+ "capabilityRequirements",
22
+ "authoredBy",
23
+ "authoredAt"
24
+ ],
25
+ "properties": {
26
+ "$schema": { "type": "string", "minLength": 1 },
27
+ "version": { "const": 1 },
28
+ "type": { "const": "org.ixo.payment-terms" },
29
+ "id": { "type": "string", "pattern": "^urn:ixo:payment-terms:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
30
+ "revision": { "type": "string", "minLength": 1, "maxLength": 128 },
31
+ "status": { "enum": ["draft", "accepted", "superseded"] },
32
+ "payer": { "$ref": "#/$defs/payer" },
33
+ "payee": { "$ref": "#/$defs/payee" },
34
+ "asset": { "$ref": "#/$defs/asset" },
35
+ "calculation": {
36
+ "oneOf": [
37
+ { "$ref": "#/$defs/fixedCalculation" },
38
+ { "$ref": "#/$defs/formulaCalculation" },
39
+ { "$ref": "#/$defs/milestoneCalculation" },
40
+ { "$ref": "#/$defs/outcomeCalculation" }
41
+ ]
42
+ },
43
+ "paymentCondition": { "$ref": "#/$defs/paymentCondition" },
44
+ "timing": { "$ref": "#/$defs/timing" },
45
+ "partialPayments": { "$ref": "#/$defs/partialPayments" },
46
+ "approvalPolicy": { "$ref": "#/$defs/approvalPolicy" },
47
+ "settlementPolicy": { "$ref": "#/$defs/settlementPolicy" },
48
+ "disputePolicy": { "$ref": "#/$defs/disputePolicy" },
49
+ "capabilityRequirements": {
50
+ "type": "array",
51
+ "minItems": 1,
52
+ "items": { "$ref": "#/$defs/capabilityRequirement" }
53
+ },
54
+ "authoredBy": { "$ref": "#/$defs/did" },
55
+ "authoredAt": { "type": "string", "format": "date-time" },
56
+ "extensions": { "type": "object" }
57
+ },
58
+ "additionalProperties": false,
59
+ "allOf": [
60
+ {
61
+ "if": {
62
+ "type": "object",
63
+ "properties": { "calculation": { "type": "object", "properties": { "model": { "const": "outcome" } }, "required": ["model"] } },
64
+ "required": ["calculation"]
65
+ },
66
+ "then": {
67
+ "properties": {
68
+ "paymentCondition": {
69
+ "type": "object",
70
+ "properties": {
71
+ "type": { "const": "outcome_supported" },
72
+ "supportedEvaluationsRequired": { "type": "integer", "minimum": 1 }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ ],
79
+ "$defs": {
80
+ "did": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
81
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
82
+ "decimal": { "type": "string", "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]+)?$" },
83
+ "policyRef": {
84
+ "type": "object",
85
+ "required": ["ref", "version", "digest"],
86
+ "properties": {
87
+ "ref": { "type": "string", "format": "uri" },
88
+ "version": { "type": "string", "minLength": 1 },
89
+ "digest": { "$ref": "#/$defs/digest" }
90
+ },
91
+ "additionalProperties": false
92
+ },
93
+ "payer": {
94
+ "type": "object",
95
+ "required": ["did"],
96
+ "properties": {
97
+ "did": { "$ref": "#/$defs/did" },
98
+ "label": { "type": "string", "minLength": 1, "maxLength": 280 }
99
+ },
100
+ "additionalProperties": false
101
+ },
102
+ "payee": {
103
+ "type": "object",
104
+ "required": ["did", "recipient"],
105
+ "properties": {
106
+ "did": { "$ref": "#/$defs/did" },
107
+ "recipient": { "type": "string", "minLength": 1, "maxLength": 256 },
108
+ "label": { "type": "string", "minLength": 1, "maxLength": 280 }
109
+ },
110
+ "additionalProperties": false
111
+ },
112
+ "asset": {
113
+ "type": "object",
114
+ "required": ["id"],
115
+ "properties": {
116
+ "id": { "type": "string", "minLength": 1, "maxLength": 128 },
117
+ "decimals": { "type": "integer", "minimum": 0, "maximum": 30 }
118
+ },
119
+ "additionalProperties": false
120
+ },
121
+ "fixedCalculation": {
122
+ "type": "object",
123
+ "required": ["model", "amount"],
124
+ "properties": {
125
+ "model": { "const": "fixed" },
126
+ "amount": { "$ref": "#/$defs/decimal" }
127
+ },
128
+ "additionalProperties": false
129
+ },
130
+ "formulaCalculation": {
131
+ "type": "object",
132
+ "required": ["model", "formula"],
133
+ "properties": {
134
+ "model": { "const": "formula" },
135
+ "formula": { "$ref": "#/$defs/policyRef" },
136
+ "maximumAmount": { "$ref": "#/$defs/decimal" },
137
+ "requiredInputTypes": {
138
+ "type": "array",
139
+ "minItems": 1,
140
+ "uniqueItems": true,
141
+ "items": { "type": "string", "minLength": 1 }
142
+ }
143
+ },
144
+ "additionalProperties": false
145
+ },
146
+ "milestoneCalculation": {
147
+ "type": "object",
148
+ "required": ["model", "milestoneId", "amount"],
149
+ "properties": {
150
+ "model": { "const": "milestone" },
151
+ "milestoneId": { "type": "string", "minLength": 1, "maxLength": 256 },
152
+ "amount": { "$ref": "#/$defs/decimal" }
153
+ },
154
+ "additionalProperties": false
155
+ },
156
+ "outcomeCalculation": {
157
+ "type": "object",
158
+ "required": ["model", "rubric", "amountRule"],
159
+ "properties": {
160
+ "model": { "const": "outcome" },
161
+ "rubric": { "$ref": "#/$defs/policyRef" },
162
+ "amountRule": { "$ref": "#/$defs/policyRef" },
163
+ "maximumAmount": { "$ref": "#/$defs/decimal" }
164
+ },
165
+ "additionalProperties": false
166
+ },
167
+ "paymentCondition": {
168
+ "type": "object",
169
+ "required": ["type", "requiredEvidenceTypes", "deliveryDecisionRequired", "supportedEvaluationsRequired"],
170
+ "properties": {
171
+ "type": {
172
+ "enum": ["delivery_accepted", "milestone_accepted", "outcome_supported", "obligation_approved"]
173
+ },
174
+ "requiredEvidenceTypes": {
175
+ "type": "array",
176
+ "uniqueItems": true,
177
+ "items": { "type": "string", "minLength": 1 }
178
+ },
179
+ "deliveryDecisionRequired": { "type": "boolean" },
180
+ "supportedEvaluationsRequired": { "type": "integer", "minimum": 0, "maximum": 100 }
181
+ },
182
+ "additionalProperties": false
183
+ },
184
+ "timing": {
185
+ "type": "object",
186
+ "required": ["trigger"],
187
+ "properties": {
188
+ "trigger": { "enum": ["claim_approved", "fixed_date"] },
189
+ "dueWithin": { "type": "string", "pattern": "^P" },
190
+ "dueAt": { "type": "string", "format": "date-time" },
191
+ "timezone": { "type": "string", "minLength": 1 }
192
+ },
193
+ "additionalProperties": false,
194
+ "allOf": [
195
+ {
196
+ "if": { "type": "object", "properties": { "trigger": { "const": "claim_approved" } }, "required": ["trigger"] },
197
+ "then": { "properties": { "dueWithin": { "type": "string", "pattern": "^P" } }, "required": ["dueWithin"] }
198
+ },
199
+ {
200
+ "if": { "type": "object", "properties": { "trigger": { "const": "fixed_date" } }, "required": ["trigger"] },
201
+ "then": {
202
+ "properties": {
203
+ "dueAt": { "type": "string", "format": "date-time" },
204
+ "timezone": { "type": "string", "minLength": 1 }
205
+ },
206
+ "required": ["dueAt", "timezone"]
207
+ }
208
+ }
209
+ ]
210
+ },
211
+ "partialPayments": {
212
+ "type": "object",
213
+ "required": ["allowed"],
214
+ "properties": {
215
+ "allowed": { "type": "boolean" },
216
+ "minimumAmount": { "$ref": "#/$defs/decimal" },
217
+ "maximumInstallments": { "type": "integer", "minimum": 1, "maximum": 1000 }
218
+ },
219
+ "additionalProperties": false
220
+ },
221
+ "approvalPolicy": {
222
+ "type": "object",
223
+ "required": ["policy", "authorityDids", "requiredApprovals", "humanConfirmationRequired"],
224
+ "properties": {
225
+ "policy": { "$ref": "#/$defs/policyRef" },
226
+ "authorityDids": {
227
+ "type": "array",
228
+ "minItems": 1,
229
+ "uniqueItems": true,
230
+ "items": { "$ref": "#/$defs/did" }
231
+ },
232
+ "requiredApprovals": { "type": "integer", "minimum": 1, "maximum": 100 },
233
+ "humanConfirmationRequired": { "type": "boolean" }
234
+ },
235
+ "additionalProperties": false
236
+ },
237
+ "settlementPolicy": {
238
+ "type": "object",
239
+ "required": ["allowedPaymentRails", "fundingCheckRequired", "identityCheckRequired", "kycCheckRequired", "sanctionsCheckRequired", "humanConfirmationRequired"],
240
+ "properties": {
241
+ "allowedPaymentRails": {
242
+ "type": "array",
243
+ "minItems": 1,
244
+ "uniqueItems": true,
245
+ "items": { "type": "string", "minLength": 1, "maxLength": 128 }
246
+ },
247
+ "fundingCheckRequired": { "type": "boolean" },
248
+ "identityCheckRequired": { "type": "boolean" },
249
+ "kycCheckRequired": { "type": "boolean" },
250
+ "sanctionsCheckRequired": { "type": "boolean" },
251
+ "humanConfirmationRequired": { "type": "boolean" },
252
+ "humanConfirmationThreshold": { "$ref": "#/$defs/decimal" }
253
+ },
254
+ "additionalProperties": false
255
+ },
256
+ "disputePolicy": {
257
+ "type": "object",
258
+ "required": ["window", "authorityDids", "allowedRemedies"],
259
+ "properties": {
260
+ "window": { "type": "string", "pattern": "^P" },
261
+ "authorityDids": {
262
+ "type": "array",
263
+ "minItems": 1,
264
+ "uniqueItems": true,
265
+ "items": { "$ref": "#/$defs/did" }
266
+ },
267
+ "allowedRemedies": {
268
+ "type": "array",
269
+ "minItems": 1,
270
+ "uniqueItems": true,
271
+ "items": { "enum": ["withhold", "return_for_changes", "partial_payment", "refund", "recovery", "escalate"] }
272
+ }
273
+ },
274
+ "additionalProperties": false
275
+ },
276
+ "capabilityRequirement": {
277
+ "type": "object",
278
+ "required": ["action", "ability", "resource"],
279
+ "properties": {
280
+ "action": { "enum": ["submit_delivery", "accept_delivery", "evaluate", "approve", "record_claim", "record_settlement", "resolve_dispute"] },
281
+ "ability": { "type": "string", "minLength": 1 },
282
+ "resource": { "type": "string", "minLength": 1 }
283
+ },
284
+ "additionalProperties": false
285
+ }
286
+ }
287
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/topic-action-request.schema.json",
4
+ "title": "Topic Action Request v1",
5
+ "type": "object",
6
+ "required": ["version", "requestId", "topicId", "topicRevision", "actionType", "actionContractDigest", "executor", "inputs", "requestedBy", "requestedAt", "idempotencyKey", "confirmation", "capability"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "requestId": { "type": "string", "minLength": 1 },
10
+ "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}$" },
11
+ "topicRevision": { "type": "string", "minLength": 1 },
12
+ "actionType": { "type": "string", "pattern": "^qi/[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
13
+ "actionContractDigest": { "$ref": "#/$defs/digest" },
14
+ "executor": { "enum": ["qi-flow", "qiforge", "mcp"] },
15
+ "inputs": {
16
+ "type": "object",
17
+ "required": ["digest"],
18
+ "properties": { "digest": { "$ref": "#/$defs/digest" }, "ref": { "type": "string", "minLength": 1 } },
19
+ "additionalProperties": false
20
+ },
21
+ "requestedBy": { "type": "string", "pattern": "^did:" },
22
+ "requestedAt": { "type": "string", "format": "date-time" },
23
+ "idempotencyKey": { "type": "string", "minLength": 1 },
24
+ "confirmation": { "enum": ["not-required", "required", "confirmed"] },
25
+ "flowBindingId": { "type": "string", "minLength": 1 },
26
+ "capability": { "type": "string", "minLength": 1 }
27
+ },
28
+ "additionalProperties": false,
29
+ "$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
30
+ }
@@ -0,0 +1,66 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/topic-contract-body.schema.json",
4
+ "title": "Topic contract body v3",
5
+ "type": "object",
6
+ "required": ["version", "revision", "status", "kindRef", "authoredBy", "authoredAt", "workingMode", "baseRecipe", "shapeSources", "shapeDigest"],
7
+ "properties": {
8
+ "version": { "const": 3 },
9
+ "revision": { "type": "string", "minLength": 1 },
10
+ "status": { "enum": ["draft", "accepted", "superseded"] },
11
+ "kindRef": { "type": "object" },
12
+ "kindProfile": { "type": "object" },
13
+ "kindResource": { "type": "object" },
14
+ "authoredBy": { "type": "string", "minLength": 1 },
15
+ "authoredAt": { "type": "string", "format": "date-time" },
16
+ "workingMode": { "enum": ["solo", "team", "client"] },
17
+ "baseRecipe": { "enum": ["project", "flow", "proposal", "evaluation", "claims", "research", "discussion", "incident"] },
18
+ "topicRecipeRef": { "$ref": "#/$defs/digestRef" },
19
+ "shapeSources": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/shapeSource" } },
20
+ "shapeDigest": { "$ref": "#/$defs/digest" },
21
+ "claimBinding": { "type": "object", "required": ["entityDid", "collectionId"], "properties": { "entityDid": { "type": "string", "pattern": "^did:ixo:" }, "collectionId": { "type": "string", "minLength": 1 } }, "additionalProperties": false },
22
+ "locale": { "type": "string" },
23
+ "timezone": { "type": "string" },
24
+ "temporalMode": { "enum": ["finite", "ongoing"] },
25
+ "tags": { "type": "array", "items": { "type": "string" } },
26
+ "appearance": { "type": "object" },
27
+ "intent": { "type": "object" },
28
+ "outcome": { "type": "object" },
29
+ "completion": { "type": "object" },
30
+ "ownerId": { "type": "string" },
31
+ "scope": { "type": "object" },
32
+ "constraints": { "type": "array", "items": { "type": "object" } },
33
+ "assumptions": { "type": "array", "items": { "type": "object" } },
34
+ "questions": { "type": "array", "items": { "type": "object" } },
35
+ "risks": { "type": "array", "items": { "$ref": "#/$defs/risk" } },
36
+ "participants": { "type": "array", "items": { "type": "object" } },
37
+ "roles": { "type": "array", "items": { "type": "object" } },
38
+ "decision": { "type": "object" },
39
+ "plan": { "type": "object" },
40
+ "attachments": { "type": "array", "items": { "type": "object" } },
41
+ "fieldProvenance": {
42
+ "type": "object",
43
+ "propertyNames": { "pattern": "^/" },
44
+ "additionalProperties": { "$ref": "#/$defs/fieldProvenance" }
45
+ }
46
+ },
47
+ "additionalProperties": false,
48
+ "$defs": {
49
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
50
+ "digestRef": { "type": "object", "required": ["id", "version", "digest"], "properties": { "id": { "type": "string", "format": "uri" }, "version": { "type": "string", "minLength": 1 }, "digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false },
51
+ "shapeSource": { "type": "object", "required": ["kind", "id", "version", "digest"], "properties": { "kind": { "enum": ["base-recipe", "topic-recipe", "kind", "topic"] }, "id": { "type": "string", "format": "uri" }, "version": { "type": "string", "minLength": 1 }, "digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false },
52
+ "risk": { "type": "object", "required": ["id", "description", "status"], "properties": { "id": { "type": "string" }, "description": { "type": "string" }, "impact": { "enum": ["low", "medium", "high", "critical"] }, "status": { "enum": ["open", "mitigated", "accepted", "closed"] }, "owner": { "type": "string" }, "mitigation": { "type": "string" } }, "additionalProperties": false },
53
+ "fieldProvenance": {
54
+ "type": "object",
55
+ "required": ["basis", "acceptance", "sourceEventIds"],
56
+ "properties": {
57
+ "basis": { "enum": ["explicit", "contextual", "inferred", "suggested", "retrieved"] },
58
+ "acceptance": { "enum": ["proposed", "accepted", "rejected", "superseded"] },
59
+ "sourceEventIds": { "type": "array", "items": { "type": "string" } },
60
+ "createdBy": { "type": "string" },
61
+ "createdAt": { "type": "string", "format": "date-time" }
62
+ },
63
+ "additionalProperties": false
64
+ }
65
+ }
66
+ }