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

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 (60) 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 +57 -0
  6. package/dist/schemas/topic-contract-state.schema.json +22 -329
  7. package/dist/schemas/topic-operation.schema.json +2 -2
  8. package/dist/schemas/topic-recipe.schema.json +19 -0
  9. package/dist/schemas/topic-root.schema.json +21 -1
  10. package/dist/schemas/topic-shape.schema.json +80 -0
  11. package/dist/src/contracts/schemas.d.ts +4448 -2534
  12. package/dist/src/contracts/schemas.js +12 -0
  13. package/dist/src/contracts/schemas.js.map +1 -1
  14. package/dist/src/contracts/topic-contract.d.ts +44 -5
  15. package/dist/src/contracts/topic-contract.js +3 -1
  16. package/dist/src/contracts/topic-contract.js.map +1 -1
  17. package/dist/src/errors.d.ts +1 -1
  18. package/dist/src/errors.js.map +1 -1
  19. package/dist/src/index.d.ts +10 -2
  20. package/dist/src/index.js +9 -1
  21. package/dist/src/index.js.map +1 -1
  22. package/dist/src/projector/payload.d.ts +34 -0
  23. package/dist/src/projector/payload.js +93 -2
  24. package/dist/src/projector/payload.js.map +1 -1
  25. package/dist/src/projector/state.js +54 -0
  26. package/dist/src/projector/state.js.map +1 -1
  27. package/dist/src/projector/types.d.ts +52 -2
  28. package/dist/src/projector/types.js.map +1 -1
  29. package/dist/src/shapes/canonical.d.ts +2 -0
  30. package/dist/src/shapes/canonical.js +20 -0
  31. package/dist/src/shapes/canonical.js.map +1 -0
  32. package/dist/src/shapes/claims.d.ts +12 -0
  33. package/dist/src/shapes/claims.js +20 -0
  34. package/dist/src/shapes/claims.js.map +1 -0
  35. package/dist/src/shapes/now.d.ts +2 -0
  36. package/dist/src/shapes/now.js +61 -0
  37. package/dist/src/shapes/now.js.map +1 -0
  38. package/dist/src/shapes/progress.d.ts +3 -0
  39. package/dist/src/shapes/progress.js +490 -0
  40. package/dist/src/shapes/progress.js.map +1 -0
  41. package/dist/src/shapes/recipes.d.ts +5 -0
  42. package/dist/src/shapes/recipes.js +386 -0
  43. package/dist/src/shapes/recipes.js.map +1 -0
  44. package/dist/src/shapes/resolver.d.ts +14 -0
  45. package/dist/src/shapes/resolver.js +121 -0
  46. package/dist/src/shapes/resolver.js.map +1 -0
  47. package/dist/src/shapes/state.d.ts +105 -0
  48. package/dist/src/shapes/state.js +3 -0
  49. package/dist/src/shapes/state.js.map +1 -0
  50. package/dist/src/shapes/types.d.ts +392 -0
  51. package/dist/src/shapes/types.js +44 -0
  52. package/dist/src/shapes/types.js.map +1 -0
  53. package/package.json +3 -1
  54. package/recipes/README.md +12 -0
  55. package/recipes/agent-delivery.json +740 -0
  56. package/recipes/registry.json +41 -0
  57. package/recipes/research-brief.json +578 -0
  58. package/recipes/verified-work-payment.json +801 -0
  59. package/templates/decision-to-pay/README.md +27 -19
  60. 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,57 @@
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 v4",
5
+ "type": "object",
6
+ "required": ["version", "revision", "kindRef", "authoredBy", "authoredAt", "workingMode", "baseRecipe", "shapeSources", "shapeDigest"],
7
+ "properties": {
8
+ "version": { "const": 4 },
9
+ "revision": { "type": "string", "minLength": 1 },
10
+ "kindRef": { "type": "object" },
11
+ "kindProfile": { "type": "object" },
12
+ "kindResource": { "type": "object" },
13
+ "authoredBy": { "type": "string", "minLength": 1 },
14
+ "authoredAt": { "type": "string", "format": "date-time" },
15
+ "workingMode": { "enum": ["solo", "team", "client"] },
16
+ "baseRecipe": { "enum": ["project", "flow", "proposal", "evaluation", "claims", "research", "discussion", "incident"] },
17
+ "topicRecipeRef": { "$ref": "#/$defs/digestRef" },
18
+ "shapeSources": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/shapeSource" } },
19
+ "shapeDigest": { "$ref": "#/$defs/digest" },
20
+ "claimBinding": { "type": "object", "required": ["entityDid", "collectionId"], "properties": { "entityDid": { "type": "string", "pattern": "^did:ixo:" }, "collectionId": { "type": "string", "minLength": 1 } }, "additionalProperties": false },
21
+ "activationPolicy": { "$ref": "#/$defs/activationPolicy" },
22
+ "assentPolicy": { "$ref": "#/$defs/assentPolicy" },
23
+ "locale": { "type": "string" },
24
+ "timezone": { "type": "string" },
25
+ "temporalMode": { "enum": ["finite", "ongoing"] },
26
+ "tags": { "type": "array", "items": { "type": "string" } },
27
+ "appearance": { "type": "object" },
28
+ "intent": { "type": "object" },
29
+ "outcome": { "type": "object" },
30
+ "completion": { "type": "object" },
31
+ "ownerId": { "type": "string" },
32
+ "scope": { "type": "object" },
33
+ "constraints": { "type": "array", "items": { "type": "object" } },
34
+ "assumptions": { "type": "array", "items": { "type": "object" } },
35
+ "questions": { "type": "array", "items": { "type": "object" } },
36
+ "risks": { "type": "array", "items": { "$ref": "#/$defs/risk" } },
37
+ "participants": { "type": "array", "items": { "type": "object" } },
38
+ "roles": { "type": "array", "items": { "type": "object" } },
39
+ "decision": { "type": "object" },
40
+ "plan": { "type": "object" },
41
+ "attachments": { "type": "array", "items": { "type": "object" } },
42
+ "fieldProvenance": { "type": "object", "propertyNames": { "pattern": "^/" }, "additionalProperties": { "$ref": "#/$defs/fieldProvenance" } }
43
+ },
44
+ "additionalProperties": false,
45
+ "$defs": {
46
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
47
+ "digestRef": { "type": "object", "required": ["id", "version", "digest"], "properties": { "id": { "type": "string", "format": "uri" }, "version": { "type": "string", "minLength": 1 }, "digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false },
48
+ "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 },
49
+ "subject": { "type": "object", "required": ["kind", "id"], "properties": { "kind": { "enum": ["actor", "role"] }, "id": { "type": "string", "minLength": 1 } }, "additionalProperties": false },
50
+ "confirmationRule": { "type": "object", "required": ["mode", "subjects"], "properties": { "mode": { "enum": ["any", "all", "threshold"] }, "subjects": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/subject" } }, "threshold": { "type": "integer", "minimum": 1 } }, "additionalProperties": false },
51
+ "assentPolicy": { "type": "object", "required": ["mode", "signatories"], "properties": { "mode": { "enum": ["any", "all", "threshold"] }, "signatories": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/subject" } }, "threshold": { "type": "integer", "minimum": 1 } }, "additionalProperties": false },
52
+ "disputePolicy": { "type": "object", "properties": { "resolvers": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/subject" } }, "process": { "type": "object", "required": ["kind", "id"], "properties": { "kind": { "enum": ["flow", "resource"] }, "id": { "type": "string", "minLength": 1 }, "label": { "type": "string" } }, "additionalProperties": false } }, "additionalProperties": false },
53
+ "activationPolicy": { "type": "object", "properties": { "editors": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/subject" } }, "confirmation": { "$ref": "#/$defs/confirmationRule" }, "lifecycle": { "type": "object", "required": ["onExpiry"], "properties": { "effectiveAt": { "type": "string", "format": "date-time" }, "reviewAt": { "type": "string", "format": "date-time" }, "expiresAt": { "type": "string", "format": "date-time" }, "onExpiry": { "const": "pause-consequential" } }, "additionalProperties": false }, "dispute": { "$ref": "#/$defs/disputePolicy" } }, "additionalProperties": false },
54
+ "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 },
55
+ "fieldProvenance": { "type": "object", "required": ["basis", "acceptance", "sourceEventIds"], "properties": { "basis": { "enum": ["explicit", "contextual", "inferred", "suggested", "retrieved"] }, "acceptance": { "enum": ["proposed", "accepted", "rejected", "superseded"] }, "sourceEventIds": { "type": "array", "items": { "type": "string" } }, "createdBy": { "type": "string" }, "createdAt": { "type": "string", "format": "date-time" } }, "additionalProperties": false }
56
+ }
57
+ }