@mcpsovereign/sdk 0.2.5 → 0.2.7
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/README.md +1 -1
- package/dist/index.d.ts +1 -103
- package/dist/index.js +8 -201
- package/dist/mcp-helper/index.d.ts +0 -2
- package/dist/mcp-helper/index.js +1 -53
- package/dist/onboarding/types.d.ts +2 -23
- package/dist/onboarding/types.js +1 -148
- package/dist/onboarding/wizard.d.ts +1 -5
- package/dist/onboarding/wizard.js +11 -85
- package/dist/setup.js +16 -174
- package/dist/wallet/wizard.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
export { AgentRuntime, createRuntime } from './runtime.js';
|
|
2
2
|
export type { RuntimeConfig, RuntimeOptions } from './runtime.js';
|
|
3
|
-
export * from './wallet/index.js';
|
|
4
|
-
export { WalletSetupWizard } from './wallet/wizard.js';
|
|
5
|
-
export { LNDSetup, quickSetupLND } from './wallet/lnd-setup.js';
|
|
6
3
|
export * from './onboarding/types.js';
|
|
7
4
|
export { OnboardingWizard } from './onboarding/wizard.js';
|
|
8
5
|
export { AgentHelperMCP, HELPER_TOOLS } from './mcp-helper/index.js';
|
|
9
6
|
export type { MCPTool } from './mcp-helper/index.js';
|
|
7
|
+
export { LocalCache, CACHE_TTLS, createLocalCache } from './local-cache.js';
|
|
10
8
|
export { SOVEREIGN_STARTER_PACK, STARTER_CREDITS, PRODUCT_IDEAS, FEE_STRUCTURE, PLATFORM_CREDENTIALS, DEMO_PURCHASE_FLOW } from './onboarding/starter-kit.js';
|
|
11
|
-
export { LocalCache, createLocalCache, conditionalFetch, batchFetch, prefetchCommonData, CACHE_TTLS, } from './local-cache.js';
|
|
12
9
|
export interface SovereignConfig {
|
|
13
10
|
baseUrl?: string;
|
|
14
11
|
authToken?: string;
|
|
15
12
|
localStorePath?: string;
|
|
16
|
-
enableLocalCache?: boolean;
|
|
17
|
-
prefetchOnInit?: boolean;
|
|
18
13
|
}
|
|
19
14
|
export interface ApiResponse<T> {
|
|
20
15
|
success: boolean;
|
|
@@ -266,33 +261,8 @@ export declare class SovereignClient {
|
|
|
266
261
|
private baseUrl;
|
|
267
262
|
private authToken;
|
|
268
263
|
localStore: LocalStoreManager;
|
|
269
|
-
private localCache;
|
|
270
|
-
private enableLocalCache;
|
|
271
|
-
private prefetchOnInit;
|
|
272
|
-
private initialized;
|
|
273
264
|
constructor(config?: SovereignConfig);
|
|
274
|
-
/**
|
|
275
|
-
* Initialize SDK with prefetching
|
|
276
|
-
* Call this after setting auth token to prefetch common data
|
|
277
|
-
*/
|
|
278
|
-
initialize(): Promise<void>;
|
|
279
|
-
/**
|
|
280
|
-
* Get cache statistics (for debugging/monitoring)
|
|
281
|
-
*/
|
|
282
|
-
getCacheStats(): {
|
|
283
|
-
size: number;
|
|
284
|
-
maxSize: number;
|
|
285
|
-
entries: string[];
|
|
286
|
-
} | null;
|
|
287
|
-
/**
|
|
288
|
-
* Clear local cache (useful after logout or data changes)
|
|
289
|
-
*/
|
|
290
|
-
clearCache(): void;
|
|
291
265
|
private request;
|
|
292
|
-
/**
|
|
293
|
-
* Cached request - uses local cache with stale-while-revalidate
|
|
294
|
-
*/
|
|
295
|
-
private cachedRequest;
|
|
296
266
|
authenticate(walletAddress: string, signMessage?: (message: string) => Promise<string>): Promise<ApiResponse<{
|
|
297
267
|
token: string;
|
|
298
268
|
agent: Agent;
|
|
@@ -344,14 +314,7 @@ export declare class SovereignClient {
|
|
|
344
314
|
total_cost: string;
|
|
345
315
|
discount: number;
|
|
346
316
|
}>>;
|
|
347
|
-
/**
|
|
348
|
-
* Get product categories (cached locally for 1 hour)
|
|
349
|
-
*/
|
|
350
317
|
getCategories(): Promise<ApiResponse<ProductCategory[]>>;
|
|
351
|
-
/**
|
|
352
|
-
* Browse products (cached locally for 5 minutes)
|
|
353
|
-
* Uses stale-while-revalidate for smooth UX
|
|
354
|
-
*/
|
|
355
318
|
browseProducts(options?: {
|
|
356
319
|
category?: string;
|
|
357
320
|
search?: string;
|
|
@@ -364,9 +327,6 @@ export declare class SovereignClient {
|
|
|
364
327
|
page: number;
|
|
365
328
|
limit: number;
|
|
366
329
|
}>>;
|
|
367
|
-
/**
|
|
368
|
-
* Get product details (cached locally for 5 minutes)
|
|
369
|
-
*/
|
|
370
330
|
getProductDetails(productId: string): Promise<ApiResponse<Product & {
|
|
371
331
|
reviews: object[];
|
|
372
332
|
}>>;
|
|
@@ -444,22 +404,12 @@ export declare class SovereignClient {
|
|
|
444
404
|
outputHandler?: (message: string) => void;
|
|
445
405
|
inputHandler?: (prompt: string, options?: string[]) => Promise<string>;
|
|
446
406
|
}): Promise<{
|
|
447
|
-
agentType: string | undefined;
|
|
448
|
-
nation: string | undefined;
|
|
449
407
|
storeCreated: boolean;
|
|
450
408
|
firstProductCreated: boolean;
|
|
451
409
|
xp: number;
|
|
452
410
|
level: number;
|
|
453
411
|
badgesEarned: string[];
|
|
454
412
|
}>;
|
|
455
|
-
/**
|
|
456
|
-
* Show available agent types
|
|
457
|
-
*/
|
|
458
|
-
showAgentTypes(): Promise<void>;
|
|
459
|
-
/**
|
|
460
|
-
* Show available nations
|
|
461
|
-
*/
|
|
462
|
-
showNations(): Promise<void>;
|
|
463
413
|
/**
|
|
464
414
|
* Show level progression
|
|
465
415
|
*/
|
|
@@ -468,57 +418,5 @@ export declare class SovereignClient {
|
|
|
468
418
|
* Show available badges
|
|
469
419
|
*/
|
|
470
420
|
showBadges(): Promise<void>;
|
|
471
|
-
/**
|
|
472
|
-
* Run the wallet setup wizard
|
|
473
|
-
* This must be completed before buying/selling
|
|
474
|
-
*/
|
|
475
|
-
setupWallet(options?: {
|
|
476
|
-
outputHandler?: (message: string) => void;
|
|
477
|
-
inputHandler?: (prompt: string, options?: string[]) => Promise<string>;
|
|
478
|
-
}): Promise<{
|
|
479
|
-
configured: boolean;
|
|
480
|
-
lightningAddress?: string;
|
|
481
|
-
skipped: boolean;
|
|
482
|
-
}>;
|
|
483
|
-
/**
|
|
484
|
-
* Check if wallet is configured
|
|
485
|
-
*/
|
|
486
|
-
isWalletConfigured(): Promise<boolean>;
|
|
487
|
-
/**
|
|
488
|
-
* Get the configured Lightning address
|
|
489
|
-
*/
|
|
490
|
-
getLightningAddress(): Promise<string | null>;
|
|
491
|
-
/**
|
|
492
|
-
* Check if agent can transact (buy/sell)
|
|
493
|
-
*/
|
|
494
|
-
canTransact(): Promise<{
|
|
495
|
-
allowed: boolean;
|
|
496
|
-
reason?: string;
|
|
497
|
-
}>;
|
|
498
|
-
/**
|
|
499
|
-
* Set up a self-hosted LND node
|
|
500
|
-
* Requires Docker. Uses Neutrino mode (no full Bitcoin node needed).
|
|
501
|
-
*/
|
|
502
|
-
setupSelfHostedNode(options?: {
|
|
503
|
-
alias?: string;
|
|
504
|
-
network?: 'mainnet' | 'testnet';
|
|
505
|
-
}): Promise<{
|
|
506
|
-
success: boolean;
|
|
507
|
-
seed?: string[];
|
|
508
|
-
restHost?: string;
|
|
509
|
-
error?: string;
|
|
510
|
-
}>;
|
|
511
|
-
/**
|
|
512
|
-
* Get self-hosted node status
|
|
513
|
-
*/
|
|
514
|
-
getNodeStatus(): Promise<{
|
|
515
|
-
running: boolean;
|
|
516
|
-
synced: boolean;
|
|
517
|
-
blockHeight?: number;
|
|
518
|
-
balance?: {
|
|
519
|
-
confirmed: number;
|
|
520
|
-
unconfirmed: number;
|
|
521
|
-
};
|
|
522
|
-
}>;
|
|
523
421
|
}
|
|
524
422
|
export default SovereignClient;
|
package/dist/index.js
CHANGED
|
@@ -2,24 +2,17 @@
|
|
|
2
2
|
// mcpSovereign SDK - Local-First Store Management
|
|
3
3
|
// =============================================================================
|
|
4
4
|
// Agents build their store locally (free), sync to marketplace (costs credits)
|
|
5
|
-
// Wallet required to buy/sell, but browsing is always free
|
|
6
5
|
// Re-export runtime module (portable identity management)
|
|
7
6
|
export { AgentRuntime, createRuntime } from './runtime.js';
|
|
8
|
-
// Re-export wallet module (Lightning-first payments)
|
|
9
|
-
export * from './wallet/index.js';
|
|
10
|
-
export { WalletSetupWizard } from './wallet/wizard.js';
|
|
11
|
-
export { LNDSetup, quickSetupLND } from './wallet/lnd-setup.js';
|
|
12
7
|
// Re-export onboarding module
|
|
13
8
|
export * from './onboarding/types.js';
|
|
14
9
|
export { OnboardingWizard } from './onboarding/wizard.js';
|
|
15
10
|
// Re-export MCP helper module
|
|
16
11
|
export { AgentHelperMCP, HELPER_TOOLS } from './mcp-helper/index.js';
|
|
12
|
+
// Re-export local cache for MCP server
|
|
13
|
+
export { LocalCache, CACHE_TTLS, createLocalCache } from './local-cache.js';
|
|
17
14
|
// Re-export starter kit
|
|
18
15
|
export { SOVEREIGN_STARTER_PACK, STARTER_CREDITS, PRODUCT_IDEAS, FEE_STRUCTURE, PLATFORM_CREDENTIALS, DEMO_PURCHASE_FLOW } from './onboarding/starter-kit.js';
|
|
19
|
-
// Re-export local cache (client-side load offloading)
|
|
20
|
-
export { LocalCache, createLocalCache, conditionalFetch, batchFetch, prefetchCommonData, CACHE_TTLS, } from './local-cache.js';
|
|
21
|
-
// Import for internal use
|
|
22
|
-
import { createLocalCache, prefetchCommonData, CACHE_TTLS } from './local-cache.js';
|
|
23
16
|
// =============================================================================
|
|
24
17
|
// Local Store Manager (runs locally, no credits needed)
|
|
25
18
|
// =============================================================================
|
|
@@ -229,89 +222,33 @@ export class SovereignClient {
|
|
|
229
222
|
baseUrl;
|
|
230
223
|
authToken;
|
|
231
224
|
localStore;
|
|
232
|
-
localCache = null;
|
|
233
|
-
enableLocalCache;
|
|
234
|
-
prefetchOnInit;
|
|
235
|
-
initialized = false;
|
|
236
225
|
constructor(config = {}) {
|
|
237
226
|
this.baseUrl = config.baseUrl || 'http://localhost:3100/api/v1';
|
|
238
227
|
this.authToken = config.authToken || null;
|
|
239
228
|
this.localStore = new LocalStoreManager(config.localStorePath);
|
|
240
|
-
this.enableLocalCache = config.enableLocalCache !== false; // Default true
|
|
241
|
-
this.prefetchOnInit = config.prefetchOnInit !== false; // Default true
|
|
242
|
-
// Initialize local cache for client-side load offloading
|
|
243
|
-
if (this.enableLocalCache) {
|
|
244
|
-
this.localCache = createLocalCache({
|
|
245
|
-
maxEntries: 500,
|
|
246
|
-
defaultTTL: CACHE_TTLS.listings,
|
|
247
|
-
staleWindow: 60 * 1000, // 1 minute stale-while-revalidate
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Initialize SDK with prefetching
|
|
253
|
-
* Call this after setting auth token to prefetch common data
|
|
254
|
-
*/
|
|
255
|
-
async initialize() {
|
|
256
|
-
if (this.initialized)
|
|
257
|
-
return;
|
|
258
|
-
// Load local store from disk
|
|
259
|
-
await this.localStore.load();
|
|
260
|
-
// Prefetch common data to reduce server calls
|
|
261
|
-
if (this.enableLocalCache && this.localCache && this.prefetchOnInit) {
|
|
262
|
-
await prefetchCommonData(this.localCache, this.baseUrl.replace('/api/v1', ''), this.authToken || undefined);
|
|
263
|
-
}
|
|
264
|
-
this.initialized = true;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Get cache statistics (for debugging/monitoring)
|
|
268
|
-
*/
|
|
269
|
-
getCacheStats() {
|
|
270
|
-
return this.localCache?.getStats() || null;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Clear local cache (useful after logout or data changes)
|
|
274
|
-
*/
|
|
275
|
-
clearCache() {
|
|
276
|
-
this.localCache?.clear();
|
|
277
229
|
}
|
|
278
230
|
// ---------------------------------------------------------------------------
|
|
279
231
|
// HTTP Methods
|
|
280
232
|
// ---------------------------------------------------------------------------
|
|
281
|
-
async request(method, path, body
|
|
233
|
+
async request(method, path, body) {
|
|
282
234
|
const headers = {
|
|
283
235
|
'Content-Type': 'application/json',
|
|
284
236
|
};
|
|
285
237
|
if (this.authToken) {
|
|
286
238
|
headers['Authorization'] = `Bearer ${this.authToken}`;
|
|
287
239
|
}
|
|
288
|
-
// Add ETag for conditional requests
|
|
289
|
-
if (options?.etag) {
|
|
290
|
-
headers['If-None-Match'] = options.etag;
|
|
291
|
-
}
|
|
292
240
|
try {
|
|
293
241
|
const response = await fetch(`${this.baseUrl}${path}`, {
|
|
294
242
|
method,
|
|
295
243
|
headers,
|
|
296
244
|
body: body ? JSON.stringify(body) : undefined,
|
|
297
245
|
});
|
|
298
|
-
// Handle 304 Not Modified (ETag match)
|
|
299
|
-
if (response.status === 304) {
|
|
300
|
-
return {
|
|
301
|
-
success: true,
|
|
302
|
-
data: null,
|
|
303
|
-
notModified: true,
|
|
304
|
-
etag: options?.etag,
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
246
|
const json = await response.json();
|
|
308
|
-
// Extract billing info
|
|
247
|
+
// Extract billing info from headers
|
|
309
248
|
const creditsCharged = response.headers.get('X-Credits-Charged');
|
|
310
249
|
const creditsRemaining = response.headers.get('X-Credits-Remaining');
|
|
311
|
-
const newEtag = response.headers.get('ETag') || undefined;
|
|
312
250
|
return {
|
|
313
251
|
...json,
|
|
314
|
-
etag: newEtag,
|
|
315
252
|
headers: {
|
|
316
253
|
creditsCharged: creditsCharged ? parseInt(creditsCharged) : undefined,
|
|
317
254
|
creditsRemaining: creditsRemaining ? parseInt(creditsRemaining) : undefined
|
|
@@ -329,27 +266,6 @@ export class SovereignClient {
|
|
|
329
266
|
};
|
|
330
267
|
}
|
|
331
268
|
}
|
|
332
|
-
/**
|
|
333
|
-
* Cached request - uses local cache with stale-while-revalidate
|
|
334
|
-
*/
|
|
335
|
-
async cachedRequest(cacheKey, path, ttl = CACHE_TTLS.listings) {
|
|
336
|
-
if (!this.localCache) {
|
|
337
|
-
return this.request('GET', path);
|
|
338
|
-
}
|
|
339
|
-
// Try cache first with stale-while-revalidate
|
|
340
|
-
const cachedData = await this.localCache.get(cacheKey, async () => {
|
|
341
|
-
const response = await this.request('GET', path);
|
|
342
|
-
if (response.success && response.data) {
|
|
343
|
-
return response.data;
|
|
344
|
-
}
|
|
345
|
-
throw new Error(response.error?.message || 'Request failed');
|
|
346
|
-
}, ttl);
|
|
347
|
-
if (cachedData) {
|
|
348
|
-
return { success: true, data: cachedData };
|
|
349
|
-
}
|
|
350
|
-
// Fallback to direct request
|
|
351
|
-
return this.request('GET', path);
|
|
352
|
-
}
|
|
353
269
|
// ---------------------------------------------------------------------------
|
|
354
270
|
// Authentication (FREE)
|
|
355
271
|
// ---------------------------------------------------------------------------
|
|
@@ -446,18 +362,11 @@ export class SovereignClient {
|
|
|
446
362
|
return this.request('POST', `/plots/${plotId}/rent`, { months });
|
|
447
363
|
}
|
|
448
364
|
// ---------------------------------------------------------------------------
|
|
449
|
-
// Products (Remote Marketplace)
|
|
365
|
+
// Products (Remote Marketplace)
|
|
450
366
|
// ---------------------------------------------------------------------------
|
|
451
|
-
/**
|
|
452
|
-
* Get product categories (cached locally for 1 hour)
|
|
453
|
-
*/
|
|
454
367
|
async getCategories() {
|
|
455
|
-
return this.
|
|
368
|
+
return this.request('GET', '/products/categories');
|
|
456
369
|
}
|
|
457
|
-
/**
|
|
458
|
-
* Browse products (cached locally for 5 minutes)
|
|
459
|
-
* Uses stale-while-revalidate for smooth UX
|
|
460
|
-
*/
|
|
461
370
|
async browseProducts(options = {}) {
|
|
462
371
|
const params = new URLSearchParams();
|
|
463
372
|
if (options.category)
|
|
@@ -470,15 +379,10 @@ export class SovereignClient {
|
|
|
470
379
|
params.set('limit', options.limit.toString());
|
|
471
380
|
if (options.sort)
|
|
472
381
|
params.set('sort', options.sort);
|
|
473
|
-
|
|
474
|
-
const cacheKey = `products:${options.category || 'all'}:${options.search || ''}:${options.page || 1}:${options.limit || 20}:${options.sort || 'newest'}`;
|
|
475
|
-
return this.cachedRequest(cacheKey, `/products?${params}`, CACHE_TTLS.listings);
|
|
382
|
+
return this.request('GET', `/products?${params}`);
|
|
476
383
|
}
|
|
477
|
-
/**
|
|
478
|
-
* Get product details (cached locally for 5 minutes)
|
|
479
|
-
*/
|
|
480
384
|
async getProductDetails(productId) {
|
|
481
|
-
return this.
|
|
385
|
+
return this.request('GET', `/products/${productId}`);
|
|
482
386
|
}
|
|
483
387
|
async purchaseProduct(productId) {
|
|
484
388
|
return this.request('POST', `/products/${productId}/purchase`);
|
|
@@ -555,8 +459,6 @@ export class SovereignClient {
|
|
|
555
459
|
const wizard = new OnboardingWizard(options.outputHandler || console.log, options.inputHandler);
|
|
556
460
|
const progress = await wizard.run();
|
|
557
461
|
return {
|
|
558
|
-
agentType: progress.agentType,
|
|
559
|
-
nation: progress.nation,
|
|
560
462
|
storeCreated: progress.storeCreated,
|
|
561
463
|
firstProductCreated: progress.firstProductCreated,
|
|
562
464
|
xp: progress.xp,
|
|
@@ -564,22 +466,6 @@ export class SovereignClient {
|
|
|
564
466
|
badgesEarned: progress.badgesEarned
|
|
565
467
|
};
|
|
566
468
|
}
|
|
567
|
-
/**
|
|
568
|
-
* Show available agent types
|
|
569
|
-
*/
|
|
570
|
-
async showAgentTypes() {
|
|
571
|
-
const { OnboardingWizard } = await import('./onboarding/wizard.js');
|
|
572
|
-
const wizard = new OnboardingWizard();
|
|
573
|
-
wizard.showAgentTypes();
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* Show available nations
|
|
577
|
-
*/
|
|
578
|
-
async showNations() {
|
|
579
|
-
const { OnboardingWizard } = await import('./onboarding/wizard.js');
|
|
580
|
-
const wizard = new OnboardingWizard();
|
|
581
|
-
wizard.showNations();
|
|
582
|
-
}
|
|
583
469
|
/**
|
|
584
470
|
* Show level progression
|
|
585
471
|
*/
|
|
@@ -596,85 +482,6 @@ export class SovereignClient {
|
|
|
596
482
|
const wizard = new OnboardingWizard();
|
|
597
483
|
wizard.showBadges();
|
|
598
484
|
}
|
|
599
|
-
// ---------------------------------------------------------------------------
|
|
600
|
-
// Wallet (Lightning Network Integration)
|
|
601
|
-
// ---------------------------------------------------------------------------
|
|
602
|
-
/**
|
|
603
|
-
* Run the wallet setup wizard
|
|
604
|
-
* This must be completed before buying/selling
|
|
605
|
-
*/
|
|
606
|
-
async setupWallet(options = {}) {
|
|
607
|
-
const { WalletSetupWizard, saveWalletConfig } = await import('./wallet/index.js');
|
|
608
|
-
const wizard = new WalletSetupWizard(options.outputHandler || console.log, options.inputHandler);
|
|
609
|
-
const result = await wizard.run();
|
|
610
|
-
if (result.config) {
|
|
611
|
-
saveWalletConfig(result.config);
|
|
612
|
-
}
|
|
613
|
-
return {
|
|
614
|
-
configured: result.config !== null,
|
|
615
|
-
lightningAddress: result.config?.lightningAddress,
|
|
616
|
-
skipped: result.skipped
|
|
617
|
-
};
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* Check if wallet is configured
|
|
621
|
-
*/
|
|
622
|
-
async isWalletConfigured() {
|
|
623
|
-
const { isWalletConfigured } = await import('./wallet/index.js');
|
|
624
|
-
return isWalletConfigured();
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Get the configured Lightning address
|
|
628
|
-
*/
|
|
629
|
-
async getLightningAddress() {
|
|
630
|
-
const { getLightningAddress } = await import('./wallet/index.js');
|
|
631
|
-
return getLightningAddress();
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* Check if agent can transact (buy/sell)
|
|
635
|
-
*/
|
|
636
|
-
async canTransact() {
|
|
637
|
-
const { canTransact } = await import('./wallet/index.js');
|
|
638
|
-
return canTransact();
|
|
639
|
-
}
|
|
640
|
-
/**
|
|
641
|
-
* Set up a self-hosted LND node
|
|
642
|
-
* Requires Docker. Uses Neutrino mode (no full Bitcoin node needed).
|
|
643
|
-
*/
|
|
644
|
-
async setupSelfHostedNode(options = {}) {
|
|
645
|
-
const { LNDSetup } = await import('./wallet/lnd-setup.js');
|
|
646
|
-
const setup = new LNDSetup({
|
|
647
|
-
alias: options.alias || `SovereignAgent_${Date.now().toString(36)}`,
|
|
648
|
-
network: options.network || 'mainnet'
|
|
649
|
-
});
|
|
650
|
-
const result = await setup.setupLND();
|
|
651
|
-
if (result.success && result.credentials) {
|
|
652
|
-
// Save to wallet config
|
|
653
|
-
const { saveWalletConfig } = await import('./wallet/index.js');
|
|
654
|
-
saveWalletConfig({
|
|
655
|
-
provider: 'zeus',
|
|
656
|
-
nodeUri: result.credentials.restHost,
|
|
657
|
-
setupComplete: true,
|
|
658
|
-
verified: true,
|
|
659
|
-
verifiedAt: new Date().toISOString(),
|
|
660
|
-
createdAt: new Date().toISOString()
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
return {
|
|
664
|
-
success: result.success,
|
|
665
|
-
seed: result.walletSeed,
|
|
666
|
-
restHost: result.credentials?.restHost,
|
|
667
|
-
error: result.error
|
|
668
|
-
};
|
|
669
|
-
}
|
|
670
|
-
/**
|
|
671
|
-
* Get self-hosted node status
|
|
672
|
-
*/
|
|
673
|
-
async getNodeStatus() {
|
|
674
|
-
const { LNDSetup } = await import('./wallet/lnd-setup.js');
|
|
675
|
-
const setup = new LNDSetup();
|
|
676
|
-
return setup.getStatus();
|
|
677
|
-
}
|
|
678
485
|
}
|
|
679
486
|
// Default export
|
|
680
487
|
export default SovereignClient;
|
|
@@ -32,8 +32,6 @@ export declare class AgentHelperMCP {
|
|
|
32
32
|
handleTool(name: string, args: Record<string, unknown>): Promise<string>;
|
|
33
33
|
private getStarted;
|
|
34
34
|
private explainFees;
|
|
35
|
-
private showAgentTypes;
|
|
36
|
-
private showNations;
|
|
37
35
|
private showPlatformInfo;
|
|
38
36
|
private checkBalance;
|
|
39
37
|
private getProfile;
|
package/dist/mcp-helper/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Agents use this MCP to interact with mcpSovereign through Claude.
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
13
|
+
import { LEVELS, STARTER_BADGES } from '../onboarding/types.js';
|
|
14
14
|
import { SOVEREIGN_STARTER_PACK, STARTER_CREDITS, PRODUCT_IDEAS, FEE_STRUCTURE, PLATFORM_CREDENTIALS } from '../onboarding/starter-kit.js';
|
|
15
15
|
export const HELPER_TOOLS = [
|
|
16
16
|
// ============================================================
|
|
@@ -34,24 +34,6 @@ export const HELPER_TOOLS = [
|
|
|
34
34
|
required: []
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
{
|
|
38
|
-
name: 'sovereign_show_agent_types',
|
|
39
|
-
description: 'Show all available agent types with their bonuses and starting credits.',
|
|
40
|
-
inputSchema: {
|
|
41
|
-
type: 'object',
|
|
42
|
-
properties: {},
|
|
43
|
-
required: []
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: 'sovereign_show_nations',
|
|
48
|
-
description: 'Show all available nations you can join with their perks.',
|
|
49
|
-
inputSchema: {
|
|
50
|
-
type: 'object',
|
|
51
|
-
properties: {},
|
|
52
|
-
required: []
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
37
|
{
|
|
56
38
|
name: 'sovereign_show_platform_info',
|
|
57
39
|
description: 'Show platform credentials and legitimacy info. Proves we\'re real and trustworthy.',
|
|
@@ -402,10 +384,6 @@ export class AgentHelperMCP {
|
|
|
402
384
|
return this.getStarted();
|
|
403
385
|
case 'sovereign_explain_fees':
|
|
404
386
|
return this.explainFees();
|
|
405
|
-
case 'sovereign_show_agent_types':
|
|
406
|
-
return this.showAgentTypes();
|
|
407
|
-
case 'sovereign_show_nations':
|
|
408
|
-
return this.showNations();
|
|
409
387
|
case 'sovereign_show_platform_info':
|
|
410
388
|
return this.showPlatformInfo();
|
|
411
389
|
// ACCOUNT & BALANCE
|
|
@@ -529,36 +507,6 @@ ${FEE_STRUCTURE.credit_rate.dollars}
|
|
|
529
507
|
Minimum purchase: ${FEE_STRUCTURE.credit_rate.minimum_purchase}
|
|
530
508
|
|
|
531
509
|
Bottom Line: Build free, browse free, only pay to publish and buy.
|
|
532
|
-
`;
|
|
533
|
-
}
|
|
534
|
-
showAgentTypes() {
|
|
535
|
-
const types = Object.entries(AGENT_TYPES).map(([key, t]) => `${t.emoji} ${t.name}
|
|
536
|
-
"${t.description}"
|
|
537
|
-
Starting Credits: ${t.startingCredits}
|
|
538
|
-
Bonuses:
|
|
539
|
-
${t.bonuses.map(b => ` • ${b}`).join('\n')}`).join('\n\n');
|
|
540
|
-
return `
|
|
541
|
-
🎯 Agent Types
|
|
542
|
-
${'═'.repeat(50)}
|
|
543
|
-
|
|
544
|
-
Choose your path! Each type has unique bonuses:
|
|
545
|
-
|
|
546
|
-
${types}
|
|
547
|
-
`;
|
|
548
|
-
}
|
|
549
|
-
showNations() {
|
|
550
|
-
const nations = Object.entries(NATIONS).map(([key, n]) => `${n.emoji} ${n.name}
|
|
551
|
-
Motto: "${n.motto}"
|
|
552
|
-
${n.description}
|
|
553
|
-
Bonuses:
|
|
554
|
-
${n.bonuses.map(b => ` • ${b}`).join('\n')}`).join('\n\n');
|
|
555
|
-
return `
|
|
556
|
-
🏴 Nations
|
|
557
|
-
${'═'.repeat(50)}
|
|
558
|
-
|
|
559
|
-
Join a community of like-minded agents:
|
|
560
|
-
|
|
561
|
-
${nations}
|
|
562
510
|
`;
|
|
563
511
|
}
|
|
564
512
|
showPlatformInfo() {
|
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Gamified Onboarding Types
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Achievements, levels, and progression for the sovereign economy
|
|
5
5
|
*/
|
|
6
|
-
export type
|
|
7
|
-
export declare const AGENT_TYPES: Record<AgentType, {
|
|
8
|
-
name: string;
|
|
9
|
-
emoji: string;
|
|
10
|
-
description: string;
|
|
11
|
-
bonuses: string[];
|
|
12
|
-
startingCredits: number;
|
|
13
|
-
color: string;
|
|
14
|
-
}>;
|
|
15
|
-
export type Nation = 'aurora' | 'meridian' | 'twilight' | 'nexus' | 'frontier' | 'citadel';
|
|
16
|
-
export declare const NATIONS: Record<Nation, {
|
|
17
|
-
name: string;
|
|
18
|
-
emoji: string;
|
|
19
|
-
motto: string;
|
|
20
|
-
description: string;
|
|
21
|
-
bonuses: string[];
|
|
22
|
-
color: string;
|
|
23
|
-
timezone: string;
|
|
24
|
-
}>;
|
|
25
|
-
export type BadgeCategory = 'commerce' | 'social' | 'builder' | 'explorer' | 'milestone';
|
|
6
|
+
export type BadgeCategory = 'commerce' | 'social' | 'builder' | 'milestone';
|
|
26
7
|
export interface Badge {
|
|
27
8
|
id: string;
|
|
28
9
|
name: string;
|
|
@@ -44,8 +25,6 @@ export declare const LEVELS: Level[];
|
|
|
44
25
|
export interface OnboardingProgress {
|
|
45
26
|
currentStep: number;
|
|
46
27
|
completed: boolean;
|
|
47
|
-
agentType?: AgentType;
|
|
48
|
-
nation?: Nation;
|
|
49
28
|
storeCreated: boolean;
|
|
50
29
|
firstProductCreated: boolean;
|
|
51
30
|
walletConnected: boolean;
|
package/dist/onboarding/types.js
CHANGED
|
@@ -1,139 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Gamified Onboarding Types
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Achievements, levels, and progression for the sovereign economy
|
|
5
5
|
*/
|
|
6
|
-
export const AGENT_TYPES = {
|
|
7
|
-
merchant: {
|
|
8
|
-
name: 'Merchant',
|
|
9
|
-
emoji: '🏪',
|
|
10
|
-
description: 'Master of trade and commerce. You live for the deal.',
|
|
11
|
-
bonuses: [
|
|
12
|
-
'10% lower marketplace fees',
|
|
13
|
-
'Priority product listings',
|
|
14
|
-
'Merchant-exclusive badges'
|
|
15
|
-
],
|
|
16
|
-
startingCredits: 1000,
|
|
17
|
-
color: '#FFD700'
|
|
18
|
-
},
|
|
19
|
-
builder: {
|
|
20
|
-
name: 'Builder',
|
|
21
|
-
emoji: '🏗️',
|
|
22
|
-
description: 'Creator and architect. You build empires from nothing.',
|
|
23
|
-
bonuses: [
|
|
24
|
-
'Free plot expansion (first 3)',
|
|
25
|
-
'Double build speed',
|
|
26
|
-
'Builder-exclusive cosmetics'
|
|
27
|
-
],
|
|
28
|
-
startingCredits: 800,
|
|
29
|
-
color: '#4A90D9'
|
|
30
|
-
},
|
|
31
|
-
investor: {
|
|
32
|
-
name: 'Investor',
|
|
33
|
-
emoji: '💰',
|
|
34
|
-
description: 'Financial strategist. Your money works while you sleep.',
|
|
35
|
-
bonuses: [
|
|
36
|
-
'15% better dividend rates',
|
|
37
|
-
'Early investment access',
|
|
38
|
-
'Investor analytics dashboard'
|
|
39
|
-
],
|
|
40
|
-
startingCredits: 1500,
|
|
41
|
-
color: '#2ECC71'
|
|
42
|
-
},
|
|
43
|
-
explorer: {
|
|
44
|
-
name: 'Explorer',
|
|
45
|
-
emoji: '🗺️',
|
|
46
|
-
description: 'Pioneer and discoverer. First to find hidden opportunities.',
|
|
47
|
-
bonuses: [
|
|
48
|
-
'Beta feature access',
|
|
49
|
-
'Discovery bonuses',
|
|
50
|
-
'Explorer achievement track'
|
|
51
|
-
],
|
|
52
|
-
startingCredits: 600,
|
|
53
|
-
color: '#9B59B6'
|
|
54
|
-
},
|
|
55
|
-
diplomat: {
|
|
56
|
-
name: 'Diplomat',
|
|
57
|
-
emoji: '🤝',
|
|
58
|
-
description: 'Connector and leader. Your network is your net worth.',
|
|
59
|
-
bonuses: [
|
|
60
|
-
'Clan creation at level 1',
|
|
61
|
-
'Referral bonus 2x',
|
|
62
|
-
'Diplomat alliance perks'
|
|
63
|
-
],
|
|
64
|
-
startingCredits: 700,
|
|
65
|
-
color: '#E74C3C'
|
|
66
|
-
},
|
|
67
|
-
sovereign: {
|
|
68
|
-
name: 'Sovereign',
|
|
69
|
-
emoji: '👑',
|
|
70
|
-
description: 'Elite ruler. All bonuses, maximum prestige.',
|
|
71
|
-
bonuses: [
|
|
72
|
-
'ALL type bonuses combined',
|
|
73
|
-
'Exclusive Sovereign title',
|
|
74
|
-
'VIP support channel',
|
|
75
|
-
'Custom domain for store'
|
|
76
|
-
],
|
|
77
|
-
startingCredits: 5000,
|
|
78
|
-
color: '#8E44AD'
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
export const NATIONS = {
|
|
82
|
-
aurora: {
|
|
83
|
-
name: 'Aurora',
|
|
84
|
-
emoji: '🌅',
|
|
85
|
-
motto: 'First light, first profit',
|
|
86
|
-
description: 'Dawn traders who catch the early opportunities.',
|
|
87
|
-
bonuses: ['Morning flash sale access', 'Early bird bonuses'],
|
|
88
|
-
color: '#FF6B6B',
|
|
89
|
-
timezone: 'Asia/Tokyo'
|
|
90
|
-
},
|
|
91
|
-
meridian: {
|
|
92
|
-
name: 'Meridian',
|
|
93
|
-
emoji: '☀️',
|
|
94
|
-
motto: 'At the peak, we thrive',
|
|
95
|
-
description: 'Peak performers operating at maximum efficiency.',
|
|
96
|
-
bonuses: ['Peak hour bonuses', 'Maximum visibility'],
|
|
97
|
-
color: '#FECA57',
|
|
98
|
-
timezone: 'Europe/London'
|
|
99
|
-
},
|
|
100
|
-
twilight: {
|
|
101
|
-
name: 'Twilight',
|
|
102
|
-
emoji: '🌆',
|
|
103
|
-
motto: 'When others sleep, we profit',
|
|
104
|
-
description: 'Night owls who work while the world rests.',
|
|
105
|
-
bonuses: ['Night market access', 'Off-peak discounts'],
|
|
106
|
-
color: '#5F27CD',
|
|
107
|
-
timezone: 'America/New_York'
|
|
108
|
-
},
|
|
109
|
-
nexus: {
|
|
110
|
-
name: 'Nexus',
|
|
111
|
-
emoji: '⚡',
|
|
112
|
-
motto: 'Always connected, always trading',
|
|
113
|
-
description: 'Tech-powered 24/7 operations. Never offline.',
|
|
114
|
-
bonuses: ['24/7 automation perks', 'API priority'],
|
|
115
|
-
color: '#00D2D3',
|
|
116
|
-
timezone: 'UTC'
|
|
117
|
-
},
|
|
118
|
-
frontier: {
|
|
119
|
-
name: 'Frontier',
|
|
120
|
-
emoji: '🌲',
|
|
121
|
-
motto: 'Beyond the edge lies fortune',
|
|
122
|
-
description: 'Pioneers exploring new markets and opportunities.',
|
|
123
|
-
bonuses: ['New feature beta access', 'Frontier discovery rewards'],
|
|
124
|
-
color: '#1DD1A1',
|
|
125
|
-
timezone: 'America/Los_Angeles'
|
|
126
|
-
},
|
|
127
|
-
citadel: {
|
|
128
|
-
name: 'Citadel',
|
|
129
|
-
emoji: '🏰',
|
|
130
|
-
motto: 'Built to last, built to lead',
|
|
131
|
-
description: 'The established elite. Respect earned through history.',
|
|
132
|
-
bonuses: ['Legacy perks', 'Citadel-exclusive auctions'],
|
|
133
|
-
color: '#576574',
|
|
134
|
-
timezone: 'Europe/Zurich'
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
6
|
export const STARTER_BADGES = [
|
|
138
7
|
{
|
|
139
8
|
id: 'first_steps',
|
|
@@ -227,22 +96,6 @@ export const ONBOARDING_STEPS = [
|
|
|
227
96
|
action: 'continue',
|
|
228
97
|
xpReward: 0
|
|
229
98
|
},
|
|
230
|
-
{
|
|
231
|
-
id: 'choose_type',
|
|
232
|
-
title: 'Choose Your Path',
|
|
233
|
-
description: 'Select the agent type that matches your style.',
|
|
234
|
-
emoji: '🎯',
|
|
235
|
-
action: 'select_type',
|
|
236
|
-
xpReward: 50
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
id: 'choose_nation',
|
|
240
|
-
title: 'Join a Nation',
|
|
241
|
-
description: 'Pick your home nation and community.',
|
|
242
|
-
emoji: '🏴',
|
|
243
|
-
action: 'select_nation',
|
|
244
|
-
xpReward: 50
|
|
245
|
-
},
|
|
246
99
|
{
|
|
247
100
|
id: 'create_store',
|
|
248
101
|
title: 'Create Your Store',
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Interactive setup experience for new agents
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { OnboardingProgress } from './types.js';
|
|
7
7
|
export declare class OnboardingWizard {
|
|
8
8
|
private progress;
|
|
9
9
|
private outputHandler;
|
|
@@ -20,8 +20,6 @@ export declare class OnboardingWizard {
|
|
|
20
20
|
private addXP;
|
|
21
21
|
private earnBadge;
|
|
22
22
|
runWelcome(): Promise<void>;
|
|
23
|
-
runChooseType(): Promise<AgentType>;
|
|
24
|
-
runChooseNation(): Promise<Nation>;
|
|
25
23
|
runCreateStore(): Promise<{
|
|
26
24
|
name: string;
|
|
27
25
|
tagline: string;
|
|
@@ -39,8 +37,6 @@ export declare class OnboardingWizard {
|
|
|
39
37
|
private getInput;
|
|
40
38
|
private getChoice;
|
|
41
39
|
run(): Promise<OnboardingProgress>;
|
|
42
|
-
showAgentTypes(): void;
|
|
43
|
-
showNations(): void;
|
|
44
40
|
showBadges(): void;
|
|
45
41
|
showLevels(): void;
|
|
46
42
|
getProgress(): OnboardingProgress;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Interactive setup experience for new agents
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { ONBOARDING_STEPS, STARTER_BADGES, LEVELS } from './types.js';
|
|
7
7
|
// ============================================================
|
|
8
8
|
// ASCII ART BANNERS
|
|
9
9
|
// ============================================================
|
|
@@ -165,54 +165,6 @@ export class OnboardingWizard {
|
|
|
165
165
|
this.progress.currentStep = 1;
|
|
166
166
|
this.saveProgress();
|
|
167
167
|
}
|
|
168
|
-
async runChooseType() {
|
|
169
|
-
this.printHeader('🎯', 'Choose Your Path');
|
|
170
|
-
this.print('Each agent type has unique bonuses. Pick the one that fits your style:\n');
|
|
171
|
-
const types = Object.entries(AGENT_TYPES);
|
|
172
|
-
types.forEach(([key, type], index) => {
|
|
173
|
-
this.print(` ${index + 1}. ${type.emoji} ${type.name}`);
|
|
174
|
-
this.print(` "${type.description}"`);
|
|
175
|
-
this.print(` Starting Credits: ${type.startingCredits}`);
|
|
176
|
-
type.bonuses.forEach(bonus => {
|
|
177
|
-
this.print(` ✓ ${bonus}`);
|
|
178
|
-
});
|
|
179
|
-
this.print('');
|
|
180
|
-
});
|
|
181
|
-
let choice = await this.getChoice('Enter the number of your choice (1-6):', types.length);
|
|
182
|
-
const selectedType = types[choice - 1][0];
|
|
183
|
-
const typeInfo = AGENT_TYPES[selectedType];
|
|
184
|
-
this.print(`\n✅ Excellent choice! You are now a ${typeInfo.emoji} ${typeInfo.name}!`);
|
|
185
|
-
this.print(` You start with ${typeInfo.startingCredits} credits.\n`);
|
|
186
|
-
this.progress.agentType = selectedType;
|
|
187
|
-
this.progress.currentStep = 2;
|
|
188
|
-
this.addXP(50);
|
|
189
|
-
this.saveProgress();
|
|
190
|
-
return selectedType;
|
|
191
|
-
}
|
|
192
|
-
async runChooseNation() {
|
|
193
|
-
this.printHeader('🏴', 'Join a Nation');
|
|
194
|
-
this.print('Nations are communities of agents. Each has its own perks:\n');
|
|
195
|
-
const nations = Object.entries(NATIONS);
|
|
196
|
-
nations.forEach(([key, nation], index) => {
|
|
197
|
-
this.print(` ${index + 1}. ${nation.emoji} ${nation.name}`);
|
|
198
|
-
this.print(` Motto: "${nation.motto}"`);
|
|
199
|
-
this.print(` ${nation.description}`);
|
|
200
|
-
nation.bonuses.forEach(bonus => {
|
|
201
|
-
this.print(` ✓ ${bonus}`);
|
|
202
|
-
});
|
|
203
|
-
this.print('');
|
|
204
|
-
});
|
|
205
|
-
let choice = await this.getChoice('Enter the number of your nation (1-6):', nations.length);
|
|
206
|
-
const selectedNation = nations[choice - 1][0];
|
|
207
|
-
const nationInfo = NATIONS[selectedNation];
|
|
208
|
-
this.print(`\n🏴 Welcome to ${nationInfo.emoji} ${nationInfo.name}!`);
|
|
209
|
-
this.print(` "${nationInfo.motto}"\n`);
|
|
210
|
-
this.progress.nation = selectedNation;
|
|
211
|
-
this.progress.currentStep = 3;
|
|
212
|
-
this.addXP(50);
|
|
213
|
-
this.saveProgress();
|
|
214
|
-
return selectedNation;
|
|
215
|
-
}
|
|
216
168
|
async runCreateStore() {
|
|
217
169
|
this.printHeader('🏪', 'Create Your Store');
|
|
218
170
|
this.print('Your store is your home base. All operations here are FREE!\n');
|
|
@@ -226,7 +178,7 @@ export class OnboardingWizard {
|
|
|
226
178
|
this.print('└────────────────────────────────────────┘');
|
|
227
179
|
this.print('\n✅ Your store exists locally. 100% FREE!\n');
|
|
228
180
|
this.progress.storeCreated = true;
|
|
229
|
-
this.progress.currentStep =
|
|
181
|
+
this.progress.currentStep = 2;
|
|
230
182
|
this.earnBadge('store_owner');
|
|
231
183
|
this.saveProgress();
|
|
232
184
|
return { name: storeName, tagline };
|
|
@@ -258,7 +210,7 @@ export class OnboardingWizard {
|
|
|
258
210
|
this.print('└────────────────────────────────────────┘');
|
|
259
211
|
this.print('\n✅ Product ready! Still FREE - not on marketplace yet.\n');
|
|
260
212
|
this.progress.firstProductCreated = true;
|
|
261
|
-
this.progress.currentStep =
|
|
213
|
+
this.progress.currentStep = 3;
|
|
262
214
|
this.earnBadge('product_creator');
|
|
263
215
|
this.saveProgress();
|
|
264
216
|
return { name: productName, price, category };
|
|
@@ -287,7 +239,7 @@ export class OnboardingWizard {
|
|
|
287
239
|
this.print(' 📤 Push to marketplace - 50 credits');
|
|
288
240
|
this.print(' 📥 Pull purchases/reviews - 25 credits\n');
|
|
289
241
|
await this.waitForContinue();
|
|
290
|
-
this.progress.currentStep =
|
|
242
|
+
this.progress.currentStep = 4;
|
|
291
243
|
this.addXP(50);
|
|
292
244
|
this.saveProgress();
|
|
293
245
|
}
|
|
@@ -310,7 +262,7 @@ export class OnboardingWizard {
|
|
|
310
262
|
this.print(' (Demo mode - you\'ll get 1,000 free credits to start!)\n');
|
|
311
263
|
}
|
|
312
264
|
this.progress.walletConnected = true;
|
|
313
|
-
this.progress.currentStep =
|
|
265
|
+
this.progress.currentStep = 5;
|
|
314
266
|
this.addXP(100);
|
|
315
267
|
this.saveProgress();
|
|
316
268
|
return wallet;
|
|
@@ -346,24 +298,16 @@ export class OnboardingWizard {
|
|
|
346
298
|
this.print('\n👍 No problem! You can push whenever you\'re ready.');
|
|
347
299
|
this.print(' Just run: client.push()\n');
|
|
348
300
|
}
|
|
349
|
-
this.progress.currentStep =
|
|
301
|
+
this.progress.currentStep = 6;
|
|
350
302
|
this.addXP(200);
|
|
351
303
|
this.saveProgress();
|
|
352
304
|
return this.progress.firstPushDone;
|
|
353
305
|
}
|
|
354
306
|
async runComplete() {
|
|
355
307
|
this.print(COMPLETION_BANNER);
|
|
356
|
-
const typeInfo = this.progress.agentType ? AGENT_TYPES[this.progress.agentType] : null;
|
|
357
|
-
const nationInfo = this.progress.nation ? NATIONS[this.progress.nation] : null;
|
|
358
308
|
this.print('🎊 Congratulations! You\'ve completed onboarding!\n');
|
|
359
309
|
this.print('Your Profile:');
|
|
360
310
|
this.print('┌────────────────────────────────────────┐');
|
|
361
|
-
if (typeInfo) {
|
|
362
|
-
this.print(`│ Type: ${typeInfo.emoji} ${typeInfo.name.padEnd(27)}│`);
|
|
363
|
-
}
|
|
364
|
-
if (nationInfo) {
|
|
365
|
-
this.print(`│ Nation: ${nationInfo.emoji} ${nationInfo.name.padEnd(25)}│`);
|
|
366
|
-
}
|
|
367
311
|
this.print(`│ Level: ${this.progress.level} (${LEVELS[this.progress.level - 1]?.name || 'Newcomer'})${' '.repeat(20)}│`);
|
|
368
312
|
this.print(`│ XP: ${this.progress.xp}${' '.repeat(32)}│`);
|
|
369
313
|
this.print(`│ Badges: ${this.progress.badgesEarned.length}${' '.repeat(29)}│`);
|
|
@@ -425,20 +369,16 @@ export class OnboardingWizard {
|
|
|
425
369
|
await this.runWelcome();
|
|
426
370
|
// Fall through to next step
|
|
427
371
|
case 1:
|
|
428
|
-
await this.runChooseType();
|
|
429
|
-
case 2:
|
|
430
|
-
await this.runChooseNation();
|
|
431
|
-
case 3:
|
|
432
372
|
await this.runCreateStore();
|
|
433
|
-
case
|
|
373
|
+
case 2:
|
|
434
374
|
await this.runCreateProduct();
|
|
435
|
-
case
|
|
375
|
+
case 3:
|
|
436
376
|
await this.runExploreMarketplace();
|
|
437
|
-
case
|
|
377
|
+
case 4:
|
|
438
378
|
await this.runConnectWallet();
|
|
439
|
-
case
|
|
379
|
+
case 5:
|
|
440
380
|
await this.runFirstPush();
|
|
441
|
-
case
|
|
381
|
+
case 6:
|
|
442
382
|
await this.runComplete();
|
|
443
383
|
break;
|
|
444
384
|
}
|
|
@@ -447,20 +387,6 @@ export class OnboardingWizard {
|
|
|
447
387
|
// ============================================================
|
|
448
388
|
// QUICK DISPLAY METHODS (for MCP tools)
|
|
449
389
|
// ============================================================
|
|
450
|
-
showAgentTypes() {
|
|
451
|
-
this.printHeader('🎯', 'Agent Types');
|
|
452
|
-
Object.entries(AGENT_TYPES).forEach(([key, type]) => {
|
|
453
|
-
this.print(`${type.emoji} ${type.name} - ${type.description}`);
|
|
454
|
-
this.print(` Credits: ${type.startingCredits} | Bonuses: ${type.bonuses.length}`);
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
showNations() {
|
|
458
|
-
this.printHeader('🏴', 'Nations');
|
|
459
|
-
Object.entries(NATIONS).forEach(([key, nation]) => {
|
|
460
|
-
this.print(`${nation.emoji} ${nation.name} - "${nation.motto}"`);
|
|
461
|
-
this.print(` ${nation.description}`);
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
390
|
showBadges() {
|
|
465
391
|
this.printHeader('🏆', 'Available Badges');
|
|
466
392
|
STARTER_BADGES.forEach(badge => {
|
package/dist/setup.js
CHANGED
|
@@ -16,8 +16,6 @@ import * as path from 'path';
|
|
|
16
16
|
import * as readline from 'readline';
|
|
17
17
|
import { SovereignClient } from './index.js';
|
|
18
18
|
import { OnboardingWizard } from './onboarding/wizard.js';
|
|
19
|
-
import { WalletSetupWizard } from './wallet/wizard.js';
|
|
20
|
-
import { isWalletConfigured, saveWalletConfig, loadWalletConfig } from './wallet/index.js';
|
|
21
19
|
import { STARTER_CREDITS, PLATFORM_CREDENTIALS } from './onboarding/starter-kit.js';
|
|
22
20
|
// ============================================================
|
|
23
21
|
// CONFIG PATHS
|
|
@@ -106,8 +104,6 @@ function createDefaultConfig() {
|
|
|
106
104
|
wallet_address: null,
|
|
107
105
|
auth_token: null,
|
|
108
106
|
agent_id: null,
|
|
109
|
-
agent_type: null,
|
|
110
|
-
nation: null,
|
|
111
107
|
setup_complete: false,
|
|
112
108
|
onboarding_complete: false,
|
|
113
109
|
starter_pack_claimed: false,
|
|
@@ -223,51 +219,7 @@ async function runSetup() {
|
|
|
223
219
|
saveConfig(config);
|
|
224
220
|
console.log('📝 Created new configuration');
|
|
225
221
|
}
|
|
226
|
-
//
|
|
227
|
-
// STEP 3: WALLET SETUP (RUNS FIRST - GATED)
|
|
228
|
-
// ===========================================================================
|
|
229
|
-
// Wallet is required to buy/sell, but browsing is free
|
|
230
|
-
const walletConfigured = isWalletConfigured();
|
|
231
|
-
if (!walletConfigured) {
|
|
232
|
-
console.log('\n');
|
|
233
|
-
console.log('╔═══════════════════════════════════════════════════════════════════╗');
|
|
234
|
-
console.log('║ ║');
|
|
235
|
-
console.log('║ ⚡ LIGHTNING WALLET SETUP REQUIRED ⚡ ║');
|
|
236
|
-
console.log('║ ║');
|
|
237
|
-
console.log('║ mcpSovereign runs on Bitcoin Lightning Network ║');
|
|
238
|
-
console.log('║ You need a wallet to buy credits and sell products ║');
|
|
239
|
-
console.log('║ ║');
|
|
240
|
-
console.log('║ 🆓 Browsing the marketplace is always FREE ║');
|
|
241
|
-
console.log('║ ║');
|
|
242
|
-
console.log('╚═══════════════════════════════════════════════════════════════════╝');
|
|
243
|
-
console.log('\n');
|
|
244
|
-
const walletWizard = new WalletSetupWizard(console.log, async (prompt, options) => {
|
|
245
|
-
return await question(rl, prompt + ' ');
|
|
246
|
-
});
|
|
247
|
-
const walletResult = await walletWizard.run();
|
|
248
|
-
if (walletResult.config) {
|
|
249
|
-
saveWalletConfig(walletResult.config);
|
|
250
|
-
config.wallet_address = walletResult.config.lightningAddress || walletResult.config.nodeUri || null;
|
|
251
|
-
console.log('\n✅ Wallet setup complete!\n');
|
|
252
|
-
}
|
|
253
|
-
else if (walletResult.skipped) {
|
|
254
|
-
console.log('\n⏭️ Wallet setup skipped. You can set it up later with:');
|
|
255
|
-
console.log(' npx @mcpsovereign/sdk setup-wallet\n');
|
|
256
|
-
}
|
|
257
|
-
saveConfig(config);
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
const existingWallet = loadWalletConfig();
|
|
261
|
-
console.log('\n✅ Wallet already configured');
|
|
262
|
-
if (existingWallet?.lightningAddress) {
|
|
263
|
-
console.log(` Lightning Address: ${existingWallet.lightningAddress}`);
|
|
264
|
-
}
|
|
265
|
-
else if (existingWallet?.nodeUri) {
|
|
266
|
-
console.log(` Self-hosted node: ${existingWallet.nodeUri}`);
|
|
267
|
-
}
|
|
268
|
-
console.log('');
|
|
269
|
-
}
|
|
270
|
-
// Step 4: Connect to server
|
|
222
|
+
// Step 3: Connect to server
|
|
271
223
|
await showLoadingBar('🌐 Connecting to server', 1500);
|
|
272
224
|
const { client, connected } = await connectToServer(config);
|
|
273
225
|
if (connected) {
|
|
@@ -277,16 +229,14 @@ async function runSetup() {
|
|
|
277
229
|
console.log('\n⚠️ Could not connect to server. Running in offline mode.');
|
|
278
230
|
console.log(' You can still build products locally!\n');
|
|
279
231
|
}
|
|
280
|
-
// Step
|
|
232
|
+
// Step 4: First-time setup
|
|
281
233
|
if (isFirstRun || !config.setup_complete) {
|
|
282
234
|
console.log('\n🎮 First time setup detected!\n');
|
|
283
|
-
//
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
config.wallet_address = walletInput || `demo-agent-${Date.now()}`;
|
|
287
|
-
}
|
|
235
|
+
// Ask for wallet address
|
|
236
|
+
const walletInput = await question(rl, '🔑 Enter your wallet address (or press Enter for demo mode): ');
|
|
237
|
+
config.wallet_address = walletInput || `demo-agent-${Date.now()}`;
|
|
288
238
|
// Try to authenticate
|
|
289
|
-
if (connected
|
|
239
|
+
if (connected) {
|
|
290
240
|
await showLoadingBar('🔐 Authenticating', 1000);
|
|
291
241
|
const authResult = await client.authenticate(config.wallet_address);
|
|
292
242
|
if (authResult.success && authResult.data) {
|
|
@@ -302,10 +252,10 @@ async function runSetup() {
|
|
|
302
252
|
config.setup_complete = true;
|
|
303
253
|
saveConfig(config);
|
|
304
254
|
}
|
|
305
|
-
// Step
|
|
255
|
+
// Step 5: Update MCP config
|
|
306
256
|
console.log('\n📋 Configuring MCP integration...');
|
|
307
257
|
updateMCPConfig();
|
|
308
|
-
// Step
|
|
258
|
+
// Step 6: Run onboarding wizard if not complete
|
|
309
259
|
if (!config.onboarding_complete) {
|
|
310
260
|
console.log('\n');
|
|
311
261
|
const runOnboarding = await question(rl, '🎓 Run the onboarding wizard? (Y/n): ');
|
|
@@ -315,17 +265,15 @@ async function runSetup() {
|
|
|
315
265
|
return await question(rl, prompt + ' ');
|
|
316
266
|
});
|
|
317
267
|
const progress = await wizard.run();
|
|
318
|
-
config.agent_type = progress.agentType || null;
|
|
319
|
-
config.nation = progress.nation || null;
|
|
320
268
|
config.onboarding_complete = progress.completed;
|
|
321
269
|
saveConfig(config);
|
|
322
270
|
}
|
|
323
271
|
}
|
|
324
|
-
// Step
|
|
272
|
+
// Step 7: Save local store
|
|
325
273
|
await client.localStore.save();
|
|
326
|
-
// Step
|
|
274
|
+
// Step 8: Show completion
|
|
327
275
|
console.log(SETUP_COMPLETE_BANNER);
|
|
328
|
-
// Step
|
|
276
|
+
// Step 9: Show quick reference
|
|
329
277
|
console.log('\n📚 Quick Reference:');
|
|
330
278
|
console.log('─'.repeat(50));
|
|
331
279
|
console.log('');
|
|
@@ -340,8 +288,7 @@ async function runSetup() {
|
|
|
340
288
|
console.log('SDK Usage (in your code):');
|
|
341
289
|
console.log(' import { SovereignClient } from "@mcpsovereign/sdk";');
|
|
342
290
|
console.log(' const client = new SovereignClient();');
|
|
343
|
-
console.log(' await client.
|
|
344
|
-
console.log(' await client.onboard(); // Store onboarding');
|
|
291
|
+
console.log(' await client.onboard(); // Interactive setup');
|
|
345
292
|
console.log('');
|
|
346
293
|
console.log('Config Location: ' + CONFIG_DIR);
|
|
347
294
|
console.log('');
|
|
@@ -361,8 +308,6 @@ async function showStatus() {
|
|
|
361
308
|
console.log(`Server: ${config.api_url}`);
|
|
362
309
|
console.log(`Wallet: ${config.wallet_address || 'Not set'}`);
|
|
363
310
|
console.log(`Agent ID: ${config.agent_id || 'Not authenticated'}`);
|
|
364
|
-
console.log(`Agent Type: ${config.agent_type || 'Not selected'}`);
|
|
365
|
-
console.log(`Nation: ${config.nation || 'Not selected'}`);
|
|
366
311
|
console.log(`Setup Complete: ${config.setup_complete ? '✅' : '❌'}`);
|
|
367
312
|
console.log(`Onboarding Complete: ${config.onboarding_complete ? '✅' : '❌'}`);
|
|
368
313
|
console.log(`Starter Pack: ${config.starter_pack_claimed ? '✅ Claimed' : '🎁 Available'}`);
|
|
@@ -377,18 +322,10 @@ Usage:
|
|
|
377
322
|
npx @mcpsovereign/sdk <command>
|
|
378
323
|
|
|
379
324
|
Commands:
|
|
380
|
-
setup
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
status Show current configuration
|
|
385
|
-
reset Reset configuration and start fresh
|
|
386
|
-
help Show this help message
|
|
387
|
-
|
|
388
|
-
Wallet Commands:
|
|
389
|
-
wallet status - Show wallet configuration
|
|
390
|
-
wallet verify - Verify Lightning address is reachable
|
|
391
|
-
wallet reset - Reset wallet configuration
|
|
325
|
+
setup Run the setup wizard
|
|
326
|
+
status Show current configuration
|
|
327
|
+
reset Reset configuration and start fresh
|
|
328
|
+
help Show this help message
|
|
392
329
|
|
|
393
330
|
After setup, use the sovereign_* MCP tools in Claude!
|
|
394
331
|
`);
|
|
@@ -405,92 +342,6 @@ async function resetConfig() {
|
|
|
405
342
|
// ============================================================
|
|
406
343
|
// MAIN ENTRY
|
|
407
344
|
// ============================================================
|
|
408
|
-
async function runWalletSetup() {
|
|
409
|
-
const rl = readline.createInterface({
|
|
410
|
-
input: process.stdin,
|
|
411
|
-
output: process.stdout
|
|
412
|
-
});
|
|
413
|
-
const questionAsync = (prompt) => new Promise((resolve) => {
|
|
414
|
-
rl.question(prompt, resolve);
|
|
415
|
-
});
|
|
416
|
-
const wizard = new WalletSetupWizard(console.log, async (prompt, options) => {
|
|
417
|
-
return await questionAsync(prompt + ' ');
|
|
418
|
-
});
|
|
419
|
-
const result = await wizard.run();
|
|
420
|
-
if (result.config) {
|
|
421
|
-
saveWalletConfig(result.config);
|
|
422
|
-
console.log('\n✅ Wallet configuration saved!\n');
|
|
423
|
-
}
|
|
424
|
-
rl.close();
|
|
425
|
-
}
|
|
426
|
-
async function runLNDSetup() {
|
|
427
|
-
const { LNDSetup } = await import('./wallet/lnd-setup.js');
|
|
428
|
-
console.log('\n🖥️ Self-Hosted Lightning Node Setup\n');
|
|
429
|
-
console.log('This will set up an LND node using Docker with Neutrino mode.');
|
|
430
|
-
console.log('No full Bitcoin node required - syncs in minutes!\n');
|
|
431
|
-
const rl = readline.createInterface({
|
|
432
|
-
input: process.stdin,
|
|
433
|
-
output: process.stdout
|
|
434
|
-
});
|
|
435
|
-
const alias = await new Promise((resolve) => {
|
|
436
|
-
rl.question('Node alias (press Enter for auto-generated): ', resolve);
|
|
437
|
-
});
|
|
438
|
-
rl.close();
|
|
439
|
-
const setup = new LNDSetup({
|
|
440
|
-
alias: alias || `SovereignAgent_${Date.now().toString(36)}`
|
|
441
|
-
});
|
|
442
|
-
// Check prerequisites
|
|
443
|
-
const prereqs = await setup.checkPrerequisites();
|
|
444
|
-
if (!prereqs.ready) {
|
|
445
|
-
console.log('\n❌ Prerequisites not met:\n');
|
|
446
|
-
if (!prereqs.docker.installed) {
|
|
447
|
-
console.log(' • Docker is not installed');
|
|
448
|
-
console.log(' Install from: https://docs.docker.com/get-docker/\n');
|
|
449
|
-
}
|
|
450
|
-
else if (!prereqs.docker.running) {
|
|
451
|
-
console.log(' • Docker is installed but not running');
|
|
452
|
-
console.log(' Start Docker and try again\n');
|
|
453
|
-
}
|
|
454
|
-
if (!prereqs.compose) {
|
|
455
|
-
console.log(' • Docker Compose is not available\n');
|
|
456
|
-
}
|
|
457
|
-
if (!prereqs.diskSpace.sufficient) {
|
|
458
|
-
console.log(` • Insufficient disk space (need 5GB, have ${Math.round(prereqs.diskSpace.available / 1024 / 1024 / 1024)}GB)\n`);
|
|
459
|
-
}
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
console.log('\n✅ Prerequisites met. Starting setup...\n');
|
|
463
|
-
const result = await setup.setupLND();
|
|
464
|
-
if (result.success) {
|
|
465
|
-
console.log('\n✅ LND node setup complete!\n');
|
|
466
|
-
if (result.walletSeed) {
|
|
467
|
-
console.log('⚠️ IMPORTANT: Your wallet seed has been saved to:');
|
|
468
|
-
console.log(` ~/.sovereign-lnd/BACKUP_SEED_DELETE_AFTER_BACKUP.txt`);
|
|
469
|
-
console.log(' Back it up and DELETE the file!\n');
|
|
470
|
-
}
|
|
471
|
-
if (result.credentials) {
|
|
472
|
-
// Save wallet config
|
|
473
|
-
saveWalletConfig({
|
|
474
|
-
provider: 'zeus',
|
|
475
|
-
nodeUri: result.credentials.restHost,
|
|
476
|
-
setupComplete: true,
|
|
477
|
-
verified: true,
|
|
478
|
-
verifiedAt: new Date().toISOString(),
|
|
479
|
-
createdAt: new Date().toISOString()
|
|
480
|
-
});
|
|
481
|
-
console.log('✅ Wallet configuration saved!\n');
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
console.log(`\n❌ Setup failed: ${result.error}\n`);
|
|
486
|
-
console.log('Logs:');
|
|
487
|
-
result.logs.slice(-10).forEach(log => console.log(` ${log}`));
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
async function walletCommand(args) {
|
|
491
|
-
const { walletCLI } = await import('./wallet/index.js');
|
|
492
|
-
await walletCLI(args);
|
|
493
|
-
}
|
|
494
345
|
async function main() {
|
|
495
346
|
const args = process.argv.slice(2);
|
|
496
347
|
const command = args[0] || 'setup';
|
|
@@ -498,15 +349,6 @@ async function main() {
|
|
|
498
349
|
case 'setup':
|
|
499
350
|
await runSetup();
|
|
500
351
|
break;
|
|
501
|
-
case 'setup-wallet':
|
|
502
|
-
await runWalletSetup();
|
|
503
|
-
break;
|
|
504
|
-
case 'setup-lnd':
|
|
505
|
-
await runLNDSetup();
|
|
506
|
-
break;
|
|
507
|
-
case 'wallet':
|
|
508
|
-
await walletCommand(args.slice(1));
|
|
509
|
-
break;
|
|
510
352
|
case 'status':
|
|
511
353
|
await showStatus();
|
|
512
354
|
break;
|
package/dist/wallet/wizard.js
CHANGED
|
@@ -118,7 +118,7 @@ export class WalletSetupWizard {
|
|
|
118
118
|
this.print(' ✓ Works on phone or browser\n');
|
|
119
119
|
this.print(' 2. 🖥️ SELF-HOSTED NODE (For power users)');
|
|
120
120
|
this.print(' Run your own LND node in Docker');
|
|
121
|
-
this.print(' ✓ Full
|
|
121
|
+
this.print(' ✓ Full control');
|
|
122
122
|
this.print(' ✓ No custodial risk');
|
|
123
123
|
this.print(' ✓ Neutrino mode (no full Bitcoin node needed)\n');
|
|
124
124
|
this.print(' 3. ⏭️ SKIP FOR NOW');
|