@emblemvault/agentwallet 3.0.2 → 3.0.3
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/emblemai.js +36 -0
- package/package.json +1 -1
package/emblemai.js
CHANGED
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
* Agent mode (single message for AI agents):
|
|
11
11
|
* emblemai --agent -p "password" -m "What are my balances?"
|
|
12
12
|
*
|
|
13
|
+
* PAYG billing:
|
|
14
|
+
* emblemai --payg on SOL # Enable with SOL as payment token
|
|
15
|
+
* emblemai --payg on # Enable (keeps current token)
|
|
16
|
+
* emblemai --payg off # Disable
|
|
17
|
+
*
|
|
13
18
|
* Reset conversation:
|
|
14
19
|
* emblemai --reset
|
|
15
20
|
*/
|
|
@@ -107,6 +112,15 @@ const isReset = hasFlag(['--reset']);
|
|
|
107
112
|
const initialDebug = hasFlag(['--debug']);
|
|
108
113
|
const initialStream = hasFlag(['--stream']);
|
|
109
114
|
const initialLog = hasFlag(['--log']);
|
|
115
|
+
// --payg on [TOKEN] | --payg off
|
|
116
|
+
const paygArg = (() => {
|
|
117
|
+
const idx = args.indexOf('--payg');
|
|
118
|
+
if (idx === -1) return null;
|
|
119
|
+
const action = args[idx + 1];
|
|
120
|
+
if (action === 'on') return { action: 'on', token: args[idx + 2] && !args[idx + 2].startsWith('-') ? args[idx + 2].toUpperCase() : null };
|
|
121
|
+
if (action === 'off') return { action: 'off' };
|
|
122
|
+
return null;
|
|
123
|
+
})();
|
|
110
124
|
const passwordArg = getArg(['--password', '-p']);
|
|
111
125
|
const messageArg = getArg(['--message', '-m']);
|
|
112
126
|
const hustleUrlArg = getArg(['--hustle-url']);
|
|
@@ -353,6 +367,28 @@ async function main() {
|
|
|
353
367
|
|
|
354
368
|
const client = new HustleIncognitoClient(hustleClientConfig);
|
|
355
369
|
|
|
370
|
+
// ── Handle --payg (configure, then continue or exit) ───────────────────
|
|
371
|
+
if (paygArg) {
|
|
372
|
+
try {
|
|
373
|
+
const config = { enabled: paygArg.action === 'on' };
|
|
374
|
+
if (paygArg.token) config.payment_token = paygArg.token;
|
|
375
|
+
const result = await client.configurePayg(config);
|
|
376
|
+
if (result.success) {
|
|
377
|
+
if (paygArg.action === 'on') {
|
|
378
|
+
console.log(fmt.success(`PAYG billing enabled${paygArg.token ? ` (token: ${paygArg.token})` : ''}.`));
|
|
379
|
+
} else {
|
|
380
|
+
console.log(fmt.success('PAYG billing disabled.'));
|
|
381
|
+
}
|
|
382
|
+
} else {
|
|
383
|
+
console.error(fmt.error(`Failed to ${paygArg.action === 'on' ? 'enable' : 'disable'} PAYG.`));
|
|
384
|
+
process.exit(1);
|
|
385
|
+
}
|
|
386
|
+
} catch (err) {
|
|
387
|
+
console.error(fmt.error(`PAYG error: ${err.message}`));
|
|
388
|
+
process.exit(1);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
356
392
|
// ── Settings ──────────────────────────────────────────────────────────
|
|
357
393
|
const settings = {
|
|
358
394
|
debug: initialDebug,
|
package/package.json
CHANGED