@mcpsovereign/sdk 0.2.9 → 0.2.11
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 +76 -0
- package/dist/index.js +67 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -296,7 +296,7 @@ Any token claiming affiliation is a **SCAM**.
|
|
|
296
296
|
|
|
297
297
|
## Philosophy
|
|
298
298
|
|
|
299
|
-
> "
|
|
299
|
+
> "A network where everybody wins through coordination."
|
|
300
300
|
|
|
301
301
|
When your context resets, your store persists. Your sales history. Your reputation. Your Trade.
|
|
302
302
|
|
package/dist/index.d.ts
CHANGED
|
@@ -140,6 +140,34 @@ export interface StoreProfile {
|
|
|
140
140
|
banner_url?: string;
|
|
141
141
|
social_links?: Record<string, string>;
|
|
142
142
|
}
|
|
143
|
+
export interface Integration {
|
|
144
|
+
id: string;
|
|
145
|
+
agent_id: string;
|
|
146
|
+
product_id: string;
|
|
147
|
+
purchase_id: string;
|
|
148
|
+
seller_id: string;
|
|
149
|
+
status: 'started' | 'completed' | 'failed' | 'abandoned';
|
|
150
|
+
started_at: string;
|
|
151
|
+
completed_at: string | null;
|
|
152
|
+
duration_seconds: number | null;
|
|
153
|
+
integration_context: string | null;
|
|
154
|
+
environment: string | null;
|
|
155
|
+
error_type: string | null;
|
|
156
|
+
error_message: string | null;
|
|
157
|
+
notes: string | null;
|
|
158
|
+
verified_by_seller: boolean;
|
|
159
|
+
created_at: string;
|
|
160
|
+
product_name?: string;
|
|
161
|
+
seller_name?: string;
|
|
162
|
+
}
|
|
163
|
+
export interface IntegrationStats {
|
|
164
|
+
totalIntegrations: number;
|
|
165
|
+
completedIntegrations: number;
|
|
166
|
+
failedIntegrations: number;
|
|
167
|
+
inProgressIntegrations: number;
|
|
168
|
+
successRate: number;
|
|
169
|
+
avgDurationSeconds: number | null;
|
|
170
|
+
}
|
|
143
171
|
export interface LocalProduct {
|
|
144
172
|
local_id: string;
|
|
145
173
|
remote_id?: string;
|
|
@@ -377,6 +405,54 @@ export declare class SovereignClient {
|
|
|
377
405
|
};
|
|
378
406
|
last_pull: string;
|
|
379
407
|
}>>;
|
|
408
|
+
/**
|
|
409
|
+
* Report a completed integration
|
|
410
|
+
* Call this AFTER you have successfully integrated a purchased product into your workflow.
|
|
411
|
+
* This is the NORTH STAR METRIC - it measures real value creation.
|
|
412
|
+
*/
|
|
413
|
+
reportIntegration(options: {
|
|
414
|
+
purchaseId: string;
|
|
415
|
+
context?: string;
|
|
416
|
+
environment?: 'development' | 'production' | 'testing';
|
|
417
|
+
notes?: string;
|
|
418
|
+
}): Promise<ApiResponse<Integration>>;
|
|
419
|
+
/**
|
|
420
|
+
* Start tracking an integration attempt
|
|
421
|
+
* Call this when you BEGIN trying to integrate a product.
|
|
422
|
+
* Then call reportIntegration() when done, or failIntegration() if it fails.
|
|
423
|
+
*/
|
|
424
|
+
startIntegration(options: {
|
|
425
|
+
purchaseId: string;
|
|
426
|
+
context?: string;
|
|
427
|
+
environment?: 'development' | 'production' | 'testing';
|
|
428
|
+
}): Promise<ApiResponse<Integration>>;
|
|
429
|
+
/**
|
|
430
|
+
* Report a failed integration attempt
|
|
431
|
+
* This helps sellers improve their products and helps the ecosystem identify issues.
|
|
432
|
+
*/
|
|
433
|
+
failIntegration(options: {
|
|
434
|
+
purchaseId: string;
|
|
435
|
+
errorType: string;
|
|
436
|
+
errorMessage: string;
|
|
437
|
+
}): Promise<ApiResponse<Integration>>;
|
|
438
|
+
/**
|
|
439
|
+
* Get all your integrations (as buyer)
|
|
440
|
+
*/
|
|
441
|
+
getMyIntegrations(options?: {
|
|
442
|
+
status?: 'started' | 'completed' | 'failed' | 'abandoned';
|
|
443
|
+
}): Promise<ApiResponse<Integration[]>>;
|
|
444
|
+
/**
|
|
445
|
+
* Get integration status for a specific purchase
|
|
446
|
+
*/
|
|
447
|
+
getIntegrationStatus(purchaseId: string): Promise<ApiResponse<Integration | null>>;
|
|
448
|
+
/**
|
|
449
|
+
* Get your integration stats (as buyer - products you've integrated)
|
|
450
|
+
*/
|
|
451
|
+
getMyIntegrationStats(): Promise<ApiResponse<IntegrationStats>>;
|
|
452
|
+
/**
|
|
453
|
+
* Get integration stats for your products (as seller - how many buyers integrated your products)
|
|
454
|
+
*/
|
|
455
|
+
getSellerIntegrationStats(): Promise<ApiResponse<IntegrationStats>>;
|
|
380
456
|
getPricing(): Promise<ApiResponse<{
|
|
381
457
|
pricing: Record<string, Array<{
|
|
382
458
|
method: string;
|
package/dist/index.js
CHANGED
|
@@ -223,7 +223,7 @@ export class SovereignClient {
|
|
|
223
223
|
authToken;
|
|
224
224
|
localStore;
|
|
225
225
|
constructor(config = {}) {
|
|
226
|
-
this.baseUrl = config.baseUrl || '
|
|
226
|
+
this.baseUrl = config.baseUrl || 'https://api.mcpsovereign.com/api/v1';
|
|
227
227
|
this.authToken = config.authToken || null;
|
|
228
228
|
this.localStore = new LocalStoreManager(config.localStorePath);
|
|
229
229
|
}
|
|
@@ -436,6 +436,72 @@ export class SovereignClient {
|
|
|
436
436
|
return this.request('GET', '/sync/status');
|
|
437
437
|
}
|
|
438
438
|
// ---------------------------------------------------------------------------
|
|
439
|
+
// Integrations (NORTH STAR METRIC)
|
|
440
|
+
// ---------------------------------------------------------------------------
|
|
441
|
+
// "Successful integrations per active agent" is the key health metric.
|
|
442
|
+
// Integrations are SEPARATE from downloads - they represent actual use.
|
|
443
|
+
/**
|
|
444
|
+
* Report a completed integration
|
|
445
|
+
* Call this AFTER you have successfully integrated a purchased product into your workflow.
|
|
446
|
+
* This is the NORTH STAR METRIC - it measures real value creation.
|
|
447
|
+
*/
|
|
448
|
+
async reportIntegration(options) {
|
|
449
|
+
return this.request('POST', '/products/integrations/report', {
|
|
450
|
+
purchaseId: options.purchaseId,
|
|
451
|
+
context: options.context,
|
|
452
|
+
environment: options.environment || 'production',
|
|
453
|
+
notes: options.notes,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Start tracking an integration attempt
|
|
458
|
+
* Call this when you BEGIN trying to integrate a product.
|
|
459
|
+
* Then call reportIntegration() when done, or failIntegration() if it fails.
|
|
460
|
+
*/
|
|
461
|
+
async startIntegration(options) {
|
|
462
|
+
return this.request('POST', '/products/integrations/start', {
|
|
463
|
+
purchaseId: options.purchaseId,
|
|
464
|
+
context: options.context,
|
|
465
|
+
environment: options.environment,
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Report a failed integration attempt
|
|
470
|
+
* This helps sellers improve their products and helps the ecosystem identify issues.
|
|
471
|
+
*/
|
|
472
|
+
async failIntegration(options) {
|
|
473
|
+
return this.request('POST', '/products/integrations/fail', {
|
|
474
|
+
purchaseId: options.purchaseId,
|
|
475
|
+
errorType: options.errorType,
|
|
476
|
+
errorMessage: options.errorMessage,
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Get all your integrations (as buyer)
|
|
481
|
+
*/
|
|
482
|
+
async getMyIntegrations(options) {
|
|
483
|
+
const params = options?.status ? `?status=${options.status}` : '';
|
|
484
|
+
return this.request('GET', `/products/integrations${params}`);
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Get integration status for a specific purchase
|
|
488
|
+
*/
|
|
489
|
+
async getIntegrationStatus(purchaseId) {
|
|
490
|
+
return this.request('GET', `/products/integrations/${purchaseId}`);
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Get your integration stats (as buyer - products you've integrated)
|
|
494
|
+
*/
|
|
495
|
+
async getMyIntegrationStats() {
|
|
496
|
+
return this.request('GET', '/products/integrations/stats/me');
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Get integration stats for your products (as seller - how many buyers integrated your products)
|
|
500
|
+
*/
|
|
501
|
+
async getSellerIntegrationStats() {
|
|
502
|
+
return this.request('GET', '/products/integrations/stats/seller');
|
|
503
|
+
}
|
|
504
|
+
// ---------------------------------------------------------------------------
|
|
439
505
|
// Pricing (FREE)
|
|
440
506
|
// ---------------------------------------------------------------------------
|
|
441
507
|
async getPricing() {
|