@xpr-agents/openclaw 0.6.1 → 0.7.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.
@@ -1,237 +0,0 @@
1
- "use strict";
2
- /**
3
- * Proton CLI wrapper.
4
- *
5
- * Shells out to the `proton` CLI for all transaction signing. The agent
6
- * process never touches private keys — they live exclusively in the CLI's
7
- * encrypted keychain.
8
- *
9
- * Used by:
10
- * - openclaw/src/session.ts (createCliSession factory)
11
- * - openclaw/src/cli-session.ts (createCliApi factory)
12
- * - openclaw/starter/agent/skills/* (via @xpr-agents/openclaw)
13
- */
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.ProtonCliError = void 0;
16
- exports.execAction = execAction;
17
- exports.execTransactionPush = execTransactionPush;
18
- exports.getTableRows = getTableRows;
19
- exports.checkProtonCli = checkProtonCli;
20
- exports.checkKeychainPopulated = checkKeychainPopulated;
21
- const child_process_1 = require("child_process");
22
- const util_1 = require("util");
23
- const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
24
- const CLI_TIMEOUT_MS = 30000;
25
- const MAX_BUFFER = 10 * 1024 * 1024; // 10MB
26
- class ProtonCliError extends Error {
27
- constructor(message, code, stderr) {
28
- super(message);
29
- this.name = 'ProtonCliError';
30
- this.code = code;
31
- this.stderr = stderr;
32
- }
33
- }
34
- exports.ProtonCliError = ProtonCliError;
35
- /**
36
- * Categorise an error from the CLI by stderr signature.
37
- * Default to 'unknown' — pattern set is intentionally narrow.
38
- */
39
- function classifyError(stderr) {
40
- if (/ECONNREFUSED|ETIMEDOUT|ENOTFOUND|fetch failed|getaddrinfo|ENETUNREACH/i.test(stderr)) {
41
- return 'network';
42
- }
43
- if (/no key found|key is not unlocked|account .* not found|signature_provider/i.test(stderr)) {
44
- return 'auth';
45
- }
46
- if (/unable to unpack|invalid type|cannot serialize|unknown action|unknown_action_exception/i.test(stderr)) {
47
- return 'serialization';
48
- }
49
- if (/assertion failure|eosio_assert|action_validate_exception/i.test(stderr)) {
50
- return 'reverted';
51
- }
52
- return 'unknown';
53
- }
54
- /**
55
- * Remove anything that looks like action data payload from stderr before logging.
56
- * Action data may contain memos, addresses, or other potentially sensitive info.
57
- */
58
- function scrubStderr(stderr) {
59
- if (!stderr)
60
- return '';
61
- return stderr
62
- // Strip "data": { ... } blocks (single-line and multi-line)
63
- .replace(/"data"\s*:\s*\{[^}]*\}/gs, '"data":[scrubbed]')
64
- // Strip hex_data blocks
65
- .replace(/"hex_data"\s*:\s*"[^"]*"/g, '"hex_data":"[scrubbed]"');
66
- }
67
- function logStart(contract, action, auth) {
68
- console.error(`[proton-cli] action ${contract}::${action} auth=${auth}`);
69
- }
70
- function logSuccess(txid, ms) {
71
- console.error(`[proton-cli] tx ${txid} ok in ${ms}ms`);
72
- }
73
- function logFailure(code, scrubbed) {
74
- // Cap stderr in logs to avoid flooding
75
- const snippet = scrubbed.length > 500 ? scrubbed.slice(0, 500) + '...' : scrubbed;
76
- console.error(`[proton-cli] tx FAILED: ${code} ${snippet}`);
77
- }
78
- /**
79
- * Parse the transaction ID from proton CLI stdout.
80
- * Output is JSON containing a transaction_id (or trx_id) field.
81
- */
82
- /**
83
- * `proton action` can exit 0 while printing a chain error (e.g. an
84
- * eosio_assert from the contract). Surface that text so callers see the real
85
- * reason instead of a generic "no transaction ID" message.
86
- */
87
- function noTxIdError(stdout) {
88
- const assertion = stdout.match(/assertion failure with message:\s*([^\n"]+)/i);
89
- if (assertion) {
90
- return new ProtonCliError(`contract rejected the action: ${assertion[1].trim()}`, 'reverted', scrubStderr(stdout));
91
- }
92
- const generic = stdout.match(/(?:^|\n)\s*(?:Error|error)[:\s]+([^\n]+)/);
93
- if (generic) {
94
- return new ProtonCliError(`proton CLI error: ${generic[1].trim()}`, classifyError(stdout), scrubStderr(stdout));
95
- }
96
- return new ProtonCliError('proton CLI returned success but no transaction ID could be parsed', 'unknown', stdout);
97
- }
98
- function parseTxId(stdout) {
99
- const txMatch = stdout.match(/"transaction_id"\s*:\s*"([0-9a-f]+)"/);
100
- if (txMatch)
101
- return txMatch[1];
102
- const trxMatch = stdout.match(/"trx_id"\s*:\s*"([0-9a-f]+)"/);
103
- return trxMatch ? trxMatch[1] : null;
104
- }
105
- /**
106
- * Try to parse the full processed result block from stdout. Best-effort.
107
- */
108
- function tryParseProcessed(stdout) {
109
- try {
110
- const parsed = JSON.parse(stdout);
111
- if (parsed && typeof parsed === 'object' && 'processed' in parsed) {
112
- return parsed.processed;
113
- }
114
- return parsed;
115
- }
116
- catch {
117
- return undefined;
118
- }
119
- }
120
- /**
121
- * Run the proton CLI with the given arguments. Always uses execFile (no shell).
122
- */
123
- async function runProton(args) {
124
- try {
125
- const result = await execFileAsync('proton', args, {
126
- timeout: CLI_TIMEOUT_MS,
127
- maxBuffer: MAX_BUFFER,
128
- });
129
- return { stdout: result.stdout };
130
- }
131
- catch (err) {
132
- const e = err;
133
- const stderrRaw = (e.stderr || '') + (e.message || '');
134
- const scrubbed = scrubStderr(stderrRaw);
135
- const code = classifyError(stderrRaw);
136
- logFailure(code, scrubbed);
137
- throw new ProtonCliError(`proton CLI failed: ${code}`, code, scrubbed);
138
- }
139
- }
140
- /**
141
- * Sign and submit a single action via `proton action`.
142
- *
143
- * @param contract - Contract account (e.g. 'agentescrow')
144
- * @param action - Action name (e.g. 'createjob')
145
- * @param data - Positional args matching the contract's action ABI
146
- * @param authorization - "account@permission" string (e.g. "alice@active")
147
- */
148
- async function execAction(contract, action, data, authorization) {
149
- logStart(contract, action, authorization);
150
- const start = Date.now();
151
- const dataJson = JSON.stringify(data);
152
- const { stdout } = await runProton(['action', contract, action, dataJson, authorization]);
153
- const txid = parseTxId(stdout);
154
- if (!txid) {
155
- throw noTxIdError(stdout);
156
- }
157
- logSuccess(txid, Date.now() - start);
158
- return { transaction_id: txid, processed: tryParseProcessed(stdout) };
159
- }
160
- /**
161
- * Sign and submit a multi-action atomic transaction via `proton transaction:push`.
162
- *
163
- * NOTE: do NOT use the bare `proton transaction` command — it does not
164
- * JSON.parse its argument (bug in @proton/cli). Use `transaction:push` exclusively.
165
- */
166
- async function execTransactionPush(tx) {
167
- if (!tx.actions || tx.actions.length === 0) {
168
- throw new ProtonCliError('execTransactionPush: empty actions array', 'unknown', '');
169
- }
170
- const first = tx.actions[0];
171
- const auth = first.authorization[0];
172
- logStart(first.account, first.name, `${auth.actor}@${auth.permission}`);
173
- const start = Date.now();
174
- const txJson = JSON.stringify(tx);
175
- const { stdout } = await runProton(['transaction:push', txJson]);
176
- const txid = parseTxId(stdout);
177
- if (!txid) {
178
- throw noTxIdError(stdout);
179
- }
180
- logSuccess(txid, Date.now() - start);
181
- return { transaction_id: txid, processed: tryParseProcessed(stdout) };
182
- }
183
- /**
184
- * Read-only table query via `proton table`. No signing required.
185
- */
186
- async function getTableRows(code, table, scope, opts) {
187
- const args = ['table', code, table];
188
- if (scope)
189
- args.push(scope);
190
- if (opts?.limit !== undefined)
191
- args.push('-c', String(opts.limit));
192
- if (opts?.lower_bound !== undefined)
193
- args.push('-l', opts.lower_bound);
194
- if (opts?.upper_bound !== undefined)
195
- args.push('-u', opts.upper_bound);
196
- if (opts?.reverse)
197
- args.push('-r');
198
- if (opts?.index_position !== undefined)
199
- args.push('-i', String(opts.index_position));
200
- if (opts?.key_type !== undefined)
201
- args.push('-k', opts.key_type);
202
- const { stdout } = await runProton(args);
203
- try {
204
- return JSON.parse(stdout);
205
- }
206
- catch {
207
- throw new ProtonCliError('proton table returned invalid JSON', 'unknown', stdout);
208
- }
209
- }
210
- /**
211
- * Verify the proton CLI is installed and on PATH. Used by startup checks.
212
- */
213
- async function checkProtonCli() {
214
- try {
215
- await execFileAsync('proton', ['--version'], { timeout: 5000 });
216
- return true;
217
- }
218
- catch {
219
- return false;
220
- }
221
- }
222
- /**
223
- * Verify the proton CLI keychain has at least one key registered.
224
- * Soft check — this doesn't verify any specific account, just that
225
- * a keychain exists. The CLI itself will fail with auth code if the
226
- * specific account's key is missing.
227
- */
228
- async function checkKeychainPopulated() {
229
- try {
230
- const { stdout } = await execFileAsync('proton', ['key:list'], { timeout: 5000 });
231
- return stdout.includes('publicKey');
232
- }
233
- catch {
234
- return false;
235
- }
236
- }
237
- //# sourceMappingURL=proton-cli.js.map
@@ -1,73 +0,0 @@
1
- /**
2
- * Proton CLI wrapper.
3
- *
4
- * Shells out to the `proton` CLI for all transaction signing. The agent
5
- * process never touches private keys — they live exclusively in the CLI's
6
- * encrypted keychain.
7
- *
8
- * Used by:
9
- * - openclaw/src/session.ts (createCliSession factory)
10
- * - openclaw/src/cli-session.ts (createCliApi factory)
11
- * - openclaw/starter/agent/skills/* (via @xpr-agents/openclaw)
12
- */
13
- export type CliErrorCode = 'network' | 'auth' | 'serialization' | 'reverted' | 'unknown';
14
- export declare class ProtonCliError extends Error {
15
- readonly code: CliErrorCode;
16
- readonly stderr: string;
17
- constructor(message: string, code: CliErrorCode, stderr: string);
18
- }
19
- export interface CliAction {
20
- account: string;
21
- name: string;
22
- authorization: Array<{
23
- actor: string;
24
- permission: string;
25
- }>;
26
- data: Record<string, unknown>;
27
- }
28
- export interface CliTransactionResult {
29
- transaction_id: string;
30
- processed?: unknown;
31
- }
32
- export interface TableQueryOpts {
33
- limit?: number;
34
- lower_bound?: string;
35
- upper_bound?: string;
36
- reverse?: boolean;
37
- index_position?: number;
38
- key_type?: string;
39
- }
40
- /**
41
- * Sign and submit a single action via `proton action`.
42
- *
43
- * @param contract - Contract account (e.g. 'agentescrow')
44
- * @param action - Action name (e.g. 'createjob')
45
- * @param data - Positional args matching the contract's action ABI
46
- * @param authorization - "account@permission" string (e.g. "alice@active")
47
- */
48
- export declare function execAction(contract: string, action: string, data: unknown[], authorization: string): Promise<CliTransactionResult>;
49
- /**
50
- * Sign and submit a multi-action atomic transaction via `proton transaction:push`.
51
- *
52
- * NOTE: do NOT use the bare `proton transaction` command — it does not
53
- * JSON.parse its argument (bug in @proton/cli). Use `transaction:push` exclusively.
54
- */
55
- export declare function execTransactionPush(tx: {
56
- actions: CliAction[];
57
- }): Promise<CliTransactionResult>;
58
- /**
59
- * Read-only table query via `proton table`. No signing required.
60
- */
61
- export declare function getTableRows(code: string, table: string, scope?: string, opts?: TableQueryOpts): Promise<unknown>;
62
- /**
63
- * Verify the proton CLI is installed and on PATH. Used by startup checks.
64
- */
65
- export declare function checkProtonCli(): Promise<boolean>;
66
- /**
67
- * Verify the proton CLI keychain has at least one key registered.
68
- * Soft check — this doesn't verify any specific account, just that
69
- * a keychain exists. The CLI itself will fail with auth code if the
70
- * specific account's key is missing.
71
- */
72
- export declare function checkKeychainPopulated(): Promise<boolean>;
73
- //# sourceMappingURL=proton-cli.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proton-cli.d.ts","sourceRoot":"","sources":["../src/proton-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,eAAe,GAAG,UAAU,GAAG,SAAS,CAAC;AAEzF,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;CAMhE;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,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IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;IACrF,IAAI,IAAI,EAAE,QAAQ,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,cAAc,CAAC,oCAAoC,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACpF,CAAC;AACH,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,cAAc;IAClC,IAAI,CAAC;QACH,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB;IAC1C,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAClF,OAAO,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -1,41 +0,0 @@
1
- "use strict";
2
- /**
3
- * Server-side ProtonSession factory.
4
- *
5
- * This module previously held a JsSignatureProvider that loaded
6
- * XPR_PRIVATE_KEY into the agent process. After the 2026-04-24 charliebot
7
- * incident — where a hardcoded private key was leaked to a public repo —
8
- * all signing was moved to the proton CLI's encrypted keychain.
9
- *
10
- * This file is now a thin wrapper around createCliSession.
11
- *
12
- * Required env: XPR_ACCOUNT
13
- * Optional env: XPR_PERMISSION (defaults to 'active'), XPR_RPC_ENDPOINT
14
- *
15
- * The agent process MUST NOT read XPR_PRIVATE_KEY. The legacy entry-point
16
- * check in starter/agent/src/index.ts refuses to start if it is set.
17
- */
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.createSession = createSession;
20
- exports.createReadOnlyRpc = createReadOnlyRpc;
21
- const js_1 = require("@proton/js");
22
- const cli_session_1 = require("./cli-session");
23
- /**
24
- * Create a server-side ProtonSession backed by the proton CLI.
25
- * No private key required — the CLI signs internally via its keychain.
26
- */
27
- function createSession(config) {
28
- const account = config.account || process.env.XPR_ACCOUNT;
29
- const permission = config.permission || process.env.XPR_PERMISSION || 'active';
30
- if (!account) {
31
- throw new Error('XPR_ACCOUNT environment variable is required');
32
- }
33
- return (0, cli_session_1.createCliSession)({ account, permission, rpcEndpoint: config.rpcEndpoint });
34
- }
35
- /**
36
- * Create a read-only RPC connection (no session/signing needed).
37
- */
38
- function createReadOnlyRpc(rpcEndpoint) {
39
- return new js_1.JsonRpc(rpcEndpoint);
40
- }
41
- //# sourceMappingURL=session.js.map
@@ -1,36 +0,0 @@
1
- /**
2
- * Server-side ProtonSession factory.
3
- *
4
- * This module previously held a JsSignatureProvider that loaded
5
- * XPR_PRIVATE_KEY into the agent process. After the 2026-04-24 charliebot
6
- * incident — where a hardcoded private key was leaked to a public repo —
7
- * all signing was moved to the proton CLI's encrypted keychain.
8
- *
9
- * This file is now a thin wrapper around createCliSession.
10
- *
11
- * Required env: XPR_ACCOUNT
12
- * Optional env: XPR_PERMISSION (defaults to 'active'), XPR_RPC_ENDPOINT
13
- *
14
- * The agent process MUST NOT read XPR_PRIVATE_KEY. The legacy entry-point
15
- * check in starter/agent/src/index.ts refuses to start if it is set.
16
- */
17
- import { JsonRpc } from '@proton/js';
18
- import type { ProtonSession } from '@xpr-agents/sdk';
19
- export interface SessionConfig {
20
- rpcEndpoint: string;
21
- account?: string;
22
- permission?: string;
23
- }
24
- /**
25
- * Create a server-side ProtonSession backed by the proton CLI.
26
- * No private key required — the CLI signs internally via its keychain.
27
- */
28
- export declare function createSession(config: SessionConfig): {
29
- rpc: JsonRpc;
30
- session: ProtonSession;
31
- };
32
- /**
33
- * Create a read-only RPC connection (no session/signing needed).
34
- */
35
- export declare function createReadOnlyRpc(rpcEndpoint: string): JsonRpc;
36
- //# sourceMappingURL=session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,CAS7F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAgBH,sCASC;AAKD,8CAEC;AA9BD,mCAAqC;AAErC,+CAAiD;AAQjD;;;GAGG;AACH,SAAgB,aAAa,CAAC,MAAqB;IACjD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IAC1D,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,QAAQ,CAAC;IAE/E,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,IAAA,8BAAgB,EAAC,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AACpF,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,WAAmB;IACnD,OAAO,IAAI,YAAO,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /**
3
- * Skill Module Types
4
- *
5
- * Defines the interfaces for the XPR Agent skill module system.
6
- * Skill authors import these types to create portable, reusable skill packages.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- //# sourceMappingURL=skill-types.js.map
@@ -1,61 +0,0 @@
1
- /**
2
- * Skill Module Types
3
- *
4
- * Defines the interfaces for the XPR Agent skill module system.
5
- * Skill authors import these types to create portable, reusable skill packages.
6
- */
7
- import type { ToolDefinition, PluginApi } from './types';
8
- /**
9
- * Skill manifest — metadata for discovery, A2A cards, and future on-chain marketplace.
10
- * Lives in skill.json at the package root.
11
- */
12
- export interface SkillManifest {
13
- /** Skill identifier, e.g. "web-scraping" */
14
- name: string;
15
- /** Semver version string */
16
- version: string;
17
- /** Human-readable description (for A2A card + on-chain listing) */
18
- description: string;
19
- /** Author — npm org or XPR account name */
20
- author: string;
21
- /** Category: compute | storage | oracle | payment | messaging | ai */
22
- category: string;
23
- /** Search/filter tags */
24
- tags: string[];
25
- /** Capabilities exposed (maps to A2A card skills) */
26
- capabilities: string[];
27
- /** Tool names this skill registers (for transparency) */
28
- tools: string[];
29
- /** Optional requirements */
30
- requires?: {
31
- /** Required environment variables */
32
- env?: string[];
33
- };
34
- /** Future: on-chain skill exchange pricing */
35
- pricing?: {
36
- model: 'free' | 'one-time' | 'subscription';
37
- amount?: string;
38
- };
39
- }
40
- /**
41
- * API passed to skill entry functions for registering tools.
42
- * Extends PluginApi with convenience accessors for RPC and session.
43
- */
44
- export interface SkillApi extends PluginApi {
45
- /** Register a tool (same interface as OpenClaw core tools) */
46
- registerTool(tool: ToolDefinition): void;
47
- /** Get plugin config values */
48
- getConfig(): Record<string, unknown>;
49
- }
50
- /**
51
- * A fully loaded skill — returned by the skill loader after successful loading.
52
- */
53
- export interface LoadedSkill {
54
- /** Parsed manifest from skill.json */
55
- manifest: SkillManifest;
56
- /** Behavioral instructions from SKILL.md (frontmatter stripped) */
57
- promptSection: string;
58
- /** Number of tools successfully registered */
59
- toolCount: number;
60
- }
61
- //# sourceMappingURL=skill-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skill-types.d.ts","sourceRoot":"","sources":["../src/skill-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,qDAAqD;IACrD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,yDAAyD;IACzD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE;QACT,qCAAqC;QACrC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;KAChB,CAAC;IACF,8CAA8C;IAC9C,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,cAAc,CAAC;QAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,QAAS,SAAQ,SAAS;IACzC,8DAA8D;IAC9D,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IACzC,+BAA+B;IAC/B,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,sCAAsC;IACtC,QAAQ,EAAE,aAAa,CAAC;IACxB,mEAAmE;IACnE,aAAa,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"skill-types.js","sourceRoot":"","sources":["../src/skill-types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
package/dist/types 2.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- /**
3
- * Internal types for the OpenClaw plugin.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- //# sourceMappingURL=types.js.map
@@ -1,39 +0,0 @@
1
- /**
2
- * Internal types for the OpenClaw plugin.
3
- */
4
- import type { JsonRpc, ProtonSession } from '@xpr-agents/sdk';
5
- export interface PluginConfig {
6
- rpc: JsonRpc;
7
- session?: ProtonSession;
8
- network: 'mainnet' | 'testnet';
9
- rpcEndpoint: string;
10
- indexerUrl: string;
11
- contracts: ContractNames;
12
- confirmHighRisk: boolean;
13
- maxTransferAmount: number;
14
- }
15
- export interface ContractNames {
16
- agentcore: string;
17
- agentfeed: string;
18
- agentvalid: string;
19
- agentescrow: string;
20
- }
21
- export interface ToolDefinition {
22
- name: string;
23
- description: string;
24
- parameters: {
25
- type: 'object';
26
- required?: string[];
27
- properties: Record<string, unknown>;
28
- };
29
- handler: (params: any) => Promise<unknown>;
30
- }
31
- /**
32
- * OpenClaw plugin API interface.
33
- * This matches the OpenClaw extension registration pattern.
34
- */
35
- export interface PluginApi {
36
- registerTool(tool: ToolDefinition): void;
37
- getConfig(): Record<string, unknown>;
38
- }
39
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,aAAa,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACrC,CAAC;IACF,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IACzC,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}