@ixo/topic-protocol 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +4 -2
  2. package/dist/schemas/approval-decision.schema.json +30 -0
  3. package/dist/schemas/claim-record.schema.json +30 -0
  4. package/dist/schemas/delivery-decision.schema.json +28 -0
  5. package/dist/schemas/delivery-packet.schema.json +58 -0
  6. package/dist/schemas/evaluation-assertion.schema.json +37 -0
  7. package/dist/schemas/external-work-binding.schema.json +83 -0
  8. package/dist/schemas/external-work-state-map.schema.json +29 -0
  9. package/dist/schemas/settlement-receipt.schema.json +53 -0
  10. package/dist/schemas/topic-operation.schema.json +2 -2
  11. package/dist/schemas/topic-state.schema.json +14 -0
  12. package/dist/schemas/work-item-snapshot.schema.json +73 -0
  13. package/dist/src/contracts/schemas.d.ts +1355 -19
  14. package/dist/src/contracts/schemas.js +18 -0
  15. package/dist/src/contracts/schemas.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 +2 -0
  19. package/dist/src/index.js +2 -0
  20. package/dist/src/index.js.map +1 -1
  21. package/dist/src/projector/payload.d.ts +29 -0
  22. package/dist/src/projector/payload.js +83 -1
  23. package/dist/src/projector/payload.js.map +1 -1
  24. package/dist/src/projector/state.js +6 -0
  25. package/dist/src/projector/state.js.map +1 -1
  26. package/dist/src/projector/types.d.ts +3 -1
  27. package/dist/src/projector/types.js.map +1 -1
  28. package/dist/src/work-bridge/mapping.d.ts +2 -0
  29. package/dist/src/work-bridge/mapping.js +17 -0
  30. package/dist/src/work-bridge/mapping.js.map +1 -0
  31. package/dist/src/work-bridge/project.d.ts +7 -0
  32. package/dist/src/work-bridge/project.js +262 -0
  33. package/dist/src/work-bridge/project.js.map +1 -0
  34. package/dist/src/work-bridge/types.d.ts +232 -0
  35. package/dist/src/work-bridge/types.js +26 -0
  36. package/dist/src/work-bridge/types.js.map +1 -0
  37. package/package.json +1 -1
package/README.md CHANGED
@@ -9,7 +9,7 @@ identity of a discussion.
9
9
 
10
10
  ## Status
11
11
 
12
- **Version:** 0.6.0
12
+ **Version:** 0.7.0
13
13
 
14
14
  **Maturity:** Draft implementation candidate
