@nevermined-io/openclaw-plugin 1.0.12 → 1.0.14
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/dist/auth.d.ts +13 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +30 -1
- package/dist/auth.js.map +1 -1
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +63 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +126 -90
- package/dist/index.js.map +1 -1
- package/dist/paid-endpoint.d.ts +20 -0
- package/dist/paid-endpoint.d.ts.map +1 -0
- package/dist/paid-endpoint.js +142 -0
- package/dist/paid-endpoint.js.map +1 -0
- package/dist/tools.d.ts +16 -9
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +253 -215
- package/dist/tools.js.map +1 -1
- package/docs/commands.md +2 -0
- package/docs/getting-started.md +8 -3
- package/docs/guide.md +247 -0
- package/docs/setup.md +16 -7
- package/openclaw.plugin.json +37 -68
- package/package.json +1 -1
package/dist/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAGA,MAAM,YAAY,GAAG,4CAAqD,CAAA;AAE1E;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,WAA2B,EAC3B,MAA8B;IAE9B,OAAO;QACL,2BAA2B;QAC3B;YACE,IAAI,EAAE,yBAAyB;YAC/B,KAAK,EAAE,0BAA0B;YACjC,WAAW,EAAE,wDAAwD;YACrE,UAAU,EAAE;gBACV,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sDAAsD,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AAC;AAED,SAAS,UAAU,CAAC,MAA+B,EAAE,GAAW;IAC9D,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,GAAG,EAAE,CAAC,CAAA;IAC7D,OAAO,CAAC,CAAA;AACV,CAAC"}
|
package/docs/commands.md
CHANGED
|
@@ -123,6 +123,7 @@ Register a new AI agent with an associated payment plan.
|
|
|
123
123
|
| `priceAmounts` | string | **Yes** | Comma-separated price amounts in wei |
|
|
124
124
|
| `priceReceivers` | string | **Yes** | Comma-separated receiver addresses |
|
|
125
125
|
| `creditsAmount` | number | **Yes** | Number of credits in the plan |
|
|
126
|
+
| `tokenAddress` | string | No | ERC20 token address (e.g. USDC). Omit for native token. |
|
|
126
127
|
|
|
127
128
|
**Returns:**
|
|
128
129
|
```json
|
|
@@ -147,6 +148,7 @@ Create a standalone payment plan (without an agent).
|
|
|
147
148
|
| `priceReceivers` | string | **Yes** | Comma-separated receiver addresses |
|
|
148
149
|
| `creditsAmount` | number | **Yes** | Number of credits in the plan |
|
|
149
150
|
| `accessLimit` | string | No | `"credits"` (default) or `"time"` |
|
|
151
|
+
| `tokenAddress` | string | No | ERC20 token address (e.g. USDC). Omit for native token. |
|
|
150
152
|
|
|
151
153
|
**Returns:**
|
|
152
154
|
```json
|
package/docs/getting-started.md
CHANGED
|
@@ -47,9 +47,14 @@ Add your API key directly to `openclaw.json`:
|
|
|
47
47
|
```json
|
|
48
48
|
{
|
|
49
49
|
"plugins": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
50
|
+
"entries": {
|
|
51
|
+
"nevermined": {
|
|
52
|
+
"enabled": true,
|
|
53
|
+
"config": {
|
|
54
|
+
"nvmApiKey": "sandbox:eyJhbG...",
|
|
55
|
+
"environment": "sandbox"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
53
58
|
}
|
|
54
59
|
}
|
|
55
60
|
}
|
package/docs/guide.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Building a Paid AI Agent with OpenClaw and Nevermined"
|
|
3
|
+
description: "Step-by-step guide to building, monetizing, and querying a paid AI agent using the Nevermined OpenClaw plugin"
|
|
4
|
+
icon: "book-open"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Building a Paid AI Agent with OpenClaw and Nevermined
|
|
8
|
+
|
|
9
|
+
The Nevermined OpenClaw plugin lets you monetize AI agents directly from chat channels. Subscribers pay per-request using the [x402 payment protocol](https://docs.nevermined.app/docs/api-reference/typescript/x402-protocol), and builders collect revenue automatically through on-chain payment plans.
|
|
10
|
+
|
|
11
|
+
This guide walks through building a **Weather Oracle** — a paid agent that serves weather forecasts and charges 1 credit per request.
|
|
12
|
+
|
|
13
|
+
## What You Get
|
|
14
|
+
|
|
15
|
+
The plugin adds 7 payment tools and 2 slash commands to your OpenClaw gateway:
|
|
16
|
+
|
|
17
|
+
**Subscriber tools** — for users who consume paid services:
|
|
18
|
+
|
|
19
|
+
| Tool | Purpose |
|
|
20
|
+
|------|---------|
|
|
21
|
+
| `nevermined_checkBalance` | Check remaining credits on a plan |
|
|
22
|
+
| `nevermined_getAccessToken` | Get an x402 token for authenticating requests |
|
|
23
|
+
| `nevermined_orderPlan` | Purchase a payment plan |
|
|
24
|
+
| `nevermined_queryAgent` | Send a paid query to an agent (end-to-end) |
|
|
25
|
+
|
|
26
|
+
**Builder tools** — for developers who create paid services:
|
|
27
|
+
|
|
28
|
+
| Tool | Purpose |
|
|
29
|
+
|------|---------|
|
|
30
|
+
| `nevermined_registerAgent` | Register an agent with a payment plan |
|
|
31
|
+
| `nevermined_createPlan` | Create a standalone payment plan |
|
|
32
|
+
| `nevermined_listPlans` | List your payment plans |
|
|
33
|
+
|
|
34
|
+
**Slash commands**: `/nvm_login` and `/nvm_logout` for authentication.
|
|
35
|
+
|
|
36
|
+
**Paid HTTP endpoint**: An x402-compatible endpoint on the gateway that handles payment verification, request processing, and credit settlement automatically.
|
|
37
|
+
|
|
38
|
+
## Prerequisites
|
|
39
|
+
|
|
40
|
+
- An [OpenClaw](https://openclaw.ai) gateway instance (v2026.2+)
|
|
41
|
+
- Node.js >= 18
|
|
42
|
+
- A [Nevermined account](https://nevermined.app) with an API key
|
|
43
|
+
|
|
44
|
+
## Step 1: Install the Plugin
|
|
45
|
+
|
|
46
|
+
From your OpenClaw gateway server:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
openclaw plugin install @nevermined-io/openclaw-plugin
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or install manually by placing the package in `~/.openclaw/extensions/nevermined/`.
|
|
53
|
+
|
|
54
|
+
After installation, restart the gateway:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
openclaw gateway restart
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
You should see in the logs:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Registered 7 Nevermined payment tools
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Step 2: Authenticate
|
|
67
|
+
|
|
68
|
+
Send `/nvm_login` from any connected chat channel (Telegram, Discord, etc.). The plugin supports two flows:
|
|
69
|
+
|
|
70
|
+
**Browser login** (if your server has a display):
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
/nvm_login
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
A browser window opens for Nevermined authentication. The API key is captured automatically.
|
|
77
|
+
|
|
78
|
+
**Manual login** (headless servers):
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
/nvm_login sandbox:eyJhbGciOiJFUzI1NksifQ...
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Paste your API key directly. Get one from [Nevermined App](https://nevermined.app) under Settings > API Keys.
|
|
85
|
+
|
|
86
|
+
Use `sandbox` for testing, `live` for production.
|
|
87
|
+
|
|
88
|
+
## Step 3: Register Your Agent and Payment Plan
|
|
89
|
+
|
|
90
|
+
Ask your Claw to register an agent. In any chat channel, send a message like:
|
|
91
|
+
|
|
92
|
+
> Register a Nevermined agent called "Weather Oracle" at URL `https://my-gateway.example.com/nevermined/agent` with a plan named "Weather Forecast" priced at 1000000 (1 USDC) to address `0xYourWalletAddress` with token `0x036CbD53842c5426634e7929541eC2318f3dCF7e` granting 5 credits.
|
|
93
|
+
|
|
94
|
+
The agent will call `nevermined_registerAgent` with these parameters:
|
|
95
|
+
|
|
96
|
+
| Parameter | Value | Description |
|
|
97
|
+
|-----------|-------|-------------|
|
|
98
|
+
| `name` | Weather Oracle | Display name on Nevermined |
|
|
99
|
+
| `agentUrl` | `https://my-gateway.example.com/nevermined/agent` | Public URL of your paid endpoint |
|
|
100
|
+
| `planName` | Weather Forecast | Name for the payment plan |
|
|
101
|
+
| `priceAmounts` | `1000000` | Price in token units (1 USDC = 1,000,000 wei) |
|
|
102
|
+
| `priceReceivers` | `0xYourWalletAddress` | Your wallet that receives payments |
|
|
103
|
+
| `creditsAmount` | `5` | Credits granted per purchase |
|
|
104
|
+
| `tokenAddress` | `0x036CbD53842c5426634e7929541eC2318f3dCF7e` | USDC on Base Sepolia. Omit for native token. |
|
|
105
|
+
|
|
106
|
+
The tool returns the `agentId` and `planId` — save these for the next step.
|
|
107
|
+
|
|
108
|
+
## Step 4: Enable the Paid Endpoint
|
|
109
|
+
|
|
110
|
+
Add the returned IDs and enable the paid endpoint in your gateway config (`~/.openclaw/openclaw.json`):
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"plugins": {
|
|
115
|
+
"entries": {
|
|
116
|
+
"nevermined": {
|
|
117
|
+
"enabled": true,
|
|
118
|
+
"config": {
|
|
119
|
+
"nvmApiKey": "sandbox:eyJhbG...",
|
|
120
|
+
"environment": "sandbox",
|
|
121
|
+
"planId": "<your-plan-id>",
|
|
122
|
+
"agentId": "<your-agent-id>",
|
|
123
|
+
"enablePaidEndpoint": true,
|
|
124
|
+
"agentEndpointPath": "/nevermined/agent",
|
|
125
|
+
"creditsPerRequest": 1
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Restart the gateway. You should see:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
Registered 7 Nevermined payment tools
|
|
137
|
+
Registered paid endpoint at /nevermined/agent
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The paid endpoint handles the full x402 lifecycle:
|
|
141
|
+
|
|
142
|
+
1. Extracts the `payment-signature` header from incoming requests
|
|
143
|
+
2. Calls `verifyPermissions` to check the subscriber has credits
|
|
144
|
+
3. Processes the request (runs your agent handler)
|
|
145
|
+
4. Calls `settlePermissions` to burn credits
|
|
146
|
+
5. Returns the response with a `payment-response` header
|
|
147
|
+
|
|
148
|
+
### Configuration Reference
|
|
149
|
+
|
|
150
|
+
| Field | Required | Default | Description |
|
|
151
|
+
|-------|----------|---------|-------------|
|
|
152
|
+
| `nvmApiKey` | No | — | API key (set via `/nvm_login` or config) |
|
|
153
|
+
| `environment` | No | `sandbox` | `sandbox` for testing, `live` for production |
|
|
154
|
+
| `planId` | No | — | Default plan ID for tools and the paid endpoint |
|
|
155
|
+
| `agentId` | No | — | Default agent ID |
|
|
156
|
+
| `creditsPerRequest` | No | `1` | Credits burned per request |
|
|
157
|
+
| `enablePaidEndpoint` | No | `false` | Enable the x402 paid HTTP endpoint |
|
|
158
|
+
| `agentEndpointPath` | No | `/nevermined/agent` | Path for the paid endpoint |
|
|
159
|
+
|
|
160
|
+
## Step 5: Test as a Subscriber
|
|
161
|
+
|
|
162
|
+
From the same gateway (or a different one with a subscriber API key), test the full flow:
|
|
163
|
+
|
|
164
|
+
### Order the plan
|
|
165
|
+
|
|
166
|
+
> Order the Weather Oracle plan `<plan-id>`
|
|
167
|
+
|
|
168
|
+
The Claw calls `nevermined_orderPlan`. You receive 5 credits.
|
|
169
|
+
|
|
170
|
+
### Check your balance
|
|
171
|
+
|
|
172
|
+
> Check my Nevermined balance for plan `<plan-id>`
|
|
173
|
+
|
|
174
|
+
Should show 5 credits.
|
|
175
|
+
|
|
176
|
+
### Query the agent
|
|
177
|
+
|
|
178
|
+
> Ask the Weather Oracle at `http://localhost:18789/nevermined/agent` about the weather in Barcelona
|
|
179
|
+
|
|
180
|
+
The Claw calls `nevermined_queryAgent`, which:
|
|
181
|
+
1. Acquires an x402 access token
|
|
182
|
+
2. Sends the prompt with a `PAYMENT-SIGNATURE` header
|
|
183
|
+
3. The paid endpoint verifies, processes, and settles
|
|
184
|
+
4. Returns the weather forecast
|
|
185
|
+
|
|
186
|
+
### Verify credit burn
|
|
187
|
+
|
|
188
|
+
> Check my balance again
|
|
189
|
+
|
|
190
|
+
Should show 4 credits — one was consumed.
|
|
191
|
+
|
|
192
|
+
## Custom Agent Handlers
|
|
193
|
+
|
|
194
|
+
The plugin includes a mock weather handler for demonstration. To use your own logic, pass a custom `agentHandler` when registering the plugin:
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
import neverminedPlugin from '@nevermined-io/openclaw-plugin'
|
|
198
|
+
|
|
199
|
+
neverminedPlugin.register(api, {
|
|
200
|
+
agentHandler: async (body) => {
|
|
201
|
+
const response = await myAIModel.generate(body.prompt)
|
|
202
|
+
return { result: response }
|
|
203
|
+
},
|
|
204
|
+
})
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The handler receives `{ prompt: string }` and returns any JSON-serializable object.
|
|
208
|
+
|
|
209
|
+
## Credit Balance Awareness
|
|
210
|
+
|
|
211
|
+
When the plugin is authenticated and a `planId` is configured, it automatically injects the current credit balance into the agent's context before each prompt. This means your Claw can proactively warn users when credits are running low:
|
|
212
|
+
|
|
213
|
+
> "You have 2 credits remaining on the Weather Forecast plan. Consider ordering more credits."
|
|
214
|
+
|
|
215
|
+
The balance is cached for 60 seconds to avoid excessive API calls.
|
|
216
|
+
|
|
217
|
+
## How It Works
|
|
218
|
+
|
|
219
|
+
The plugin implements the [x402 payment protocol](https://docs.nevermined.app/docs/api-reference/typescript/x402-protocol) for agent-to-agent payments:
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
Subscriber Claw Builder Claw (Gateway)
|
|
223
|
+
│ │
|
|
224
|
+
│ 1. getX402AccessToken(planId) │
|
|
225
|
+
│─────────────────────────────────────>│ Nevermined API
|
|
226
|
+
│<─────────────────────────────────────│ returns token
|
|
227
|
+
│ │
|
|
228
|
+
│ 2. POST /nevermined/agent │
|
|
229
|
+
│ Header: payment-signature: token │
|
|
230
|
+
│ Body: { prompt: "..." } │
|
|
231
|
+
│─────────────────────────────────────>│
|
|
232
|
+
│ │ 3. verifyPermissions()
|
|
233
|
+
│ │ 4. Process request
|
|
234
|
+
│ │ 5. settlePermissions()
|
|
235
|
+
│ 6. Response + payment-response hdr │
|
|
236
|
+
│<─────────────────────────────────────│
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Credits are managed on-chain through the Nevermined Protocol. The `verifyPermissions` step checks the subscriber's balance without burning credits, and `settlePermissions` burns them only after successful processing.
|
|
240
|
+
|
|
241
|
+
## Next Steps
|
|
242
|
+
|
|
243
|
+
- [Commands Reference](./commands) — full parameter documentation for all tools
|
|
244
|
+
- [Setup Reference](./setup) — detailed configuration options
|
|
245
|
+
- [Nevermined Docs](https://docs.nevermined.app) — platform documentation
|
|
246
|
+
- [x402 Protocol](https://docs.nevermined.app/docs/api-reference/typescript/x402-protocol) — payment protocol specification
|
|
247
|
+
- [OpenClaw Plugin Development](https://docs.openclaw.ai/tools/plugin) — building OpenClaw plugins
|
package/docs/setup.md
CHANGED
|
@@ -13,12 +13,19 @@ The plugin reads its configuration from the `plugins.nevermined` section of your
|
|
|
13
13
|
```json
|
|
14
14
|
{
|
|
15
15
|
"plugins": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
"entries": {
|
|
17
|
+
"nevermined": {
|
|
18
|
+
"enabled": true,
|
|
19
|
+
"config": {
|
|
20
|
+
"nvmApiKey": "sandbox:eyJhbG...",
|
|
21
|
+
"environment": "sandbox",
|
|
22
|
+
"planId": "did:nv:abc123...",
|
|
23
|
+
"agentId": "did:nv:def456...",
|
|
24
|
+
"creditsPerRequest": 1,
|
|
25
|
+
"enablePaidEndpoint": false,
|
|
26
|
+
"agentEndpointPath": "/nevermined/agent"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
22
29
|
}
|
|
23
30
|
}
|
|
24
31
|
}
|
|
@@ -28,11 +35,13 @@ The plugin reads its configuration from the `plugins.nevermined` section of your
|
|
|
28
35
|
|
|
29
36
|
| Field | Required | Default | Description |
|
|
30
37
|
|-------|----------|---------|-------------|
|
|
31
|
-
| `nvmApiKey` | No | — | Your Nevermined API key. Can be set via `/
|
|
38
|
+
| `nvmApiKey` | No | — | Your Nevermined API key. Can be set via `/nvm_login` instead. |
|
|
32
39
|
| `environment` | No | `sandbox` | Target environment: `sandbox` for testing, `live` for production. |
|
|
33
40
|
| `planId` | No | — | Default payment plan ID. When set, subscriber tools use this plan automatically. |
|
|
34
41
|
| `agentId` | No | — | Default agent ID. Required for plans with multiple agents. |
|
|
35
42
|
| `creditsPerRequest` | No | `1` | Number of credits consumed per request. |
|
|
43
|
+
| `enablePaidEndpoint` | No | `false` | Enable the x402 paid HTTP endpoint on the gateway. |
|
|
44
|
+
| `agentEndpointPath` | No | `/nevermined/agent` | HTTP path for the paid agent endpoint. |
|
|
36
45
|
|
|
37
46
|
### Environment Details
|
|
38
47
|
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,75 +1,44 @@
|
|
|
1
1
|
{
|
|
2
|
+
"id": "nevermined",
|
|
2
3
|
"name": "@nevermined-io/openclaw-plugin",
|
|
3
|
-
"version": "0.1.0",
|
|
4
4
|
"description": "Nevermined plugin for OpenClaw — AI agent payments and access control",
|
|
5
5
|
"configSchema": {
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"nvmApiKey": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Your Nevermined API key (optional — use /nvm-login to authenticate via browser)"
|
|
12
|
+
},
|
|
13
|
+
"environment": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"enum": ["sandbox", "live"],
|
|
16
|
+
"default": "sandbox",
|
|
17
|
+
"description": "Nevermined environment to connect to"
|
|
18
|
+
},
|
|
19
|
+
"planId": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Default payment plan ID (required for subscriber tools)"
|
|
22
|
+
},
|
|
23
|
+
"agentId": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Default agent ID (required for multi-agent plans)"
|
|
26
|
+
},
|
|
27
|
+
"creditsPerRequest": {
|
|
28
|
+
"type": "number",
|
|
29
|
+
"default": 1,
|
|
30
|
+
"description": "Number of credits consumed per request"
|
|
31
|
+
},
|
|
32
|
+
"enablePaidEndpoint": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"default": false,
|
|
35
|
+
"description": "Enable the paid HTTP endpoint on the gateway for receiving paid queries"
|
|
36
|
+
},
|
|
37
|
+
"agentEndpointPath": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"default": "/nevermined/agent",
|
|
40
|
+
"description": "HTTP path for the paid agent endpoint"
|
|
41
|
+
}
|
|
31
42
|
}
|
|
32
|
-
},
|
|
33
|
-
"uiHints": {
|
|
34
|
-
"nvmApiKey": {
|
|
35
|
-
"sensitive": true,
|
|
36
|
-
"label": "Nevermined API Key",
|
|
37
|
-
"placeholder": "sandbox:eyJhbG... (or use /nvm-login)"
|
|
38
|
-
},
|
|
39
|
-
"environment": {
|
|
40
|
-
"label": "Environment"
|
|
41
|
-
},
|
|
42
|
-
"planId": {
|
|
43
|
-
"label": "Plan ID",
|
|
44
|
-
"placeholder": "did:nv:..."
|
|
45
|
-
},
|
|
46
|
-
"agentId": {
|
|
47
|
-
"label": "Agent ID",
|
|
48
|
-
"placeholder": "did:nv:..."
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"commands": [
|
|
52
|
-
{
|
|
53
|
-
"name": "nvm-login",
|
|
54
|
-
"description": "Authenticate with Nevermined via browser login"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"name": "nvm-logout",
|
|
58
|
-
"description": "Log out from Nevermined"
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"skills": ["skills/nevermined/SKILL.md"],
|
|
62
|
-
"gateway": {
|
|
63
|
-
"methods": [
|
|
64
|
-
"nevermined.login",
|
|
65
|
-
"nevermined.logout",
|
|
66
|
-
"nevermined.checkBalance",
|
|
67
|
-
"nevermined.getAccessToken",
|
|
68
|
-
"nevermined.orderPlan",
|
|
69
|
-
"nevermined.queryAgent",
|
|
70
|
-
"nevermined.registerAgent",
|
|
71
|
-
"nevermined.createPlan",
|
|
72
|
-
"nevermined.listPlans"
|
|
73
|
-
]
|
|
74
43
|
}
|
|
75
44
|
}
|
package/package.json
CHANGED