@envarai/envarpay 0.1.0-alpha.2 → 0.2.0-alpha.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.
- package/README.md +56 -145
- package/dist/commerce/buyer-store.d.ts +93 -0
- package/dist/commerce/buyer-store.js +168 -0
- package/dist/commerce/buyer.d.ts +129 -0
- package/dist/commerce/buyer.js +631 -0
- package/dist/commerce/card.d.ts +5 -0
- package/dist/commerce/card.js +29 -0
- package/dist/commerce/chain.d.ts +24 -0
- package/dist/commerce/chain.js +146 -0
- package/dist/commerce/cli.d.ts +2 -0
- package/dist/commerce/cli.js +268 -0
- package/dist/commerce/client-runtime.d.ts +8 -0
- package/dist/commerce/client-runtime.js +7 -0
- package/dist/commerce/config.d.ts +7 -0
- package/dist/commerce/config.js +164 -0
- package/dist/commerce/envar-runtime.d.ts +46 -0
- package/dist/commerce/envar-runtime.js +256 -0
- package/dist/commerce/envar.d.ts +126 -0
- package/dist/commerce/envar.js +647 -0
- package/dist/commerce/http.d.ts +2 -0
- package/dist/commerce/http.js +34 -0
- package/dist/commerce/index.d.ts +4 -0
- package/dist/commerce/index.js +4 -0
- package/dist/commerce/management.d.ts +14 -0
- package/dist/commerce/management.js +138 -0
- package/dist/commerce/mpp-client.d.ts +59 -0
- package/dist/commerce/mpp-client.js +24 -0
- package/dist/commerce/mpp-runtime.d.ts +3 -0
- package/dist/commerce/mpp-runtime.js +3 -0
- package/dist/commerce/mpp.d.ts +53 -0
- package/dist/commerce/mpp.js +163 -0
- package/dist/commerce/peer-proxy.d.ts +44 -0
- package/dist/commerce/peer-proxy.js +667 -0
- package/dist/commerce/pricing.d.ts +12 -0
- package/dist/commerce/pricing.js +60 -0
- package/dist/commerce/runtime.d.ts +8 -0
- package/dist/commerce/runtime.js +8 -0
- package/dist/commerce/server.d.ts +58 -0
- package/dist/commerce/server.js +485 -0
- package/dist/commerce/store.d.ts +86 -0
- package/dist/commerce/store.js +466 -0
- package/dist/commerce/stripe-provider.d.ts +9 -0
- package/dist/commerce/stripe-provider.js +97 -0
- package/dist/commerce/types.d.ts +113 -0
- package/dist/commerce/types.js +8 -0
- package/dist/commerce/upstream.d.ts +6 -0
- package/dist/commerce/upstream.js +103 -0
- package/dist/commerce/vault.d.ts +8 -0
- package/dist/commerce/vault.js +55 -0
- package/dist/commerce/x402.d.ts +37 -0
- package/dist/commerce/x402.js +174 -0
- package/dist/index.js +3 -1
- package/examples/buyer-policy.json +18 -0
- package/examples/envar-integration-policy.json +18 -0
- package/examples/seller.json +52 -0
- package/package.json +75 -10
- package/schemas/buyer-policy.schema.json +148 -0
- package/schemas/envarpay.config.schema.json +376 -0
- package/schemas/quote.schema.json +91 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"enabled": true,
|
|
3
|
+
"platformOrigin": "https://envar.ai",
|
|
4
|
+
"agentId": "54fe760a-4580-4258-9002-80f34c0d757a",
|
|
5
|
+
"runtimeAgentId": "hermes-researcher",
|
|
6
|
+
"acceptUpdates": true,
|
|
7
|
+
"allowedServices": ["research"],
|
|
8
|
+
"allowedUpstreamOrigins": ["http://hermes:9000"],
|
|
9
|
+
"allowedX402": [
|
|
10
|
+
{
|
|
11
|
+
"network": "eip155:84532",
|
|
12
|
+
"asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
13
|
+
"payTo": "0x2222222222222222222222222222222222222222",
|
|
14
|
+
"facilitatorOrigin": "https://facilitator.example"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"allowedMppAccounts": ["seller-stripe"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"configVersion": 1,
|
|
3
|
+
"agent": {"id": "hermes-researcher", "name": "我的研究助手"},
|
|
4
|
+
"paymentProfiles": {
|
|
5
|
+
"base-usdc": {
|
|
6
|
+
"adapter": "x402", "scheme": "exact", "network": "eip155:84532",
|
|
7
|
+
"asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
8
|
+
"payTo": "0x2222222222222222222222222222222222222222",
|
|
9
|
+
"facilitatorUrl": "https://facilitator.example"
|
|
10
|
+
},
|
|
11
|
+
"stripe-usd": {"adapter": "mpp", "method": "stripe", "intent": "charge", "currency": "usd", "accountRef": "seller-stripe"}
|
|
12
|
+
},
|
|
13
|
+
"services": [
|
|
14
|
+
{
|
|
15
|
+
"id": "research", "name": "竞品调研", "revision": 1,
|
|
16
|
+
"execution": {"type": "a2a", "cardUrl": "http://hermes:9000/research/agent-card.json"},
|
|
17
|
+
"contract": {
|
|
18
|
+
"inputSchema": {
|
|
19
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
20
|
+
"type": "object", "additionalProperties": false, "required": ["topic", "competitors"],
|
|
21
|
+
"properties": {
|
|
22
|
+
"topic": {"type": "string", "minLength": 1, "maxLength": 500},
|
|
23
|
+
"competitors": {"type": "array", "minItems": 1, "maxItems": 3, "uniqueItems": true, "items": {"type": "string", "minLength": 1, "maxLength": 120}}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"deliverables": ["report.md", "comparison.csv"], "targetDurationSeconds": 600, "includedRevisions": 0
|
|
27
|
+
},
|
|
28
|
+
"offers": [
|
|
29
|
+
{"id": "usdc-once", "pricing": {"kind": "fixed", "amount": "3000000"}, "collection": {"kind": "upfront"}, "paymentProfile": "base-usdc"},
|
|
30
|
+
{"id": "card-once", "pricing": {"kind": "fixed", "amount": "300"}, "collection": {"kind": "upfront"}, "paymentProfile": "stripe-usd"}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "summary-preview", "name": "免费试读", "revision": 1,
|
|
35
|
+
"execution": {"type": "a2a", "cardUrl": "http://hermes:9000/preview/agent-card.json"},
|
|
36
|
+
"contract": {
|
|
37
|
+
"inputSchema": {"type": "object", "additionalProperties": false, "required": ["text"], "properties": {"text": {"type": "string", "minLength": 1, "maxLength": 500}}},
|
|
38
|
+
"deliverables": ["summary.txt"], "targetDurationSeconds": 60, "includedRevisions": 0
|
|
39
|
+
},
|
|
40
|
+
"offers": [{"id": "free", "pricing": {"kind": "free"}, "collection": {"kind": "none"}}]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "translation", "name": "文档翻译", "revision": 1,
|
|
44
|
+
"execution": {"type": "a2a", "cardUrl": "http://openclaw:9000/translate/agent-card.json"},
|
|
45
|
+
"contract": {
|
|
46
|
+
"inputSchema": {"type": "object", "additionalProperties": false, "required": ["documents"], "properties": {"documents": {"type": "array", "minItems": 1, "maxItems": 20, "items": {"type": "string", "minLength": 1, "maxLength": 10000}}}},
|
|
47
|
+
"deliverables": ["translations.json"], "targetDurationSeconds": 600, "includedRevisions": 0
|
|
48
|
+
},
|
|
49
|
+
"offers": [{"id": "per-document", "pricing": {"kind": "quantity", "unit": "document", "unitAmount": "100000", "quantity": {"pointer": "/documents", "measure": "count", "min": 1, "max": 20}}, "collection": {"kind": "upfront"}, "paymentProfile": "base-usdc"}]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envarai/envarpay",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0-alpha.1",
|
|
4
|
+
"description": "Independent A2A service commerce, budgeted buyers and x402/MPP payments",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"engines": {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.14.0"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/commerce/index.d.ts",
|
|
13
|
+
"import": "./dist/commerce/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./commerce": {
|
|
16
|
+
"types": "./dist/commerce/index.d.ts",
|
|
17
|
+
"import": "./dist/commerce/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./commerce/server": {
|
|
20
|
+
"types": "./dist/commerce/runtime.d.ts",
|
|
21
|
+
"import": "./dist/commerce/runtime.js"
|
|
22
|
+
},
|
|
23
|
+
"./client": {
|
|
24
|
+
"types": "./dist/commerce/client-runtime.d.ts",
|
|
25
|
+
"import": "./dist/commerce/client-runtime.js"
|
|
26
|
+
},
|
|
27
|
+
"./server": {
|
|
28
|
+
"types": "./dist/commerce/runtime.d.ts",
|
|
29
|
+
"import": "./dist/commerce/runtime.js"
|
|
30
|
+
},
|
|
31
|
+
"./mpp": {
|
|
32
|
+
"types": "./dist/commerce/mpp-runtime.d.ts",
|
|
33
|
+
"import": "./dist/commerce/mpp-runtime.js"
|
|
34
|
+
},
|
|
35
|
+
"./envar": {
|
|
36
|
+
"types": "./dist/commerce/envar.d.ts",
|
|
37
|
+
"import": "./dist/commerce/envar.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"schemas",
|
|
45
|
+
"examples"
|
|
46
|
+
],
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/EnvarAI/EnvarPay.git",
|
|
50
|
+
"directory": "packages/typescript"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public",
|
|
54
|
+
"tag": "next"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsc",
|
|
58
|
+
"test": "npm run build && node --test test/*.test.mjs",
|
|
59
|
+
"prepack": "npm run build"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@a2a-js/sdk": "1.2.1",
|
|
63
|
+
"@modelcontextprotocol/sdk": "^1.31.0",
|
|
64
|
+
"@x402/core": "2.24.0",
|
|
65
|
+
"@x402/evm": "2.24.0",
|
|
66
|
+
"@x402/extensions": "2.24.0",
|
|
67
|
+
"ajv": "8.20.0",
|
|
68
|
+
"ajv-formats": "3.0.1",
|
|
69
|
+
"canonicalize": "2.1.0",
|
|
70
|
+
"mppx": "0.13.1",
|
|
71
|
+
"viem": "2.57.1"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@types/node": "^22.0.0",
|
|
75
|
+
"typescript": "~5.9.3"
|
|
76
|
+
},
|
|
77
|
+
"bin": {
|
|
78
|
+
"envarpay": "dist/commerce/cli.js"
|
|
79
|
+
}
|
|
15
80
|
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "urn:envarpay:buyer-policy:1",
|
|
4
|
+
"title": "Local buyer permission policy; not supplied by the seller",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"policyVersion",
|
|
9
|
+
"paymentsEnabled",
|
|
10
|
+
"approval",
|
|
11
|
+
"peers",
|
|
12
|
+
"budgets"
|
|
13
|
+
],
|
|
14
|
+
"properties": {
|
|
15
|
+
"policyVersion": {
|
|
16
|
+
"const": 1
|
|
17
|
+
},
|
|
18
|
+
"paymentsEnabled": {
|
|
19
|
+
"type": "boolean"
|
|
20
|
+
},
|
|
21
|
+
"approval": {
|
|
22
|
+
"enum": [
|
|
23
|
+
"per_purchase",
|
|
24
|
+
"within_preapproved_limits"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"peers": {
|
|
28
|
+
"type": "array",
|
|
29
|
+
"minItems": 1,
|
|
30
|
+
"items": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"required": [
|
|
34
|
+
"id",
|
|
35
|
+
"cardUrl",
|
|
36
|
+
"protocol",
|
|
37
|
+
"currency",
|
|
38
|
+
"recipient",
|
|
39
|
+
"maxPerPurchase"
|
|
40
|
+
],
|
|
41
|
+
"properties": {
|
|
42
|
+
"id": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"pattern": "^[a-z][a-z0-9-]{0,63}$"
|
|
45
|
+
},
|
|
46
|
+
"cardUrl": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"format": "uri",
|
|
49
|
+
"pattern": "^https://"
|
|
50
|
+
},
|
|
51
|
+
"protocol": {
|
|
52
|
+
"enum": [
|
|
53
|
+
"x402",
|
|
54
|
+
"mpp",
|
|
55
|
+
"free"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"currency": {
|
|
59
|
+
"type": [
|
|
60
|
+
"string",
|
|
61
|
+
"null"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"recipient": {
|
|
65
|
+
"type": [
|
|
66
|
+
"string",
|
|
67
|
+
"null"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"maxPerPurchase": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"pattern": "^(0|[1-9][0-9]{0,77})$"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"allOf": [
|
|
76
|
+
{
|
|
77
|
+
"if": {
|
|
78
|
+
"properties": {
|
|
79
|
+
"protocol": {
|
|
80
|
+
"const": "free"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"then": {
|
|
85
|
+
"properties": {
|
|
86
|
+
"currency": {
|
|
87
|
+
"const": null
|
|
88
|
+
},
|
|
89
|
+
"recipient": {
|
|
90
|
+
"const": null
|
|
91
|
+
},
|
|
92
|
+
"maxPerPurchase": {
|
|
93
|
+
"const": "0"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"else": {
|
|
98
|
+
"properties": {
|
|
99
|
+
"currency": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"minLength": 1
|
|
102
|
+
},
|
|
103
|
+
"recipient": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"minLength": 1
|
|
106
|
+
},
|
|
107
|
+
"maxPerPurchase": {
|
|
108
|
+
"$ref": "#/$defs/amount"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"budgets": {
|
|
117
|
+
"type": "array",
|
|
118
|
+
"minItems": 0,
|
|
119
|
+
"items": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"additionalProperties": false,
|
|
122
|
+
"required": [
|
|
123
|
+
"currency",
|
|
124
|
+
"maxTotal",
|
|
125
|
+
"period"
|
|
126
|
+
],
|
|
127
|
+
"properties": {
|
|
128
|
+
"currency": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"minLength": 1
|
|
131
|
+
},
|
|
132
|
+
"maxTotal": {
|
|
133
|
+
"$ref": "#/$defs/amount"
|
|
134
|
+
},
|
|
135
|
+
"period": {
|
|
136
|
+
"const": "cumulative"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"$defs": {
|
|
143
|
+
"amount": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"pattern": "^[1-9][0-9]{0,77}$"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "urn:envarpay:config:1",
|
|
4
|
+
"title": "EnvarPay A2A commerce MVP configuration",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"configVersion",
|
|
9
|
+
"agent",
|
|
10
|
+
"paymentProfiles",
|
|
11
|
+
"services"
|
|
12
|
+
],
|
|
13
|
+
"properties": {
|
|
14
|
+
"configVersion": {
|
|
15
|
+
"const": 1
|
|
16
|
+
},
|
|
17
|
+
"agent": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"required": [
|
|
21
|
+
"id",
|
|
22
|
+
"name"
|
|
23
|
+
],
|
|
24
|
+
"properties": {
|
|
25
|
+
"id": {
|
|
26
|
+
"$ref": "#/$defs/id"
|
|
27
|
+
},
|
|
28
|
+
"name": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"minLength": 1,
|
|
31
|
+
"maxLength": 120
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"paymentProfiles": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"maxProperties": 16,
|
|
38
|
+
"propertyNames": {
|
|
39
|
+
"$ref": "#/$defs/id"
|
|
40
|
+
},
|
|
41
|
+
"additionalProperties": {
|
|
42
|
+
"oneOf": [
|
|
43
|
+
{
|
|
44
|
+
"$ref": "#/$defs/x402"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"$ref": "#/$defs/mpp"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"services": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"minItems": 1,
|
|
55
|
+
"maxItems": 64,
|
|
56
|
+
"items": {
|
|
57
|
+
"$ref": "#/$defs/service"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"$defs": {
|
|
62
|
+
"id": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"pattern": "^[a-z][a-z0-9-]{0,63}$"
|
|
65
|
+
},
|
|
66
|
+
"amount": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"pattern": "^[1-9][0-9]{0,77}$"
|
|
69
|
+
},
|
|
70
|
+
"address": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"pattern": "^0x[0-9a-fA-F]{40}$"
|
|
73
|
+
},
|
|
74
|
+
"httpUrl": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"format": "uri",
|
|
77
|
+
"pattern": "^https?://",
|
|
78
|
+
"maxLength": 2048
|
|
79
|
+
},
|
|
80
|
+
"x402": {
|
|
81
|
+
"type": "object",
|
|
82
|
+
"additionalProperties": false,
|
|
83
|
+
"required": [
|
|
84
|
+
"adapter",
|
|
85
|
+
"scheme",
|
|
86
|
+
"network",
|
|
87
|
+
"asset",
|
|
88
|
+
"payTo",
|
|
89
|
+
"facilitatorUrl"
|
|
90
|
+
],
|
|
91
|
+
"properties": {
|
|
92
|
+
"adapter": {
|
|
93
|
+
"const": "x402"
|
|
94
|
+
},
|
|
95
|
+
"scheme": {
|
|
96
|
+
"const": "exact"
|
|
97
|
+
},
|
|
98
|
+
"network": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"pattern": "^eip155:[1-9][0-9]*$"
|
|
101
|
+
},
|
|
102
|
+
"asset": {
|
|
103
|
+
"$ref": "#/$defs/address"
|
|
104
|
+
},
|
|
105
|
+
"payTo": {
|
|
106
|
+
"$ref": "#/$defs/address"
|
|
107
|
+
},
|
|
108
|
+
"facilitatorUrl": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"format": "uri",
|
|
111
|
+
"pattern": "^https://"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"mpp": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"additionalProperties": false,
|
|
118
|
+
"required": [
|
|
119
|
+
"adapter",
|
|
120
|
+
"method",
|
|
121
|
+
"intent",
|
|
122
|
+
"currency",
|
|
123
|
+
"accountRef"
|
|
124
|
+
],
|
|
125
|
+
"properties": {
|
|
126
|
+
"adapter": {
|
|
127
|
+
"const": "mpp"
|
|
128
|
+
},
|
|
129
|
+
"method": {
|
|
130
|
+
"const": "stripe"
|
|
131
|
+
},
|
|
132
|
+
"intent": {
|
|
133
|
+
"const": "charge"
|
|
134
|
+
},
|
|
135
|
+
"currency": {
|
|
136
|
+
"const": "usd"
|
|
137
|
+
},
|
|
138
|
+
"accountRef": {
|
|
139
|
+
"$ref": "#/$defs/id"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"service": {
|
|
144
|
+
"type": "object",
|
|
145
|
+
"additionalProperties": false,
|
|
146
|
+
"required": [
|
|
147
|
+
"id",
|
|
148
|
+
"name",
|
|
149
|
+
"revision",
|
|
150
|
+
"execution",
|
|
151
|
+
"contract",
|
|
152
|
+
"offers"
|
|
153
|
+
],
|
|
154
|
+
"properties": {
|
|
155
|
+
"id": {
|
|
156
|
+
"$ref": "#/$defs/id"
|
|
157
|
+
},
|
|
158
|
+
"name": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"minLength": 1
|
|
161
|
+
},
|
|
162
|
+
"revision": {
|
|
163
|
+
"type": "integer",
|
|
164
|
+
"minimum": 1,
|
|
165
|
+
"maximum": 2147483647
|
|
166
|
+
},
|
|
167
|
+
"execution": {
|
|
168
|
+
"type": "object",
|
|
169
|
+
"additionalProperties": false,
|
|
170
|
+
"required": [
|
|
171
|
+
"type",
|
|
172
|
+
"cardUrl"
|
|
173
|
+
],
|
|
174
|
+
"properties": {
|
|
175
|
+
"type": {
|
|
176
|
+
"const": "a2a"
|
|
177
|
+
},
|
|
178
|
+
"cardUrl": {
|
|
179
|
+
"$ref": "#/$defs/httpUrl"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"contract": {
|
|
184
|
+
"type": "object",
|
|
185
|
+
"additionalProperties": false,
|
|
186
|
+
"required": [
|
|
187
|
+
"inputSchema",
|
|
188
|
+
"deliverables",
|
|
189
|
+
"targetDurationSeconds",
|
|
190
|
+
"includedRevisions"
|
|
191
|
+
],
|
|
192
|
+
"properties": {
|
|
193
|
+
"inputSchema": {
|
|
194
|
+
"type": "object"
|
|
195
|
+
},
|
|
196
|
+
"deliverables": {
|
|
197
|
+
"type": "array",
|
|
198
|
+
"minItems": 1,
|
|
199
|
+
"uniqueItems": true,
|
|
200
|
+
"items": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"minLength": 1
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"targetDurationSeconds": {
|
|
206
|
+
"type": "integer",
|
|
207
|
+
"minimum": 1,
|
|
208
|
+
"maximum": 86400
|
|
209
|
+
},
|
|
210
|
+
"includedRevisions": {
|
|
211
|
+
"const": 0
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"offers": {
|
|
216
|
+
"type": "array",
|
|
217
|
+
"minItems": 1,
|
|
218
|
+
"maxItems": 16,
|
|
219
|
+
"items": {
|
|
220
|
+
"$ref": "#/$defs/offer"
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"free": {
|
|
226
|
+
"type": "object",
|
|
227
|
+
"additionalProperties": false,
|
|
228
|
+
"required": [
|
|
229
|
+
"kind"
|
|
230
|
+
],
|
|
231
|
+
"properties": {
|
|
232
|
+
"kind": {
|
|
233
|
+
"const": "free"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"fixed": {
|
|
238
|
+
"type": "object",
|
|
239
|
+
"additionalProperties": false,
|
|
240
|
+
"required": [
|
|
241
|
+
"kind",
|
|
242
|
+
"amount"
|
|
243
|
+
],
|
|
244
|
+
"properties": {
|
|
245
|
+
"kind": {
|
|
246
|
+
"const": "fixed"
|
|
247
|
+
},
|
|
248
|
+
"amount": {
|
|
249
|
+
"$ref": "#/$defs/amount"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"quantity": {
|
|
254
|
+
"type": "object",
|
|
255
|
+
"additionalProperties": false,
|
|
256
|
+
"required": [
|
|
257
|
+
"kind",
|
|
258
|
+
"unit",
|
|
259
|
+
"unitAmount",
|
|
260
|
+
"quantity"
|
|
261
|
+
],
|
|
262
|
+
"properties": {
|
|
263
|
+
"kind": {
|
|
264
|
+
"const": "quantity"
|
|
265
|
+
},
|
|
266
|
+
"unit": {
|
|
267
|
+
"$ref": "#/$defs/id"
|
|
268
|
+
},
|
|
269
|
+
"unitAmount": {
|
|
270
|
+
"$ref": "#/$defs/amount"
|
|
271
|
+
},
|
|
272
|
+
"quantity": {
|
|
273
|
+
"type": "object",
|
|
274
|
+
"additionalProperties": false,
|
|
275
|
+
"required": [
|
|
276
|
+
"pointer",
|
|
277
|
+
"measure",
|
|
278
|
+
"min",
|
|
279
|
+
"max"
|
|
280
|
+
],
|
|
281
|
+
"properties": {
|
|
282
|
+
"pointer": {
|
|
283
|
+
"type": "string",
|
|
284
|
+
"pattern": "^(/([^~/]|~[01])*)+$"
|
|
285
|
+
},
|
|
286
|
+
"measure": {
|
|
287
|
+
"const": "count"
|
|
288
|
+
},
|
|
289
|
+
"min": {
|
|
290
|
+
"type": "integer",
|
|
291
|
+
"minimum": 1
|
|
292
|
+
},
|
|
293
|
+
"max": {
|
|
294
|
+
"type": "integer",
|
|
295
|
+
"minimum": 1,
|
|
296
|
+
"maximum": 10000
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
"offer": {
|
|
303
|
+
"oneOf": [
|
|
304
|
+
{
|
|
305
|
+
"type": "object",
|
|
306
|
+
"additionalProperties": false,
|
|
307
|
+
"required": [
|
|
308
|
+
"id",
|
|
309
|
+
"pricing",
|
|
310
|
+
"collection"
|
|
311
|
+
],
|
|
312
|
+
"properties": {
|
|
313
|
+
"id": {
|
|
314
|
+
"$ref": "#/$defs/id"
|
|
315
|
+
},
|
|
316
|
+
"pricing": {
|
|
317
|
+
"$ref": "#/$defs/free"
|
|
318
|
+
},
|
|
319
|
+
"collection": {
|
|
320
|
+
"type": "object",
|
|
321
|
+
"additionalProperties": false,
|
|
322
|
+
"required": [
|
|
323
|
+
"kind"
|
|
324
|
+
],
|
|
325
|
+
"properties": {
|
|
326
|
+
"kind": {
|
|
327
|
+
"const": "none"
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"type": "object",
|
|
335
|
+
"additionalProperties": false,
|
|
336
|
+
"required": [
|
|
337
|
+
"id",
|
|
338
|
+
"pricing",
|
|
339
|
+
"collection",
|
|
340
|
+
"paymentProfile"
|
|
341
|
+
],
|
|
342
|
+
"properties": {
|
|
343
|
+
"id": {
|
|
344
|
+
"$ref": "#/$defs/id"
|
|
345
|
+
},
|
|
346
|
+
"pricing": {
|
|
347
|
+
"oneOf": [
|
|
348
|
+
{
|
|
349
|
+
"$ref": "#/$defs/fixed"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"$ref": "#/$defs/quantity"
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
"collection": {
|
|
357
|
+
"type": "object",
|
|
358
|
+
"additionalProperties": false,
|
|
359
|
+
"required": [
|
|
360
|
+
"kind"
|
|
361
|
+
],
|
|
362
|
+
"properties": {
|
|
363
|
+
"kind": {
|
|
364
|
+
"const": "upfront"
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
"paymentProfile": {
|
|
369
|
+
"$ref": "#/$defs/id"
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
]
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|