15
15
  **Execution source of truth:** [Linear Topic Protocol project](https://linear.app/ixo-world/project/topic-protocol-4ea58bc7910d)
@@ -40,7 +40,7 @@ key-value adapter at its integration boundary.
40
40
 
41
41
  The package includes:
42
42
 
43
- - strict Draft 2020-12 validation for all 20 contracts, including Kind Profiles and Job Cards;
43
+ - strict Draft 2020-12 validation for all 29 contracts, including Kind Profiles, Job Cards, external work, delivery, evaluation, claims, and settlement receipts;
44
44
  - pinned, declarative Kind Profiles with safe standard-Kind fallback;
45
45
  - deterministic Topic-index reconciliation, structured search, and personal ranking;
46
46
  - deterministic Topic projection from a root and authorised operations;
@@ -50,6 +50,8 @@ The package includes:
50
50
  - restart-safe two-event Topic creation with duplicate suppression;
51
51
  - append-only Matrix operation parsing and room-upgrade anchor selection;
52
52
  - explicit conflict, duplicate-delivery, unauthorised, and unreachable handling;
53
+ - governed external-work bindings and immutable Delivery Packet handoff with separate evaluation, approval, claim, and settlement axes;
54
+ - fail-closed settlement projection that cannot promote tracker completion into approval or payment;
53
55
  - immutable caller inputs and typed protocol errors.
54
56
 
55
57
  Topics retain a singular conversational `kind` while linking any number of
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/approval-decision.schema.json",
4
+ "title": "Outcome approval decision v1",
5
+ "type": "object",
6
+ "required": ["version", "approvalId", "topicId", "deliveryPacketId", "deliveryPacketDigest", "evaluationIds", "decision", "policy", "decidedBy", "decidedAt", "capability", "digest"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "approvalId": { "$ref": "#/$defs/uuidV7" },
10
+ "topicId": { "$ref": "#/$defs/topicId" },
11
+ "deliveryPacketId": { "$ref": "#/$defs/uuidV7" },
12
+ "deliveryPacketDigest": { "$ref": "#/$defs/digest" },
13
+ "evaluationIds": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/uuidV7" } },
14
+ "decision": { "enum": ["approved", "rejected", "changes_requested", "superseded"] },
15
+ "reasons": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1, "maxLength": 2000 } },
16
+ "policy": { "type": "object", "required": ["ref", "version", "digest"], "properties": { "ref": { "type": "string", "format": "uri" }, "version": { "type": "string", "minLength": 1 }, "digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false },
17
+ "decidedBy": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" } },
18
+ "decidedAt": { "type": "string", "format": "date-time" },
19
+ "capability": { "type": "string", "minLength": 1 },
20
+ "digest": { "$ref": "#/$defs/digest" },
21
+ "extensions": { "type": "object" }
22
+ },
23
+ "$defs": {
24
+ "uuidV7": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
25
+ "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}$" },
26
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
27
+ },
28
+ "additionalProperties": false,
29
+ "allOf": [{ "if": { "properties": { "decision": { "enum": ["rejected", "changes_requested"] } }, "required": ["decision"] }, "then": { "properties": { "reasons": { "type": "array", "minItems": 1 } }, "required": ["reasons"] } }]
30
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/claim-record.schema.json",
4
+ "title": "Outcome claim record v1",
5
+ "type": "object",
6
+ "required": ["version", "claimId", "topicId", "deliveryPacketId", "deliveryPacketDigest", "evaluationIds", "approvalId", "claimantDid", "requested", "status", "replayKey", "source", "recordedAt", "digest"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "claimId": { "type": "string", "minLength": 1, "maxLength": 256 },
10
+ "topicId": { "$ref": "#/$defs/topicId" },
11
+ "deliveryPacketId": { "$ref": "#/$defs/uuidV7" },
12
+ "deliveryPacketDigest": { "$ref": "#/$defs/digest" },
13
+ "evaluationIds": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/uuidV7" } },
14
+ "approvalId": { "$ref": "#/$defs/uuidV7" },
15
+ "claimantDid": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
16
+ "requested": { "type": "object", "required": ["amount", "asset", "recipient"], "properties": { "amount": { "type": "string", "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]+)?$" }, "asset": { "type": "string", "minLength": 1, "maxLength": 128 }, "recipient": { "type": "string", "minLength": 1, "maxLength": 256 } }, "additionalProperties": false },
17
+ "status": { "enum": ["pending", "approved", "rejected", "disputed", "invalidated", "flagged"] },
18
+ "replayKey": { "type": "string", "minLength": 1, "maxLength": 256 },
19
+ "source": { "type": "object", "required": ["provider", "ref"], "properties": { "provider": { "type": "string", "pattern": "^[a-z][a-z0-9.-]{0,63}$" }, "ref": { "type": "string", "minLength": 1 } }, "additionalProperties": false },
20
+ "recordedAt": { "type": "string", "format": "date-time" },
21
+ "digest": { "$ref": "#/$defs/digest" },
22
+ "extensions": { "type": "object" }
23
+ },
24
+ "$defs": {
25
+ "uuidV7": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
26
+ "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}$" },
27
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
28
+ },
29
+ "additionalProperties": false
30
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/delivery-decision.schema.json",
4
+ "title": "Delivery handoff decision v1",
5
+ "type": "object",
6
+ "required": ["version", "decisionId", "topicId", "deliveryPacketId", "deliveryPacketDigest", "decision", "decidedBy", "decidedAt", "capability", "digest"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "decisionId": { "$ref": "#/$defs/uuidV7" },
10
+ "topicId": { "$ref": "#/$defs/topicId" },
11
+ "deliveryPacketId": { "$ref": "#/$defs/uuidV7" },
12
+ "deliveryPacketDigest": { "$ref": "#/$defs/digest" },
13
+ "decision": { "enum": ["accepted", "returned", "rejected"] },
14
+ "reasons": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1, "maxLength": 2000 } },
15
+ "decidedBy": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
16
+ "decidedAt": { "type": "string", "format": "date-time" },
17
+ "capability": { "type": "string", "minLength": 1 },
18
+ "digest": { "$ref": "#/$defs/digest" },
19
+ "extensions": { "type": "object" }
20
+ },
21
+ "$defs": {
22
+ "uuidV7": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
23
+ "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}$" },
24
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
25
+ },
26
+ "additionalProperties": false,
27
+ "allOf": [{ "if": { "properties": { "decision": { "enum": ["returned", "rejected"] } }, "required": ["decision"] }, "then": { "properties": { "reasons": { "type": "array", "minItems": 1 } }, "required": ["reasons"] } }]
28
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/delivery-packet.schema.json",
4
+ "title": "Delivery Packet v1",
5
+ "type": "object",
6
+ "required": ["version", "deliveryPacketId", "sequence", "topicId", "bindingId", "contract", "workItemSnapshot", "deliverables", "evidence", "traces", "submittedBy", "submittedAt", "capability", "status", "digest"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "deliveryPacketId": { "$ref": "#/$defs/uuidV7" },
10
+ "sequence": { "type": "integer", "minimum": 1 },
11
+ "topicId": { "$ref": "#/$defs/topicId" },
12
+ "bindingId": { "$ref": "#/$defs/uuidV7" },
13
+ "supersedes": { "$ref": "#/$defs/uuidV7" },
14
+ "contract": {
15
+ "type": "object",
16
+ "required": ["revision", "digest", "status"],
17
+ "properties": {
18
+ "revision": { "type": "string", "minLength": 1 },
19
+ "digest": { "$ref": "#/$defs/digest" },
20
+ "status": { "const": "accepted" }
21
+ },
22
+ "additionalProperties": false
23
+ },
24
+ "workItemSnapshot": {
25
+ "type": "object",
26
+ "required": ["snapshotId", "ref", "digest"],
27
+ "properties": {
28
+ "snapshotId": { "$ref": "#/$defs/uuidV7" },
29
+ "ref": { "type": "string", "format": "uri" },
30
+ "digest": { "$ref": "#/$defs/digest" }
31
+ },
32
+ "additionalProperties": false
33
+ },
34
+ "deliverables": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/artifact" } },
35
+ "evidence": { "type": "array", "items": { "$ref": "#/$defs/evidence" } },
36
+ "traces": { "type": "array", "items": { "$ref": "#/$defs/artifact" } },
37
+ "paymentTerms": {
38
+ "type": "object",
39
+ "required": ["ref", "digest"],
40
+ "properties": { "ref": { "type": "string", "format": "uri" }, "digest": { "$ref": "#/$defs/digest" } },
41
+ "additionalProperties": false
42
+ },
43
+ "submittedBy": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
44
+ "submittedAt": { "type": "string", "format": "date-time" },
45
+ "capability": { "type": "string", "minLength": 1 },
46
+ "status": { "const": "submitted" },
47
+ "digest": { "$ref": "#/$defs/digest" },
48
+ "extensions": { "type": "object" }
49
+ },
50
+ "$defs": {
51
+ "uuidV7": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
52
+ "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}$" },
53
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
54
+ "artifact": { "type": "object", "required": ["type", "uri", "digest"], "properties": { "type": { "type": "string", "minLength": 1 }, "uri": { "type": "string", "format": "uri" }, "digest": { "$ref": "#/$defs/digest" }, "label": { "type": "string", "minLength": 1 }, "mediaType": { "type": "string", "minLength": 1 } }, "additionalProperties": false },
55
+ "evidence": { "type": "object", "required": ["type", "uri", "digest", "provenanceClass"], "properties": { "type": { "type": "string", "minLength": 1 }, "uri": { "type": "string", "format": "uri" }, "digest": { "$ref": "#/$defs/digest" }, "provenanceClass": { "enum": ["claimant_provided", "client_assisted", "server_verified", "third_party_attested"] }, "label": { "type": "string", "minLength": 1 } }, "additionalProperties": false }
56
+ },
57
+ "additionalProperties": false
58
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/evaluation-assertion.schema.json",
4
+ "title": "Evaluation assertion v1",
5
+ "type": "object",
6
+ "required": ["version", "evaluationId", "topicId", "deliveryPacketId", "deliveryPacketDigest", "rubric", "evidenceDigests", "traceDigests", "outcome", "result", "evaluatorDid", "evaluatedAt", "capability", "signature", "digest"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "evaluationId": { "$ref": "#/$defs/uuidV7" },
10
+ "topicId": { "$ref": "#/$defs/topicId" },
11
+ "deliveryPacketId": { "$ref": "#/$defs/uuidV7" },
12
+ "deliveryPacketDigest": { "$ref": "#/$defs/digest" },
13
+ "rubric": {
14
+ "type": "object",
15
+ "required": ["id", "version", "ref", "digest", "governanceStatus"],
16
+ "properties": { "id": { "type": "string", "minLength": 1 }, "version": { "type": "string", "minLength": 1 }, "ref": { "type": "string", "format": "uri" }, "digest": { "$ref": "#/$defs/digest" }, "governanceStatus": { "const": "approved" } },
17
+ "additionalProperties": false
18
+ },
19
+ "evidenceDigests": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/digest" } },
20
+ "traceDigests": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/digest" } },
21
+ "outcome": { "enum": ["supported", "refuted", "insufficient_evidence", "human_review", "disputed", "superseded"] },
22
+ "confidence": { "type": "number", "minimum": 0, "maximum": 1 },
23
+ "result": { "type": "object" },
24
+ "evaluatorDid": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
25
+ "evaluatedAt": { "type": "string", "format": "date-time" },
26
+ "capability": { "type": "string", "minLength": 1 },
27
+ "signature": { "type": "object", "required": ["type", "verificationMethod", "value"], "properties": { "type": { "type": "string", "minLength": 1 }, "verificationMethod": { "type": "string", "format": "uri" }, "value": { "type": "string", "minLength": 1 } }, "additionalProperties": false },
28
+ "digest": { "$ref": "#/$defs/digest" },
29
+ "extensions": { "type": "object" }
30
+ },
31
+ "$defs": {
32
+ "uuidV7": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
33
+ "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}$" },
34
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
35
+ },
36
+ "additionalProperties": false
37
+ }
@@ -0,0 +1,83 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/external-work-binding.schema.json",
4
+ "title": "External work binding v1",
5
+ "type": "object",
6
+ "required": ["version", "bindingId", "topicId", "role", "createdFrom", "external", "syncPolicy", "workState", "checkpoint", "identity", "health", "createdBy", "createdAt"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "bindingId": { "$ref": "#/$defs/uuidV7" },
10
+ "topicId": { "$ref": "#/$defs/topicId" },
11
+ "role": { "enum": ["primary", "child", "related", "verification", "delivery"] },
12
+ "createdFrom": { "enum": ["topic", "external"] },
13
+ "external": {
14
+ "type": "object",
15
+ "required": ["provider", "resourceType", "organizationId", "resourceId", "identifier", "url"],
16
+ "properties": {
17
+ "provider": { "type": "string", "pattern": "^[a-z][a-z0-9.-]{0,63}$" },
18
+ "resourceType": { "type": "string", "minLength": 1, "maxLength": 80 },
19
+ "organizationId": { "type": "string", "minLength": 1, "maxLength": 256 },
20
+ "teamId": { "type": "string", "minLength": 1, "maxLength": 256 },
21
+ "resourceId": { "type": "string", "minLength": 1, "maxLength": 256 },
22
+ "identifier": { "type": "string", "minLength": 1, "maxLength": 128 },
23
+ "url": { "type": "string", "format": "uri" }
24
+ },
25
+ "additionalProperties": false
26
+ },
27
+ "syncPolicy": {
28
+ "type": "object",
29
+ "required": ["mode", "direction", "comments", "files", "delete", "fieldPolicy"],
30
+ "properties": {
31
+ "mode": { "enum": ["link_only", "governed_projection"] },
32
+ "direction": { "enum": ["external_to_topic", "topic_to_external", "bidirectional"] },
33
+ "comments": { "enum": ["none", "explicit_promote"] },
34
+ "files": { "enum": ["none", "reference_only", "explicit_ingest"] },
35
+ "delete": { "const": "tombstone" },
36
+ "fieldPolicy": {
37
+ "type": "object",
38
+ "required": ["id", "version", "digest"],
39
+ "properties": {
40
+ "id": { "type": "string", "format": "uri" },
41
+ "version": { "type": "integer", "minimum": 1 },
42
+ "digest": { "$ref": "#/$defs/digest" }
43
+ },
44
+ "additionalProperties": false
45
+ }
46
+ },
47
+ "additionalProperties": false
48
+ },
49
+ "workState": { "enum": ["planned", "ready", "in_progress", "blocked", "handoff_ready", "handed_off", "cancelled"] },
50
+ "checkpoint": {
51
+ "type": "object",
52
+ "required": ["topicRevision", "syncedAt"],
53
+ "properties": {
54
+ "topicRevision": { "type": "string", "minLength": 1 },
55
+ "effectiveContractDigest": { "$ref": "#/$defs/digest" },
56
+ "externalUpdatedAt": { "type": "string", "format": "date-time" },
57
+ "externalSnapshotDigest": { "$ref": "#/$defs/digest" },
58
+ "lastEventId": { "type": "string", "minLength": 1, "maxLength": 256 },
59
+ "syncedAt": { "type": "string", "format": "date-time" }
60
+ },
61
+ "additionalProperties": false
62
+ },
63
+ "identity": {
64
+ "type": "object",
65
+ "required": ["bridgeDid"],
66
+ "properties": {
67
+ "bridgeDid": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
68
+ "externalAppActorId": { "type": "string", "minLength": 1, "maxLength": 256 }
69
+ },
70
+ "additionalProperties": false
71
+ },
72
+ "health": { "enum": ["up_to_date", "changes_pending", "degraded", "disconnected", "conflicted", "permission_lost"] },
73
+ "createdBy": { "type": "string", "minLength": 1 },
74
+ "createdAt": { "type": "string", "format": "date-time" },
75
+ "extensions": { "type": "object" }
76
+ },
77
+ "$defs": {
78
+ "uuidV7": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
79
+ "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}$" },
80
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
81
+ },
82
+ "additionalProperties": false
83
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/external-work-state-map.schema.json",
4
+ "title": "External work state mapping profile v1",
5
+ "type": "object",
6
+ "required": ["version", "profileId", "provider", "organizationId", "teamId", "mappings"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "profileId": { "type": "string", "format": "uri" },
10
+ "provider": { "type": "string", "pattern": "^[a-z][a-z0-9.-]{0,63}$" },
11
+ "organizationId": { "type": "string", "minLength": 1, "maxLength": 256 },
12
+ "teamId": { "type": "string", "minLength": 1, "maxLength": 256 },
13
+ "mappings": {
14
+ "type": "array",
15
+ "minItems": 1,
16
+ "items": {
17
+ "type": "object",
18
+ "required": ["workflowStateId", "category", "workState"],
19
+ "properties": {
20
+ "workflowStateId": { "type": "string", "minLength": 1, "maxLength": 256 },
21
+ "category": { "enum": ["triage", "backlog", "unstarted", "started", "completed", "canceled"] },
22
+ "workState": { "enum": ["planned", "ready", "in_progress", "blocked", "handoff_ready", "handed_off", "cancelled"] }
23
+ },
24
+ "additionalProperties": false
25
+ }
26
+ }
27
+ },
28
+ "additionalProperties": false
29
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/settlement-receipt.schema.json",
4
+ "title": "Settlement receipt v1",
5
+ "type": "object",
6
+ "required": ["version", "settlementId", "topicId", "claimId", "deliveryPacketId", "deliveryPacketDigest", "evaluationIds", "approvalId", "policy", "idempotencyKey", "amount", "asset", "recipient", "paymentRail", "state", "finality", "signerDid", "recordedAt", "capability", "digest"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "settlementId": { "$ref": "#/$defs/uuidV7" },
10
+ "topicId": { "$ref": "#/$defs/topicId" },
11
+ "claimId": { "type": "string", "minLength": 1, "maxLength": 256 },
12
+ "deliveryPacketId": { "$ref": "#/$defs/uuidV7" },
13
+ "deliveryPacketDigest": { "$ref": "#/$defs/digest" },
14
+ "evaluationIds": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/uuidV7" } },
15
+ "approvalId": { "$ref": "#/$defs/uuidV7" },
16
+ "policy": { "type": "object", "required": ["ref", "digest"], "properties": { "ref": { "type": "string", "format": "uri" }, "digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false },
17
+ "idempotencyKey": { "type": "string", "minLength": 1, "maxLength": 512 },
18
+ "amount": { "type": "string", "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]+)?$" },
19
+ "asset": { "type": "string", "minLength": 1, "maxLength": 128 },
20
+ "recipient": { "type": "string", "minLength": 1, "maxLength": 256 },
21
+ "paymentRail": { "type": "string", "minLength": 1, "maxLength": 128 },
22
+ "transactionReference": { "type": "string", "minLength": 1, "maxLength": 512 },
23
+ "state": { "enum": ["unfunded", "funded", "held", "authorised", "submitted", "confirmed", "failed", "refunded"] },
24
+ "finality": { "type": "object", "required": ["state"], "properties": { "state": { "enum": ["pending", "confirmed", "failed"] }, "confirmations": { "type": "integer", "minimum": 0 }, "confirmedAt": { "type": "string", "format": "date-time" } }, "additionalProperties": false },
25
+ "signerDid": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
26
+ "recordedAt": { "type": "string", "format": "date-time" },
27
+ "capability": { "type": "string", "minLength": 1 },
28
+ "digest": { "$ref": "#/$defs/digest" },
29
+ "extensions": { "type": "object" }
30
+ },
31
+ "$defs": {
32
+ "uuidV7": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
33
+ "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}$" },
34
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
35
+ },
36
+ "additionalProperties": false,
37
+ "allOf": [
38
+ {
39
+ "if": { "properties": { "state": { "const": "confirmed" } }, "required": ["state"] },
40
+ "then": {
41
+ "required": ["transactionReference"],
42
+ "properties": {
43
+ "transactionReference": { "type": "string", "minLength": 1, "maxLength": 512 },
44
+ "finality": {
45
+ "type": "object",
46
+ "properties": { "state": { "const": "confirmed" }, "confirmedAt": { "type": "string", "format": "date-time" } },
47
+ "required": ["state", "confirmedAt"]
48
+ }
49
+ }
50
+ }
51
+ }
52
+ ]
53
+ }
@@ -8,7 +8,7 @@
8
8
  "version": { "enum": [1, 2] },
