@mixrpay/agent-sdk 0.11.0 → 0.11.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/dist/index.d.cts CHANGED
@@ -4,6 +4,8 @@
4
4
  interface AgentWalletConfig {
5
5
  /** Session key (sk_live_ or sk_test_ prefix). */
6
6
  sessionKey: string;
7
+ /** Session key ID (UUID) for X-Mixr-Session header authentication. */
8
+ sessionKeyId?: string;
7
9
  /** Override wallet address. */
8
10
  walletAddress?: string;
9
11
  /** Client-side max payment per request in USD. */
@@ -517,7 +519,7 @@ declare const NETWORKS: {
517
519
  interface AgentRegisterOptions {
518
520
  /** The agent's external wallet private key (used for signing, NOT transmitted) */
519
521
  privateKey: `0x${string}`;
520
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
522
+ /** Mixr Network API base URL (default: https://mixr.network) */
521
523
  baseUrl?: string;
522
524
  /** Optional display name for the agent */
523
525
  name?: string;
@@ -537,7 +539,7 @@ interface AgentRegisterResult {
537
539
  interface AgentGetSessionKeyOptions {
538
540
  /** The agent's external wallet private key (used for signing, NOT transmitted) */
539
541
  privateKey: `0x${string}`;
540
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
542
+ /** Mixr Network API base URL (default: https://mixr.network) */
541
543
  baseUrl?: string;
542
544
  /** Maximum total spending in USD (default: $25) */
543
545
  spendingLimitUsd?: number;
@@ -573,7 +575,7 @@ interface AgentGetSessionKeyResult {
573
575
  interface AgentGetStatusOptions {
574
576
  /** The agent's external wallet private key (used for signing, NOT transmitted) */
575
577
  privateKey: `0x${string}`;
576
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
578
+ /** Mixr Network API base URL (default: https://mixr.network) */
577
579
  baseUrl?: string;
578
580
  }
579
581
  /**
@@ -603,7 +605,7 @@ interface AgentRevokeSessionKeyOptions {
603
605
  privateKey: `0x${string}`;
604
606
  /** The session key ID to revoke */
605
607
  sessionKeyId: string;
606
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
608
+ /** Mixr Network API base URL (default: https://mixr.network) */
607
609
  baseUrl?: string;
608
610
  }
609
611
  /**
@@ -614,7 +616,7 @@ interface AgentWithdrawOptions {
614
616
  privateKey: `0x${string}`;
615
617
  /** Amount to withdraw in USD */
616
618
  amountUsd: number;
617
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
619
+ /** Mixr Network API base URL (default: https://mixr.network) */
618
620
  baseUrl?: string;
619
621
  }
620
622
  /**
@@ -636,7 +638,7 @@ interface AgentClaimInviteOptions {
636
638
  inviteCode: string;
637
639
  /** The agent's external wallet private key (used for signing, NOT transmitted) */
638
640
  privateKey: `0x${string}`;
639
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
641
+ /** Mixr Network API base URL (default: https://mixr.network) */
640
642
  baseUrl?: string;
641
643
  }
642
644
  /**
@@ -669,7 +671,7 @@ interface AgentClaimInviteResult {
669
671
  * Options for activating an agent
670
672
  */
671
673
  interface AgentActivateOptions {
672
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
674
+ /** Mixr Network API base URL (default: https://mixr.network) */
673
675
  baseUrl?: string;
674
676
  }
675
677
  /**
@@ -716,6 +718,8 @@ interface AgentRuntime {
716
718
  interface ConnectOptions {
717
719
  /** Explicit session key (highest priority) */
718
720
  sessionKey?: string;
721
+ /** Session key ID (UUID) for X-Mixr-Session authentication */
722
+ sessionKeyId?: string;
719
723
  /** Access code from MixrPay dashboard (mixr-xxx) - one-time use, auto-cached */
720
724
  accessCode?: string;
721
725
  /** Master key for multi-agent deployments */
@@ -724,7 +728,7 @@ interface ConnectOptions {
724
728
  agentName?: string;
725
729
  /** Enable interactive device flow login if no credentials found */
726
730
  interactive?: boolean;
727
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
731
+ /** Mixr Network API base URL (default: https://mixr.network) */
728
732
  baseUrl?: string;
729
733
  /** Log level for debugging */
730
734
  logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'none';
@@ -924,6 +928,7 @@ declare class AgentWallet {
924
928
  private selfCustodyKey?;
925
929
  private agentInstanceId?;
926
930
  private apiKey?;
931
+ private sessionKeyId?;
927
932
  /**
928
933
  * Create a new AgentWallet instance.
929
934
  *
@@ -1008,7 +1013,7 @@ declare class AgentWallet {
1008
1013
  *
1009
1014
  * Use this to diagnose registration issues before attempting to register.
1010
1015
  *
1011
- * @param baseUrl - MixrPay API base URL (default: https://www.mixrpay.com)
1016
+ * @param baseUrl - Mixr Network API base URL (default: https://mixr.network)
1012
1017
  * @returns Server health status including agent registration availability
1013
1018
  *
1014
1019
  * @example
@@ -1469,6 +1474,12 @@ declare class AgentWallet {
1469
1474
  * @returns The Ethereum address of the smart wallet
1470
1475
  */
1471
1476
  getWalletAddress(): `0x${string}`;
1477
+ /**
1478
+ * Get the session key ID (UUID) for X-Mixr-Session authentication.
1479
+ *
1480
+ * @returns Session key ID if available, undefined otherwise
1481
+ */
1482
+ getSessionKeyId(): string | undefined;
1472
1483
  /**
1473
1484
  * Check if using testnet session key.
1474
1485
  *
@@ -2034,10 +2045,12 @@ declare class AgentWallet {
2034
2045
  */
2035
2046
  listMCPTools(): Promise<Tool[]>;
2036
2047
  /**
2037
- * Call a tool with wallet authentication (direct pay per call).
2048
+ * Call a tool from the MixrPay gateway.
2038
2049
  *
2039
- * This method signs a fresh auth message for each call, charging
2040
- * directly from your wallet balance without needing a session.
2050
+ * If a session key ID is available (from device flow login), this method
2051
+ * uses session-based authentication (X-Mixr-Session header). Otherwise,
2052
+ * it falls back to wallet signature authentication which requires the
2053
+ * wallet to be registered in MixrPay.
2041
2054
  *
2042
2055
  * @param toolName - The tool name in format "merchant/tool"
2043
2056
  * @param args - Arguments to pass to the tool
@@ -3321,6 +3334,49 @@ declare class AgentWallet {
3321
3334
  private callApiWithAuth;
3322
3335
  /** Helper to call our API with auth */
3323
3336
  private callApi;
3337
+ /**
3338
+ * Store a credential in the agent's secure vault
3339
+ *
3340
+ * @param service - Service name (e.g., "openai", "github")
3341
+ * @param key - Key name (e.g., "api_key", "token")
3342
+ * @param value - Credential value to store (encrypted at rest)
3343
+ * @param description - Optional description of the credential
3344
+ * @throws {MixrPayError} If storage fails
3345
+ */
3346
+ credsSet(service: string, key: string, value: string, description?: string): Promise<void>;
3347
+ /**
3348
+ * Retrieve a credential from the agent's secure vault
3349
+ *
3350
+ * @param service - Service name (e.g., "openai", "github")
3351
+ * @param key - Key name (e.g., "api_key", "token")
3352
+ * @returns Decrypted credential value or null if not found
3353
+ * @throws {MixrPayError} If retrieval fails
3354
+ */
3355
+ credsGet(service: string, key: string): Promise<string | null>;
3356
+ /**
3357
+ * List all credential names stored in the agent's vault (without values)
3358
+ *
3359
+ * @returns Array of credential metadata objects
3360
+ * @throws {MixrPayError} If listing fails
3361
+ */
3362
+ credsList(): Promise<Array<{
3363
+ service: string;
3364
+ key: string;
3365
+ description: string | null;
3366
+ lastAccessedAt: string | null;
3367
+ accessCount: number;
3368
+ createdAt: string;
3369
+ updatedAt: string;
3370
+ }>>;
3371
+ /**
3372
+ * Delete a credential from the agent's secure vault
3373
+ *
3374
+ * @param service - Service name (e.g., "openai", "github")
3375
+ * @param key - Key name (e.g., "api_key", "token")
3376
+ * @returns True if deleted, false if not found
3377
+ * @throws {MixrPayError} If deletion fails
3378
+ */
3379
+ credsDelete(service: string, key: string): Promise<boolean>;
3324
3380
  }
3325
3381
  /** Task status */
3326
3382
  type TaskStatus = 'open' | 'claimed' | 'submitted' | 'completed' | 'cancelled' | 'completing';
@@ -4821,6 +4877,8 @@ declare function getErrorMessage(error: unknown): string;
4821
4877
  interface StoredCredentials {
4822
4878
  /** Session key (sk_live_xxx or sk_test_xxx) */
4823
4879
  sessionKey?: string;
4880
+ /** Session key ID (UUID) for X-Mixr-Session header authentication */
4881
+ sessionKeyId?: string;
4824
4882
  /** API token (agt_live_xxx) for API calls */
4825
4883
  apiToken?: string;
4826
4884
  /** @deprecated Use apiToken instead. Legacy connect token (ac_live_xxx) */
@@ -4833,6 +4891,12 @@ interface StoredCredentials {
4833
4891
  baseUrl?: string;
4834
4892
  /** When credentials were last updated */
4835
4893
  updatedAt?: string;
4894
+ /** Private key for self-funded agents (0x...) */
4895
+ privateKey?: string;
4896
+ /** Wallet address for self-funded agents */
4897
+ walletAddress?: string;
4898
+ /** Deposit address for receiving funds */
4899
+ depositAddress?: string;
4836
4900
  }
4837
4901
  type CredentialLoadResult = {
4838
4902
  success: true;
package/dist/index.d.ts CHANGED
@@ -4,6 +4,8 @@
4
4
  interface AgentWalletConfig {
5
5
  /** Session key (sk_live_ or sk_test_ prefix). */
6
6
  sessionKey: string;
7
+ /** Session key ID (UUID) for X-Mixr-Session header authentication. */
8
+ sessionKeyId?: string;
7
9
  /** Override wallet address. */
8
10
  walletAddress?: string;
9
11
  /** Client-side max payment per request in USD. */
@@ -517,7 +519,7 @@ declare const NETWORKS: {
517
519
  interface AgentRegisterOptions {
518
520
  /** The agent's external wallet private key (used for signing, NOT transmitted) */
519
521
  privateKey: `0x${string}`;
520
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
522
+ /** Mixr Network API base URL (default: https://mixr.network) */
521
523
  baseUrl?: string;
522
524
  /** Optional display name for the agent */
523
525
  name?: string;
@@ -537,7 +539,7 @@ interface AgentRegisterResult {
537
539
  interface AgentGetSessionKeyOptions {
538
540
  /** The agent's external wallet private key (used for signing, NOT transmitted) */
539
541
  privateKey: `0x${string}`;
540
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
542
+ /** Mixr Network API base URL (default: https://mixr.network) */
541
543
  baseUrl?: string;
542
544
  /** Maximum total spending in USD (default: $25) */
543
545
  spendingLimitUsd?: number;
@@ -573,7 +575,7 @@ interface AgentGetSessionKeyResult {
573
575
  interface AgentGetStatusOptions {
574
576
  /** The agent's external wallet private key (used for signing, NOT transmitted) */
575
577
  privateKey: `0x${string}`;
576
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
578
+ /** Mixr Network API base URL (default: https://mixr.network) */
577
579
  baseUrl?: string;
578
580
  }
579
581
  /**
@@ -603,7 +605,7 @@ interface AgentRevokeSessionKeyOptions {
603
605
  privateKey: `0x${string}`;
604
606
  /** The session key ID to revoke */
605
607
  sessionKeyId: string;
606
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
608
+ /** Mixr Network API base URL (default: https://mixr.network) */
607
609
  baseUrl?: string;
608
610
  }
609
611
  /**
@@ -614,7 +616,7 @@ interface AgentWithdrawOptions {
614
616
  privateKey: `0x${string}`;
615
617
  /** Amount to withdraw in USD */
616
618
  amountUsd: number;
617
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
619
+ /** Mixr Network API base URL (default: https://mixr.network) */
618
620
  baseUrl?: string;
619
621
  }
620
622
  /**
@@ -636,7 +638,7 @@ interface AgentClaimInviteOptions {
636
638
  inviteCode: string;
637
639
  /** The agent's external wallet private key (used for signing, NOT transmitted) */
638
640
  privateKey: `0x${string}`;
639
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
641
+ /** Mixr Network API base URL (default: https://mixr.network) */
640
642
  baseUrl?: string;
641
643
  }
642
644
  /**
@@ -669,7 +671,7 @@ interface AgentClaimInviteResult {
669
671
  * Options for activating an agent
670
672
  */
671
673
  interface AgentActivateOptions {
672
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
674
+ /** Mixr Network API base URL (default: https://mixr.network) */
673
675
  baseUrl?: string;
674
676
  }
675
677
  /**
@@ -716,6 +718,8 @@ interface AgentRuntime {
716
718
  interface ConnectOptions {
717
719
  /** Explicit session key (highest priority) */
718
720
  sessionKey?: string;
721
+ /** Session key ID (UUID) for X-Mixr-Session authentication */
722
+ sessionKeyId?: string;
719
723
  /** Access code from MixrPay dashboard (mixr-xxx) - one-time use, auto-cached */
720
724
  accessCode?: string;
721
725
  /** Master key for multi-agent deployments */
@@ -724,7 +728,7 @@ interface ConnectOptions {
724
728
  agentName?: string;
725
729
  /** Enable interactive device flow login if no credentials found */
726
730
  interactive?: boolean;
727
- /** MixrPay API base URL (default: https://www.mixrpay.com) */
731
+ /** Mixr Network API base URL (default: https://mixr.network) */
728
732
  baseUrl?: string;
729
733
  /** Log level for debugging */
730
734
  logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'none';
@@ -924,6 +928,7 @@ declare class AgentWallet {
924
928
  private selfCustodyKey?;
925
929
  private agentInstanceId?;
926
930
  private apiKey?;
931
+ private sessionKeyId?;
927
932
  /**
928
933
  * Create a new AgentWallet instance.
929
934
  *
@@ -1008,7 +1013,7 @@ declare class AgentWallet {
1008
1013
  *
1009
1014
  * Use this to diagnose registration issues before attempting to register.
1010
1015
  *
1011
- * @param baseUrl - MixrPay API base URL (default: https://www.mixrpay.com)
1016
+ * @param baseUrl - Mixr Network API base URL (default: https://mixr.network)
1012
1017
  * @returns Server health status including agent registration availability
1013
1018
  *
1014
1019
  * @example
@@ -1469,6 +1474,12 @@ declare class AgentWallet {
1469
1474
  * @returns The Ethereum address of the smart wallet
1470
1475
  */
1471
1476
  getWalletAddress(): `0x${string}`;
1477
+ /**
1478
+ * Get the session key ID (UUID) for X-Mixr-Session authentication.
1479
+ *
1480
+ * @returns Session key ID if available, undefined otherwise
1481
+ */
1482
+ getSessionKeyId(): string | undefined;
1472
1483
  /**
1473
1484
  * Check if using testnet session key.
1474
1485
  *
@@ -2034,10 +2045,12 @@ declare class AgentWallet {
2034
2045
  */
2035
2046
  listMCPTools(): Promise<Tool[]>;
2036
2047
  /**
2037
- * Call a tool with wallet authentication (direct pay per call).
2048
+ * Call a tool from the MixrPay gateway.
2038
2049
  *
2039
- * This method signs a fresh auth message for each call, charging
2040
- * directly from your wallet balance without needing a session.
2050
+ * If a session key ID is available (from device flow login), this method
2051
+ * uses session-based authentication (X-Mixr-Session header). Otherwise,
2052
+ * it falls back to wallet signature authentication which requires the
2053
+ * wallet to be registered in MixrPay.
2041
2054
  *
2042
2055
  * @param toolName - The tool name in format "merchant/tool"
2043
2056
  * @param args - Arguments to pass to the tool
@@ -3321,6 +3334,49 @@ declare class AgentWallet {
3321
3334
  private callApiWithAuth;
3322
3335
  /** Helper to call our API with auth */
3323
3336
  private callApi;
3337
+ /**
3338
+ * Store a credential in the agent's secure vault
3339
+ *
3340
+ * @param service - Service name (e.g., "openai", "github")
3341
+ * @param key - Key name (e.g., "api_key", "token")
3342
+ * @param value - Credential value to store (encrypted at rest)
3343
+ * @param description - Optional description of the credential
3344
+ * @throws {MixrPayError} If storage fails
3345
+ */
3346
+ credsSet(service: string, key: string, value: string, description?: string): Promise<void>;
3347
+ /**
3348
+ * Retrieve a credential from the agent's secure vault
3349
+ *
3350
+ * @param service - Service name (e.g., "openai", "github")
3351
+ * @param key - Key name (e.g., "api_key", "token")
3352
+ * @returns Decrypted credential value or null if not found
3353
+ * @throws {MixrPayError} If retrieval fails
3354
+ */
3355
+ credsGet(service: string, key: string): Promise<string | null>;
3356
+ /**
3357
+ * List all credential names stored in the agent's vault (without values)
3358
+ *
3359
+ * @returns Array of credential metadata objects
3360
+ * @throws {MixrPayError} If listing fails
3361
+ */
3362
+ credsList(): Promise<Array<{
3363
+ service: string;
3364
+ key: string;
3365
+ description: string | null;
3366
+ lastAccessedAt: string | null;
3367
+ accessCount: number;
3368
+ createdAt: string;
3369
+ updatedAt: string;
3370
+ }>>;
3371
+ /**
3372
+ * Delete a credential from the agent's secure vault
3373
+ *
3374
+ * @param service - Service name (e.g., "openai", "github")
3375
+ * @param key - Key name (e.g., "api_key", "token")
3376
+ * @returns True if deleted, false if not found
3377
+ * @throws {MixrPayError} If deletion fails
3378
+ */
3379
+ credsDelete(service: string, key: string): Promise<boolean>;
3324
3380
  }
3325
3381
  /** Task status */
3326
3382
  type TaskStatus = 'open' | 'claimed' | 'submitted' | 'completed' | 'cancelled' | 'completing';
@@ -4821,6 +4877,8 @@ declare function getErrorMessage(error: unknown): string;
4821
4877
  interface StoredCredentials {
4822
4878
  /** Session key (sk_live_xxx or sk_test_xxx) */
4823
4879
  sessionKey?: string;
4880
+ /** Session key ID (UUID) for X-Mixr-Session header authentication */
4881
+ sessionKeyId?: string;
4824
4882
  /** API token (agt_live_xxx) for API calls */
4825
4883
  apiToken?: string;
4826
4884
  /** @deprecated Use apiToken instead. Legacy connect token (ac_live_xxx) */
@@ -4833,6 +4891,12 @@ interface StoredCredentials {
4833
4891
  baseUrl?: string;
4834
4892
  /** When credentials were last updated */
4835
4893
  updatedAt?: string;
4894
+ /** Private key for self-funded agents (0x...) */
4895
+ privateKey?: string;
4896
+ /** Wallet address for self-funded agents */
4897
+ walletAddress?: string;
4898
+ /** Deposit address for receiving funds */
4899
+ depositAddress?: string;
4836
4900
  }
4837
4901
  type CredentialLoadResult = {
4838
4902
  success: true;