@nevermined-io/openclaw-plugin 1.0.12 → 1.0.13
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/index.d.ts +42 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +91 -91
- package/dist/index.js.map +1 -1
- package/dist/tools.d.ts +16 -9
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +228 -215
- package/dist/tools.js.map +1 -1
- package/openclaw.plugin.json +27 -68
- package/package.json +1 -1
package/dist/auth.d.ts
CHANGED
|
@@ -4,6 +4,19 @@ export interface LoginResult {
|
|
|
4
4
|
environment: string;
|
|
5
5
|
loginUrl: string;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Returns the Nevermined login URL for a given environment.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getLoginUrl(environment: EnvironmentName): string;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the API key settings URL for a given environment.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getApiKeyUrl(environment: EnvironmentName): string;
|
|
15
|
+
/**
|
|
16
|
+
* Checks whether a string looks like a Nevermined API key.
|
|
17
|
+
* API keys have the format "environment:base64token".
|
|
18
|
+
*/
|
|
19
|
+
export declare function looksLikeApiKey(value: string): boolean;
|
|
7
20
|
/**
|
|
8
21
|
* Starts a one-shot HTTP server, opens the Nevermined login page in the browser,
|
|
9
22
|
* and resolves with the API key once the callback is received.
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAa9D,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,eAAe,EAC5B,aAAa,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAe,GAC1D,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAa9D,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,eAAe,GAAG,MAAM,CAMhE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,eAAe,GAAG,MAAM,CAMjE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,eAAe,EAC5B,aAAa,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAe,GAC1D,OAAO,CAAC,WAAW,CAAC,CAmEtB;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBtD"}
|
package/dist/auth.js
CHANGED
|
@@ -10,6 +10,33 @@ const SUCCESS_HTML = `
|
|
|
10
10
|
</div>
|
|
11
11
|
</body></html>
|
|
12
12
|
`;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the Nevermined login URL for a given environment.
|
|
15
|
+
*/
|
|
16
|
+
export function getLoginUrl(environment) {
|
|
17
|
+
const envInfo = Environments[environment];
|
|
18
|
+
if (!envInfo?.frontend) {
|
|
19
|
+
throw new Error(`Unknown environment: ${environment}`);
|
|
20
|
+
}
|
|
21
|
+
return `${envInfo.frontend}/login`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Returns the API key settings URL for a given environment.
|
|
25
|
+
*/
|
|
26
|
+
export function getApiKeyUrl(environment) {
|
|
27
|
+
const envInfo = Environments[environment];
|
|
28
|
+
if (!envInfo?.frontend) {
|
|
29
|
+
throw new Error(`Unknown environment: ${environment}`);
|
|
30
|
+
}
|
|
31
|
+
return `${envInfo.frontend}/permissions/global-permissions`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Checks whether a string looks like a Nevermined API key.
|
|
35
|
+
* API keys have the format "environment:base64token".
|
|
36
|
+
*/
|
|
37
|
+
export function looksLikeApiKey(value) {
|
|
38
|
+
return /^(sandbox|live|staging_sandbox|staging_live):/.test(value.trim());
|
|
39
|
+
}
|
|
13
40
|
/**
|
|
14
41
|
* Starts a one-shot HTTP server, opens the Nevermined login page in the browser,
|
|
15
42
|
* and resolves with the API key once the callback is received.
|
|
@@ -56,7 +83,9 @@ export async function startLoginFlow(environment, openBrowserFn = openBrowser) {
|
|
|
56
83
|
const callbackUrl = encodeURIComponent(`http://localhost:${port}/callback`);
|
|
57
84
|
const loginUrl = `${frontendUrl}/auth/cli?callback_url=${callbackUrl}`;
|
|
58
85
|
openBrowserFn(loginUrl).catch(() => {
|
|
59
|
-
|
|
86
|
+
clearTimeout(timeout);
|
|
87
|
+
server.close();
|
|
88
|
+
reject(new Error('Could not open browser'));
|
|
60
89
|
});
|
|
61
90
|
});
|
|
62
91
|
server.on('error', (err) => {
|
package/dist/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC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K,OAAO,EAAE,CAAC;YAChC,GAAG,GAAG,KAAK,CAAA;YACX,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;QACnC,CAAC;aAAM,CAAC;YACN,GAAG,GAAG,UAAU,CAAA;YAChB,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;QACd,CAAC;QACD,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;YAC1B,IAAI,GAAG;gBAAE,MAAM,CAAC,GAAG,CAAC,CAAA;;gBACf,OAAO,EAAE,CAAA;QAChB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,44 +1,64 @@
|
|
|
1
1
|
import { validateConfig, createPaymentsFromConfig, requireApiKey } from './config.js';
|
|
2
|
-
import { allTools } from './tools.js';
|
|
3
2
|
import { Payments } from '@nevermined-io/payments';
|
|
4
3
|
import type { NeverminedPluginConfig } from './config.js';
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export { validateConfig, createPaymentsFromConfig, requireApiKey, allTools };
|
|
4
|
+
export type { NeverminedPluginConfig };
|
|
5
|
+
export { validateConfig, createPaymentsFromConfig, requireApiKey };
|
|
8
6
|
export { startLoginFlow, openBrowser } from './auth.js';
|
|
7
|
+
/**
|
|
8
|
+
* Minimal subset of the OpenClaw Plugin API used by this plugin.
|
|
9
|
+
*/
|
|
9
10
|
export interface OpenClawPluginAPI {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
id: string;
|
|
12
|
+
pluginConfig?: Record<string, unknown>;
|
|
13
|
+
config: Record<string, unknown>;
|
|
14
|
+
logger: {
|
|
15
|
+
info: (msg: string) => void;
|
|
16
|
+
warn: (msg: string) => void;
|
|
17
|
+
error: (msg: string) => void;
|
|
18
|
+
};
|
|
19
|
+
registerTool(tool: unknown, opts?: {
|
|
20
|
+
optional?: boolean;
|
|
21
|
+
names?: string[];
|
|
21
22
|
}): void;
|
|
22
|
-
registerCommand(
|
|
23
|
+
registerCommand(command: {
|
|
23
24
|
name: string;
|
|
24
25
|
description: string;
|
|
25
26
|
acceptsArgs?: boolean;
|
|
26
27
|
requireAuth?: boolean;
|
|
27
|
-
handler: (ctx: CommandContext) => Promise<
|
|
28
|
-
text: string;
|
|
29
|
-
}>;
|
|
28
|
+
handler: (ctx: CommandContext) => Promise<CommandResult> | CommandResult;
|
|
30
29
|
}): void;
|
|
30
|
+
registerGatewayMethod(method: string, handler: unknown): void;
|
|
31
31
|
}
|
|
32
32
|
export interface CommandContext {
|
|
33
|
-
senderId
|
|
33
|
+
senderId?: string;
|
|
34
34
|
channel: string;
|
|
35
35
|
isAuthorizedSender: boolean;
|
|
36
|
-
args
|
|
36
|
+
args?: string;
|
|
37
37
|
commandBody: string;
|
|
38
38
|
config: Record<string, unknown>;
|
|
39
39
|
}
|
|
40
|
+
export interface CommandResult {
|
|
41
|
+
text: string;
|
|
42
|
+
}
|
|
40
43
|
export interface RegisterOptions {
|
|
41
44
|
paymentsFactory?: (config: NeverminedPluginConfig) => Payments;
|
|
42
45
|
}
|
|
43
|
-
export
|
|
46
|
+
export interface ToolContext {
|
|
47
|
+
config?: Record<string, unknown>;
|
|
48
|
+
workspaceDir?: string;
|
|
49
|
+
agentDir?: string;
|
|
50
|
+
agentId?: string;
|
|
51
|
+
sessionKey?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* OpenClaw plugin definition object.
|
|
55
|
+
* Exports id, name, description, and a register function.
|
|
56
|
+
*/
|
|
57
|
+
declare const neverminedPlugin: {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
register(api: OpenClawPluginAPI, options?: RegisterOptions): void;
|
|
62
|
+
};
|
|
63
|
+
export default neverminedPlugin;
|
|
44
64
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAGrF,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAElD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,YAAY,EAAE,sBAAsB,EAAE,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,aAAa,EAAE,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,MAAM,EAAE;QACN,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;QAC3B,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;QAC3B,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAC7B,CAAA;IACD,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;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ig, createPaymentsFromConfig, requireApiKey } from './config.js';
|
|
2
|
-
import {
|
|
3
|
-
import { startLoginFlow } from './auth.js';
|
|
4
|
-
export { validateConfig, createPaymentsFromConfig, requireApiKey
|
|
2
|
+
import { createTools } from './tools.js';
|
|
3
|
+
import { startLoginFlow, looksLikeApiKey, getLoginUrl, getApiKeyUrl } from './auth.js';
|
|
4
|
+
export { validateConfig, createPaymentsFromConfig, requireApiKey };
|
|
5
5
|
export { startLoginFlow, openBrowser } from './auth.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{ name: 'environment', type: 'string', description: 'Target environment: sandbox or live (default: from config)', required: false },
|
|
24
|
-
],
|
|
25
|
-
handler: async (params) => {
|
|
26
|
-
const env = params.environment || config.environment || 'sandbox';
|
|
27
|
-
const result = await startLoginFlow(env);
|
|
28
|
-
config.nvmApiKey = result.nvmApiKey;
|
|
29
|
-
config.environment = result.environment;
|
|
30
|
-
payments = null; // Reset so next call creates a fresh instance
|
|
31
|
-
api.setConfig('nevermined', 'nvmApiKey', result.nvmApiKey);
|
|
32
|
-
api.setConfig('nevermined', 'environment', result.environment);
|
|
33
|
-
return {
|
|
34
|
-
authenticated: true,
|
|
35
|
-
environment: result.environment,
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
api.registerGatewayMethod('nevermined.logout', {
|
|
40
|
-
description: 'Log out from Nevermined by removing the stored API key',
|
|
41
|
-
params: [],
|
|
42
|
-
handler: async () => {
|
|
43
|
-
config.nvmApiKey = undefined;
|
|
44
|
-
payments = null;
|
|
45
|
-
api.setConfig('nevermined', 'nvmApiKey', '');
|
|
46
|
-
return { authenticated: false };
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
// --- Slash commands for chat channels ---
|
|
50
|
-
api.registerCommand({
|
|
51
|
-
name: 'nvm-login',
|
|
52
|
-
description: 'Authenticate with Nevermined via browser login',
|
|
53
|
-
acceptsArgs: true,
|
|
54
|
-
requireAuth: true,
|
|
55
|
-
handler: async (ctx) => {
|
|
56
|
-
try {
|
|
57
|
-
const env = (ctx.args?.trim() || config.environment || 'sandbox');
|
|
58
|
-
const result = await startLoginFlow(env);
|
|
59
|
-
config.nvmApiKey = result.nvmApiKey;
|
|
60
|
-
config.environment = result.environment;
|
|
61
|
-
payments = null;
|
|
62
|
-
api.setConfig('nevermined', 'nvmApiKey', result.nvmApiKey);
|
|
63
|
-
api.setConfig('nevermined', 'environment', result.environment);
|
|
64
|
-
return { text: `Authenticated with Nevermined (${result.environment}). You can now use payment tools.` };
|
|
6
|
+
/**
|
|
7
|
+
* OpenClaw plugin definition object.
|
|
8
|
+
* Exports id, name, description, and a register function.
|
|
9
|
+
*/
|
|
10
|
+
const neverminedPlugin = {
|
|
11
|
+
id: 'nevermined',
|
|
12
|
+
name: '@nevermined-io/openclaw-plugin',
|
|
13
|
+
description: 'Nevermined plugin for OpenClaw — AI agent payments and access control',
|
|
14
|
+
register(api, options) {
|
|
15
|
+
const config = validateConfig(api.pluginConfig ?? {});
|
|
16
|
+
// Lazy Payments instance — created on first use after authentication
|
|
17
|
+
let payments = null;
|
|
18
|
+
const factory = options?.paymentsFactory ?? createPaymentsFromConfig;
|
|
19
|
+
function getPayments() {
|
|
20
|
+
if (!payments) {
|
|
21
|
+
requireApiKey(config);
|
|
22
|
+
payments = factory(config);
|
|
65
23
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
handler: async (
|
|
24
|
+
return payments;
|
|
25
|
+
}
|
|
26
|
+
// --- Register tools via factory function ---
|
|
27
|
+
// OpenClaw calls the factory per agent session, providing context.
|
|
28
|
+
// We return the full tool array each time.
|
|
29
|
+
const toolNames = [
|
|
30
|
+
'nevermined_checkBalance',
|
|
31
|
+
'nevermined_getAccessToken',
|
|
32
|
+
'nevermined_orderPlan',
|
|
33
|
+
'nevermined_queryAgent',
|
|
34
|
+
'nevermined_registerAgent',
|
|
35
|
+
'nevermined_createPlan',
|
|
36
|
+
'nevermined_listPlans',
|
|
37
|
+
];
|
|
38
|
+
api.registerTool((_ctx) => createTools(getPayments, config), { names: toolNames });
|
|
39
|
+
api.logger.info(`Registered ${toolNames.length} Nevermined payment tools`);
|
|
40
|
+
// --- Slash commands for chat channels ---
|
|
41
|
+
api.registerCommand({
|
|
42
|
+
name: 'nvm_login',
|
|
43
|
+
description: 'Authenticate with Nevermined. Usage: /nvm_login [environment] or /nvm_login <api-key>',
|
|
44
|
+
acceptsArgs: true,
|
|
45
|
+
requireAuth: true,
|
|
46
|
+
handler: async (ctx) => {
|
|
47
|
+
const input = ctx.args?.trim() || '';
|
|
48
|
+
// --- Flow 1: User pasted an API key directly ---
|
|
49
|
+
if (looksLikeApiKey(input)) {
|
|
50
|
+
const apiKey = input;
|
|
51
|
+
const keyEnv = apiKey.split(':')[0];
|
|
52
|
+
config.nvmApiKey = apiKey;
|
|
53
|
+
config.environment = keyEnv;
|
|
54
|
+
payments = null;
|
|
55
|
+
api.logger.info(`Nevermined: authenticated via API key (${keyEnv})`);
|
|
56
|
+
return { text: `Authenticated with Nevermined (${keyEnv}). You can now use payment tools.` };
|
|
57
|
+
}
|
|
58
|
+
// --- Flow 2: Try browser login, fall back to manual instructions ---
|
|
59
|
+
const env = (input || config.environment || 'sandbox');
|
|
89
60
|
try {
|
|
90
|
-
|
|
61
|
+
const result = await startLoginFlow(env);
|
|
62
|
+
config.nvmApiKey = result.nvmApiKey;
|
|
63
|
+
config.environment = result.environment;
|
|
64
|
+
payments = null;
|
|
65
|
+
return { text: `Authenticated with Nevermined (${result.environment}). You can now use payment tools.` };
|
|
91
66
|
}
|
|
92
|
-
catch (
|
|
93
|
-
|
|
94
|
-
|
|
67
|
+
catch (_err) {
|
|
68
|
+
// Browser login failed (headless server, timeout, etc.)
|
|
69
|
+
// Provide manual instructions
|
|
70
|
+
const loginUrl = getLoginUrl(env);
|
|
71
|
+
const apiKeyUrl = getApiKeyUrl(env);
|
|
72
|
+
return {
|
|
73
|
+
text: [
|
|
74
|
+
`I couldn't open a browser for automatic login. Here's how to authenticate manually:`,
|
|
75
|
+
``,
|
|
76
|
+
`1. Open this URL and log in: ${loginUrl}`,
|
|
77
|
+
`2. Go to API Keys to get your API key: ${apiKeyUrl}`,
|
|
78
|
+
`3. Copy the API key and send it here:`,
|
|
79
|
+
` /nvm_login <your-api-key>`,
|
|
80
|
+
``,
|
|
81
|
+
`API keys look like: ${env}:eyJhbG...`,
|
|
82
|
+
].join('\n'),
|
|
83
|
+
};
|
|
95
84
|
}
|
|
96
85
|
},
|
|
97
86
|
});
|
|
98
|
-
|
|
99
|
-
|
|
87
|
+
api.registerCommand({
|
|
88
|
+
name: 'nvm_logout',
|
|
89
|
+
description: 'Log out from Nevermined',
|
|
90
|
+
requireAuth: true,
|
|
91
|
+
handler: async () => {
|
|
92
|
+
config.nvmApiKey = undefined;
|
|
93
|
+
payments = null;
|
|
94
|
+
return { text: 'Logged out from Nevermined. API key has been removed.' };
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
export default neverminedPlugin;
|
|
100
100
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EA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iC,CAAA;oBAC7D,QAAQ,GAAG,IAAI,CAAA;oBAEf,OAAO,EAAE,IAAI,EAAE,kCAAkC,MAAM,CAAC,WAAW,mCAAmC,EAAE,CAAA;gBAC1G,CAAC;gBAAC,OAAO,IAAI,EAAE,CAAC;oBACd,wDAAwD;oBACxD,8BAA8B;oBAC9B,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;oBACjC,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAA;oBAEnC,OAAO;wBACL,IAAI,EAAE;4BACJ,qFAAqF;4BACrF,EAAE;4BACF,gCAAgC,QAAQ,EAAE;4BAC1C,0CAA0C,SAAS,EAAE;4BACrD,uCAAuC;4BACvC,8BAA8B;4BAC9B,EAAE;4BACF,uBAAuB,GAAG,YAAY;yBACvC,CAAC,IAAI,CAAC,IAAI,CAAC;qBACb,CAAA;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAA;QAEF,GAAG,CAAC,eAAe,CAAC;YAClB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,yBAAyB;YACtC,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,MAAM,CAAC,SAAS,GAAG,SAAS,CAAA;gBAC5B,QAAQ,GAAG,IAAI,CAAA;gBACf,OAAO,EAAE,IAAI,EAAE,uDAAuD,EAAE,CAAA;YAC1E,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import type { Payments } from '@nevermined-io/payments';
|
|
2
2
|
import type { NeverminedPluginConfig } from './config.js';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Creates all Nevermined payment tools for the OpenClaw plugin.
|
|
5
|
+
* Each tool is an object with { name, description, parameters, execute }
|
|
6
|
+
* compatible with the OpenClaw AnyAgentTool interface.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createTools(getPayments: () => Payments, config: NeverminedPluginConfig): ToolObject[];
|
|
9
|
+
interface ToolObject {
|
|
4
10
|
name: string;
|
|
5
|
-
|
|
11
|
+
label: string;
|
|
6
12
|
description: string;
|
|
7
|
-
|
|
13
|
+
parameters: Record<string, unknown>;
|
|
14
|
+
execute: (_id: string, params: Record<string, unknown>) => Promise<ToolResult>;
|
|
8
15
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
interface ToolResult {
|
|
17
|
+
content: Array<{
|
|
18
|
+
type: string;
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
14
21
|
}
|
|
15
|
-
export
|
|
22
|
+
export {};
|
|
16
23
|
//# sourceMappingURL=tools.d.ts.map
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,WAAW,EAAE,MAAM,QAAQ,EAC3B,MAAM,EAAE,sBAAsB,GAC7B,UAAU,EAAE,CA2Od;AAID,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;CAC/E;AAED,UAAU,UAAU;IAClB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC/C"}
|
package/dist/tools.js
CHANGED
|
@@ -1,218 +1,231 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Creates all Nevermined payment tools for the OpenClaw plugin.
|
|
3
|
+
* Each tool is an object with { name, description, parameters, execute }
|
|
4
|
+
* compatible with the OpenClaw AnyAgentTool interface.
|
|
5
|
+
*/
|
|
6
|
+
export function createTools(getPayments, config) {
|
|
7
|
+
return [
|
|
8
|
+
// --- Subscriber tools ---
|
|
9
|
+
{
|
|
10
|
+
name: 'nevermined_checkBalance',
|
|
11
|
+
label: 'Nevermined Check Balance',
|
|
12
|
+
description: 'Check the credit balance for a Nevermined payment plan',
|
|
13
|
+
parameters: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
planId: { type: 'string', description: 'The payment plan ID (uses config default if omitted)' },
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
async execute(_id, params) {
|
|
20
|
+
const planId = str(params, 'planId') ?? config.planId;
|
|
21
|
+
if (!planId)
|
|
22
|
+
throw new Error('planId is required — provide it as a parameter or in the plugin config');
|
|
23
|
+
const balance = await getPayments().plans.getPlanBalance(planId);
|
|
24
|
+
return result({
|
|
25
|
+
planId: balance.planId,
|
|
26
|
+
planName: balance.planName,
|
|
27
|
+
balance: balance.balance.toString(),
|
|
28
|
+
isSubscriber: balance.isSubscriber,
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'nevermined_getAccessToken',
|
|
34
|
+
label: 'Nevermined Get Access Token',
|
|
35
|
+
description: 'Get an x402 access token for authenticating requests to a Nevermined agent',
|
|
36
|
+
parameters: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
properties: {
|
|
39
|
+
planId: { type: 'string', description: 'The payment plan ID' },
|
|
40
|
+
agentId: { type: 'string', description: 'The agent ID' },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
async execute(_id, params) {
|
|
44
|
+
const planId = str(params, 'planId') ?? config.planId;
|
|
45
|
+
if (!planId)
|
|
46
|
+
throw new Error('planId is required — provide it as a parameter or in the plugin config');
|
|
47
|
+
const agentId = str(params, 'agentId') ?? config.agentId;
|
|
48
|
+
const token = await getPayments().x402.getX402AccessToken(planId, agentId);
|
|
49
|
+
return result({ accessToken: token.accessToken });
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'nevermined_orderPlan',
|
|
54
|
+
label: 'Nevermined Order Plan',
|
|
55
|
+
description: 'Order (purchase) a Nevermined payment plan',
|
|
56
|
+
parameters: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
properties: {
|
|
59
|
+
planId: { type: 'string', description: 'The payment plan ID to order' },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
async execute(_id, params) {
|
|
63
|
+
const planId = str(params, 'planId') ?? config.planId;
|
|
64
|
+
if (!planId)
|
|
65
|
+
throw new Error('planId is required — provide it as a parameter or in the plugin config');
|
|
66
|
+
const res = await getPayments().plans.orderPlan(planId);
|
|
67
|
+
return result(res);
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'nevermined_queryAgent',
|
|
72
|
+
label: 'Nevermined Query Agent',
|
|
73
|
+
description: 'Query a Nevermined AI agent end-to-end: acquires an x402 access token, sends the prompt to the agent, and returns the response',
|
|
74
|
+
parameters: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
agentUrl: { type: 'string', description: 'The URL of the agent to query' },
|
|
78
|
+
prompt: { type: 'string', description: 'The prompt to send to the agent' },
|
|
79
|
+
planId: { type: 'string', description: 'The payment plan ID' },
|
|
80
|
+
agentId: { type: 'string', description: 'The agent ID' },
|
|
81
|
+
method: { type: 'string', description: 'HTTP method (default: POST)' },
|
|
82
|
+
},
|
|
83
|
+
required: ['agentUrl', 'prompt'],
|
|
84
|
+
},
|
|
85
|
+
async execute(_id, params) {
|
|
86
|
+
const agentUrl = requireStr(params, 'agentUrl');
|
|
87
|
+
const prompt = requireStr(params, 'prompt');
|
|
88
|
+
const planId = str(params, 'planId') ?? config.planId;
|
|
89
|
+
if (!planId)
|
|
90
|
+
throw new Error('planId is required — provide it as a parameter or in the plugin config');
|
|
91
|
+
const agentId = str(params, 'agentId') ?? config.agentId;
|
|
92
|
+
const method = str(params, 'method') ?? 'POST';
|
|
93
|
+
const { accessToken } = await getPayments().x402.getX402AccessToken(planId, agentId);
|
|
94
|
+
const response = await fetch(agentUrl, {
|
|
95
|
+
method,
|
|
96
|
+
headers: {
|
|
97
|
+
'Content-Type': 'application/json',
|
|
98
|
+
'PAYMENT-SIGNATURE': accessToken,
|
|
99
|
+
},
|
|
100
|
+
body: method !== 'GET' ? JSON.stringify({ prompt }) : undefined,
|
|
101
|
+
});
|
|
102
|
+
if (response.status === 402) {
|
|
103
|
+
return result({
|
|
104
|
+
error: 'Payment required — insufficient credits. Order the plan first using nevermined_orderPlan.',
|
|
105
|
+
status: 402,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (!response.ok) {
|
|
109
|
+
return result({
|
|
110
|
+
error: `Agent returned HTTP ${response.status}: ${response.statusText}`,
|
|
111
|
+
status: response.status,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
const body = await response.json();
|
|
115
|
+
return result(body);
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
// --- Builder tools ---
|
|
119
|
+
{
|
|
120
|
+
name: 'nevermined_registerAgent',
|
|
121
|
+
label: 'Nevermined Register Agent',
|
|
122
|
+
description: 'Register a new AI agent with an associated payment plan on Nevermined',
|
|
123
|
+
parameters: {
|
|
124
|
+
type: 'object',
|
|
125
|
+
properties: {
|
|
126
|
+
name: { type: 'string', description: 'Agent name' },
|
|
127
|
+
description: { type: 'string', description: 'Agent description' },
|
|
128
|
+
agentUrl: { type: 'string', description: 'The endpoint URL for the agent' },
|
|
129
|
+
planName: { type: 'string', description: 'Name for the payment plan' },
|
|
130
|
+
priceAmounts: { type: 'string', description: 'Comma-separated price amounts in wei' },
|
|
131
|
+
priceReceivers: { type: 'string', description: 'Comma-separated receiver addresses' },
|
|
132
|
+
creditsAmount: { type: 'number', description: 'Number of credits in the plan' },
|
|
133
|
+
},
|
|
134
|
+
required: ['name', 'agentUrl', 'planName', 'priceAmounts', 'priceReceivers', 'creditsAmount'],
|
|
135
|
+
},
|
|
136
|
+
async execute(_id, params) {
|
|
137
|
+
const name = requireStr(params, 'name');
|
|
138
|
+
const description = str(params, 'description') ?? '';
|
|
139
|
+
const agentUrl = requireStr(params, 'agentUrl');
|
|
140
|
+
const planName = requireStr(params, 'planName');
|
|
141
|
+
const priceAmounts = requireStr(params, 'priceAmounts')
|
|
142
|
+
.split(',')
|
|
143
|
+
.map((s) => BigInt(s.trim()));
|
|
144
|
+
const priceReceivers = requireStr(params, 'priceReceivers')
|
|
145
|
+
.split(',')
|
|
146
|
+
.map((s) => s.trim());
|
|
147
|
+
const creditsAmount = Number(requireStr(params, 'creditsAmount'));
|
|
148
|
+
const res = await getPayments().agents.registerAgentAndPlan({ name, description }, { endpoints: [{ POST: agentUrl }], agentDefinitionUrl: agentUrl }, { name: planName }, { amounts: priceAmounts, receivers: priceReceivers, isCrypto: true }, {
|
|
149
|
+
isRedemptionAmountFixed: true,
|
|
150
|
+
redemptionType: 4,
|
|
151
|
+
proofRequired: false,
|
|
152
|
+
durationSecs: 0n,
|
|
153
|
+
amount: BigInt(creditsAmount),
|
|
154
|
+
minAmount: 1n,
|
|
155
|
+
maxAmount: BigInt(creditsAmount),
|
|
156
|
+
});
|
|
157
|
+
return result({ agentId: res.agentId, planId: res.planId, txHash: res.txHash });
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: 'nevermined_createPlan',
|
|
162
|
+
label: 'Nevermined Create Plan',
|
|
163
|
+
description: 'Create a new payment plan on Nevermined',
|
|
164
|
+
parameters: {
|
|
165
|
+
type: 'object',
|
|
166
|
+
properties: {
|
|
167
|
+
name: { type: 'string', description: 'Plan name' },
|
|
168
|
+
description: { type: 'string', description: 'Plan description' },
|
|
169
|
+
priceAmounts: { type: 'string', description: 'Comma-separated price amounts in wei' },
|
|
170
|
+
priceReceivers: { type: 'string', description: 'Comma-separated receiver addresses' },
|
|
171
|
+
creditsAmount: { type: 'number', description: 'Number of credits in the plan' },
|
|
172
|
+
accessLimit: { type: 'string', description: '"credits" or "time" (default: credits)' },
|
|
173
|
+
},
|
|
174
|
+
required: ['name', 'priceAmounts', 'priceReceivers', 'creditsAmount'],
|
|
175
|
+
},
|
|
176
|
+
async execute(_id, params) {
|
|
177
|
+
const name = requireStr(params, 'name');
|
|
178
|
+
const description = str(params, 'description') ?? '';
|
|
179
|
+
const priceAmounts = requireStr(params, 'priceAmounts')
|
|
180
|
+
.split(',')
|
|
181
|
+
.map((s) => BigInt(s.trim()));
|
|
182
|
+
const priceReceivers = requireStr(params, 'priceReceivers')
|
|
183
|
+
.split(',')
|
|
184
|
+
.map((s) => s.trim());
|
|
185
|
+
const creditsAmount = Number(requireStr(params, 'creditsAmount'));
|
|
186
|
+
const accessLimit = (str(params, 'accessLimit') ?? 'credits');
|
|
187
|
+
const res = await getPayments().plans.registerPlan({ name, description, accessLimit }, { amounts: priceAmounts, receivers: priceReceivers, isCrypto: true }, {
|
|
188
|
+
isRedemptionAmountFixed: true,
|
|
189
|
+
redemptionType: 4,
|
|
190
|
+
proofRequired: false,
|
|
191
|
+
durationSecs: 0n,
|
|
192
|
+
amount: BigInt(creditsAmount),
|
|
193
|
+
minAmount: 1n,
|
|
194
|
+
maxAmount: BigInt(creditsAmount),
|
|
195
|
+
}, undefined, accessLimit);
|
|
196
|
+
return result({ planId: res.planId });
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: 'nevermined_listPlans',
|
|
201
|
+
label: 'Nevermined List Plans',
|
|
202
|
+
description: "List the builder's payment plans on Nevermined",
|
|
203
|
+
parameters: {
|
|
204
|
+
type: 'object',
|
|
205
|
+
properties: {},
|
|
206
|
+
},
|
|
207
|
+
async execute() {
|
|
208
|
+
const res = await getPayments().plans.getPlans();
|
|
209
|
+
return result(res);
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
];
|
|
7
213
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
214
|
+
function result(payload) {
|
|
215
|
+
return {
|
|
216
|
+
content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }],
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function str(params, key) {
|
|
220
|
+
const v = params[key];
|
|
221
|
+
if (v === undefined || v === null || v === '')
|
|
222
|
+
return undefined;
|
|
223
|
+
return String(v);
|
|
224
|
+
}
|
|
225
|
+
function requireStr(params, key) {
|
|
226
|
+
const v = str(params, key);
|
|
227
|
+
if (!v)
|
|
228
|
+
throw new Error(`Missing required parameter: ${key}`);
|
|
229
|
+
return v;
|
|
14
230
|
}
|
|
15
|
-
// --- Subscriber tools ---
|
|
16
|
-
const checkBalance = {
|
|
17
|
-
name: 'nevermined.checkBalance',
|
|
18
|
-
description: 'Check the credit balance for a Nevermined payment plan',
|
|
19
|
-
params: [
|
|
20
|
-
{ name: 'planId', type: 'string', description: 'The payment plan ID', required: false },
|
|
21
|
-
],
|
|
22
|
-
handler: async (payments, config, params) => {
|
|
23
|
-
const planId = optionalParam(params, 'planId', config.planId);
|
|
24
|
-
if (!planId) {
|
|
25
|
-
throw new Error('planId is required — provide it as a parameter or in the plugin config');
|
|
26
|
-
}
|
|
27
|
-
const balance = await payments.plans.getPlanBalance(planId);
|
|
28
|
-
return {
|
|
29
|
-
planId: balance.planId,
|
|
30
|
-
planName: balance.planName,
|
|
31
|
-
balance: balance.balance.toString(),
|
|
32
|
-
isSubscriber: balance.isSubscriber,
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
const getAccessToken = {
|
|
37
|
-
name: 'nevermined.getAccessToken',
|
|
38
|
-
description: 'Get an x402 access token for authenticating requests to a Nevermined agent',
|
|
39
|
-
params: [
|
|
40
|
-
{ name: 'planId', type: 'string', description: 'The payment plan ID', required: false },
|
|
41
|
-
{ name: 'agentId', type: 'string', description: 'The agent ID', required: false },
|
|
42
|
-
],
|
|
43
|
-
handler: async (payments, config, params) => {
|
|
44
|
-
const planId = optionalParam(params, 'planId', config.planId);
|
|
45
|
-
if (!planId) {
|
|
46
|
-
throw new Error('planId is required — provide it as a parameter or in the plugin config');
|
|
47
|
-
}
|
|
48
|
-
const agentId = optionalParam(params, 'agentId', config.agentId);
|
|
49
|
-
const result = await payments.x402.getX402AccessToken(planId, agentId);
|
|
50
|
-
return { accessToken: result.accessToken };
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
const orderPlan = {
|
|
54
|
-
name: 'nevermined.orderPlan',
|
|
55
|
-
description: 'Order (purchase) a Nevermined payment plan',
|
|
56
|
-
params: [
|
|
57
|
-
{ name: 'planId', type: 'string', description: 'The payment plan ID to order', required: false },
|
|
58
|
-
],
|
|
59
|
-
handler: async (payments, config, params) => {
|
|
60
|
-
const planId = optionalParam(params, 'planId', config.planId);
|
|
61
|
-
if (!planId) {
|
|
62
|
-
throw new Error('planId is required — provide it as a parameter or in the plugin config');
|
|
63
|
-
}
|
|
64
|
-
const result = await payments.plans.orderPlan(planId);
|
|
65
|
-
return result;
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
const queryAgent = {
|
|
69
|
-
name: 'nevermined.queryAgent',
|
|
70
|
-
description: 'Query a Nevermined AI agent end-to-end: acquires an x402 access token, sends the prompt to the agent, and returns the response',
|
|
71
|
-
params: [
|
|
72
|
-
{ name: 'agentUrl', type: 'string', description: 'The URL of the agent to query', required: true },
|
|
73
|
-
{ name: 'prompt', type: 'string', description: 'The prompt to send to the agent', required: true },
|
|
74
|
-
{ name: 'planId', type: 'string', description: 'The payment plan ID', required: false },
|
|
75
|
-
{ name: 'agentId', type: 'string', description: 'The agent ID', required: false },
|
|
76
|
-
{ name: 'method', type: 'string', description: 'HTTP method (default: POST)', required: false },
|
|
77
|
-
],
|
|
78
|
-
handler: async (payments, config, params) => {
|
|
79
|
-
const agentUrl = requireParam(params, 'agentUrl');
|
|
80
|
-
const prompt = requireParam(params, 'prompt');
|
|
81
|
-
const planId = optionalParam(params, 'planId', config.planId);
|
|
82
|
-
if (!planId) {
|
|
83
|
-
throw new Error('planId is required — provide it as a parameter or in the plugin config');
|
|
84
|
-
}
|
|
85
|
-
const agentId = optionalParam(params, 'agentId', config.agentId);
|
|
86
|
-
const method = optionalParam(params, 'method', 'POST') ?? 'POST';
|
|
87
|
-
const { accessToken } = await payments.x402.getX402AccessToken(planId, agentId);
|
|
88
|
-
const response = await fetch(agentUrl, {
|
|
89
|
-
method,
|
|
90
|
-
headers: {
|
|
91
|
-
'Content-Type': 'application/json',
|
|
92
|
-
'PAYMENT-SIGNATURE': accessToken,
|
|
93
|
-
},
|
|
94
|
-
body: method !== 'GET' ? JSON.stringify({ prompt }) : undefined,
|
|
95
|
-
});
|
|
96
|
-
if (response.status === 402) {
|
|
97
|
-
return {
|
|
98
|
-
error: 'Payment required — insufficient credits. Order the plan first using nevermined.orderPlan.',
|
|
99
|
-
status: 402,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
if (!response.ok) {
|
|
103
|
-
return {
|
|
104
|
-
error: `Agent returned HTTP ${response.status}: ${response.statusText}`,
|
|
105
|
-
status: response.status,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
const body = await response.json();
|
|
109
|
-
return body;
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
// --- Builder tools ---
|
|
113
|
-
const registerAgent = {
|
|
114
|
-
name: 'nevermined.registerAgent',
|
|
115
|
-
description: 'Register a new AI agent with an associated payment plan on Nevermined',
|
|
116
|
-
params: [
|
|
117
|
-
{ name: 'name', type: 'string', description: 'Agent name', required: true },
|
|
118
|
-
{ name: 'description', type: 'string', description: 'Agent description', required: false },
|
|
119
|
-
{ name: 'agentUrl', type: 'string', description: 'The endpoint URL for the agent', required: true },
|
|
120
|
-
{ name: 'planName', type: 'string', description: 'Name for the payment plan', required: true },
|
|
121
|
-
{ name: 'priceAmounts', type: 'string', description: 'Comma-separated price amounts in wei', required: true },
|
|
122
|
-
{ name: 'priceReceivers', type: 'string', description: 'Comma-separated receiver addresses', required: true },
|
|
123
|
-
{ name: 'creditsAmount', type: 'number', description: 'Number of credits in the plan', required: true },
|
|
124
|
-
],
|
|
125
|
-
handler: async (payments, _config, params) => {
|
|
126
|
-
const name = requireParam(params, 'name');
|
|
127
|
-
const description = optionalParam(params, 'description', '');
|
|
128
|
-
const agentUrl = requireParam(params, 'agentUrl');
|
|
129
|
-
const planName = requireParam(params, 'planName');
|
|
130
|
-
const priceAmounts = requireParam(params, 'priceAmounts')
|
|
131
|
-
.split(',')
|
|
132
|
-
.map((s) => BigInt(s.trim()));
|
|
133
|
-
const priceReceivers = requireParam(params, 'priceReceivers')
|
|
134
|
-
.split(',')
|
|
135
|
-
.map((s) => s.trim());
|
|
136
|
-
const creditsAmount = Number(requireParam(params, 'creditsAmount'));
|
|
137
|
-
const result = await payments.agents.registerAgentAndPlan({ name, description }, {
|
|
138
|
-
endpoints: [{ POST: agentUrl }],
|
|
139
|
-
agentDefinitionUrl: agentUrl,
|
|
140
|
-
}, { name: planName }, {
|
|
141
|
-
amounts: priceAmounts,
|
|
142
|
-
receivers: priceReceivers,
|
|
143
|
-
isCrypto: true,
|
|
144
|
-
}, {
|
|
145
|
-
isRedemptionAmountFixed: true,
|
|
146
|
-
redemptionType: 4, // ONLY_SUBSCRIBER
|
|
147
|
-
proofRequired: false,
|
|
148
|
-
durationSecs: 0n,
|
|
149
|
-
amount: BigInt(creditsAmount),
|
|
150
|
-
minAmount: 1n,
|
|
151
|
-
maxAmount: BigInt(creditsAmount),
|
|
152
|
-
});
|
|
153
|
-
return {
|
|
154
|
-
agentId: result.agentId,
|
|
155
|
-
planId: result.planId,
|
|
156
|
-
txHash: result.txHash,
|
|
157
|
-
};
|
|
158
|
-
},
|
|
159
|
-
};
|
|
160
|
-
const createPlan = {
|
|
161
|
-
name: 'nevermined.createPlan',
|
|
162
|
-
description: 'Create a new payment plan on Nevermined',
|
|
163
|
-
params: [
|
|
164
|
-
{ name: 'name', type: 'string', description: 'Plan name', required: true },
|
|
165
|
-
{ name: 'description', type: 'string', description: 'Plan description', required: false },
|
|
166
|
-
{ name: 'priceAmounts', type: 'string', description: 'Comma-separated price amounts in wei', required: true },
|
|
167
|
-
{ name: 'priceReceivers', type: 'string', description: 'Comma-separated receiver addresses', required: true },
|
|
168
|
-
{ name: 'creditsAmount', type: 'number', description: 'Number of credits in the plan', required: true },
|
|
169
|
-
{ name: 'accessLimit', type: 'string', description: '"credits" or "time" (default: credits)', required: false },
|
|
170
|
-
],
|
|
171
|
-
handler: async (payments, _config, params) => {
|
|
172
|
-
const name = requireParam(params, 'name');
|
|
173
|
-
const description = optionalParam(params, 'description', '');
|
|
174
|
-
const priceAmounts = requireParam(params, 'priceAmounts')
|
|
175
|
-
.split(',')
|
|
176
|
-
.map((s) => BigInt(s.trim()));
|
|
177
|
-
const priceReceivers = requireParam(params, 'priceReceivers')
|
|
178
|
-
.split(',')
|
|
179
|
-
.map((s) => s.trim());
|
|
180
|
-
const creditsAmount = Number(requireParam(params, 'creditsAmount'));
|
|
181
|
-
const accessLimit = optionalParam(params, 'accessLimit', 'credits');
|
|
182
|
-
const result = await payments.plans.registerPlan({ name, description, accessLimit }, {
|
|
183
|
-
amounts: priceAmounts,
|
|
184
|
-
receivers: priceReceivers,
|
|
185
|
-
isCrypto: true,
|
|
186
|
-
}, {
|
|
187
|
-
isRedemptionAmountFixed: true,
|
|
188
|
-
redemptionType: 4,
|
|
189
|
-
proofRequired: false,
|
|
190
|
-
durationSecs: 0n,
|
|
191
|
-
amount: BigInt(creditsAmount),
|
|
192
|
-
minAmount: 1n,
|
|
193
|
-
maxAmount: BigInt(creditsAmount),
|
|
194
|
-
}, undefined, accessLimit);
|
|
195
|
-
return { planId: result.planId };
|
|
196
|
-
},
|
|
197
|
-
};
|
|
198
|
-
const listPlans = {
|
|
199
|
-
name: 'nevermined.listPlans',
|
|
200
|
-
description: "List the builder's payment plans on Nevermined",
|
|
201
|
-
params: [],
|
|
202
|
-
handler: async (payments) => {
|
|
203
|
-
const result = await payments.plans.getPlans();
|
|
204
|
-
return result;
|
|
205
|
-
},
|
|
206
|
-
};
|
|
207
|
-
export const allTools = [
|
|
208
|
-
// Subscriber
|
|
209
|
-
checkBalance,
|
|
210
|
-
getAccessToken,
|
|
211
|
-
orderPlan,
|
|
212
|
-
queryAgent,
|
|
213
|
-
// Builder
|
|
214
|
-
registerAgent,
|
|
215
|
-
createPlan,
|
|
216
|
-
listPlans,
|
|
217
|
-
];
|
|
218
231
|
//# sourceMappingURL=tools.js.map
|
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;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,WAA2B,EAC3B,MAA8B;IAE9B,OAAO;QACL,2BAA2B;QAC3B;YACE,IAAI,EAAE,yBAAyB;YAC/B,KAAK,EAAE,0BAA0B;YACjC,WA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gDAAgD;YAC7D,UAAU,EAAE;gBACV,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE,EAAE;aACf;YACD,KAAK,CAAC,OAAO;gBACX,MAAM,GAAG,GAAG,MAAM,WAAW,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAA;gBAChD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;YACpB,CAAC;SACF;KACF,CAAA;AACH,CAAC;AAgBD,SAAS,MAAM,CAAC,OAAgB;IAC9B,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KACpE,CAAA;AACH,CAAC;AAED,SAAS,GAAG,CAAC,MAA+B,EAAE,GAAW;IACvD,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;IACrB,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE;QAAE,OAAO,SAAS,CAAA;IAC/D,OAAO,MAAM,CAAC,CAAC,CAAC,CAAA;AAClB,CAAC;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/openclaw.plugin.json
CHANGED
|
@@ -1,75 +1,34 @@
|
|
|
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
|
+
}
|
|
31
32
|
}
|
|
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
33
|
}
|
|
75
34
|
}
|
package/package.json
CHANGED