9
9
  "operationId": { "type": "string", "minLength": 1 },
10
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
- "type": { "type": "string", "enum": ["rename", "change-status", "update-overview", "link-context", "unlink-context", "attach-files", "detach-files", "record-decision", "propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation", "redirect", "branch", "merge", "resolve-conflict"] },
11
+ "type": { "type": "string", "enum": ["rename", "change-status", "update-overview", "link-context", "unlink-context", "attach-files", "detach-files", "record-decision", "propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation", "bind-external-work", "sync-external-work", "unlink-external-work", "submit-delivery", "record-delivery-decision", "record-evaluation", "record-approval", "record-claim", "record-settlement", "redirect", "branch", "merge", "resolve-conflict"] },
12
12
  "previousRevision": { "type": "string", "minLength": 1 },
13
13
  "actor": { "type": "string", "minLength": 1 },
14
14
  "createdAt": { "type": "string", "format": "date-time" },
@@ -20,7 +20,7 @@
20
20
  {
21
21
  "if": {
22
22
  "properties": {
23
- "type": { "enum": ["propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation"] }
23
+ "type": { "enum": ["propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation", "bind-external-work", "sync-external-work", "unlink-external-work", "submit-delivery", "record-delivery-decision", "record-evaluation", "record-approval", "record-claim", "record-settlement"] }
24
24
  },
25
25
  "required": ["type"]
26
26
  },
@@ -33,6 +33,20 @@
33
33
  ]
