@nevermined-io/payments 1.0.0-rc0 → 1.0.0-rc2

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.
Files changed (71) hide show
  1. package/dist/a2a/agent-card.d.ts +85 -0
  2. package/dist/a2a/agent-card.d.ts.map +1 -0
  3. package/dist/a2a/agent-card.js +79 -0
  4. package/dist/a2a/agent-card.js.map +1 -0
  5. package/dist/a2a/index.d.ts +23 -0
  6. package/dist/a2a/index.d.ts.map +1 -0
  7. package/dist/a2a/index.js +42 -0
  8. package/dist/a2a/index.js.map +1 -0
  9. package/dist/a2a/paymentsRequestHandler.d.ts +107 -0
  10. package/dist/a2a/paymentsRequestHandler.d.ts.map +1 -0
  11. package/dist/a2a/paymentsRequestHandler.js +333 -0
  12. package/dist/a2a/paymentsRequestHandler.js.map +1 -0
  13. package/dist/a2a/server.d.ts +126 -0
  14. package/dist/a2a/server.d.ts.map +1 -0
  15. package/dist/a2a/server.js +189 -0
  16. package/dist/a2a/server.js.map +1 -0
  17. package/dist/a2a/types.d.ts +91 -0
  18. package/dist/a2a/types.d.ts.map +1 -0
  19. package/dist/a2a/types.js +16 -0
  20. package/dist/a2a/types.js.map +1 -0
  21. package/dist/api/agents-api.d.ts +196 -0
  22. package/dist/api/agents-api.d.ts.map +1 -0
  23. package/dist/api/agents-api.js +281 -0
  24. package/dist/api/agents-api.js.map +1 -0
  25. package/dist/api/base-payments.d.ts +35 -0
  26. package/dist/api/base-payments.d.ts.map +1 -0
  27. package/dist/api/base-payments.js +62 -0
  28. package/dist/api/base-payments.js.map +1 -0
  29. package/dist/api/nvm-api.d.ts +12 -12
  30. package/dist/api/nvm-api.d.ts.map +1 -1
  31. package/dist/api/nvm-api.js +57 -59
  32. package/dist/api/nvm-api.js.map +1 -1
  33. package/dist/api/plans-api.d.ts +349 -0
  34. package/dist/api/plans-api.d.ts.map +1 -0
  35. package/dist/api/plans-api.js +465 -0
  36. package/dist/api/plans-api.js.map +1 -0
  37. package/dist/api/query-api.d.ts +12 -41
  38. package/dist/api/query-api.d.ts.map +1 -1
  39. package/dist/api/query-api.js +17 -46
  40. package/dist/api/query-api.js.map +1 -1
  41. package/dist/api/requests-api.d.ts +108 -0
  42. package/dist/api/requests-api.d.ts.map +1 -0
  43. package/dist/api/requests-api.js +171 -0
  44. package/dist/api/requests-api.js.map +1 -0
  45. package/dist/common/helper.js.map +1 -1
  46. package/dist/common/payments.error.d.ts +31 -1
  47. package/dist/common/payments.error.d.ts.map +1 -1
  48. package/dist/common/payments.error.js +39 -1
  49. package/dist/common/payments.error.js.map +1 -1
  50. package/dist/common/types.d.ts +57 -3
  51. package/dist/common/types.d.ts.map +1 -1
  52. package/dist/common/types.js +10 -1
  53. package/dist/common/types.js.map +1 -1
  54. package/dist/environments.d.ts +1 -1
  55. package/dist/environments.d.ts.map +1 -1
  56. package/dist/environments.js +19 -28
  57. package/dist/environments.js.map +1 -1
  58. package/dist/index.d.ts +2 -0
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +14 -0
  61. package/dist/index.js.map +1 -1
  62. package/dist/payments.d.ts +35 -408
  63. package/dist/payments.d.ts.map +1 -1
  64. package/dist/payments.js +71 -618
  65. package/dist/payments.js.map +1 -1
  66. package/dist/plans.js.map +1 -1
  67. package/dist/utils.d.ts +30 -0
  68. package/dist/utils.d.ts.map +1 -1
  69. package/dist/utils.js +74 -1
  70. package/dist/utils.js.map +1 -1
  71. package/package.json +13 -6
@@ -1,56 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AIQueryApi = exports.AIQueryOptions = void 0;
3
+ exports.AIQueryApi = void 0;
4
4
  const nvm_api_1 = require("./nvm-api");
5
5
  /**
6
- * Options required for interacting with an external AI Agent/Service.
7
- */
8
- class AIQueryOptions {
9
- }
10
- exports.AIQueryOptions = AIQueryOptions;
11
- /**
12
- * The AI Query API class provides the methods to interact with the AI Query API.
13
- * This API implements the Nevermined AI Query Protocol @see https://docs.nevermined.io/docs/protocol/query-protocol.
14
- *
6
+ * The AIQueryApi class provides methods to query AI Agents on Nevermined.
7
+
15
8
  * @remarks
16
- * This API is oriented for AI Builders providing AI Agents and AI Subscribers interacting with them.
9
+ * This API is oriented for AI users who already purchased access to an AI Agent and want to start querying them.
17
10
  */
