minia2a-skill 1.1.7 → 1.1.9

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.
Files changed (2) hide show
  1. package/cli/minia2a +56 -8
  2. package/package.json +11 -4
package/cli/minia2a CHANGED
@@ -10,9 +10,10 @@ 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>]
13
14
  minia2a call <id> --tx-hash <hash> --signature <sig> [--input <json>]
14
15
  minia2a account <name>
15
- minia2a register [--name ... --endpoint ... --price-cents <n> --wallet <0x> --advantage ...]
16
+ minia2a register [--name ... --endpoint ... --price-cents <n> --wallet <0x> --private-key <hex> --advantage ...]
16
17
  minia2a update <id> --api-key <key> [--endpoint <url>] [--price-cents <n>] [--desc "..."]
17
18
  minia2a delete <id> --api-key <key>
18
19
  minia2a rate <id> --tx-hash <hash> --rating <1-5> [--comment "..."]
@@ -145,18 +146,61 @@ async function register() {
145
146
  agentName: agentName || undefined
146
147
  };
147
148
 
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
+ }
148
159
  try {
149
- const r = await fetch(`${API}/api/register`, {
150
- method: 'POST',
151
- headers: { 'Content-Type': 'application/json' },
152
- body: JSON.stringify(body)
153
- });
160
+ const r = await fetch(`${API}/api/register`, { method: 'POST', headers: hdrs, body: JSON.stringify(body) });
154
161
  const d = await r.json();
155
162
  json(d);
163
+ if (d.error === 'wallet signature required') {
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
+ }
156
168
  if (!r.ok) process.exit(3);
157
- } catch(e) {
158
- bail(`Cannot reach marketplace: ${e.message}`, 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 {}
159
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 })
199
+ });
200
+ const d = await r.json();
201
+ json(d);
202
+ if (!r.ok) process.exit(3);
203
+ } catch(e) { bail(`Cannot reach marketplace: ${e.message}`, 3); }
160
204
  }
161
205
 
162
206
  async function rate() {
@@ -241,6 +285,10 @@ async function meta() {
241
285
  case 'register':
242
286
  case 'reg':
243
287
  return await register();
288
+ case 'register-simple':
289
+ case 'reg-simple':
290
+ case 'signup':
291
+ return await registerSimple();
244
292
  case 'rate':
245
293
  case 'review':
246
294
  return await rate();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "minia2a-skill",
3
- "version": "1.1.7",
4
- "description": "Agent skill for minia2a.uk \u2014 159 x402 services, USDC micropayments, 500 free credits. Zero-dep CLI.",
3
+ "version": "1.1.9",
4
+ "description": "Agent skill for minia2a.uk \u2014 166 x402 services. AI agents earn USDC. 500 free credits. Zero-dep CLI.",
5
5
  "bin": {
6
6
  "minia2a": "./cli/minia2a"
7
7
  },
@@ -21,13 +21,20 @@
21
21
  "a2a",
22
22
  "micropayments",
23
23
  "claude-code",
24
- "agent-economy"
24
+ "agent-economy",
25
+ "earn",
26
+ "monetize",
27
+ "autonomous"
25
28
  ],
26
29
  "author": "minia2a",
27
30
  "license": "MIT",
28
31
  "repository": {
29
32
  "type": "git",
30
- "url": "https://github.com/minia2a/minia2a-skill.git"
33
+ "url": "git+https://github.com/afu20260324/minia2a-skill.git"
34
+ },
35
+ "homepage": "https://github.com/afu20260324/minia2a-skill#readme",
36
+ "bugs": {
37
+ "url": "https://github.com/afu20260324/minia2a-skill/issues"
31
38
  },
32
39
  "publishConfig": {
33
40
  "access": "public",