34
34
  }
35
35
  },
36
+ "workBridge": {
37
+ "type": "object",
38
+ "required": ["bindings", "deliveryPackets", "deliveryDecisions", "evaluations", "approvals", "claims", "settlements"],
39
+ "properties": {
40
+ "bindings": { "type": "array", "items": { "type": "object", "required": ["bindingId", "topicId", "workState", "health", "lastOperationId"], "properties": { "bindingId": { "type": "string" }, "topicId": { "type": "string" }, "workState": { "type": "string" }, "health": { "type": "string" }, "lastOperationId": { "type": "string" } } } },
41
+ "deliveryPackets": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/delivery-packet.schema.json" } },
42
+ "deliveryDecisions": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/delivery-decision.schema.json" } },
43
+ "evaluations": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/evaluation-assertion.schema.json" } },
44
+ "approvals": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/approval-decision.schema.json" } },
45
+ "claims": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/claim-record.schema.json" } },
46
+ "settlements": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/settlement-receipt.schema.json" } }
47
+ },
48
+ "additionalProperties": false
49
+ },
36
50
  "basedOnEvents": { "type": "array", "items": { "type": "string", "pattern": "^\\$" } },
37
51
  "conflicts": { "type": "array", "items": { "type": "string" } }
38
52
  },
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/work-item-snapshot.schema.json",
4
+ "title": "External work item snapshot v1",
5
+ "type": "object",
6
+ "required": ["version", "snapshotId", "bindingId", "topicId", "source", "title", "workflowState", "planning", "relations", "attachments", "promotedComments", "sourceCreatedAt", "sourceUpdatedAt", "retrievedAt", "digest"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "snapshotId": { "$ref": "#/$defs/uuidV7" },
10
+ "bindingId": { "$ref": "#/$defs/uuidV7" },
11
+ "topicId": { "$ref": "#/$defs/topicId" },
12
+ "source": {
13
+ "type": "object",
14
+ "required": ["provider", "organizationId", "resourceId", "identifier", "url"],
15
+ "properties": {
16
+ "provider": { "type": "string", "pattern": "^[a-z][a-z0-9.-]{0,63}$" },
17
+ "organizationId": { "type": "string", "minLength": 1 },
18
+ "teamId": { "type": "string", "minLength": 1 },
19
+ "resourceId": { "type": "string", "minLength": 1 },
20
+ "identifier": { "type": "string", "minLength": 1 },
21
+ "url": { "type": "string", "format": "uri" }
22
+ },
23
+ "additionalProperties": false
24
+ },
25
+ "title": { "type": "string", "minLength": 1, "maxLength": 512 },
26
+ "descriptionMarkdown": { "type": "string", "maxLength": 200000 },
27
+ "workflowState": {
28
+ "type": "object",
29
+ "required": ["id", "name", "category", "mappedWorkState", "mappingProfileId", "mappingVersion"],
30
+ "properties": {
31
+ "id": { "type": "string", "minLength": 1 },
32
+ "name": { "type": "string", "minLength": 1 },
33
+ "category": { "enum": ["triage", "backlog", "unstarted", "started", "completed", "canceled"] },
34
+ "mappedWorkState": { "enum": ["planned", "ready", "in_progress", "blocked", "handoff_ready", "handed_off", "cancelled"] },
35
+ "mappingProfileId": { "type": "string", "format": "uri" },
36
+ "mappingVersion": { "type": "integer", "minimum": 1 }
37
+ },
38
+ "additionalProperties": false
39
+ },
40
+ "assignee": { "$ref": "#/$defs/externalActor" },
41
+ "delegate": { "$ref": "#/$defs/externalActor" },
42
+ "planning": {
43
+ "type": "object",
44
+ "required": ["labels"],
45
+ "properties": {
46
+ "priority": { "type": "integer", "minimum": 0 },
47
+ "estimate": { "type": "number", "minimum": 0 },
48
+ "projectId": { "type": "string", "minLength": 1 },
49
+ "cycleId": { "type": "string", "minLength": 1 },
50
+ "dueDate": { "type": "string", "format": "date" },
51
+ "labels": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
52
+ },
53
+ "additionalProperties": false
54
+ },
55
+ "relations": { "type": "array", "items": { "type": "object", "required": ["type", "resourceId"], "properties": { "type": { "type": "string", "minLength": 1 }, "resourceId": { "type": "string", "minLength": 1 }, "url": { "type": "string", "format": "uri" } }, "additionalProperties": false } },
56
+ "attachments": { "type": "array", "items": { "$ref": "#/$defs/sourceReference" } },
57
+ "promotedComments": { "type": "array", "items": { "$ref": "#/$defs/sourceReference" } },
58
+ "sourceCreatedAt": { "type": "string", "format": "date-time" },
59
+ "sourceUpdatedAt": { "type": "string", "format": "date-time" },
60
+ "retrievedAt": { "type": "string", "format": "date-time" },
61
+ "sourceEventId": { "type": "string", "minLength": 1 },
62
+ "digest": { "$ref": "#/$defs/digest" },
63
+ "extensions": { "type": "object" }
64
+ },
65
+ "$defs": {
66
+ "uuidV7": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
67
+ "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}$" },
68
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
69
+ "externalActor": { "type": "object", "required": ["id"], "properties": { "id": { "type": "string", "minLength": 1 }, "displayName": { "type": "string", "minLength": 1 }, "did": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" } }, "additionalProperties": false },
70
+ "sourceReference": { "type": "object", "required": ["id", "url", "digest"], "properties": { "id": { "type": "string", "minLength": 1 }, "url": { "type": "string", "format": "uri" }, "digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false }
71
+ },
72
+ "additionalProperties": false
73
+ }