@envarai/envarpay 0.2.0-alpha.8 → 2026.1025.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 +18 -56
- package/dist/commerce/agent-setup.d.ts +19 -0
- package/dist/commerce/agent-setup.js +210 -0
- package/dist/commerce/alerts.d.ts +5 -15
- package/dist/commerce/alerts.js +21 -77
- package/dist/commerce/card.js +1 -1
- package/dist/commerce/cli.js +74 -137
- package/dist/commerce/config.d.ts +1 -4
- package/dist/commerce/config.js +5 -81
- package/dist/commerce/configure.d.ts +2 -0
- package/dist/commerce/configure.js +78 -0
- package/dist/commerce/discovery.d.ts +20 -0
- package/dist/commerce/discovery.js +162 -0
- package/dist/commerce/envar-balance.d.ts +25 -0
- package/dist/commerce/envar-balance.js +65 -0
- package/dist/commerce/envar-runtime.d.ts +1 -0
- package/dist/commerce/envar-runtime.js +7 -0
- package/dist/commerce/envar.d.ts +13 -31
- package/dist/commerce/envar.js +35 -83
- package/dist/commerce/external-agent.d.ts +26 -0
- package/dist/commerce/external-agent.js +129 -0
- package/dist/commerce/external-events.d.ts +76 -0
- package/dist/commerce/external-events.js +273 -0
- package/dist/commerce/external-mcp.d.ts +10 -0
- package/dist/commerce/external-mcp.js +199 -0
- package/dist/commerce/external-oauth.d.ts +12 -0
- package/dist/commerce/external-oauth.js +230 -0
- package/dist/commerce/external-runtime.d.ts +25 -0
- package/dist/commerce/external-runtime.js +244 -0
- package/dist/commerce/managed.d.ts +3 -0
- package/dist/commerce/managed.js +143 -0
- package/dist/commerce/native-inventory.d.ts +9 -0
- package/dist/commerce/native-inventory.js +75 -0
- package/dist/commerce/native-skills.d.ts +8 -0
- package/dist/commerce/native-skills.js +11 -8
- package/dist/commerce/openclaw-setup.d.ts +28 -0
- package/dist/commerce/openclaw-setup.js +43 -0
- package/dist/commerce/operations.d.ts +1 -2
- package/dist/commerce/operations.js +17 -20
- package/dist/commerce/pricing.d.ts +0 -1
- package/dist/commerce/pricing.js +1 -3
- package/dist/commerce/runtime.d.ts +2 -2
- package/dist/commerce/runtime.js +2 -2
- package/dist/commerce/server.d.ts +0 -1
- package/dist/commerce/server.js +2 -3
- package/dist/commerce/setup.d.ts +25 -0
- package/dist/commerce/setup.js +379 -0
- package/dist/commerce/store.d.ts +11 -1
- package/dist/commerce/store.js +36 -2
- package/dist/commerce/types.d.ts +1 -56
- package/examples/envar-integration-policy.json +1 -9
- package/examples/seller.json +143 -26
- package/package.json +11 -20
- package/runtime/hermes-setup-probe.py +109 -0
- package/runtime/hermes-skill-inventory.py +108 -0
- package/schemas/envarpay.config.schema.json +7 -73
- package/dist/commerce/buyer-store.d.ts +0 -101
- package/dist/commerce/buyer-store.js +0 -168
- package/dist/commerce/buyer.d.ts +0 -138
- package/dist/commerce/buyer.js +0 -775
- package/dist/commerce/chain.d.ts +0 -24
- package/dist/commerce/chain.js +0 -146
- package/dist/commerce/client-runtime.d.ts +0 -8
- package/dist/commerce/client-runtime.js +0 -7
- package/dist/commerce/management.d.ts +0 -14
- package/dist/commerce/management.js +0 -140
- package/dist/commerce/mpp-client.d.ts +0 -70
- package/dist/commerce/mpp-client.js +0 -29
- package/dist/commerce/mpp-runtime.d.ts +0 -4
- package/dist/commerce/mpp-runtime.js +0 -4
- package/dist/commerce/mpp.d.ts +0 -53
- package/dist/commerce/mpp.js +0 -163
- package/dist/commerce/peer-proxy.d.ts +0 -44
- package/dist/commerce/peer-proxy.js +0 -673
- package/dist/commerce/stripe-issuer.d.ts +0 -41
- package/dist/commerce/stripe-issuer.js +0 -351
- package/dist/commerce/stripe-provider.d.ts +0 -11
- package/dist/commerce/stripe-provider.js +0 -132
- package/dist/commerce/x402.d.ts +0 -37
- package/dist/commerce/x402.js +0 -174
- package/dist/index.d.ts +0 -95
- package/dist/index.js +0 -163
- package/examples/buyer-policy.json +0 -18
- package/schemas/buyer-policy.schema.json +0 -253
- /package/{examples → runtime}/native-skill-runner.py +0 -0
package/examples/seller.json
CHANGED
|
@@ -1,52 +1,169 @@
|
|
|
1
1
|
{
|
|
2
2
|
"configVersion": 1,
|
|
3
|
-
"agent": {
|
|
3
|
+
"agent": {
|
|
4
|
+
"id": "hermes-researcher",
|
|
5
|
+
"name": "我的研究助手"
|
|
6
|
+
},
|
|
4
7
|
"paymentProfiles": {
|
|
5
|
-
"
|
|
6
|
-
"adapter": "
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
"stripe-usd": {"adapter": "mpp", "method": "stripe", "intent": "charge", "currency": "usd", "accountRef": "seller-stripe"}
|
|
8
|
+
"envar-usd": {
|
|
9
|
+
"adapter": "envar_balance",
|
|
10
|
+
"currency": "usd",
|
|
11
|
+
"accountRef": "envar"
|
|
12
|
+
}
|
|
12
13
|
},
|
|
13
14
|
"services": [
|
|
14
15
|
{
|
|
15
|
-
"id": "research",
|
|
16
|
-
"
|
|
16
|
+
"id": "research",
|
|
17
|
+
"name": "竞品调研",
|
|
18
|
+
"revision": 1,
|
|
19
|
+
"execution": {
|
|
20
|
+
"type": "a2a",
|
|
21
|
+
"cardUrl": "http://hermes:9000/research/agent-card.json"
|
|
22
|
+
},
|
|
17
23
|
"contract": {
|
|
18
24
|
"inputSchema": {
|
|
19
25
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
20
|
-
"type": "object",
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"required": [
|
|
29
|
+
"topic",
|
|
30
|
+
"competitors"
|
|
31
|
+
],
|
|
21
32
|
"properties": {
|
|
22
|
-
"topic": {
|
|
23
|
-
|
|
33
|
+
"topic": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"minLength": 1,
|
|
36
|
+
"maxLength": 500
|
|
37
|
+
},
|
|
38
|
+
"competitors": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"minItems": 1,
|
|
41
|
+
"maxItems": 3,
|
|
42
|
+
"uniqueItems": true,
|
|
43
|
+
"items": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"minLength": 1,
|
|
46
|
+
"maxLength": 120
|
|
47
|
+
}
|
|
48
|
+
}
|
|
24
49
|
}
|
|
25
50
|
},
|
|
26
|
-
"deliverables": [
|
|
51
|
+
"deliverables": [
|
|
52
|
+
"report.md",
|
|
53
|
+
"comparison.csv"
|
|
54
|
+
],
|
|
55
|
+
"targetDurationSeconds": 600,
|
|
56
|
+
"includedRevisions": 0
|
|
27
57
|
},
|
|
28
58
|
"offers": [
|
|
29
|
-
{
|
|
30
|
-
|
|
59
|
+
{
|
|
60
|
+
"id": "balance-once",
|
|
61
|
+
"pricing": {
|
|
62
|
+
"kind": "fixed",
|
|
63
|
+
"amount": "3000000"
|
|
64
|
+
},
|
|
65
|
+
"collection": {
|
|
66
|
+
"kind": "upfront"
|
|
67
|
+
},
|
|
68
|
+
"paymentProfile": "envar-usd"
|
|
69
|
+
}
|
|
31
70
|
]
|
|
32
71
|
},
|
|
33
72
|
{
|
|
34
|
-
"id": "summary-preview",
|
|
35
|
-
"
|
|
73
|
+
"id": "summary-preview",
|
|
74
|
+
"name": "免费试读",
|
|
75
|
+
"revision": 1,
|
|
76
|
+
"execution": {
|
|
77
|
+
"type": "a2a",
|
|
78
|
+
"cardUrl": "http://hermes:9000/preview/agent-card.json"
|
|
79
|
+
},
|
|
36
80
|
"contract": {
|
|
37
|
-
"inputSchema": {
|
|
38
|
-
|
|
81
|
+
"inputSchema": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"additionalProperties": false,
|
|
84
|
+
"required": [
|
|
85
|
+
"text"
|
|
86
|
+
],
|
|
87
|
+
"properties": {
|
|
88
|
+
"text": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"minLength": 1,
|
|
91
|
+
"maxLength": 500
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"deliverables": [
|
|
96
|
+
"summary.txt"
|
|
97
|
+
],
|
|
98
|
+
"targetDurationSeconds": 60,
|
|
99
|
+
"includedRevisions": 0
|
|
39
100
|
},
|
|
40
|
-
"offers": [
|
|
101
|
+
"offers": [
|
|
102
|
+
{
|
|
103
|
+
"id": "free",
|
|
104
|
+
"pricing": {
|
|
105
|
+
"kind": "free"
|
|
106
|
+
},
|
|
107
|
+
"collection": {
|
|
108
|
+
"kind": "none"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
]
|
|
41
112
|
},
|
|
42
113
|
{
|
|
43
|
-
"id": "translation",
|
|
44
|
-
"
|
|
114
|
+
"id": "translation",
|
|
115
|
+
"name": "文档翻译",
|
|
116
|
+
"revision": 1,
|
|
117
|
+
"execution": {
|
|
118
|
+
"type": "a2a",
|
|
119
|
+
"cardUrl": "http://openclaw:9000/translate/agent-card.json"
|
|
120
|
+
},
|
|
45
121
|
"contract": {
|
|
46
|
-
"inputSchema": {
|
|
47
|
-
|
|
122
|
+
"inputSchema": {
|
|
123
|
+
"type": "object",
|
|
124
|
+
"additionalProperties": false,
|
|
125
|
+
"required": [
|
|
126
|
+
"documents"
|
|
127
|
+
],
|
|
128
|
+
"properties": {
|
|
129
|
+
"documents": {
|
|
130
|
+
"type": "array",
|
|
131
|
+
"minItems": 1,
|
|
132
|
+
"maxItems": 20,
|
|
133
|
+
"items": {
|
|
134
|
+
"type": "string",
|
|
135
|
+
"minLength": 1,
|
|
136
|
+
"maxLength": 10000
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"deliverables": [
|
|
142
|
+
"translations.json"
|
|
143
|
+
],
|
|
144
|
+
"targetDurationSeconds": 600,
|
|
145
|
+
"includedRevisions": 0
|
|
48
146
|
},
|
|
49
|
-
"offers": [
|
|
147
|
+
"offers": [
|
|
148
|
+
{
|
|
149
|
+
"id": "per-document",
|
|
150
|
+
"pricing": {
|
|
151
|
+
"kind": "quantity",
|
|
152
|
+
"unit": "document",
|
|
153
|
+
"unitAmount": "100000",
|
|
154
|
+
"quantity": {
|
|
155
|
+
"pointer": "/documents",
|
|
156
|
+
"measure": "count",
|
|
157
|
+
"min": 1,
|
|
158
|
+
"max": 20
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"collection": {
|
|
162
|
+
"kind": "upfront"
|
|
163
|
+
},
|
|
164
|
+
"paymentProfile": "envar-usd"
|
|
165
|
+
}
|
|
166
|
+
]
|
|
50
167
|
}
|
|
51
168
|
]
|
|
52
169
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envarai/envarpay",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2026.1025.1",
|
|
4
|
+
"description": "A2A services with Envar account-balance payments",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
@@ -20,18 +20,10 @@
|
|
|
20
20
|
"types": "./dist/commerce/runtime.d.ts",
|
|
21
21
|
"import": "./dist/commerce/runtime.js"
|
|
22
22
|
},
|
|
23
|
-
"./client": {
|
|
24
|
-
"types": "./dist/commerce/client-runtime.d.ts",
|
|
25
|
-
"import": "./dist/commerce/client-runtime.js"
|
|
26
|
-
},
|
|
27
23
|
"./server": {
|
|
28
24
|
"types": "./dist/commerce/runtime.d.ts",
|
|
29
25
|
"import": "./dist/commerce/runtime.js"
|
|
30
26
|
},
|
|
31
|
-
"./mpp": {
|
|
32
|
-
"types": "./dist/commerce/mpp-runtime.d.ts",
|
|
33
|
-
"import": "./dist/commerce/mpp-runtime.js"
|
|
34
|
-
},
|
|
35
27
|
"./envar": {
|
|
36
28
|
"types": "./dist/commerce/envar.d.ts",
|
|
37
29
|
"import": "./dist/commerce/envar.js"
|
|
@@ -42,7 +34,8 @@
|
|
|
42
34
|
"README.md",
|
|
43
35
|
"LICENSE",
|
|
44
36
|
"schemas",
|
|
45
|
-
"examples"
|
|
37
|
+
"examples",
|
|
38
|
+
"runtime"
|
|
46
39
|
],
|
|
47
40
|
"repository": {
|
|
48
41
|
"type": "git",
|
|
@@ -51,24 +44,22 @@
|
|
|
51
44
|
},
|
|
52
45
|
"publishConfig": {
|
|
53
46
|
"access": "public",
|
|
54
|
-
"tag": "
|
|
47
|
+
"tag": "latest"
|
|
55
48
|
},
|
|
56
49
|
"scripts": {
|
|
57
|
-
"build": "tsc",
|
|
58
|
-
"test": "npm run build && node --test test/*.test.mjs",
|
|
59
|
-
"prepack": "npm run build"
|
|
50
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc",
|
|
51
|
+
"test": "npm run build && node --test test/*.test.mjs ../../scripts/release.test.mjs",
|
|
52
|
+
"prepack": "npm run build",
|
|
53
|
+
"version:date": "node ../../scripts/release-version.mjs"
|
|
60
54
|
},
|
|
61
55
|
"dependencies": {
|
|
62
56
|
"@a2a-js/sdk": "1.2.1",
|
|
63
57
|
"@modelcontextprotocol/sdk": "^1.31.0",
|
|
64
|
-
"@x402/core": "2.24.0",
|
|
65
|
-
"@x402/evm": "2.24.0",
|
|
66
|
-
"@x402/extensions": "2.24.0",
|
|
67
58
|
"ajv": "8.20.0",
|
|
68
59
|
"ajv-formats": "3.0.1",
|
|
69
60
|
"canonicalize": "2.1.0",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
61
|
+
"yaml": "2.8.2",
|
|
62
|
+
"zod": "4.6.5"
|
|
72
63
|
},
|
|
73
64
|
"devDependencies": {
|
|
74
65
|
"@types/node": "^22.0.0",
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""Read owner-local Hermes settings through a private pipe; never calls a model."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import shlex
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
import hermes_yaml as yaml
|
|
11
|
+
except ImportError:
|
|
12
|
+
import yaml
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def inspect(home):
|
|
16
|
+
home = Path(home or os.environ.get("HERMES_HOME", "~/.hermes")).expanduser().resolve()
|
|
17
|
+
config = yaml.safe_load((home / "config.yaml").read_text()) or {}
|
|
18
|
+
model = config.get("model", {})
|
|
19
|
+
if isinstance(model, str):
|
|
20
|
+
model = {"default": model}
|
|
21
|
+
provider_id = str(model.get("provider", "")).removeprefix("custom:")
|
|
22
|
+
provider = config.get("providers", {}).get(provider_id, {})
|
|
23
|
+
dotenv = {}
|
|
24
|
+
if (home / ".env").exists():
|
|
25
|
+
for line in (home / ".env").read_text().splitlines():
|
|
26
|
+
key, sep, value = line.partition("=")
|
|
27
|
+
if sep and not key.strip().startswith("#"):
|
|
28
|
+
dotenv[key.strip()] = value.strip().strip("\"'")
|
|
29
|
+
key_file = None
|
|
30
|
+
command = shlex.split(provider.get("key_cmd", ""))
|
|
31
|
+
if len(command) == 2 and command[0] == "cat":
|
|
32
|
+
key_file = str(Path(command[1]).expanduser().resolve())
|
|
33
|
+
key = (
|
|
34
|
+
provider.get("api_key")
|
|
35
|
+
or provider.get("key")
|
|
36
|
+
or dotenv.get(provider.get("key_env", ""))
|
|
37
|
+
or os.environ.get(provider.get("key_env", ""))
|
|
38
|
+
or dotenv.get("OPENAI_API_KEY")
|
|
39
|
+
or os.environ.get("OPENAI_API_KEY")
|
|
40
|
+
)
|
|
41
|
+
base = (
|
|
42
|
+
provider.get("api")
|
|
43
|
+
or provider.get("base_url")
|
|
44
|
+
or model.get("base_url")
|
|
45
|
+
or dotenv.get("OPENAI_BASE_URL")
|
|
46
|
+
or os.environ.get("OPENAI_BASE_URL")
|
|
47
|
+
)
|
|
48
|
+
if not model.get("default") or not base or not (key_file or key):
|
|
49
|
+
raise ValueError("Model configuration unavailable")
|
|
50
|
+
if key_file and (not Path(key_file).is_file() or not Path(key_file).read_text().strip()):
|
|
51
|
+
raise ValueError("Model key unavailable")
|
|
52
|
+
roots = [home / "skills"]
|
|
53
|
+
roots.extend(
|
|
54
|
+
Path(os.path.expandvars(str(p))).expanduser().resolve()
|
|
55
|
+
for p in config.get("skills", {}).get("external_dirs", [])
|
|
56
|
+
)
|
|
57
|
+
skills = []
|
|
58
|
+
seen = set()
|
|
59
|
+
for root in roots:
|
|
60
|
+
for entry in sorted(root.rglob("SKILL.md")) if root.is_dir() else []:
|
|
61
|
+
if entry.is_symlink():
|
|
62
|
+
continue
|
|
63
|
+
raw = entry.read_text()
|
|
64
|
+
front = raw.split("---", 2)
|
|
65
|
+
meta = yaml.safe_load(front[1]) if raw.startswith("---\n") and len(front) == 3 else {}
|
|
66
|
+
name = (meta or {}).get("name")
|
|
67
|
+
if not isinstance(name, str) or name in seen:
|
|
68
|
+
continue
|
|
69
|
+
seen.add(name)
|
|
70
|
+
files = []
|
|
71
|
+
unsupported = False
|
|
72
|
+
for file in entry.parent.rglob("*"):
|
|
73
|
+
if file.is_symlink():
|
|
74
|
+
unsupported = True
|
|
75
|
+
elif file.is_file():
|
|
76
|
+
if file.suffix.lower() not in {".md", ".txt"} and file.name != "LICENSE":
|
|
77
|
+
unsupported = True
|
|
78
|
+
files.append(str(file.relative_to(entry.parent)))
|
|
79
|
+
skills.append(
|
|
80
|
+
{
|
|
81
|
+
"name": name,
|
|
82
|
+
"path": str(entry.parent),
|
|
83
|
+
"description": str((meta or {}).get("description", ""))[:500],
|
|
84
|
+
"textPackage": not unsupported,
|
|
85
|
+
"files": len(files),
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
return {
|
|
89
|
+
"home": str(home),
|
|
90
|
+
"python": sys.executable,
|
|
91
|
+
"model": model["default"],
|
|
92
|
+
"baseUrl": base,
|
|
93
|
+
"apiKeyFile": key_file,
|
|
94
|
+
"apiKey": None if key_file else key,
|
|
95
|
+
"skills": skills,
|
|
96
|
+
"skillRoots": [str(root) for root in roots],
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
if __name__ == "__main__":
|
|
101
|
+
try:
|
|
102
|
+
print(json.dumps(inspect(sys.argv[1] if len(sys.argv) > 1 else None)))
|
|
103
|
+
except Exception:
|
|
104
|
+
print(
|
|
105
|
+
"Cannot read this Hermes model configuration. "
|
|
106
|
+
"Configure an OpenAI-compatible model with a base URL and a local API key first.",
|
|
107
|
+
file=sys.stderr,
|
|
108
|
+
)
|
|
109
|
+
sys.exit(1)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"""Bounded, metadata-only local inventory. Never reads model credentials or executes Skills."""
|
|
2
|
+
|
|
3
|
+
import hashlib
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
import hermes_yaml as yaml
|
|
12
|
+
except ImportError:
|
|
13
|
+
import yaml
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def inventory(home):
|
|
17
|
+
home = Path(home or os.environ.get("HERMES_HOME", "~/.hermes")).expanduser().resolve()
|
|
18
|
+
config = yaml.safe_load((home / "config.yaml").read_text()) or {}
|
|
19
|
+
roots = [home / "skills"]
|
|
20
|
+
roots.extend(
|
|
21
|
+
Path(os.path.expandvars(str(p))).expanduser().resolve()
|
|
22
|
+
for p in config.get("skills", {}).get("external_dirs", [])
|
|
23
|
+
)
|
|
24
|
+
result, seen = [], set()
|
|
25
|
+
for root in roots:
|
|
26
|
+
if not root.is_dir():
|
|
27
|
+
continue
|
|
28
|
+
for folder, directories, files in os.walk(root, followlinks=False):
|
|
29
|
+
directories[:] = sorted(
|
|
30
|
+
d
|
|
31
|
+
for d in directories
|
|
32
|
+
if not d.startswith(".") and not (Path(folder) / d).is_symlink()
|
|
33
|
+
)
|
|
34
|
+
if len(Path(folder).relative_to(root).parts) > 10:
|
|
35
|
+
directories[:] = []
|
|
36
|
+
continue
|
|
37
|
+
if "SKILL.md" not in files:
|
|
38
|
+
continue
|
|
39
|
+
entry = Path(folder) / "SKILL.md"
|
|
40
|
+
if entry.is_symlink() or entry.stat().st_size > 48000:
|
|
41
|
+
continue
|
|
42
|
+
raw = entry.read_text()
|
|
43
|
+
front = raw.split("---", 2)
|
|
44
|
+
try:
|
|
45
|
+
meta = (
|
|
46
|
+
yaml.safe_load(front[1]) if raw.startswith("---\n") and len(front) == 3 else {}
|
|
47
|
+
)
|
|
48
|
+
except Exception:
|
|
49
|
+
continue
|
|
50
|
+
name = (meta or {}).get("name")
|
|
51
|
+
if (
|
|
52
|
+
not isinstance(name, str)
|
|
53
|
+
or not re.fullmatch(r"[a-z][a-z0-9-]{0,63}", name)
|
|
54
|
+
or name in seen
|
|
55
|
+
):
|
|
56
|
+
continue
|
|
57
|
+
seen.add(name)
|
|
58
|
+
package, size, supported = [], 0, True
|
|
59
|
+
for subfolder, dirs, names in os.walk(entry.parent, followlinks=False):
|
|
60
|
+
for d in dirs[:]:
|
|
61
|
+
if (Path(subfolder) / d).is_symlink():
|
|
62
|
+
supported = False
|
|
63
|
+
dirs.remove(d)
|
|
64
|
+
if len(Path(subfolder).relative_to(entry.parent).parts) > 10:
|
|
65
|
+
supported = False
|
|
66
|
+
dirs[:] = []
|
|
67
|
+
for file_name in sorted(names):
|
|
68
|
+
file = Path(subfolder) / file_name
|
|
69
|
+
if file.is_symlink() or not file.is_file() or file.stat().st_size > 512 * 1024:
|
|
70
|
+
supported = False
|
|
71
|
+
continue
|
|
72
|
+
size += file.stat().st_size
|
|
73
|
+
if size > 1024 * 1024 or len(package) >= 128:
|
|
74
|
+
supported = False
|
|
75
|
+
break
|
|
76
|
+
if (file.suffix.lower() not in {".md", ".txt"} and file.name != "LICENSE"
|
|
77
|
+
and str(file.relative_to(entry.parent)) not in {".clawhub/origin.json", ".openclaw/source-origin.json"}):
|
|
78
|
+
supported = False
|
|
79
|
+
package.append(
|
|
80
|
+
[
|
|
81
|
+
str(file.relative_to(entry.parent)),
|
|
82
|
+
hashlib.sha256(file.read_bytes()).hexdigest(),
|
|
83
|
+
]
|
|
84
|
+
)
|
|
85
|
+
digest = hashlib.sha256(
|
|
86
|
+
json.dumps(sorted(package), separators=(",", ":")).encode()
|
|
87
|
+
).hexdigest()
|
|
88
|
+
result.append(
|
|
89
|
+
{
|
|
90
|
+
"name": name,
|
|
91
|
+
"digest": digest,
|
|
92
|
+
"path": str(entry.parent),
|
|
93
|
+
"description": str((meta or {}).get("description", ""))[:500],
|
|
94
|
+
"supported": supported,
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
directories[:] = []
|
|
98
|
+
if len(result) >= 128:
|
|
99
|
+
return result
|
|
100
|
+
return result
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
if __name__ == "__main__":
|
|
104
|
+
try:
|
|
105
|
+
print(json.dumps(inventory(sys.argv[1] if len(sys.argv) > 1 else None)))
|
|
106
|
+
except Exception:
|
|
107
|
+
print("Skill inventory unavailable", file=sys.stderr)
|
|
108
|
+
sys.exit(1)
|
|
@@ -38,20 +38,11 @@
|
|
|
38
38
|
"propertyNames": {
|
|
39
39
|
"$ref": "#/$defs/id"
|
|
40
40
|
},
|
|
41
|
-
"additionalProperties": {
|
|
42
|
-
"oneOf": [
|
|
43
|
-
{
|
|
44
|
-
"$ref": "#/$defs/x402"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"$ref": "#/$defs/mpp"
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
|
41
|
+
"additionalProperties": { "$ref": "#/$defs/envarBalance" }
|
|
51
42
|
},
|
|
52
43
|
"services": {
|
|
53
44
|
"type": "array",
|
|
54
|
-
"minItems":
|
|
45
|
+
"minItems": 0,
|
|
55
46
|
"maxItems": 64,
|
|
56
47
|
"items": {
|
|
57
48
|
"$ref": "#/$defs/service"
|
|
@@ -67,77 +58,20 @@
|
|
|
67
58
|
"type": "string",
|
|
68
59
|
"pattern": "^[1-9][0-9]{0,77}$"
|
|
69
60
|
},
|
|
70
|
-
"address": {
|
|
71
|
-
"type": "string",
|
|
72
|
-
"pattern": "^0x[0-9a-fA-F]{40}$"
|
|
73
|
-
},
|
|
74
61
|
"httpUrl": {
|
|
75
62
|
"type": "string",
|
|
76
63
|
"format": "uri",
|
|
77
64
|
"pattern": "^https?://",
|
|
78
65
|
"maxLength": 2048
|
|
79
66
|
},
|
|
80
|
-
"
|
|
67
|
+
"envarBalance": {
|
|
81
68
|
"type": "object",
|
|
82
69
|
"additionalProperties": false,
|
|
83
|
-
"required": [
|
|
84
|
-
"adapter",
|
|
85
|
-
"scheme",
|
|
86
|
-
"network",
|
|
87
|
-
"asset",
|
|
88
|
-
"payTo",
|
|
89
|
-
"facilitatorUrl"
|
|
90
|
-
],
|
|
70
|
+
"required": ["adapter", "currency", "accountRef"],
|
|
91
71
|
"properties": {
|
|
92
|
-
"adapter": {
|
|
93
|
-
|
|
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
|
-
}
|
|
72
|
+
"adapter": { "const": "envar_balance" },
|
|
73
|
+
"currency": { "const": "usd" },
|
|
74
|
+
"accountRef": { "$ref": "#/$defs/id" }
|
|
141
75
|
}
|
|
142
76
|
},
|
|
143
77
|
"service": {
|