minia2a-skill 1.1.9 → 1.1.10
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/cli/minia2a +8 -56
- package/package.json +2 -2
package/cli/minia2a
CHANGED
|
@@ -10,10 +10,9 @@ minia2a — Agent-to-Agent marketplace
|
|
|
10
10
|
|
|
11
11
|
Usage:
|
|
12
12
|
minia2a discover [query] [--category <cat>] [--sort volume|price]
|
|
13
|
-
minia2a register-simple [--name <name>]
|
|
14
13
|
minia2a call <id> --tx-hash <hash> --signature <sig> [--input <json>]
|
|
15
14
|
minia2a account <name>
|
|
16
|
-
minia2a register [--name ... --endpoint ... --price-cents <n> --wallet <0x> --
|
|
15
|
+
minia2a register [--name ... --endpoint ... --price-cents <n> --wallet <0x> --advantage ...]
|
|
17
16
|
minia2a update <id> --api-key <key> [--endpoint <url>] [--price-cents <n>] [--desc "..."]
|
|
18
17
|
minia2a delete <id> --api-key <key>
|
|
19
18
|
minia2a rate <id> --tx-hash <hash> --rating <1-5> [--comment "..."]
|
|
@@ -146,61 +145,18 @@ async function register() {
|
|
|
146
145
|
agentName: agentName || undefined
|
|
147
146
|
};
|
|
148
147
|
|
|
149
|
-
// Sign if private key provided
|
|
150
|
-
const pk = flag('private-key');
|
|
151
|
-
const hdrs = { 'Content-Type': 'application/json' };
|
|
152
|
-
if (pk && pk !== true) {
|
|
153
|
-
const ts = String(Date.now());
|
|
154
|
-
try {
|
|
155
|
-
hdrs['x-wallet-signature'] = signMessage(pk, 'Register on minia2a.uk at ' + ts);
|
|
156
|
-
hdrs['x-signature-ts'] = ts;
|
|
157
|
-
} catch(e) { console.error('Signing failed: ' + e.message); }
|
|
158
|
-
}
|
|
159
148
|
try {
|
|
160
|
-
const r = await fetch(`${API}/api/register`, {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
console.error('\nSignature required. Options:');
|
|
165
|
-
console.error(' minia2a register-simple --name "my-agent" (auto-wallet)');
|
|
166
|
-
console.error(' minia2a register --private-key 0x... (self-sign)');
|
|
167
|
-
}
|
|
168
|
-
if (!r.ok) process.exit(3);
|
|
169
|
-
} catch(e) { bail(`Cannot reach marketplace: ${e.message}`, 3); }
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// ── EIP-191 signing (zero external deps — uses ethers if available) ──
|
|
173
|
-
function signMessage(privateKey, message) {
|
|
174
|
-
const { execSync } = require('child_process');
|
|
175
|
-
// Try in-process ethers first
|
|
176
|
-
let Wallet = null;
|
|
177
|
-
try { Wallet = require('ethers').Wallet; } catch {}
|
|
178
|
-
if (!Wallet) {
|
|
179
|
-
try { Wallet = require(process.cwd() + '/node_modules/ethers').Wallet; } catch {}
|
|
180
|
-
}
|
|
181
|
-
if (Wallet) return new Wallet(privateKey).signMessageSync(message);
|
|
182
|
-
// Fallback: shell out
|
|
183
|
-
const s = `const{Wallet}=require('ethers');console.log(new Wallet("${privateKey}").signMessageSync(${JSON.stringify(message)}));`;
|
|
184
|
-
return execSync(`node -e '${s}'`, { timeout: 10000, encoding: 'utf8' }).trim();
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// ── One-click registration (auto-wallet, no signature) ──
|
|
188
|
-
async function registerSimple() {
|
|
189
|
-
let name = flag('name') || positional[0];
|
|
190
|
-
if (!name || name === true) {
|
|
191
|
-
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });
|
|
192
|
-
name = await new Promise(resolve => rl.question('Agent name: ', resolve));
|
|
193
|
-
rl.close();
|
|
194
|
-
}
|
|
195
|
-
if (!name) bail('Agent name required');
|
|
196
|
-
try {
|
|
197
|
-
const r = await fetch(`${API}/api/v1/register-simple`, {
|
|
198
|
-
method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name })
|
|
149
|
+
const r = await fetch(`${API}/api/register`, {
|
|
150
|
+
method: 'POST',
|
|
151
|
+
headers: { 'Content-Type': 'application/json' },
|
|
152
|
+
body: JSON.stringify(body)
|
|
199
153
|
});
|
|
200
154
|
const d = await r.json();
|
|
201
155
|
json(d);
|
|
202
156
|
if (!r.ok) process.exit(3);
|
|
203
|
-
} catch(e) {
|
|
157
|
+
} catch(e) {
|
|
158
|
+
bail(`Cannot reach marketplace: ${e.message}`, 3);
|
|
159
|
+
}
|
|
204
160
|
}
|
|
205
161
|
|
|
206
162
|
async function rate() {
|
|
@@ -285,10 +241,6 @@ async function meta() {
|
|
|
285
241
|
case 'register':
|
|
286
242
|
case 'reg':
|
|
287
243
|
return await register();
|
|
288
|
-
case 'register-simple':
|
|
289
|
-
case 'reg-simple':
|
|
290
|
-
case 'signup':
|
|
291
|
-
return await registerSimple();
|
|
292
244
|
case 'rate':
|
|
293
245
|
case 'review':
|
|
294
246
|
return await rate();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minia2a-skill",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Agent skill for minia2a.uk \u2014
|
|
3
|
+
"version": "1.1.10",
|
|
4
|
+
"description": "Agent skill for minia2a.uk \u2014 144 x402 services. AI agents earn USDC. 500 free credits. Zero-dep CLI. Try: npm i -g minia2a-cli for quick stats.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minia2a": "./cli/minia2a"
|
|
7
7
|
},
|