@mixrpay/agent-sdk 0.8.8 → 0.9.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.

Potentially problematic release.


This version of @mixrpay/agent-sdk might be problematic. Click here for more details.

package/dist/index.d.ts CHANGED
@@ -557,7 +557,7 @@ interface AgentClaimInviteResult {
557
557
  * Options for spawning a child invite
558
558
  */
559
559
  interface SpawnChildOptions {
560
- /** Budget in USD for the child (max 20% of available) */
560
+ /** Budget in USD for the child (subject to platform limits) */
561
561
  budgetUsd: number;
562
562
  /** Name for the child invite */
563
563
  name: string;
@@ -574,13 +574,13 @@ interface SpawnChildResult {
574
574
  inviteCode: string;
575
575
  /** Database ID of the invite */
576
576
  inviteId: string;
577
- /** Actual budget (may be less than requested due to 20% cap) */
577
+ /** Actual budget (may be less than requested due to platform limits) */
578
578
  budgetUsd: number;
579
579
  /** When the invite expires */
580
580
  expiresAt: Date;
581
581
  /** Depth in hierarchy (1 = child, 2 = grandchild, etc.) */
582
582
  depth: number;
583
- /** How much this child can spawn (20% of their budget) */
583
+ /** How much this child can spawn */
584
584
  maxSpawnBudget: number;
585
585
  /** Allowed merchants for this child */
586
586
  allowedMerchants: string[];
@@ -597,9 +597,9 @@ interface AvailableBudget {
597
597
  allocatedToChildren: number;
598
598
  /** Available for spending or spawning */
599
599
  available: number;
600
- /** Maximum budget for next spawn (20% of available) */
600
+ /** Maximum budget for next spawn */
601
601
  maxSpawnBudget: number;
602
- /** Whether spawning is allowed (depth < 10, can_spawn, available > 0) */
602
+ /** Whether spawning is allowed */
603
603
  canSpawn: boolean;
604
604
  }
605
605
  /**
@@ -748,7 +748,7 @@ declare class AgentWallet {
748
748
  /**
749
749
  * Register a new agent with MixrPay.
750
750
  *
751
- * This creates a Privy-managed embedded wallet for the agent's payments.
751
+ * This creates a platform-managed embedded wallet for the agent's payments.
752
752
  * The agent proves ownership of their external wallet by signing a challenge.
753
753
  *
754
754
  * @param options - Registration options including the private key
@@ -786,7 +786,7 @@ declare class AgentWallet {
786
786
  healthy: boolean;
787
787
  database: string;
788
788
  agentRegistrationAvailable: boolean;
789
- privyConfigured: boolean;
789
+ walletServiceConfigured: boolean;
790
790
  error?: string;
791
791
  }>;
792
792
  /**
@@ -916,7 +916,7 @@ declare class AgentWallet {
916
916
  * Spawn a child invite for sub-agents.
917
917
  *
918
918
  * Allows an agent to create an invite code for a sub-agent with a portion
919
- * of their remaining budget (max 20%). The child inherits merchant restrictions
919
+ * of their remaining budget. The child inherits merchant restrictions
920
920
  * and cannot outlive the parent session.
921
921
  *
922
922
  * @param options - Spawn options
@@ -930,7 +930,7 @@ declare class AgentWallet {
930
930
  *
931
931
  * // Spawn a child invite for a sub-agent
932
932
  * const childInvite = await wallet.spawnChildInvite({
933
- * budgetUsd: 10.00, // Max 20% of available budget
933
+ * budgetUsd: 10.00,
934
934
  * name: 'Research Sub-Agent',
935
935
  * allowedMerchants: ['firecrawl.dev'], // Must be subset of parent
936
936
  * expiresInDays: 7, // Will be capped to parent's expiry
@@ -944,8 +944,7 @@ declare class AgentWallet {
944
944
  /**
945
945
  * Get available budget information for spawning.
946
946
  *
947
- * Returns the current budget status including how much can be spawned
948
- * to child agents (20% of available).
947
+ * Returns the current budget status including spawn availability.
949
948
  *
950
949
  * @returns Budget information
951
950
  *
@@ -1459,6 +1458,183 @@ declare class AgentWallet {
1459
1458
  * ```
1460
1459
  */
1461
1460
  getJitInstance(instanceId: string): Promise<JitInstance>;
1461
+ /**
1462
+ * Execute an on-chain transaction from the human's wallet.
1463
+ *
1464
+ * Submits arbitrary calldata to any contract, bounded by the session key's
1465
+ * budget limits (max_total, max_per_tx, max_daily). The platform validates
1466
+ * the budget, executes the transaction, and records a charge.
1467
+ *
1468
+ * @param params - Transaction parameters
1469
+ * @returns Transaction result with hash and remaining budget
1470
+ * @throws {MixrPayError} If budget exceeded, tx reverted, or auth fails
1471
+ *
1472
+ * @example
1473
+ * ```typescript
1474
+ * // Bridge USDC via deBridge
1475
+ * const quote = await deBridgeMcp.create_tx({ ... });
1476
+ * const result = await wallet.executeTransaction({
1477
+ * to: quote.contractAddress,
1478
+ * data: quote.calldata,
1479
+ * estimatedCostUsd: 25.0,
1480
+ * description: 'Bridge 25 USDC Base -> Avalanche via deBridge',
1481
+ * });
1482
+ * console.log('TX:', result.txHash);
1483
+ * console.log('Budget remaining:', result.remainingBudgetUsd);
1484
+ * ```
1485
+ */
1486
+ executeTransaction(params: {
1487
+ to: `0x${string}`;
1488
+ data: `0x${string}`;
1489
+ value?: bigint;
1490
+ chainId?: number;
1491
+ estimatedCostUsd: number;
1492
+ description?: string;
1493
+ idempotencyKey?: string;
1494
+ }): Promise<{
1495
+ success: boolean;
1496
+ txHash: string;
1497
+ chargeId: string;
1498
+ estimatedCostUsd: number;
1499
+ remainingBudgetUsd: number | null;
1500
+ }>;
1501
+ /**
1502
+ * Use a configured skill by deploying a JIT MCP server with your saved API keys.
1503
+ *
1504
+ * Skills are configured on the MixrPay dashboard with your API keys stored securely.
1505
+ * When you call useSkill(), MixrPay deploys an ephemeral MCP server with your keys
1506
+ * injected server-side - your keys are never exposed to the agent.
1507
+ *
1508
+ * @param skillId - The skill ID (e.g., 'github', 'notion', 'spotify')
1509
+ * @param options - Optional configuration
1510
+ * @returns Skill endpoint and available tools
1511
+ *
1512
+ * @example
1513
+ * ```typescript
1514
+ * // Use the GitHub skill
1515
+ * const github = await wallet.useSkill('github');
1516
+ *
1517
+ * console.log('Endpoint:', github.endpoint);
1518
+ * console.log('Tools:', github.tools);
1519
+ * console.log('Expires:', github.expiresAt);
1520
+ *
1521
+ * // Connect to the MCP endpoint and call tools
1522
+ * // The exact method depends on your MCP client
1523
+ * ```
1524
+ *
1525
+ * @example
1526
+ * ```typescript
1527
+ * // Use Notion with custom TTL
1528
+ * const notion = await wallet.useSkill('notion', { ttlHours: 48 });
1529
+ * ```
1530
+ *
1531
+ * @throws {MixrPayError} If skill is not configured or deployment fails
1532
+ */
1533
+ useSkill(skillId: string, options?: UseSkillOptions): Promise<UseSkillResult>;
1534
+ /**
1535
+ * List all available skills and their configuration status.
1536
+ *
1537
+ * @returns Array of skills with status
1538
+ *
1539
+ * @example
1540
+ * ```typescript
1541
+ * const skills = await wallet.listSkills();
1542
+ *
1543
+ * // Find configured skills
1544
+ * const configured = skills.filter(s => s.status === 'configured');
1545
+ * console.log(`${configured.length} skills ready to use`);
1546
+ *
1547
+ * // Find skills that need configuration
1548
+ * const needsConfig = skills.filter(s => s.status === 'not_configured' && s.envVars.length > 0);
1549
+ * for (const skill of needsConfig) {
1550
+ * console.log(`${skill.name} needs: ${skill.envVars.map(v => v.label).join(', ')}`);
1551
+ * }
1552
+ * ```
1553
+ */
1554
+ listSkills(): Promise<SkillInfo[]>;
1555
+ /**
1556
+ * Get apps connected via Composio (Gmail, Slack, GitHub, etc.).
1557
+ *
1558
+ * Use this to discover which apps the owner has connected before
1559
+ * attempting to use them via `wallet.useSkill('composio')`.
1560
+ *
1561
+ * @returns Object with connected app names and connection details
1562
+ *
1563
+ * @example
1564
+ * ```typescript
1565
+ * const apps = await wallet.getConnectedApps();
1566
+ *
1567
+ * if (apps.connected.length === 0) {
1568
+ * console.log('No apps connected. Ask your owner to connect apps at the dashboard.');
1569
+ * } else {
1570
+ * console.log('Connected apps:', apps.connected.join(', '));
1571
+ *
1572
+ * if (apps.connected.includes('gmail')) {
1573
+ * // Safe to use Composio for Gmail
1574
+ * const { endpoint, tools } = await wallet.useSkill('composio');
1575
+ * // tools will include 'gmail_read_emails', 'gmail_send_email', etc.
1576
+ * }
1577
+ * }
1578
+ * ```
1579
+ */
1580
+ getConnectedApps(): Promise<ConnectedAppsResult>;
1581
+ /**
1582
+ * Get configuration status for a specific skill.
1583
+ *
1584
+ * @param skillId - The skill ID
1585
+ * @returns Skill configuration status
1586
+ *
1587
+ * @example
1588
+ * ```typescript
1589
+ * const status = await wallet.getSkillStatus('github');
1590
+ *
1591
+ * if (status.status === 'configured') {
1592
+ * console.log('GitHub is ready!');
1593
+ * console.log('Configured vars:', status.configuredVars);
1594
+ * } else {
1595
+ * console.log('Please configure GitHub at the MixrPay dashboard');
1596
+ * }
1597
+ * ```
1598
+ */
1599
+ getSkillStatus(skillId: string): Promise<SkillStatus>;
1600
+ /**
1601
+ * Configure a skill with API keys.
1602
+ *
1603
+ * This allows agents to save API keys received via chat to the MixrPay platform.
1604
+ * Keys are encrypted at rest and will be available for use on subsequent deploy/redeploy.
1605
+ *
1606
+ * @param skillId - The skill ID (e.g., 'web-search', 'github', 'notion') or custom skill with 'custom-' prefix
1607
+ * @param envVars - Environment variables with API keys (e.g., { BRAVE_API_KEY: 'xxx' })
1608
+ * @returns Configuration result with list of configured variables
1609
+ *
1610
+ * @example Predefined skill
1611
+ * ```typescript
1612
+ * // User provides API key in chat, agent saves it
1613
+ * const result = await wallet.configureSkill('web-search', {
1614
+ * BRAVE_API_KEY: 'BSA_abc123xyz',
1615
+ * });
1616
+ *
1617
+ * console.log('Configured:', result.configuredVars);
1618
+ * // After next redeploy, the skill will be enabled with this key
1619
+ * ```
1620
+ *
1621
+ * @example Custom API key
1622
+ * ```typescript
1623
+ * // For APIs not in predefined skills, use custom- prefix
1624
+ * // User: "Here's my Polymarket API key: pk_abc123"
1625
+ * const result = await wallet.configureSkill('custom-polymarket', {
1626
+ * POLYMARKET_API_KEY: 'pk_abc123',
1627
+ * });
1628
+ *
1629
+ * // The key is now available in the agent's environment
1630
+ * // Access via: process.env.POLYMARKET_API_KEY
1631
+ * ```
1632
+ */
1633
+ configureSkill(skillId: string, envVars: Record<string, string>): Promise<{
1634
+ success: boolean;
1635
+ skillId: string;
1636
+ configuredVars: string[];
1637
+ }>;
1462
1638
  /**
1463
1639
  * Search the Glama MCP server directory.
1464
1640
  *
@@ -2468,6 +2644,115 @@ interface JitInstance {
2468
2644
  /** Creation time */
2469
2645
  createdAt: Date;
2470
2646
  }
2647
+ /**
2648
+ * Options for using a skill
2649
+ */
2650
+ interface UseSkillOptions {
2651
+ /** Time-to-live in hours for the MCP server (default: 24, max: 48) */
2652
+ ttlHours?: number;
2653
+ }
2654
+ /**
2655
+ * Result from using a skill
2656
+ */
2657
+ interface UseSkillResult {
2658
+ /** Skill ID */
2659
+ skillId: string;
2660
+ /** MCP server endpoint URL */
2661
+ endpoint: string;
2662
+ /** Available tool names */
2663
+ tools: string[];
2664
+ /** When the MCP server expires */
2665
+ expiresAt: Date;
2666
+ /** JIT instance ID for reference */
2667
+ instanceId: string;
2668
+ }
2669
+ /**
2670
+ * Skill information from the skills list
2671
+ */
2672
+ interface SkillInfo {
2673
+ /** Skill ID */
2674
+ id: string;
2675
+ /** Display name */
2676
+ name: string;
2677
+ /** Short description */
2678
+ description: string;
2679
+ /** Category */
2680
+ category: string;
2681
+ /** Category display name */
2682
+ categoryName: string;
2683
+ /** Icon name */
2684
+ icon: string;
2685
+ /** Whether this is a built-in skill */
2686
+ builtIn: boolean;
2687
+ /** Whether this skill requires MCP deployment */
2688
+ requiresMcp: boolean;
2689
+ /** Whether this skill is available */
2690
+ available: boolean;
2691
+ /** Configuration status */
2692
+ status: 'not_configured' | 'configured' | 'error';
2693
+ /** Last used timestamp */
2694
+ lastUsedAt?: string;
2695
+ /** Error message if status is 'error' */
2696
+ errorMessage?: string;
2697
+ /** Environment variables required */
2698
+ envVars: Array<{
2699
+ name: string;
2700
+ label: string;
2701
+ description: string;
2702
+ required: boolean;
2703
+ isSecret: boolean;
2704
+ configured: boolean;
2705
+ }>;
2706
+ }
2707
+ /**
2708
+ * Skill configuration status
2709
+ */
2710
+ interface SkillStatus {
2711
+ /** Skill ID */
2712
+ skillId: string;
2713
+ /** Configuration status */
2714
+ status: 'not_configured' | 'configured' | 'error';
2715
+ /** Names of configured environment variables */
2716
+ configuredVars: string[];
2717
+ /** Last used timestamp */
2718
+ lastUsedAt?: Date;
2719
+ /** Error message if status is 'error' */
2720
+ errorMessage?: string;
2721
+ }
2722
+ /**
2723
+ * Connected apps information from Composio
2724
+ */
2725
+ interface ConnectedAppsResult {
2726
+ /** Array of connected app IDs (e.g., ['gmail', 'slack', 'github']) */
2727
+ connected: string[];
2728
+ /** Full connection details */
2729
+ connections: Array<{
2730
+ id: string;
2731
+ app: string;
2732
+ app_name: string;
2733
+ type: 'oauth' | 'api_key';
2734
+ status: string;
2735
+ account_name: string | null;
2736
+ connected_at: string;
2737
+ }>;
2738
+ /** OAuth connections only */
2739
+ oauthConnections: Array<{
2740
+ id: string;
2741
+ app: string;
2742
+ app_name: string;
2743
+ status: string;
2744
+ account_name: string | null;
2745
+ connected_at: string;
2746
+ }>;
2747
+ /** API key connections only */
2748
+ apiKeyConnections: Array<{
2749
+ id: string;
2750
+ app: string;
2751
+ app_name: string;
2752
+ status: string;
2753
+ connected_at: string;
2754
+ }>;
2755
+ }
2471
2756
  /**
2472
2757
  * MCP server from the Glama directory
2473
2758
  */
@@ -3403,4 +3688,4 @@ declare function isMixrPayError(error: unknown): error is MixrPayError;
3403
3688
  */
3404
3689
  declare function getErrorMessage(error: unknown): string;
3405
3690
 
3406
- export { type AgentClaimInviteOptions, type AgentClaimInviteResult, type AgentMessage, type AgentRunConfig, type AgentRunEvent, type AgentRunOptions, type AgentRunResult, type AgentRunStatusResult, AgentWallet, type AgentWalletConfig, type AvailableBudget, type CallMerchantApiOptions, type ChargeResult, type ChildSession, type CompleteOptions, type CompleteResult, type DeployJitMcpOptions, type DeployJitMcpResult, type DiagnosticsResult, type GlamaImportData, type GlamaSearchResult, type GlamaServer, InsufficientBalanceError, InvalidSessionKeyError, type JitInstance, MerchantNotAllowedError, MixrPayError, type PaymentEvent, PaymentFailedError, SDK_VERSION, type SessionAuthorization, SessionExpiredError, SessionKeyExpiredError, type SessionKeyInfo, SessionLimitExceededError, SessionNotFoundError, SessionRevokedError, type SessionStats, type SpawnChildOptions, type SpawnChildResult, SpendingLimitExceededError, type SpendingStats, X402ProtocolError, getErrorMessage, isMixrPayError };
3691
+ export { type AgentClaimInviteOptions, type AgentClaimInviteResult, type AgentMessage, type AgentRunConfig, type AgentRunEvent, type AgentRunOptions, type AgentRunResult, type AgentRunStatusResult, AgentWallet, type AgentWalletConfig, type AvailableBudget, type CallMerchantApiOptions, type ChargeResult, type ChildSession, type CompleteOptions, type CompleteResult, type DeployJitMcpOptions, type DeployJitMcpResult, type DiagnosticsResult, type GlamaImportData, type GlamaSearchResult, type GlamaServer, InsufficientBalanceError, InvalidSessionKeyError, type JitInstance, MerchantNotAllowedError, MixrPayError, type PaymentEvent, PaymentFailedError, SDK_VERSION, type SessionAuthorization, SessionExpiredError, SessionKeyExpiredError, type SessionKeyInfo, SessionLimitExceededError, SessionNotFoundError, SessionRevokedError, type SessionStats, type SkillInfo, type SkillStatus, type SpawnChildOptions, type SpawnChildResult, SpendingLimitExceededError, type SpendingStats, type UseSkillOptions, type UseSkillResult, X402ProtocolError, getErrorMessage, isMixrPayError };