@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
@@ -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,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
+ }