@emblemvault/agentwallet 1.2.0 → 1.3.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.
- package/emblemai.js +124 -4
- package/package.json +2 -2
package/emblemai.js
CHANGED
|
@@ -41,6 +41,14 @@ async function main() {
|
|
|
41
41
|
const initialStream = hasFlag(['--stream']);
|
|
42
42
|
const passwordArg = getArg(['--password', '-p']);
|
|
43
43
|
const messageArg = getArg(['--message', '-m']);
|
|
44
|
+
const hustleUrlArg = getArg(['--hustle-url']);
|
|
45
|
+
const authUrlArg = getArg(['--auth-url']);
|
|
46
|
+
const apiUrlArg = getArg(['--api-url']);
|
|
47
|
+
|
|
48
|
+
// Endpoint overrides (CLI args > env vars > defaults)
|
|
49
|
+
const hustleApiUrl = hustleUrlArg || process.env.HUSTLE_API_URL || undefined;
|
|
50
|
+
const authUrl = authUrlArg || process.env.EMBLEM_AUTH_URL || undefined;
|
|
51
|
+
const apiUrl = apiUrlArg || process.env.EMBLEM_API_URL || undefined;
|
|
44
52
|
|
|
45
53
|
// Conversation history file
|
|
46
54
|
const historyFile = path.join(os.homedir(), '.emblemai-history.json');
|
|
@@ -160,10 +168,14 @@ async function main() {
|
|
|
160
168
|
console.log('Authenticating with Agent Hustle...');
|
|
161
169
|
}
|
|
162
170
|
|
|
163
|
-
const
|
|
171
|
+
const authSdkConfig = {
|
|
164
172
|
appId: 'emblem-agent-wallet',
|
|
165
173
|
persistSession: false,
|
|
166
|
-
}
|
|
174
|
+
};
|
|
175
|
+
if (authUrl) authSdkConfig.authUrl = authUrl;
|
|
176
|
+
if (apiUrl) authSdkConfig.apiUrl = apiUrl;
|
|
177
|
+
|
|
178
|
+
const authSdk = new EmblemAuthSDK(authSdkConfig);
|
|
167
179
|
|
|
168
180
|
const session = await authSdk.authenticatePassword({ password });
|
|
169
181
|
if (!session) {
|
|
@@ -179,10 +191,13 @@ async function main() {
|
|
|
179
191
|
model: null,
|
|
180
192
|
};
|
|
181
193
|
|
|
182
|
-
const
|
|
194
|
+
const hustleClientConfig = {
|
|
183
195
|
sdk: authSdk,
|
|
184
196
|
debug: settings.debug,
|
|
185
|
-
}
|
|
197
|
+
};
|
|
198
|
+
if (hustleApiUrl) hustleClientConfig.hustleApiUrl = hustleApiUrl;
|
|
199
|
+
|
|
200
|
+
const client = new HustleIncognitoClient(hustleClientConfig);
|
|
186
201
|
|
|
187
202
|
// Intent context for auto-tools mode
|
|
188
203
|
let lastIntentContext = null;
|
|
@@ -273,6 +288,11 @@ async function main() {
|
|
|
273
288
|
console.log(' /tools - List tool categories');
|
|
274
289
|
console.log(' /tools add|remove <id> - Manage tools');
|
|
275
290
|
console.log(' /tools clear - Enable auto-tools mode');
|
|
291
|
+
console.log(' /payment - Show PAYG billing status');
|
|
292
|
+
console.log(' /payment enable - Enable pay-as-you-go billing');
|
|
293
|
+
console.log(' /payment disable - Disable pay-as-you-go billing');
|
|
294
|
+
console.log(' /payment token <T> - Set payment token (SOL, ETH, HUSTLE, etc.)');
|
|
295
|
+
console.log(' /payment mode <M> - Set payment mode (pay_per_request, debt_accumulation)');
|
|
276
296
|
console.log(' /exit - Exit the CLI');
|
|
277
297
|
}
|
|
278
298
|
|
|
@@ -283,12 +303,16 @@ async function main() {
|
|
|
283
303
|
console.log(` App ID: emblem-agent-wallet`);
|
|
284
304
|
console.log(` Vault ID: ${sess?.user?.vaultId || 'N/A'}`);
|
|
285
305
|
console.log(` Auth Mode: Password (headless)`);
|
|
306
|
+
if (hustleApiUrl) console.log(` Hustle API: ${hustleApiUrl}`);
|
|
307
|
+
if (authUrl) console.log(` Auth URL: ${authUrl}`);
|
|
308
|
+
if (apiUrl) console.log(` API URL: ${apiUrl}`);
|
|
286
309
|
console.log(` Model: ${settings.model || 'API default'}`);
|
|
287
310
|
console.log(` Streaming: ${settings.stream ? 'ON' : 'OFF'}`);
|
|
288
311
|
console.log(` Debug: ${settings.debug ? 'ON' : 'OFF'}`);
|
|
289
312
|
console.log(` History: ${settings.retainHistory ? 'ON' : 'OFF'}`);
|
|
290
313
|
console.log(` Messages: ${history.messages.length}`);
|
|
291
314
|
console.log(` Tools: ${settings.selectedTools.length > 0 ? settings.selectedTools.join(', ') : 'Auto-tools mode'}`);
|
|
315
|
+
console.log(' PAYG: Use /payment to view billing status');
|
|
292
316
|
}
|
|
293
317
|
|
|
294
318
|
// ==================== AUTH MENU ====================
|
|
@@ -491,6 +515,42 @@ async function main() {
|
|
|
491
515
|
}
|
|
492
516
|
}
|
|
493
517
|
|
|
518
|
+
// ==================== PAYG MANAGEMENT ====================
|
|
519
|
+
async function showPaygStatus() {
|
|
520
|
+
console.log('\nFetching PAYG billing status...');
|
|
521
|
+
try {
|
|
522
|
+
const status = await client.getPaygStatus();
|
|
523
|
+
console.log('\n========================================');
|
|
524
|
+
console.log(' PAYG Billing Status');
|
|
525
|
+
console.log('========================================');
|
|
526
|
+
console.log('');
|
|
527
|
+
console.log(` Enabled: ${status.enabled ? 'YES' : 'NO'}`);
|
|
528
|
+
console.log(` Mode: ${status.mode || 'N/A'}`);
|
|
529
|
+
console.log(` Payment Token: ${status.payment_token || 'N/A'}`);
|
|
530
|
+
console.log(` Payment Chain: ${status.payment_chain || 'N/A'}`);
|
|
531
|
+
console.log(` Blocked: ${status.is_blocked ? 'YES' : 'NO'}`);
|
|
532
|
+
console.log(` Total Debt: $${(status.total_debt_usd || 0).toFixed(4)}`);
|
|
533
|
+
console.log(` Total Paid: $${(status.total_paid_usd || 0).toFixed(4)}`);
|
|
534
|
+
console.log(` Debt Ceiling: $${(status.debt_ceiling_usd || 0).toFixed(2)}`);
|
|
535
|
+
console.log(` Pending Charges: ${status.pending_charges || 0}`);
|
|
536
|
+
console.log('');
|
|
537
|
+
if (status.available_tokens && status.available_tokens.length > 0) {
|
|
538
|
+
console.log(' Available Tokens:');
|
|
539
|
+
status.available_tokens.forEach(t => console.log(` - ${t}`));
|
|
540
|
+
}
|
|
541
|
+
console.log('');
|
|
542
|
+
console.log('========================================');
|
|
543
|
+
console.log('');
|
|
544
|
+
console.log('Commands:');
|
|
545
|
+
console.log(' /payment enable - Enable PAYG billing');
|
|
546
|
+
console.log(' /payment disable - Disable PAYG billing');
|
|
547
|
+
console.log(' /payment token <TOKEN> - Set payment token');
|
|
548
|
+
console.log(' /payment mode <MODE> - Set payment mode');
|
|
549
|
+
} catch (error) {
|
|
550
|
+
console.error('Error fetching PAYG status:', error.message);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
494
554
|
// ==================== STREAM RESPONSE ====================
|
|
495
555
|
async function streamResponse(msgs) {
|
|
496
556
|
let fullText = '';
|
|
@@ -792,6 +852,66 @@ async function main() {
|
|
|
792
852
|
return true;
|
|
793
853
|
}
|
|
794
854
|
|
|
855
|
+
if (command.startsWith('/payment')) {
|
|
856
|
+
const parts = command.split(' ');
|
|
857
|
+
|
|
858
|
+
if (parts.length === 1) {
|
|
859
|
+
await showPaygStatus();
|
|
860
|
+
return true;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
const subCommand = parts[1];
|
|
864
|
+
|
|
865
|
+
if (subCommand === 'enable') {
|
|
866
|
+
try {
|
|
867
|
+
const result = await client.configurePayg({ enabled: true });
|
|
868
|
+
console.log(result.success ? 'PAYG billing enabled.' : 'Failed to enable PAYG.');
|
|
869
|
+
} catch (error) {
|
|
870
|
+
console.error('Error enabling PAYG:', error.message);
|
|
871
|
+
}
|
|
872
|
+
return true;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
if (subCommand === 'disable') {
|
|
876
|
+
try {
|
|
877
|
+
const result = await client.configurePayg({ enabled: false });
|
|
878
|
+
console.log(result.success ? 'PAYG billing disabled.' : 'Failed to disable PAYG.');
|
|
879
|
+
} catch (error) {
|
|
880
|
+
console.error('Error disabling PAYG:', error.message);
|
|
881
|
+
}
|
|
882
|
+
return true;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
if (subCommand === 'token' && parts[2]) {
|
|
886
|
+
const token = parts[2].toUpperCase();
|
|
887
|
+
try {
|
|
888
|
+
const result = await client.configurePayg({ payment_token: token });
|
|
889
|
+
console.log(result.success ? `Payment token set to: ${token}` : 'Failed to set payment token.');
|
|
890
|
+
} catch (error) {
|
|
891
|
+
console.error('Error setting payment token:', error.message);
|
|
892
|
+
}
|
|
893
|
+
return true;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
if (subCommand === 'mode' && parts[2]) {
|
|
897
|
+
const mode = parts[2];
|
|
898
|
+
if (mode !== 'pay_per_request' && mode !== 'debt_accumulation') {
|
|
899
|
+
console.log('Invalid mode. Use: pay_per_request or debt_accumulation');
|
|
900
|
+
return true;
|
|
901
|
+
}
|
|
902
|
+
try {
|
|
903
|
+
const result = await client.configurePayg({ mode });
|
|
904
|
+
console.log(result.success ? `Payment mode set to: ${mode}` : 'Failed to set payment mode.');
|
|
905
|
+
} catch (error) {
|
|
906
|
+
console.error('Error setting payment mode:', error.message);
|
|
907
|
+
}
|
|
908
|
+
return true;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
console.log('Invalid /payment command. Use /payment for status, or /payment enable|disable|token|mode');
|
|
912
|
+
return true;
|
|
913
|
+
}
|
|
914
|
+
|
|
795
915
|
return false;
|
|
796
916
|
}
|
|
797
917
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emblemvault/agentwallet",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "CLI for EmblemVault Hustle AI - autonomous crypto wallet management",
|
|
5
5
|
"main": "emblemai.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"reset": "node emblemai.js --reset"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"hustle-incognito": "^0.
|
|
15
|
+
"hustle-incognito": "^1.0.0",
|
|
16
16
|
"@emblemvault/auth-sdk": "^2.3.16",
|
|
17
17
|
"dotenv": "^16.3.1"
|
|
18
18
|
},
|