18
- class AIQueryApi extends nvm_api_1.NVMBackendApi {
19
- constructor(opts) {
20
- super(opts);
21
- this.queryOptionsCache = new Map();
22
- }
11
+ class AIQueryApi extends nvm_api_1.AbstractHTTPClient {
23
12
  /**
24
- * Get the required configuration for accessing a remote service agent.
25
- * This configuration includes:
26
- * - The JWT access token
27
- * - The Proxy url that can be used to query the agent/service.
28
- *
29
- * @example
30
- * ```
31
- * const accessConfig = await payments.query.getServiceAccessConfig(agentId)
32
- * console.log(`Agent JWT Token: ${accessConfig.accessToken}`)
33
- * console.log(`Agent Proxy URL: ${accessConfig.neverminedProxyUri}`)
34
- * ```
13
+ * This method is used to create a singleton instance of the AIQueryApi class.
35
14
  *
36
- * @param agentId - The unique identifier of the agent
37
- * @returns A promise that resolves to the service token.
15
+ * @param options - The options to initialize the payments class.
16
+ * @returns The instance of the AIQueryApi class.
38
17
  */
39
- async getServiceAccessConfig(agentId) {
40
- const options = {
41
- method: 'GET',
42
- headers: {
43
- Accept: 'application/json',
44
- 'Content-Type': 'application/json',
45
- Authorization: `Bearer ${this.opts.apiKey}`,
46
- },
47
- };
48
- const url = new URL(`/api/v1/payments/service/token/${agentId}`, this.opts.backendHost);
49
- const response = await fetch(url, options);
50
- if (!response.ok) {
51
- throw Error(`${response.statusText} - ${await response.text()}`);
52
- }
53
- return (await response.json()).token;
18
+ static getInstance() {
19
+ return new AIQueryApi();
54
20
  }
55
21
  /**
56
22
  * It sends a request to the AI Agent/Service.
@@ -62,7 +28,7 @@ class AIQueryApi extends nvm_api_1.NVMBackendApi {
62
28
  * To send this request through a Nevermined proxy, it's necessary to specify the "sendThroughProxy" in the reqOptions parameter
63
29
  * @example
64
30
  * ```
65
- * await payments.query.send('POST', 'http://example.com/agent/prompt', {'input': 'Hello'})
31
+ * await payments.query.send(accessCredentials, 'POST', 'http://example.com/agent/prompt', {'input': 'Hello'})
66
32
  * ```
67
33
  *
68
34
  * @param method - The HTTP method to use when querying the Agent @see {@link AxiosRequestConfig.method}
@@ -71,9 +37,14 @@ class AIQueryApi extends nvm_api_1.NVMBackendApi {
71
37
  * @param reqOptions - The request options to use when querying the Agent/Service.
72
38
  * @returns The result of query
73
39
  */
74
- async send(method, url, data, reqOptions = {
40
+ async send(accessCredentials, method, url, data, reqOptions = {
75
41
  sendThroughProxy: false,
76
42
  }) {
43
+ reqOptions.accessToken = accessCredentials.accessToken;
44
+ if (accessCredentials.proxies && accessCredentials.proxies.length > 0) {
45
+ reqOptions.proxyHost = accessCredentials.proxies[0];
46
+ reqOptions.sendThroughProxy = true;
47
+ }
77
48
  return this.request(method, url, data, reqOptions);
78
49
  }
79
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"query-api.js","sourceRoot":"","sources":["../../src/api/query-api.ts"],"names":[],"mappings":";;;AAAA,uCAAgF;AAEhF;;GAEG;AACH,MAAa,cAAc;CAW1B;AAXD,wCAWC;AAED;;;;;;GAMG;AACH,MAAa,UAAW,SAAQ,uBAAa;IAG3C,YAAY,IAAuB;QACjC,KAAK,CAAC,IAAI,CAAC,CAAA;QAHb,sBAAiB,GAAG,IAAI,GAAG,EAA0B,CAAA;IAIrD,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACI,KAAK,CAAC,sBAAsB,CAAC,OAAe;QAIjD,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;aAC5C;SACF,CAAA;QACD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,kCAAkC,OAAO,EAAE,EA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nD,UAAU,CAAC,gBAAgB,GAAG,IAAI,CAAA;QACpC,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,CAAA;IACpD,CAAC;CACF;AA9CD,gCA8CC","sourcesContent":["import { AbstractHTTPClient, HTTPRequestOptions } from './nvm-api'\nimport { AgentAccessCredentials } from '../common/types'\n\n/**\n * The AIQueryApi class provides methods to query AI Agents on Nevermined.\n\n * @remarks\n * This API is oriented for AI users who already purchased access to an AI Agent and want to start querying them.\n */\nexport class AIQueryApi extends AbstractHTTPClient {\n /**\n * This method is used to create a singleton instance of the AIQueryApi class.\n *\n * @param options - The options to initialize the payments class.\n * @returns The instance of the AIQueryApi class.\n */\n static getInstance(): AIQueryApi {\n return new AIQueryApi()\n }\n\n /**\n * It sends a request to the AI Agent/Service.\n *\n * @remarks\n * This method is used to query an existing AI Agent. It requires the user controlling the NVM API Key to have access to the agent.\n *\n * @remarks\n * To send this request through a Nevermined proxy, it's necessary to specify the \"sendThroughProxy\" in the reqOptions parameter\n * @example\n * ```\n * await payments.query.send(accessCredentials, 'POST', 'http://example.com/agent/prompt', {'input': 'Hello'})\n * ```\n *\n * @param method - The HTTP method to use when querying the Agent @see {@link AxiosRequestConfig.method}\n * @param url - The URL of the endpoint to query the Agent/Service.\n * @param data - The data to send to the Agent/Service.\n * @param reqOptions - The request options to use when querying the Agent/Service.\n * @returns The result of query\n */\n async send(\n accessCredentials: AgentAccessCredentials,\n method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH',\n url: string,\n data?: any,\n reqOptions: HTTPRequestOptions = {\n sendThroughProxy: false,\n },\n ) {\n reqOptions.accessToken = accessCredentials.accessToken\n if (accessCredentials.proxies && accessCredentials.proxies.length > 0) {\n reqOptions.proxyHost = accessCredentials.proxies[0]\n reqOptions.sendThroughProxy = true\n }\n return this.request(method, url, data, reqOptions)\n }\n}\n"]}
@@ -0,0 +1,108 @@
1
+ import { BasePaymentsAPI } from './base-payments';
2
+ import { PaymentOptions, TrackAgentSubTaskDto, StartAgentRequest, NvmAPIResult } from '../common/types';
3
+ /**
4
+ * The AgentRequestsAPI class provides methods to manage the requests received by AI Agents integrated with Nevermined.
5
+ *
6
+ */
7
+ export declare class AgentRequestsAPI extends BasePaymentsAPI {
8
+ /**
9
+ * This method is used to create a singleton instance of the AgentRequestsAPI class.
10
+ *
11
+ * @param options - The options to initialize the payments class.
12
+ * @returns The instance of the AgentRequestsAPI class.
13
+ */
14
+ static getInstance(options: PaymentOptions): AgentRequestsAPI;
15
+ /**
16
+ * This method initializes an agent request.
17
+ *
18
+ * @remarks
19
+ * This method is used to initialize an agent request.
20
+ *
21
+ * @param agentId - The unique identifier of the AI Agent.
22
+ * @param accessToken - The access token provided by the subscriber to validate
23
+ * @param urlRequested - The URL requested by the subscriber to access the agent's API.
24
+ * @param httpMethodRequested - The HTTP method requested by the subscriber to access the agent's API.
25
+ * @returns @see {@link StartAgentRequest} The information about the initialization of the request.
26
+ * @throws PaymentsError if unable to initialize the agent request.
27
+ *
28
+ * @example
29
+ * ```
30
+ * onst authHeader = req.headers['authorization']
31
+ *
32
+ * const result = await payments.requests.startProcessingRequest(
33
+ * agentId,
34
+ * authHeader,
35
+ * 'https://api.example.com/agent-endpoint/1234',
36
+ * 'POST'
37
+ * )
38
+ *
39
+ * // {
40
+ * // agentRequestId: '3921032910321',
41
+ * // urlMatching: 'https://api.example.com/agent-endpoint/1234',
42
+ * // verbMatching: 'POST',
43
+ * // balance: {
44
+ * // planId: '105906633592154016712415751065660953070604027297000423385655551747721326921578',
45
+ * // planType: 'credits',
46
+ * // holderAddress: '0x505384192Ba6a4D4b50EAB846ee67db3b9A93359',
47
+ * // creditsContract: '0xdd0240858fE744C3BF245DD377abBC04d1FDA443',
48
+ * // balance: '100',
49
+ * // isSubscriber: true
50
+ * // }
51
+ * // }
52
+ * ```
53
+ */
54
+ startProcessingRequest(agentId: string, accessToken: string, urlRequested: string, httpMethodRequested: string): Promise<StartAgentRequest>;
55
+ /**
56
+ * Allows the agent to redeem credits from a request.
57
+ *
58
+ * @param agentRequestId - The unique identifier of the agent request.
59
+ * @param requestAccessToken - The access token of the request.
60
+ * @param creditsToBurn - The number of credits to burn.
61
+ * @returns @see {@link NvmAPIResult} A promise that resolves to the result of the operation.
62
+ * @throws PaymentsError if unable to redeem credits from the request.
63
+ *
64
+ * @example
65
+ * ```
66
+ * const result = await payments.requests.redeemCreditsFromRequest(
67
+ * 'request-id-12345', // The request ID to track the operation
68
+ * accessToken, // The access token of the request
69
+ * 5n // The number of credits to burn
70
+ * )
71
+ *
72
+ * // {
73
+ * // txHash: '0x8d29d5769e832a35e53f80cd4e8890d941c50a09c33dbd975533debc894f2535',
74
+ * // success: true
75
+ * // }
76
+ * ```
77
+ */
78
+ redeemCreditsFromRequest(agentRequestId: string, requestAccessToken: string, creditsToBurn: bigint): Promise<NvmAPIResult>;
79
+ /**
80
+ * Tracks an agent sub task.
81
+ *
82
+ * @remarks
83
+ * This method is used by agent owners to track agent sub tasks for agent tasks.
84
+ * It records information about credit redemption, categorization tags, and processing descriptions.
85
+ *
86
+ * @param trackAgentSubTask - @see {@link TrackAgentSubTaskDto} The agent sub task data to track
87
+ * @returns @see {@link NvmAPIResult} A promise that resolves to the result of the operation.
88
+ * @throws PaymentsError if unable to track the agent sub task
89
+ *
90
+ * @example
91
+ * ```
92
+ * const result = await payments.requests.trackAgentSubTask({
93
+ * agentRequestId: 'atx-12345',
94
+ * creditsToRedeem: 5,
95
+ * tag: 'high-priority',
96
+ * description: 'Processing high-priority data request',
97
+ * status: AgentTaskStatus.SUCCESS
98
+ * })
99
+ *
100
+ * // {
101
+ * // txHash: '0x8d29d5769e832a35e53f80cd4e8890d941c50a09c33dbd975533debc894f2535',
102
+ * // success: true
103
+ * // }
104
+ * ```
105
+ */
106
+ trackAgentSubTask(trackAgentSubTask: TrackAgentSubTaskDto): Promise<NvmAPIResult>;
107
+ }
108
+ //# sourceMappingURL=requests-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests-api.d.ts","sourceRoot":"","sources":["../../src/api/requests-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACb,MAAM,iBAAiB,CAAA;AASxB;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,eAAe;IACnD;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,gBAAgB;IAI7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACU,sBAAsB,CACjC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,iBAAiB,CAAC;IAoB7B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,wBAAwB,CACnC,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,YAAY,CAAC;IAmCxB;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACU,iBAAiB,CAAC,iBAAiB,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC;CAqB/F"}
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentRequestsAPI = void 0;
4
+ const base_payments_1 = require("./base-payments");
5
+ const nvm_api_1 = require("./nvm-api");
6
+ const payments_error_1 = require("../common/payments.error");
7
+ const utils_1 = require("../utils");
8
+ /**
9
+ * The AgentRequestsAPI class provides methods to manage the requests received by AI Agents integrated with Nevermined.
10
+ *
11
+ */
12
+ class AgentRequestsAPI extends base_payments_1.BasePaymentsAPI {
13
+ /**
14
+ * This method is used to create a singleton instance of the AgentRequestsAPI class.
15
+ *
16
+ * @param options - The options to initialize the payments class.
17
+ * @returns The instance of the AgentRequestsAPI class.
18
+ */
19
+ static getInstance(options) {
20
+ return new AgentRequestsAPI(options);
21
+ }
22
+ /**
23
+ * This method initializes an agent request.
24
+ *
25
+ * @remarks
26
+ * This method is used to initialize an agent request.
27
+ *
28
+ * @param agentId - The unique identifier of the AI Agent.
29
+ * @param accessToken - The access token provided by the subscriber to validate
30
+ * @param urlRequested - The URL requested by the subscriber to access the agent's API.
31
+ * @param httpMethodRequested - The HTTP method requested by the subscriber to access the agent's API.
32
+ * @returns @see {@link StartAgentRequest} The information about the initialization of the request.
33
+ * @throws PaymentsError if unable to initialize the agent request.
34
+ *
35
+ * @example
36
+ * ```
37
+ * onst authHeader = req.headers['authorization']
38
+ *
39
+ * const result = await payments.requests.startProcessingRequest(
40
+ * agentId,
41
+ * authHeader,
42
+ * 'https://api.example.com/agent-endpoint/1234',
43
+ * 'POST'
44
+ * )
45
+ *
46
+ * // {
47
+ * // agentRequestId: '3921032910321',
48
+ * // urlMatching: 'https://api.example.com/agent-endpoint/1234',
49
+ * // verbMatching: 'POST',
50
+ * // balance: {
51
+ * // planId: '105906633592154016712415751065660953070604027297000423385655551747721326921578',
52
+ * // planType: 'credits',
53
+ * // holderAddress: '0x505384192Ba6a4D4b50EAB846ee67db3b9A93359',
54
+ * // creditsContract: '0xdd0240858fE744C3BF245DD377abBC04d1FDA443',
55
+ * // balance: '100',
56
+ * // isSubscriber: true
57
+ * // }
58
+ * // }
59
+ * ```
60
+ */
61
+ async startProcessingRequest(agentId, accessToken, urlRequested, httpMethodRequested) {
62
+ const initializeAgentUrl = nvm_api_1.API_URL_INITIALIZE_AGENT.replace(':agentId', agentId);
63
+ const body = {
64
+ accessToken,
65
+ endpoint: urlRequested,
66
+ httpVerb: httpMethodRequested,
67
+ };
68
+ const options = this.getBackendHTTPOptions('POST', body);
69
+ const url = new URL(initializeAgentUrl, this.environment.backend);
70
+ const response = await fetch(url, options);
71
+ if (!response.ok) {
72
+ throw new payments_error_1.PaymentsError(`Unable to validate access token. ${response.statusText} - ${await response.text()}`);
73
+ }
74
+ return response.json();
75
+ }
76
+ /**
77
+ * Allows the agent to redeem credits from a request.
78
+ *
79
+ * @param agentRequestId - The unique identifier of the agent request.
80
+ * @param requestAccessToken - The access token of the request.
81
+ * @param creditsToBurn - The number of credits to burn.
82
+ * @returns @see {@link NvmAPIResult} A promise that resolves to the result of the operation.
83
+ * @throws PaymentsError if unable to redeem credits from the request.
84
+ *
85
+ * @example
86
+ * ```
87
+ * const result = await payments.requests.redeemCreditsFromRequest(
88
+ * 'request-id-12345', // The request ID to track the operation
89
+ * accessToken, // The access token of the request
90
+ * 5n // The number of credits to burn
91
+ * )
92
+ *
93
+ * // {
94
+ * // txHash: '0x8d29d5769e832a35e53f80cd4e8890d941c50a09c33dbd975533debc894f2535',
95
+ * // success: true
96
+ * // }
97
+ * ```
98
+ */
99
+ async redeemCreditsFromRequest(agentRequestId, requestAccessToken, creditsToBurn) {
100
+ // Decode the access token to get the wallet address and plan ID
101
+ const decodedToken = (0, utils_1.decodeAccessToken)(requestAccessToken);
102
+ if (!decodedToken) {
103
+ throw new payments_error_1.PaymentsError('Invalid access token provided');
104
+ }
105
+ // Extract wallet address and plan ID from the token
106
+ const walletAddress = decodedToken.authToken?.sub || decodedToken.sub;
107
+ const planId = decodedToken.authToken?.planId || decodedToken.planId;
108
+ if (!walletAddress || !planId) {
109
+ throw new payments_error_1.PaymentsError('Missing wallet address or plan ID in access token');
110
+ }
111
+ const body = {
112
+ agentRequestId,
113
+ planId: BigInt(planId),
114
+ redeemFrom: walletAddress,
115
+ amount: creditsToBurn,
116
+ };
117
+ const options = this.getBackendHTTPOptions('POST', body);
118
+ const url = new URL(nvm_api_1.API_URL_REDEEM_PLAN, this.environment.backend);
119
+ const response = await fetch(url, options);
120
+ if (!response.ok) {
121
+ const responseText = await response.text();
122
+ throw new payments_error_1.PaymentsError(`Unable to redeem credits from request. ${response.status} ${response.statusText} - ${responseText}`);
123
+ }
124
+ return response.json();
125
+ }
126
+ /**
127
+ * Tracks an agent sub task.
128
+ *
129
+ * @remarks
130
+ * This method is used by agent owners to track agent sub tasks for agent tasks.
131
+ * It records information about credit redemption, categorization tags, and processing descriptions.
132
+ *
133
+ * @param trackAgentSubTask - @see {@link TrackAgentSubTaskDto} The agent sub task data to track
134
+ * @returns @see {@link NvmAPIResult} A promise that resolves to the result of the operation.
135
+ * @throws PaymentsError if unable to track the agent sub task
136
+ *
137
+ * @example
138
+ * ```
139
+ * const result = await payments.requests.trackAgentSubTask({
140
+ * agentRequestId: 'atx-12345',
141
+ * creditsToRedeem: 5,
142
+ * tag: 'high-priority',
143
+ * description: 'Processing high-priority data request',
144
+ * status: AgentTaskStatus.SUCCESS
145
+ * })
146
+ *
147
+ * // {
148
+ * // txHash: '0x8d29d5769e832a35e53f80cd4e8890d941c50a09c33dbd975533debc894f2535',
149
+ * // success: true
150
+ * // }
151
+ * ```
152
+ */
153
+ async trackAgentSubTask(trackAgentSubTask) {
154
+ const body = {
155
+ agentRequestId: trackAgentSubTask.agentRequestId,
156
+ creditsToRedeem: trackAgentSubTask.creditsToRedeem || 0,
157
+ tag: trackAgentSubTask.tag,
158
+ description: trackAgentSubTask.description,
159
+ status: trackAgentSubTask.status,
160
+ };
161
+ const options = this.getBackendHTTPOptions('POST', body);
162
+ const url = new URL(nvm_api_1.API_URL_TRACK_AGENT_SUB_TASK, this.environment.backend);
163
+ const response = await fetch(url, options);
164
+ if (!response.ok) {
165
+ throw new payments_error_1.PaymentsError(`Unable to track agent sub task. ${response.statusText} - ${await response.text()}`);
166
+ }
167
+ return response.json();
168
+ }
169
+ }
170
+ exports.AgentRequestsAPI = AgentRequestsAPI;
171
+ //# sourceMappingURL=requests-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests-api.js","sourceRoot":"","sources":["../../src/api/requests-api.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAOjD,uCAIkB;AAClB,6DAAwD;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iB,CAAC,GAAG;YAC1B,WAAW,EAAE,iBAAiB,CAAC,WAAW;YAC1C,MAAM,EAAE,iBAAiB,CAAC,MAAM;SACjC,CAAA;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QACxD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,sCAA4B,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAC3E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAE1C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,8BAAa,CACrB,mCAAmC,QAAQ,CAAC,UAAU,MAAM,MAAM,QAAQ,CAAC,IAAI,EAAE,EAAE,CACpF,CAAA;QACH,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;IACxB,CAAC;CACF;AAzLD,4CAyLC","sourcesContent":["import { BasePaymentsAPI } from './base-payments'\nimport {\n PaymentOptions,\n TrackAgentSubTaskDto,\n StartAgentRequest,\n NvmAPIResult,\n} from '../common/types'\nimport {\n API_URL_REDEEM_PLAN,\n API_URL_INITIALIZE_AGENT,\n API_URL_TRACK_AGENT_SUB_TASK,\n} from './nvm-api'\nimport { PaymentsError } from '../common/payments.error'\nimport { decodeAccessToken } from '../utils'\n\n/**\n * The AgentRequestsAPI class provides methods to manage the requests received by AI Agents integrated with Nevermined.\n *\n */\nexport class AgentRequestsAPI extends BasePaymentsAPI {\n /**\n * This method is used to create a singleton instance of the AgentRequestsAPI class.\n *\n * @param options - The options to initialize the payments class.\n * @returns The instance of the AgentRequestsAPI class.\n */\n static getInstance(options: PaymentOptions): AgentRequestsAPI {\n return new AgentRequestsAPI(options)\n }\n\n /**\n * This method initializes an agent request.\n *\n * @remarks\n * This method is used to initialize an agent request.\n *\n * @param agentId - The unique identifier of the AI Agent.\n * @param accessToken - The access token provided by the subscriber to validate\n * @param urlRequested - The URL requested by the subscriber to access the agent's API.\n * @param httpMethodRequested - The HTTP method requested by the subscriber to access the agent's API.\n * @returns @see {@link StartAgentRequest} The information about the initialization of the request.\n * @throws PaymentsError if unable to initialize the agent request.\n *\n * @example\n * ```\n * onst authHeader = req.headers['authorization']\n *\n * const result = await payments.requests.startProcessingRequest(\n * agentId,\n * authHeader,\n * 'https://api.example.com/agent-endpoint/1234',\n * 'POST'\n * )\n *\n * // {\n * // agentRequestId: '3921032910321',\n * // urlMatching: 'https://api.example.com/agent-endpoint/1234',\n * // verbMatching: 'POST',\n * // balance: {\n * // planId: '105906633592154016712415751065660953070604027297000423385655551747721326921578',\n * // planType: 'credits',\n * // holderAddress: '0x505384192Ba6a4D4b50EAB846ee67db3b9A93359',\n * // creditsContract: '0xdd0240858fE744C3BF245DD377abBC04d1FDA443',\n * // balance: '100',\n * // isSubscriber: true\n * // }\n * // }\n * ```\n */\n public async startProcessingRequest(\n agentId: string,\n accessToken: string,\n urlRequested: string,\n httpMethodRequested: string,\n ): Promise<StartAgentRequest> {\n const initializeAgentUrl = API_URL_INITIALIZE_AGENT.replace(':agentId', agentId!)\n const body = {\n accessToken,\n endpoint: urlRequested,\n httpVerb: httpMethodRequested,\n }\n const options = this.getBackendHTTPOptions('POST', body)\n\n const url = new URL(initializeAgentUrl, this.environment.backend)\n const response = await fetch(url, options)\n if (!response.ok) {\n throw new PaymentsError(\n `Unable to validate access token. ${response.statusText} - ${await response.text()}`,\n )\n }\n\n return response.json()\n }\n\n /**\n * Allows the agent to redeem credits from a request.\n *\n * @param agentRequestId - The unique identifier of the agent request.\n * @param requestAccessToken - The access token of the request.\n * @param creditsToBurn - The number of credits to burn.\n * @returns @see {@link NvmAPIResult} A promise that resolves to the result of the operation.\n * @throws PaymentsError if unable to redeem credits from the request.\n *\n * @example\n * ```\n * const result = await payments.requests.redeemCreditsFromRequest(\n * 'request-id-12345', // The request ID to track the operation\n * accessToken, // The access token of the request\n * 5n // The number of credits to burn\n * )\n *\n * // {\n * // txHash: '0x8d29d5769e832a35e53f80cd4e8890d941c50a09c33dbd975533debc894f2535',\n * // success: true\n * // }\n * ```\n */\n public async redeemCreditsFromRequest(\n agentRequestId: string,\n requestAccessToken: string,\n creditsToBurn: bigint,\n ): Promise<NvmAPIResult> {\n // Decode the access token to get the wallet address and plan ID\n const decodedToken = decodeAccessToken(requestAccessToken)\n if (!decodedToken) {\n throw new PaymentsError('Invalid access token provided')\n }\n\n // Extract wallet address and plan ID from the token\n const walletAddress = decodedToken.authToken?.sub || decodedToken.sub\n const planId = decodedToken.authToken?.planId || decodedToken.planId\n\n if (!walletAddress || !planId) {\n throw new PaymentsError('Missing wallet address or plan ID in access token')\n }\n\n const body = {\n agentRequestId,\n planId: BigInt(planId),\n redeemFrom: walletAddress,\n amount: creditsToBurn,\n }\n\n const options = this.getBackendHTTPOptions('POST', body)\n const url = new URL(API_URL_REDEEM_PLAN, this.environment.backend)\n const response = await fetch(url, options)\n if (!response.ok) {\n const responseText = await response.text()\n throw new PaymentsError(\n `Unable to redeem credits from request. ${response.status} ${response.statusText} - ${responseText}`,\n )\n }\n\n return response.json()\n }\n\n /**\n * Tracks an agent sub task.\n *\n * @remarks\n * This method is used by agent owners to track agent sub tasks for agent tasks.\n * It records information about credit redemption, categorization tags, and processing descriptions.\n *\n * @param trackAgentSubTask - @see {@link TrackAgentSubTaskDto} The agent sub task data to track\n * @returns @see {@link NvmAPIResult} A promise that resolves to the result of the operation.\n * @throws PaymentsError if unable to track the agent sub task\n *\n * @example\n * ```\n * const result = await payments.requests.trackAgentSubTask({\n * agentRequestId: 'atx-12345',\n * creditsToRedeem: 5,\n * tag: 'high-priority',\n * description: 'Processing high-priority data request',\n * status: AgentTaskStatus.SUCCESS\n * })\n *\n * // {\n * // txHash: '0x8d29d5769e832a35e53f80cd4e8890d941c50a09c33dbd975533debc894f2535',\n * // success: true\n * // }\n * ```\n */\n public async trackAgentSubTask(trackAgentSubTask: TrackAgentSubTaskDto): Promise<NvmAPIResult> {\n const body = {\n agentRequestId: trackAgentSubTask.agentRequestId,\n creditsToRedeem: trackAgentSubTask.creditsToRedeem || 0,\n tag: trackAgentSubTask.tag,\n description: trackAgentSubTask.description,\n status: trackAgentSubTask.status,\n }\n\n const options = this.getBackendHTTPOptions('POST', body)\n const url = new URL(API_URL_TRACK_AGENT_SUB_TASK, this.environment.backend)\n const response = await fetch(url, options)\n\n if (!response.ok) {\n throw new PaymentsError(\n `Unable to track agent sub task. ${response.statusText} - ${await response.text()}`,\n )\n }\n\n return response.json()\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/common/helper.ts"],"names":[],"mappings":";;;AAEO,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAAzE,QAAA,KAAK,SAAoE;AAE/E,MAAM,YAAY,GAAG,CAAC,IAAS,EAAE,KAA8B,EAAE,EAAE;IACxE,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;AAC7D,CAAC,CAAA;AAFY,QAAA,YAAY,gBAExB;AAEM,MAAM,2BAA2B,GAAG,CAAC,SAAqB,EAAU,EAAE;IAC3E,IAAI,WAAW,GAAG,EAAE,CAAA;IACpB,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC1B,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QAC5C,WAAW,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAA;IACzC,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAPY,QAAA,2BAA2B,+BAOvC"}
1
+ {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/common/helper.ts"],"names":[],"mappings":";;;AAEO,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAAzE,QAAA,KAAK,SAAoE;AAE/E,MAAM,YAAY,GAAG,CAAC,IAAS,EAAE,KAA8B,EAAE,EAAE;IACxE,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;AAC7D,CAAC,CAAA;AAFY,QAAA,YAAY,gBAExB;AAEM,MAAM,2BAA2B,GAAG,CAAC,SAAqB,EAAU,EAAE;IAC3E,IAAI,WAAW,GAAG,EAAE,CAAA;IACpB,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC1B,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QAC5C,WAAW,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAA;IACzC,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAPY,QAAA,2BAA2B,+BAOvC","sourcesContent":["import { Endpoint } from './types'\n\nexport const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\nexport const jsonReplacer = (_key: any, value: { toString: () => any }) => {\n return typeof value === 'bigint' ? value.toString() : value\n}\n\nexport const getServiceHostFromEndpoints = (endpoints: Endpoint[]): string => {\n let serviceHost = ''\n endpoints.some((endpoint) => {\n const _endpoint = Object.values(endpoint)[0]\n serviceHost = new URL(_endpoint).origin\n })\n return serviceHost\n}\n"]}
@@ -1,4 +1,34 @@
1
+ /**
2
+ * PaymentsError extends Error to provide detailed error information for payments and authentication.
3
+ * Supports error codes for unauthorized, payment required, and other payment-related errors.
4
+ */
1
5
  export declare class PaymentsError extends Error {
2
- constructor(message: string);
6
+ code: string;
7
+ /**
8
+ * Creates a new PaymentsError instance.
9
+ * @param message - The error message
10
+ * @param code - The error code (e.g., 'unauthorized', 'payment_required')
11
+ */
12
+ constructor(message: string, code?: string);
13
+ /**
14
+ * Creates an unauthorized error (missing or invalid credentials).
15
+ * @param message - Optional custom message
16
+ */
17
+ static unauthorized(message?: string): PaymentsError;
18
+ /**
19
+ * Creates a payment required error (insufficient credits, etc.).
20
+ * @param message - Optional custom message
21
+ */
22
+ static paymentRequired(message?: string): PaymentsError;
23
+ /**
24
+ * Creates a generic validation error.
25
+ * @param message - Optional custom message
26
+ */
27
+ static validation(message?: string): PaymentsError;
28
+ /**
29
+ * Creates an internal error.
30
+ * @param message - Optional custom message
31
+ */
32
+ static internal(message?: string): PaymentsError;
3
33
  }
4
34
  //# sourceMappingURL=payments.error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"payments.error.d.ts","sourceRoot":"","sources":["../../src/common/payments.error.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B"}
1
+ {"version":3,"file":"payments.error.d.ts","sourceRoot":"","sources":["../../src/common/payments.error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,IAAI,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAyB;IAM5D;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,GAAE,MAAuB;IAIpD;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,GAAE,MAA2B;IAI3D;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,GAAE,MAA2B;IAItD;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAE,MAAyB;CAGnD"}
@@ -1,10 +1,48 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PaymentsError = void 0;
4
+ /**
5
+ * PaymentsError extends Error to provide detailed error information for payments and authentication.
6
+ * Supports error codes for unauthorized, payment required, and other payment-related errors.
7
+ */
4
8
  class PaymentsError extends Error {
5
- constructor(message) {
9
+ /**
10
+ * Creates a new PaymentsError instance.
11
+ * @param message - The error message
12
+ * @param code - The error code (e.g., 'unauthorized', 'payment_required')
13
+ */
14
+ constructor(message, code = 'payments_error') {
6
15
  super(message);
7
16
  this.name = 'PaymentsError';
17
+ this.code = code;
18
+ }
19
+ /**
20
+ * Creates an unauthorized error (missing or invalid credentials).
21
+ * @param message - Optional custom message
22
+ */
23
+ static unauthorized(message = 'Unauthorized') {
24
+ return new PaymentsError(message, 'unauthorized');
25
+ }
26
+ /**
27
+ * Creates a payment required error (insufficient credits, etc.).
28
+ * @param message - Optional custom message
29
+ */
30
+ static paymentRequired(message = 'Payment required') {
31
+ return new PaymentsError(message, 'payment_required');
32
+ }
33
+ /**
34
+ * Creates a generic validation error.
35
+ * @param message - Optional custom message
36
+ */
37
+ static validation(message = 'Validation error') {
38
+ return new PaymentsError(message, 'validation');
39
+ }
40
+ /**
41
+ * Creates an internal error.
42
+ * @param message - Optional custom message
43
+ */
44
+ static internal(message = 'Internal error') {
45
+ return new PaymentsError(message, 'internal');
8
46
  }
9
47
  }
10
48
  exports.PaymentsError = PaymentsError;
@@ -1 +1 @@
1
- {"version":3,"file":"payments.error.js","sourceRoot":"","sources":["../../src/common/payments.error.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;IAC7B,CAAC;CACF;AALD,sCAKC"}
1
+ {"version":3,"file":"payments.error.js","sourceRoot":"","sources":["../../src/common/payments.error.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,aAAc,SAAQ,KAAK;IAGtC;;;;OAIG;IACH,YAAY,OAAe,EAAE,OAAe,gBAAgB;QAC1D,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,UAAkB,cAAc;QAClD,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;IACnD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,UAAkB,kBAAkB;QACzD,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA;IACvD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,UAAkB,kBAAkB;QACpD,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;IACjD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAkB,gBAAgB;QAChD,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;IAC/C,CAAC;CACF;AA7CD,sCA6CC","sourcesContent":["/**\n * PaymentsError extends Error to provide detailed error information for payments and authentication.\n * Supports error codes for unauthorized, payment required, and other payment-related errors.\n */\nexport class PaymentsError extends Error {\n code: string\n\n /**\n * Creates a new PaymentsError instance.\n * @param message - The error message\n * @param code - The error code (e.g., 'unauthorized', 'payment_required')\n */\n constructor(message: string, code: string = 'payments_error') {\n super(message)\n this.name = 'PaymentsError'\n this.code = code\n }\n\n /**\n * Creates an unauthorized error (missing or invalid credentials).\n * @param message - Optional custom message\n */\n static unauthorized(message: string = 'Unauthorized') {\n return new PaymentsError(message, 'unauthorized')\n }\n\n /**\n * Creates a payment required error (insufficient credits, etc.).\n * @param message - Optional custom message\n */\n static paymentRequired(message: string = 'Payment required') {\n return new PaymentsError(message, 'payment_required')\n }\n\n /**\n * Creates a generic validation error.\n * @param message - Optional custom message\n */\n static validation(message: string = 'Validation error') {\n return new PaymentsError(message, 'validation')\n }\n\n /**\n * Creates an internal error.\n * @param message - Optional custom message\n */\n static internal(message: string = 'Internal error') {\n return new PaymentsError(message, 'internal')\n }\n}\n"]}
@@ -14,7 +14,7 @@ export interface PaymentOptions {
14
14
  * You can get your API key by logging in to the Nevermined App.
15
15
  * @see https://docs.nevermined.app/docs/tutorials/integration/nvm-api-keys
16
16
  */
17
- nvmApiKey?: string;
17
+ nvmApiKey: string;
18
18
  /**
19
19
  * The URL to return to the app after a successful login.
20
20
  */
@@ -155,12 +155,13 @@ export interface PlanBalance {
155
155
  creditsContract: Address;
156
156
  isSubscriber: boolean;
157
157
  }
158
- export interface ValidationAgentRequest {
158
+ export interface StartAgentRequest {
159
+ agentRequestId: string;
159
160
  balance: PlanBalance;
160
161
  urlMatching: string;
161
162
  verbMatching: string;
162
163
  }
163
- export interface AgentAccessParams {
164
+ export interface AgentAccessCredentials {
164
165
  accessToken: string;
165
166
  proxies?: string[];
166
167
  }
@@ -171,6 +172,25 @@ export interface SubscriberRequestStatus {
171
172
  code: number;
172
173
  message?: string;
173
174
  }
175
+ export interface NvmAPIResult {
176
+ success: boolean;
177
+ message?: string;
178
+ txHash?: string;
179
+ httpStatus?: number;
180
+ data?: APIOutputData;
181
+ when?: Date;
182
+ }
183
+ export interface APIOutputData {
184
+ [key: string]: any;
185
+ }
186
+ export interface StripeCheckoutResult {
187
+ stripeCheckoutSessionId: string;
188
+ checkoutLink: string;
189
+ clientReferenceId: string;
190
+ paymentStatus?: string;
191
+ linkCreatedAt: number;
192
+ linkExpiresAt: number;
193
+ }
174
194
  /**
175
195
  * Metadata attributes describing the AI Agent.
176
196
  */
@@ -293,4 +313,38 @@ export declare class PaginationOptions {
293
313
  */
294
314
  asQueryParams(): string;
295
315
  }
316
+ /**
317
+ * Status of an agent task
318
+ */
319
+ export declare enum AgentTaskStatus {
320
+ SUCCESS = "SUCCESS",
321
+ FAILED = "FAILED",
322
+ PENDING = "PENDING"
323
+ }
324
+ /**
325
+ * Data transfer object for tracking agent sub tasks
326
+ */
327
+ export interface TrackAgentSubTaskDto {
328
+ /**
329
+ * The unique identifier of the agent task
330
+ */
331
+ agentRequestId: string;
332
+ /**
333
+ * The number of credits burned in this agent sub task (optional)
334
+ * @defaultValue 0
335
+ */
336
+ creditsToRedeem?: number;
337
+ /**
338
+ * A tag to categorize this agent sub task (optional)
339
+ */
340
+ tag?: string;
341
+ /**
342
+ * A description of this agent sub task (optional)
343
+ */
344
+ description?: string;
345
+ /**
346
+ * The status of the agent sub task (optional)
347
+ */
348
+ status?: AgentTaskStatus;
349
+ }
296
350
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,WAAW,EAAE,eAAe,CAAA;IAE5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,CAAC,CAAA;IACR,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,OAAO,GAAG,KAAK,MAAM,EAAE,CAAA;AAEnC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,SAAS,EAAE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CAAA;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,CAAA;CACzB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PaginationOptions = exports.PlanRedemptionType = exports.PlanCreditsType = exports.PlanPriceType = void 0;
3
+ exports.AgentTaskStatus = exports.PaginationOptions = exports.PlanRedemptionType = exports.PlanCreditsType = exports.PlanPriceType = void 0;
4
4
  /**
5
5
  * Different types of prices that can be configured for a plan
6
6
  * @remarks 0 - FIXED_PRICE, 1 - FIXED_FIAT_PRICE, 2 - SMART_CONTRACT_PRICE
@@ -88,4 +88,13 @@ class PaginationOptions {
88
88
  }
89
89
  }
90
90
  exports.PaginationOptions = PaginationOptions;
91
+ /**
92
+ * Status of an agent task
93
+ */
94
+ var AgentTaskStatus;
95
+ (function (AgentTaskStatus) {
96
+ AgentTaskStatus["SUCCESS"] = "SUCCESS";
97
+ AgentTaskStatus["FAILED"] = "FAILED";
98
+ AgentTaskStatus["PENDING"] = "PENDING";
99
+ })(AgentTaskStatus || (exports.AgentTaskStatus = AgentTaskStatus = {}));
91
100
  //# sourceMappingURL=types.js.map