@ixo/topic-protocol 0.6.0 → 0.8.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.
- package/README.md +6 -2
- package/dist/schemas/action-receipt.schema.json +105 -11
- package/dist/schemas/approval-decision.schema.json +30 -0
- package/dist/schemas/claim-record.schema.json +30 -0
- package/dist/schemas/decision-to-pay-template.schema.json +346 -0
- package/dist/schemas/delivery-decision.schema.json +28 -0
- package/dist/schemas/delivery-packet.schema.json +58 -0
- package/dist/schemas/evaluation-assertion.schema.json +37 -0
- package/dist/schemas/external-work-binding.schema.json +83 -0
- package/dist/schemas/external-work-state-map.schema.json +29 -0
- package/dist/schemas/payable-obligation.schema.json +312 -0
- package/dist/schemas/payment-terms.schema.json +287 -0
- package/dist/schemas/settlement-receipt.schema.json +53 -0
- package/dist/schemas/topic-action-request.schema.json +30 -0
- package/dist/schemas/topic-contract-state.schema.json +29 -3
- package/dist/schemas/topic-flow-binding.schema.json +28 -0
- package/dist/schemas/topic-kind-profile.schema.json +32 -2
- package/dist/schemas/topic-operation.schema.json +2 -2
- package/dist/schemas/topic-state.schema.json +14 -0
- package/dist/schemas/work-item-snapshot.schema.json +73 -0
- package/dist/src/action-runtime/types.d.ts +101 -0
- package/dist/src/action-runtime/types.js +12 -0
- package/dist/src/action-runtime/types.js.map +1 -0
- package/dist/src/contracts/schemas.d.ts +3611 -130
- package/dist/src/contracts/schemas.js +28 -0
- package/dist/src/contracts/schemas.js.map +1 -1
- package/dist/src/contracts/topic-contract.d.ts +8 -1
- package/dist/src/contracts/topic-contract.js.map +1 -1
- package/dist/src/contracts/topic-kind-profile.d.ts +29 -0
- package/dist/src/contracts/topic-kind-profile.js +31 -0
- package/dist/src/contracts/topic-kind-profile.js.map +1 -1
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/errors.js.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.js +4 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/projector/payload.d.ts +47 -0
- package/dist/src/projector/payload.js +140 -2
- package/dist/src/projector/payload.js.map +1 -1
- package/dist/src/projector/state.js +150 -0
- package/dist/src/projector/state.js.map +1 -1
- package/dist/src/projector/types.d.ts +15 -3
- package/dist/src/projector/types.js.map +1 -1
- package/dist/src/work-bridge/mapping.d.ts +2 -0
- package/dist/src/work-bridge/mapping.js +17 -0
- package/dist/src/work-bridge/mapping.js.map +1 -0
- package/dist/src/work-bridge/project.d.ts +7 -0
- package/dist/src/work-bridge/project.js +262 -0
- package/dist/src/work-bridge/project.js.map +1 -0
- package/dist/src/work-bridge/types.d.ts +232 -0
- package/dist/src/work-bridge/types.js +26 -0
- package/dist/src/work-bridge/types.js.map +1 -0
- package/package.json +4 -2
- package/templates/decision-to-pay/README.md +59 -0
- package/templates/decision-to-pay/milestone-payment-release.template.json +195 -0
- package/templates/decision-to-pay/outcome-payment-claim.template.json +198 -0
- package/templates/decision-to-pay/payment-on-delivery.template.json +198 -0
- package/templates/decision-to-pay/verified-work-payment.template.json +283 -0
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export declare const TOPIC_ACTION_RUNTIME_PROVIDERS: readonly ["qi-flow", "qiforge", "mcp"];
|
|
2
|
+
export declare const TOPIC_ACTION_STATUSES: readonly ["requested", "awaiting_confirmation", "running", "succeeded", "failed", "rejected", "cancelled", "needs_verification"];
|
|
3
|
+
export type TopicActionRuntimeProvider = (typeof TOPIC_ACTION_RUNTIME_PROVIDERS)[number];
|
|
4
|
+
export type TopicActionStatus = (typeof TOPIC_ACTION_STATUSES)[number];
|
|
5
|
+
export type Sha256Uri = `sha256:${string}`;
|
|
6
|
+
export interface TopicFlowBindingV1 {
|
|
7
|
+
readonly version: 1;
|
|
8
|
+
readonly bindingId: string;
|
|
9
|
+
readonly topicId: string;
|
|
10
|
+
readonly flowUri: string;
|
|
11
|
+
readonly flowRevision: string;
|
|
12
|
+
readonly flowDigest: Sha256Uri;
|
|
13
|
+
readonly role: "primary" | "supporting";
|
|
14
|
+
readonly actionManifestDigest: Sha256Uri;
|
|
15
|
+
readonly controllerDid: string;
|
|
16
|
+
readonly startPolicy: "manual" | "on-topic-active" | "scheduled" | "event";
|
|
17
|
+
readonly triggerPolicy: Readonly<Record<string, unknown>>;
|
|
18
|
+
readonly receiptPolicy: "all" | "terminal";
|
|
19
|
+
readonly status: "pending" | "active" | "paused" | "closed" | "failed";
|
|
20
|
+
readonly capability: string;
|
|
21
|
+
readonly capabilityReferences: readonly string[];
|
|
22
|
+
readonly createdBy: string;
|
|
23
|
+
readonly createdAt: string;
|
|
24
|
+
}
|
|
25
|
+
export interface TopicActionRequestV1 {
|
|
26
|
+
readonly version: 1;
|
|
27
|
+
readonly requestId: string;
|
|
28
|
+
readonly topicId: string;
|
|
29
|
+
readonly topicRevision: string;
|
|
30
|
+
readonly actionType: string;
|
|
31
|
+
readonly actionContractDigest: Sha256Uri;
|
|
32
|
+
readonly executor: TopicActionRuntimeProvider;
|
|
33
|
+
readonly inputs: {
|
|
34
|
+
readonly digest: Sha256Uri;
|
|
35
|
+
readonly ref?: string;
|
|
36
|
+
};
|
|
37
|
+
readonly requestedBy: string;
|
|
38
|
+
readonly requestedAt: string;
|
|
39
|
+
readonly idempotencyKey: string;
|
|
40
|
+
readonly confirmation: "not-required" | "required" | "confirmed";
|
|
41
|
+
readonly flowBindingId?: string;
|
|
42
|
+
readonly capability: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ActionReceiptReference {
|
|
45
|
+
readonly digest: Sha256Uri;
|
|
46
|
+
readonly ref?: string;
|
|
47
|
+
readonly summary?: Readonly<Record<string, unknown>>;
|
|
48
|
+
}
|
|
49
|
+
export interface ActionReceiptV2 {
|
|
50
|
+
readonly version: 2;
|
|
51
|
+
readonly receiptId: string;
|
|
52
|
+
readonly sequence: number;
|
|
53
|
+
readonly requestId: string;
|
|
54
|
+
readonly topicId: string;
|
|
55
|
+
readonly topicRevision: string;
|
|
56
|
+
readonly action: {
|
|
57
|
+
readonly type: string;
|
|
58
|
+
readonly can: string;
|
|
59
|
+
readonly registryVersion: string;
|
|
60
|
+
readonly contractDigest: Sha256Uri;
|
|
61
|
+
};
|
|
62
|
+
readonly runtime: {
|
|
63
|
+
readonly provider: TopicActionRuntimeProvider;
|
|
64
|
+
readonly bindingId?: string;
|
|
65
|
+
readonly flowUri?: string;
|
|
66
|
+
readonly sessionRunId?: string;
|
|
67
|
+
readonly nodeId?: string;
|
|
68
|
+
readonly executionId: string;
|
|
69
|
+
};
|
|
70
|
+
readonly actorDid: string;
|
|
71
|
+
readonly executorDid: string;
|
|
72
|
+
readonly status: TopicActionStatus;
|
|
73
|
+
readonly idempotencyKey: string;
|
|
74
|
+
readonly occurredAt: string;
|
|
75
|
+
readonly authorization: {
|
|
76
|
+
readonly capability: string;
|
|
77
|
+
readonly invocation?: string;
|
|
78
|
+
readonly confirmation?: string;
|
|
79
|
+
};
|
|
80
|
+
readonly input: ActionReceiptReference;
|
|
81
|
+
readonly output?: ActionReceiptReference;
|
|
82
|
+
readonly proof?: {
|
|
83
|
+
readonly kind: "fields" | "custom" | "host-receipt";
|
|
84
|
+
readonly digest: Sha256Uri;
|
|
85
|
+
readonly refs?: readonly string[];
|
|
86
|
+
};
|
|
87
|
+
readonly evidenceRefs?: readonly string[];
|
|
88
|
+
readonly traceRef?: string;
|
|
89
|
+
readonly error?: {
|
|
90
|
+
readonly code?: string;
|
|
91
|
+
readonly message: string;
|
|
92
|
+
};
|
|
93
|
+
readonly issuerDid: string;
|
|
94
|
+
readonly signature: string;
|
|
95
|
+
}
|
|
96
|
+
export interface ProjectedTopicAction {
|
|
97
|
+
readonly request: TopicActionRequestV1;
|
|
98
|
+
readonly latestReceipt?: ActionReceiptV2;
|
|
99
|
+
readonly status: TopicActionStatus;
|
|
100
|
+
readonly operationId: string;
|
|
101
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const TOPIC_ACTION_RUNTIME_PROVIDERS = ["qi-flow", "qiforge", "mcp"];
|
|
2
|
+
export const TOPIC_ACTION_STATUSES = [
|
|
3
|
+
"requested",
|
|
4
|
+
"awaiting_confirmation",
|
|
5
|
+
"running",
|
|
6
|
+
"succeeded",
|
|
7
|
+
"failed",
|
|
8
|
+
"rejected",
|
|
9
|
+
"cancelled",
|
|
10
|
+
"needs_verification",
|
|
11
|
+
];
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/action-runtime/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,CAAU,CAAC;AACrF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,WAAW;IACX,uBAAuB;IACvB,SAAS;IACT,WAAW;IACX,QAAQ;IACR,UAAU;IACV,WAAW;IACX,oBAAoB;CACZ,CAAC"}
|