valta-sdk 2.1.7 → 2.2.2

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.ts CHANGED
@@ -1,197 +1,351 @@
1
- interface RequestOptions {
2
- method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';
3
- body?: unknown;
1
+ interface ValtaConfig {
2
+ apiKey: string;
3
+ baseUrl?: string;
4
+ timeout?: number;
4
5
  }
5
- declare class Requester {
6
- private apiKey;
7
- private baseUrl;
8
- constructor(apiKey: string, baseUrl?: string);
9
- request<T>(path: string, options?: RequestOptions): Promise<T>;
6
+ interface LoginResponse {
7
+ token: string;
8
+ user: {
9
+ id: string;
10
+ email: string;
11
+ name?: string | null;
12
+ plan: string;
13
+ };
10
14
  }
11
-
12
- interface Agent {
15
+ interface WhoamiResponse {
13
16
  id: string;
14
- name: string;
15
- type: string;
16
- status: 'active' | 'frozen' | 'paused';
17
- walletAddress?: string;
17
+ email: string;
18
+ name: string | null;
19
+ plan: string;
20
+ creditsRemaining: number;
18
21
  createdAt: string;
19
- updatedAt: string;
20
22
  }
21
23
  interface CreateAgentParams {
22
24
  name: string;
23
- type: string;
24
25
  description?: string;
26
+ wallet?: {
27
+ initialBalance?: number;
28
+ dailyLimit?: number;
29
+ monthlyLimit?: number;
30
+ currency?: string;
31
+ };
32
+ policy?: {
33
+ requireApprovalAbove?: number;
34
+ requireApproval?: {
35
+ above: number;
36
+ };
37
+ maxPerTransaction?: number;
38
+ blockedCategories?: string[];
39
+ allowedDomains?: string[];
40
+ blockedDomains?: string[];
41
+ };
42
+ autonomyLevel?: 'supervised' | 'semi_autonomous' | 'fully_autonomous';
43
+ agentType?: string;
44
+ type?: string;
25
45
  }
26
- interface ListAgentsParams {
27
- limit?: number;
28
- offset?: number;
29
- status?: 'active' | 'frozen' | 'paused';
30
- }
31
- interface ListAgentsResponse {
32
- agents: Agent[];
33
- total: number;
34
- limit: number;
35
- offset: number;
46
+ interface Agent {
47
+ id: string;
48
+ userId: string;
49
+ name: string;
50
+ description: string | null;
51
+ status: 'active' | 'frozen' | 'inactive';
52
+ autonomyLevel: 'supervised' | 'semi_autonomous' | 'fully_autonomous';
53
+ agentType: string | null;
54
+ walletAddress: string;
55
+ wallet: AgentWallet;
56
+ policy: AgentPolicy | null;
57
+ createdAt: string;
58
+ updatedAt: string;
36
59
  }
37
- declare class AgentsResource {
38
- private requester;
39
- constructor(requester: Requester);
40
- list(params?: ListAgentsParams): Promise<ListAgentsResponse>;
41
- get(agentId: string): Promise<Agent>;
42
- create(params: CreateAgentParams): Promise<Agent>;
43
- update(agentId: string, params: Partial<CreateAgentParams>): Promise<Agent>;
44
- freeze(agentId: string): Promise<Agent>;
45
- unfreeze(agentId: string): Promise<Agent>;
46
- delete(agentId: string): Promise<{
47
- deleted: boolean;
48
- id: string;
49
- }>;
60
+ interface AgentWallet {
61
+ id: string;
62
+ agentId: string;
63
+ balance: number;
64
+ currency: string;
65
+ dailyLimit: number | null;
66
+ monthlyLimit: number | null;
67
+ dailySpent: number;
68
+ monthlySpent: number;
50
69
  }
51
-
52
- interface WalletBalance {
53
- usdc: string;
54
- usdcPending: string;
55
- lastUpdated: string;
56
- }
57
- interface WalletTransferParams {
58
- toAgentId?: string;
59
- toAddress?: string;
60
- amount: string;
61
- currency: 'USDC';
62
- note?: string;
70
+ interface AgentPolicy {
71
+ id: string;
72
+ agentId: string;
73
+ requireApprovalAbove: number | null;
74
+ maxPerTransaction: number | null;
75
+ dailyLimit: number | null;
76
+ monthlyLimit: number | null;
77
+ blockedCategories: string[];
78
+ allowedDomains: string[];
79
+ blockedDomains: string[];
63
80
  }
64
- interface WalletTransfer {
81
+ interface AgentRun {
65
82
  id: string;
66
- fromAgentId: string;
67
- toAgentId?: string;
68
- toAddress?: string;
69
- amount: string;
70
- currency: string;
71
- status: 'pending' | 'completed' | 'failed';
83
+ agentId: string;
84
+ status: 'running' | 'completed' | 'failed' | 'waiting_approval' | 'frozen' | 'cancelled';
85
+ task: string;
86
+ output: string | null;
87
+ summary?: string | null;
88
+ error: string | null;
89
+ tokensUsed: number;
90
+ toolCallsCount: number;
91
+ durationMs: number | null;
92
+ startedAt: string;
93
+ completedAt: string | null;
72
94
  createdAt: string;
73
95
  }
74
- declare class WalletsResource {
75
- private requester;
76
- constructor(requester: Requester);
77
- get(agentId: string): Promise<WalletBalance>;
78
- transfer(agentId: string, params: WalletTransferParams): Promise<WalletTransfer>;
96
+ interface RunAgentParams {
97
+ task: string;
98
+ context?: string;
99
+ timeout?: number;
79
100
  }
80
-
81
- interface Policy {
101
+ interface WalletBalance {
102
+ agentId: string;
103
+ balance: number;
104
+ currency: string;
105
+ dailySpent: number;
106
+ monthlySpent: number;
107
+ dailyLimit: number | null;
108
+ monthlyLimit: number | null;
109
+ walletAddress: string;
110
+ }
111
+ interface WalletDepositAddress {
112
+ address: string;
113
+ qrCodeDataUrl: string;
114
+ network: 'Base';
115
+ currency: 'USDC';
116
+ }
117
+ interface WalletTransaction {
82
118
  id: string;
83
119
  agentId: string;
84
- name: string;
85
- maxSpendPerDay?: number;
86
- maxSpendPerTransaction?: number;
87
- allowedRecipients?: string[];
120
+ type: 'debit' | 'credit' | 'transfer_out' | 'transfer_in';
121
+ amount: number;
88
122
  currency: string;
89
- active: boolean;
123
+ description: string;
124
+ referenceId: string | null;
125
+ status: 'completed' | 'pending' | 'failed' | 'blocked';
90
126
  createdAt: string;
91
127
  }
128
+ interface TransferParams {
129
+ fromAgentId: string;
130
+ toAgentId: string;
131
+ amount: number;
132
+ description?: string;
133
+ }
92
134
  interface CreatePolicyParams {
93
135
  agentId: string;
94
- name: string;
95
- maxSpendPerDay?: number;
96
- maxSpendPerTransaction?: number;
97
- allowedRecipients?: string[];
98
- currency?: string;
136
+ requireApprovalAbove?: number;
137
+ maxPerTransaction?: number;
138
+ dailyLimit?: number;
139
+ monthlyLimit?: number;
140
+ blockedCategories?: string[];
141
+ allowedDomains?: string[];
142
+ blockedDomains?: string[];
99
143
  }
100
- declare class PoliciesResource {
101
- private requester;
102
- constructor(requester: Requester);
103
- list(agentId?: string): Promise<Policy[]>;
104
- create(params: CreatePolicyParams): Promise<Policy>;
105
- update(policyId: string, params: Partial<CreatePolicyParams>): Promise<Policy>;
106
- delete(policyId: string): Promise<{
107
- deleted: boolean;
108
- }>;
144
+ interface UpdatePolicyParams extends Partial<Omit<CreatePolicyParams, 'agentId'>> {
109
145
  }
110
-
111
- interface AuditLog {
146
+ interface AuditEntry {
112
147
  id: string;
113
148
  agentId: string;
149
+ userId: string;
114
150
  action: string;
115
- amount?: string;
116
- currency?: string;
117
- metadata?: Record<string, unknown>;
151
+ details: Record<string, unknown> | null;
152
+ amount: number | null;
153
+ status: 'success' | 'blocked' | 'pending' | 'failed';
154
+ previousHash: string | null;
118
155
  hash: string;
119
- previousHash: string;
156
+ ipAddress: string | null;
120
157
  createdAt: string;
121
158
  }
122
159
  interface ListAuditParams {
123
160
  agentId?: string;
124
- limit?: number;
125
- offset?: number;
161
+ action?: string;
162
+ status?: 'success' | 'blocked' | 'pending' | 'failed';
126
163
  from?: string;
127
164
  to?: string;
165
+ page?: number;
166
+ limit?: number;
128
167
  }
129
- interface ListAuditResponse {
130
- logs: AuditLog[];
131
- total: number;
132
- }
133
- declare class AuditResource {
134
- private requester;
135
- constructor(requester: Requester);
136
- list(params?: ListAuditParams): Promise<ListAuditResponse>;
137
- }
138
-
139
168
  interface ApiKey {
140
169
  id: string;
141
170
  name: string;
142
- prefix: string;
143
- tier: 'free' | 'builder' | 'startup' | 'enterprise';
144
- lastUsed?: string;
171
+ keyPrefix: string;
172
+ fullKey?: string;
173
+ lastUsedAt: string | null;
145
174
  createdAt: string;
146
175
  }
147
- interface CreateKeyResponse {
148
- id: string;
176
+ interface CreateApiKeyParams {
149
177
  name: string;
150
- key: string;
151
- tier: string;
152
- createdAt: string;
153
178
  }
179
+ interface PaginatedResponse<T> {
180
+ data: T[];
181
+ pagination: {
182
+ total: number;
183
+ page: number;
184
+ limit: number;
185
+ hasMore: boolean;
186
+ };
187
+ }
188
+
189
+ declare class HttpClient {
190
+ private readonly apiKey;
191
+ private readonly baseUrl;
192
+ private readonly timeout;
193
+ constructor(config: ValtaConfig);
194
+ request<T>(params: {
195
+ method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
196
+ path: string;
197
+ body?: unknown;
198
+ query?: Record<string, string | number | boolean | undefined>;
199
+ authenticated?: boolean;
200
+ }): Promise<T>;
201
+ get<T>(path: string, query?: Record<string, string | number | boolean | undefined>): Promise<T>;
202
+ post<T>(path: string, body?: unknown, authenticated?: boolean): Promise<T>;
203
+ patch<T>(path: string, body?: unknown): Promise<T>;
204
+ delete<T>(path: string): Promise<T>;
205
+ }
206
+
207
+ declare class AuthResource {
208
+ private http;
209
+ constructor(http: HttpClient);
210
+ login(email: string, password: string): Promise<LoginResponse>;
211
+ logout(): Promise<void>;
212
+ whoami(): Promise<WhoamiResponse>;
213
+ refreshToken(): Promise<{
214
+ token: string;
215
+ }>;
216
+ }
217
+
218
+ declare class AgentsResource {
219
+ private http;
220
+ constructor(http: HttpClient);
221
+ create(params: CreateAgentParams): Promise<Agent>;
222
+ list(params?: {
223
+ page?: number;
224
+ limit?: number;
225
+ status?: 'active' | 'frozen' | 'inactive';
226
+ }): Promise<PaginatedResponse<Agent>>;
227
+ get(agentId: string): Promise<Agent>;
228
+ update(agentId: string, params: {
229
+ name?: string;
230
+ description?: string;
231
+ autonomyLevel?: Agent['autonomyLevel'];
232
+ }): Promise<Agent>;
233
+ delete(agentId: string): Promise<{
234
+ success: boolean;
235
+ }>;
236
+ freeze(agentId: string): Promise<{
237
+ success: boolean;
238
+ agentId: string;
239
+ status: 'frozen';
240
+ }>;
241
+ unfreeze(agentId: string): Promise<{
242
+ success: boolean;
243
+ agentId: string;
244
+ status: 'active';
245
+ }>;
246
+ run(agentId: string, params: RunAgentParams): Promise<AgentRun>;
247
+ getRun(agentId: string, runId: string): Promise<AgentRun>;
248
+ listRuns(agentId: string, params?: {
249
+ page?: number;
250
+ limit?: number;
251
+ status?: AgentRun['status'];
252
+ }): Promise<PaginatedResponse<AgentRun>>;
253
+ }
254
+
255
+ declare class AuditResource {
256
+ private http;
257
+ constructor(http: HttpClient);
258
+ list(params?: ListAuditParams): Promise<PaginatedResponse<AuditEntry>>;
259
+ get(entryId: string): Promise<AuditEntry>;
260
+ export(params?: ListAuditParams): Promise<AuditEntry[]>;
261
+ verify(agentId: string): Promise<{
262
+ intact: boolean;
263
+ entriesChecked: number;
264
+ }>;
265
+ }
266
+
154
267
  declare class KeysResource {
155
- private requester;
156
- constructor(requester: Requester);
268
+ private http;
269
+ constructor(http: HttpClient);
270
+ create(params: CreateApiKeyParams): Promise<ApiKey & {
271
+ fullKey: string;
272
+ }>;
157
273
  list(): Promise<ApiKey[]>;
158
- create(name: string): Promise<CreateKeyResponse>;
159
274
  revoke(keyId: string): Promise<{
160
- deleted: boolean;
275
+ success: boolean;
161
276
  }>;
162
277
  }
163
278
 
164
- interface ValtaConfig {
165
- apiKey: string;
166
- baseUrl?: string;
279
+ declare class PoliciesResource {
280
+ private http;
281
+ constructor(http: HttpClient);
282
+ create(params: CreatePolicyParams): Promise<AgentPolicy>;
283
+ get(agentId: string): Promise<AgentPolicy | null>;
284
+ update(agentId: string, params: UpdatePolicyParams): Promise<AgentPolicy>;
285
+ delete(agentId: string): Promise<{
286
+ success: boolean;
287
+ }>;
288
+ list(): Promise<AgentPolicy[]>;
167
289
  }
168
- declare class ValtaClient {
169
- agents: AgentsResource;
170
- wallets: WalletsResource;
171
- policies: PoliciesResource;
172
- audit: AuditResource;
173
- keys: KeysResource;
290
+
291
+ declare class WalletsResource {
292
+ private http;
293
+ constructor(http: HttpClient);
294
+ get(agentId: string): Promise<WalletBalance>;
295
+ getBalance(agentId: string): Promise<number>;
296
+ getDepositAddress(agentId: string): Promise<WalletDepositAddress>;
297
+ listTransactions(agentId: string, params?: {
298
+ page?: number;
299
+ limit?: number;
300
+ type?: WalletTransaction['type'];
301
+ }): Promise<PaginatedResponse<WalletTransaction>>;
302
+ transfer(params: TransferParams): Promise<{
303
+ success: boolean;
304
+ transactionId: string;
305
+ fromBalance: number;
306
+ toBalance: number;
307
+ }>;
308
+ }
309
+
310
+ declare class Valta {
311
+ readonly auth: AuthResource;
312
+ readonly agents: AgentsResource;
313
+ readonly wallets: WalletsResource;
314
+ readonly policies: PoliciesResource;
315
+ readonly audit: AuditResource;
316
+ readonly keys: KeysResource;
317
+ private readonly http;
174
318
  constructor(config: ValtaConfig | string);
175
319
  }
176
320
 
321
+ type ValtaErrorCode = 'UNAUTHORISED' | 'FORBIDDEN' | 'NOT_FOUND' | 'RATE_LIMIT_EXCEEDED' | 'TIER_LIMIT_EXCEEDED' | 'AGENT_FROZEN' | 'POLICY_VIOLATION' | 'INSUFFICIENT_BALANCE' | 'APPROVAL_REQUIRED' | 'INVALID_REQUEST' | 'SERVER_ERROR' | 'NETWORK_ERROR' | 'TIMEOUT';
177
322
  declare class ValtaError extends Error {
178
- code: string;
179
- status: number;
180
- constructor(message: string, code: string, status: number);
323
+ readonly code: ValtaErrorCode;
324
+ readonly status: number | null;
325
+ readonly details: Record<string, unknown> | null;
326
+ constructor(params: {
327
+ message: string;
328
+ code: ValtaErrorCode;
329
+ status?: number;
330
+ details?: Record<string, unknown>;
331
+ });
332
+ isRateLimit(): boolean;
333
+ isAuth(): boolean;
334
+ requiresApproval(): boolean;
181
335
  }
182
336
  declare class AuthError extends ValtaError {
183
337
  constructor(message?: string);
184
338
  }
185
339
  declare class TierError extends ValtaError {
186
- requiredTier: string;
187
- upgradeUrl: string;
188
- constructor(message: string, requiredTier: string);
340
+ readonly requiredTier: string | null;
341
+ readonly upgradeUrl: string;
342
+ constructor(message: string, requiredTier?: string);
189
343
  }
190
344
  declare class RateLimitError extends ValtaError {
191
345
  constructor(message?: string);
192
346
  }
193
347
  declare class NotFoundError extends ValtaError {
194
- constructor(resource: string);
348
+ constructor(message?: string);
195
349
  }
196
350
 
197
- export { type Agent, type ApiKey, type AuditLog, AuthError, type CreateAgentParams, type CreateKeyResponse, type CreatePolicyParams, type ListAgentsParams, type ListAuditParams, NotFoundError, type Policy, RateLimitError, TierError, ValtaClient, ValtaError, type WalletBalance, type WalletTransfer, type WalletTransferParams, ValtaClient as default };
351
+ export { type Agent, type AgentPolicy, type AgentRun, type AgentWallet, type ApiKey, type AuditEntry, AuthError, type CreateAgentParams, type CreateApiKeyParams, type CreatePolicyParams, type ListAuditParams, type LoginResponse, NotFoundError, type PaginatedResponse, RateLimitError, type RunAgentParams, TierError, type TransferParams, type UpdatePolicyParams, Valta, Valta as ValtaClient, type ValtaConfig, ValtaError, type ValtaErrorCode, type WalletBalance, type WalletDepositAddress, type WalletTransaction, type WhoamiResponse, Valta as default };
package/dist/index.js CHANGED
@@ -1,17 +1,2 @@
1
- import {
2
- AuthError,
3
- NotFoundError,
4
- RateLimitError,
5
- TierError,
6
- ValtaClient,
7
- ValtaError
8
- } from "./chunk-LBY67QV7.js";
9
- export {
10
- AuthError,
11
- NotFoundError,
12
- RateLimitError,
13
- TierError,
14
- ValtaClient,
15
- ValtaError,
16
- ValtaClient as default
17
- };
1
+ var d=class{constructor(t){this.http=t;}async login(t,e){return this.http.post("/auth/login",{email:t,password:e},false)}async logout(){await this.http.post("/auth/logout");}async whoami(){return this.http.get("/auth/whoami")}async refreshToken(){return this.http.post("/auth/refresh-token")}};var m=class{constructor(t){this.http=t;}async create(t){return this.http.post("/agents",t)}async list(t){return this.http.get("/agents",t)}async get(t){return this.http.get(`/agents/${encodeURIComponent(t)}`)}async update(t,e){return this.http.patch(`/agents/${encodeURIComponent(t)}`,e)}async delete(t){return this.http.delete(`/agents/${encodeURIComponent(t)}`)}async freeze(t){return this.http.post(`/agents/${encodeURIComponent(t)}/freeze`)}async unfreeze(t){return this.http.post(`/agents/${encodeURIComponent(t)}/unfreeze`)}async run(t,e){return this.http.post(`/agents/${encodeURIComponent(t)}/run`,e)}async getRun(t,e){return this.http.get(`/agents/${encodeURIComponent(t)}/runs/${encodeURIComponent(e)}`)}async listRuns(t,e){return this.http.get(`/agents/${encodeURIComponent(t)}/runs`,e)}};var g=class{constructor(t){this.http=t;}async list(t){return this.http.get("/audit",t)}async get(t){return this.http.get(`/audit/${encodeURIComponent(t)}`)}async export(t){let e=[],o=1,i=true;for(;i;){let p=await this.list({...t,page:o,limit:100});e.push(...p.data),i=p.pagination.hasMore,o+=1;}return e}async verify(t){return this.http.get(`/audit/verify/${encodeURIComponent(t)}`)}};var h=class{constructor(t){this.http=t;}async create(t){return this.http.post("/keys",t)}async list(){return this.http.get("/keys")}async revoke(t){return this.http.delete(`/keys/${encodeURIComponent(t)}`)}};var n=class extends Error{constructor(t){super(t.message),this.name="ValtaError",this.code=t.code,this.status=t.status??null,this.details=t.details??null;}isRateLimit(){return this.code==="RATE_LIMIT_EXCEEDED"}isAuth(){return this.code==="UNAUTHORISED"||this.code==="FORBIDDEN"}requiresApproval(){return this.code==="APPROVAL_REQUIRED"}},A=class extends n{constructor(t="Invalid or missing API key"){super({message:t,code:"UNAUTHORISED",status:401}),this.name="AuthError";}},P=class extends n{constructor(t,e){super({message:t,code:"TIER_LIMIT_EXCEEDED",status:403,details:{requiredTier:e}}),this.name="TierError",this.requiredTier=e??null,this.upgradeUrl="https://valta.co/upgrade";}},I=class extends n{constructor(t="Rate limit exceeded"){super({message:t,code:"RATE_LIMIT_EXCEEDED",status:429}),this.name="RateLimitError";}},T=class extends n{constructor(t="Resource not found"){super({message:t,code:"NOT_FOUND",status:404}),this.name="NotFoundError";}};var E=class{constructor(t){this.http=t;}async create(t){return this.http.post("/policies",t)}async get(t){try{return await this.http.get(`/policies/${encodeURIComponent(t)}`)}catch(e){if(e instanceof n&&e.code==="NOT_FOUND")return null;throw e}}async update(t,e){return this.http.patch(`/policies/${encodeURIComponent(t)}`,e)}async delete(t){return this.http.delete(`/policies/${encodeURIComponent(t)}`)}async list(){return this.http.get("/policies")}};var y=class{constructor(t){this.http=t;}async get(t){return this.http.get(`/wallets/${encodeURIComponent(t)}`)}async getBalance(t){return (await this.get(t)).balance}async getDepositAddress(t){return this.http.get(`/wallets/${encodeURIComponent(t)}/deposit-address`)}async listTransactions(t,e){return this.http.get(`/wallets/${encodeURIComponent(t)}/transactions`,e)}async transfer(t){return this.http.post("/wallets/transfer",t)}};var f="2.2.0",R=class{constructor(t){this.apiKey=t.apiKey,this.baseUrl=(t.baseUrl??"https://valta.co/api/v1").replace(/\/$/,""),this.timeout=t.timeout??3e4;}async request(t){let e=`${this.baseUrl}${t.path}`;if(t.query){let r=new URLSearchParams;for(let[u,a]of Object.entries(t.query))a!==void 0&&r.set(u,String(a));let l=r.toString();l&&(e+=`?${l}`);}let o=new AbortController,i=setTimeout(()=>o.abort(),this.timeout),p={"Content-Type":"application/json","User-Agent":`valta-sdk/${f}`,"X-Valta-SDK":f};t.authenticated!==false&&(p["x-api-key"]=this.apiKey);try{let r=await fetch(e,{method:t.method,headers:p,body:t.body===void 0?void 0:JSON.stringify(t.body),signal:o.signal});clearTimeout(i);let l=await r.text(),u=l?C(l,r.status):null;if(!r.ok){let a=u??{};throw new n({message:a.message??a.error??`HTTP ${r.status}`,code:U(a.code,r.status),status:r.status,details:a})}return u}catch(r){throw clearTimeout(i),r instanceof n?r:r instanceof Error&&r.name==="AbortError"?new n({message:`Request timed out after ${this.timeout}ms`,code:"TIMEOUT"}):new n({message:r instanceof Error?r.message:"An unknown network error occurred",code:"NETWORK_ERROR"})}}get(t,e){return this.request({method:"GET",path:t,query:e})}post(t,e,o=true){return this.request({method:"POST",path:t,body:e,authenticated:o})}patch(t,e){return this.request({method:"PATCH",path:t,body:e})}delete(t){return this.request({method:"DELETE",path:t})}};function C(s,t){try{return JSON.parse(s)}catch{throw new n({message:"Invalid JSON response from server",code:"SERVER_ERROR",status:t})}}function U(s,t){let e=String(s||"").toUpperCase();if(e==="UNAUTHORIZED"||e==="API_KEY_REQUIRED"||e==="INVALID_API_KEY")return "UNAUTHORISED";if(e==="RATE_LIMIT"||e==="API_KEY_RATE_LIMITED")return "RATE_LIMIT_EXCEEDED";if(e==="TIER_LIMIT")return "TIER_LIMIT_EXCEEDED";if(D(e))return e;switch(t){case 400:return "INVALID_REQUEST";case 401:return "UNAUTHORISED";case 403:return "FORBIDDEN";case 404:return "NOT_FOUND";case 429:return "RATE_LIMIT_EXCEEDED";default:return "SERVER_ERROR"}}function D(s){return ["UNAUTHORISED","FORBIDDEN","NOT_FOUND","RATE_LIMIT_EXCEEDED","TIER_LIMIT_EXCEEDED","AGENT_FROZEN","POLICY_VIOLATION","INSUFFICIENT_BALANCE","APPROVAL_REQUIRED","INVALID_REQUEST","SERVER_ERROR","NETWORK_ERROR","TIMEOUT"].includes(s)}var c=class{constructor(t){let e=typeof t=="string"?{apiKey:t}:t;if(!e.apiKey)throw new Error("Valta API key is required. Get one at https://valta.co/dashboard/api-keys");this.http=new R(e),this.auth=new d(this.http),this.agents=new m(this.http),this.wallets=new y(this.http),this.policies=new E(this.http),this.audit=new g(this.http),this.keys=new h(this.http);}};
2
+ export{A as AuthError,T as NotFoundError,I as RateLimitError,P as TierError,c as Valta,c as ValtaClient,n as ValtaError,c as default};
package/package.json CHANGED
@@ -1,35 +1,56 @@
1
- {
2
- "name": "valta-sdk",
3
- "version": "2.1.7",
4
- "description": "Official SDK for Valta AI agent financial infrastructure",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
-
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.mjs",
13
- "require": "./dist/index.js"
14
- }
15
- },
16
- "bin": {
17
- "valta": "bin/valta.js"
18
- },
19
- "files": [
20
- "dist",
21
- "bin"
22
- ],
23
- "scripts": {
24
- "build": "tsup src/index.ts src/cli/index.ts --format cjs,esm --dts",
25
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch"
26
- },
27
- "keywords": ["valta", "ai", "agents", "payments", "usdc"],
28
- "author": "Valta",
29
- "license": "MIT",
30
- "type": "module",
31
- "devDependencies": {
32
- "tsup": "^8.5.1",
33
- "typescript": "^5.9.3"
34
- }
35
- }
1
+ {
2
+ "name": "valta-sdk",
3
+ "version": "2.2.2",
4
+ "description": "Financial governance infrastructure for autonomous AI agents",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "bin": {
16
+ "valta": "bin/valta.js"
17
+ },
18
+ "files": [
19
+ "dist/index.js",
20
+ "dist/index.cjs",
21
+ "dist/index.d.ts",
22
+ "dist/cli/index.js",
23
+ "bin",
24
+ "README.md"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsup",
28
+ "dev": "tsup --watch",
29
+ "test": "vitest run --pool forks",
30
+ "test:watch": "vitest --pool forks",
31
+ "typecheck": "tsc --noEmit",
32
+ "prepublishOnly": "npm run build && npm run test && npm run typecheck"
33
+ },
34
+ "keywords": [
35
+ "ai",
36
+ "agents",
37
+ "financial",
38
+ "governance",
39
+ "wallet",
40
+ "valta"
41
+ ],
42
+ "author": "Valta",
43
+ "license": "MIT",
44
+ "homepage": "https://valta.co/docs",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/Billionaire664/Valta.co"
48
+ },
49
+ "type": "module",
50
+ "devDependencies": {
51
+ "@types/node": "^20.0.0",
52
+ "tsup": "^8.5.1",
53
+ "typescript": "^5.9.3",
54
+ "vitest": "^1.6.1"
55
+ }
56
+ }