@autenai/sdk 0.4.0 → 0.6.0

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 (88) hide show
  1. package/README.md +760 -0
  2. package/bin/auten.js +2 -0
  3. package/dist/cli/add-phone.d.ts +2 -0
  4. package/dist/cli/add-phone.d.ts.map +1 -0
  5. package/dist/cli/add-phone.js +254 -0
  6. package/dist/cli/add-phone.js.map +1 -0
  7. package/dist/cli/autocomplete.d.ts +31 -0
  8. package/dist/cli/autocomplete.d.ts.map +1 -0
  9. package/dist/cli/autocomplete.js +438 -0
  10. package/dist/cli/autocomplete.js.map +1 -0
  11. package/dist/cli/build-apk.d.ts +2 -0
  12. package/dist/cli/build-apk.d.ts.map +1 -0
  13. package/dist/cli/build-apk.js +97 -0
  14. package/dist/cli/build-apk.js.map +1 -0
  15. package/dist/cli/creds.d.ts +2 -0
  16. package/dist/cli/creds.d.ts.map +1 -0
  17. package/dist/cli/creds.js +161 -0
  18. package/dist/cli/creds.js.map +1 -0
  19. package/dist/cli/devices.d.ts +2 -0
  20. package/dist/cli/devices.d.ts.map +1 -0
  21. package/dist/cli/devices.js +38 -0
  22. package/dist/cli/devices.js.map +1 -0
  23. package/dist/cli/index.d.ts +2 -0
  24. package/dist/cli/index.d.ts.map +1 -0
  25. package/dist/cli/index.js +111 -0
  26. package/dist/cli/index.js.map +1 -0
  27. package/dist/cli/keys.d.ts +2 -0
  28. package/dist/cli/keys.d.ts.map +1 -0
  29. package/dist/cli/keys.js +88 -0
  30. package/dist/cli/keys.js.map +1 -0
  31. package/dist/cli/login.d.ts +2 -0
  32. package/dist/cli/login.d.ts.map +1 -0
  33. package/dist/cli/login.js +35 -0
  34. package/dist/cli/login.js.map +1 -0
  35. package/dist/cli/logo.d.ts +2 -0
  36. package/dist/cli/logo.d.ts.map +1 -0
  37. package/dist/cli/logo.js +11 -0
  38. package/dist/cli/logo.js.map +1 -0
  39. package/dist/cli/me.d.ts +2 -0
  40. package/dist/cli/me.d.ts.map +1 -0
  41. package/dist/cli/me.js +19 -0
  42. package/dist/cli/me.js.map +1 -0
  43. package/dist/cli/shell.d.ts +2 -0
  44. package/dist/cli/shell.d.ts.map +1 -0
  45. package/dist/cli/shell.js +22 -0
  46. package/dist/cli/shell.js.map +1 -0
  47. package/dist/cli/task.d.ts +2 -0
  48. package/dist/cli/task.d.ts.map +1 -0
  49. package/dist/cli/task.js +148 -0
  50. package/dist/cli/task.js.map +1 -0
  51. package/dist/cli/tasks.d.ts +2 -0
  52. package/dist/cli/tasks.d.ts.map +1 -0
  53. package/dist/cli/tasks.js +76 -0
  54. package/dist/cli/tasks.js.map +1 -0
  55. package/dist/cli/util.d.ts +46 -0
  56. package/dist/cli/util.d.ts.map +1 -0
  57. package/dist/cli/util.js +134 -0
  58. package/dist/cli/util.js.map +1 -0
  59. package/dist/package.json +56 -0
  60. package/dist/src/client.d.ts +92 -0
  61. package/dist/src/client.d.ts.map +1 -0
  62. package/dist/src/client.js +131 -0
  63. package/dist/src/client.js.map +1 -0
  64. package/dist/src/errors.d.ts +16 -0
  65. package/dist/src/errors.d.ts.map +1 -0
  66. package/dist/src/errors.js +31 -0
  67. package/dist/src/errors.js.map +1 -0
  68. package/dist/src/index.d.ts +7 -0
  69. package/dist/src/index.d.ts.map +1 -0
  70. package/dist/src/index.js +5 -0
  71. package/dist/src/index.js.map +1 -0
  72. package/dist/src/phone.d.ts +124 -0
  73. package/dist/src/phone.d.ts.map +1 -0
  74. package/dist/src/phone.js +129 -0
  75. package/dist/src/phone.js.map +1 -0
  76. package/dist/src/transport.d.ts +14 -0
  77. package/dist/src/transport.d.ts.map +1 -0
  78. package/dist/src/transport.js +71 -0
  79. package/dist/src/transport.js.map +1 -0
  80. package/dist/src/types.d.ts +142 -0
  81. package/dist/src/types.d.ts.map +1 -0
  82. package/dist/src/types.js +2 -0
  83. package/dist/src/types.js.map +1 -0
  84. package/package.json +43 -26
  85. package/dist/index.d.mts +0 -500
  86. package/dist/index.d.ts +0 -500
  87. package/dist/index.js +0 -450
  88. package/dist/index.mjs +0 -418
package/dist/index.d.ts DELETED
@@ -1,500 +0,0 @@
1
- /**
2
- * Auten SDK — HTTP Client
3
- * Fetch-based with retry, error mapping, and rate limit handling.
4
- */
5
- interface ClientConfig {
6
- apiKey: string;
7
- baseUrl: string;
8
- timeout: number;
9
- retries: number;
10
- }
11
- declare class HttpClient {
12
- private config;
13
- constructor(config: ClientConfig);
14
- get<T>(path: string): Promise<T>;
15
- post<T>(path: string, body?: unknown): Promise<T>;
16
- del<T>(path: string): Promise<T | void>;
17
- private request;
18
- private sleep;
19
- }
20
-
21
- /**
22
- * Auten SDK — Type Definitions
23
- */
24
- interface AutenConfig {
25
- /** Your Auten API key (starts with auten_live_ or auten_test_) */
26
- apiKey: string;
27
- /** Base URL for the API. Default: https://auten.ai */
28
- baseUrl?: string;
29
- /** Request timeout in ms. Default: 30000 */
30
- timeout?: number;
31
- /** Number of retries on failure. Default: 3 */
32
- retries?: number;
33
- }
34
- interface Provider {
35
- slug: string;
36
- name: string;
37
- category: string;
38
- icon: string | null;
39
- accountEmail: string | null;
40
- isActive: boolean;
41
- connectedAt: string;
42
- }
43
- interface ProviderCredentials {
44
- provider: string;
45
- accessToken: string;
46
- }
47
- interface ExecuteResult {
48
- provider: string;
49
- action: string;
50
- result: any;
51
- duration?: number;
52
- }
53
- interface AIExecuteResult {
54
- provider: string;
55
- task: string;
56
- plan?: string;
57
- result: any;
58
- callsMade?: number;
59
- learned?: boolean;
60
- cached?: boolean;
61
- duration?: number;
62
- }
63
- interface AIChainStep {
64
- provider: string;
65
- task: string;
66
- status: 'success' | 'failed' | 'skipped';
67
- result?: any;
68
- error?: string;
69
- }
70
- interface AIChainResult {
71
- summary: string;
72
- steps: AIChainStep[];
73
- totalProviders: number;
74
- duration: number;
75
- }
76
- interface Agent {
77
- id: string;
78
- name: string;
79
- description: string | null;
80
- status: string;
81
- isPublished: boolean;
82
- schedule: AgentSchedule | null;
83
- createdAt: string;
84
- updatedAt: string;
85
- }
86
- interface AgentDetail extends Agent {
87
- tools: AgentTool[];
88
- }
89
- interface AgentTool {
90
- name: string;
91
- description: string;
92
- }
93
- interface AgentSchedule {
94
- cron: string;
95
- timezone: string;
96
- enabled: boolean;
97
- nextRunAt: string | null;
98
- }
99
- interface CreateAgentOptions {
100
- name: string;
101
- description?: string;
102
- tools?: Array<{
103
- name: string;
104
- code: string;
105
- description?: string;
106
- }>;
107
- schedule?: {
108
- cron: string;
109
- timezone?: string;
110
- enabled?: boolean;
111
- };
112
- }
113
- interface DeployAgentOptions {
114
- tools: Array<{
115
- name: string;
116
- code: string;
117
- description?: string;
118
- }>;
119
- schedule?: {
120
- cron?: string;
121
- timezone?: string;
122
- enabled?: boolean;
123
- };
124
- }
125
- interface AgentRunResult {
126
- executionId: string;
127
- status: string;
128
- }
129
- interface CreateAgentResult {
130
- id: string;
131
- name: string;
132
- scope: string;
133
- status: string;
134
- toolCount: number;
135
- }
136
- interface DeployResult {
137
- id: string;
138
- deployed: boolean;
139
- tools: string[];
140
- version: string;
141
- }
142
-
143
- /**
144
- * Auten SDK — Provider Client
145
- * Manages provider connections and executes actions.
146
- */
147
-
148
- declare class ProviderClient {
149
- private client;
150
- constructor(client: HttpClient);
151
- /**
152
- * List all connected providers for the authenticated user.
153
- */
154
- list(): Promise<Provider[]>;
155
- /**
156
- * Execute an action on a provider.
157
- *
158
- * @example
159
- * const result = await auten.providers.execute('google-gmail', 'listEmails', { query: 'is:unread' });
160
- */
161
- execute(slug: string, action: string, params?: Record<string, any>): Promise<ExecuteResult>;
162
- /**
163
- * Get a valid access token for a provider.
164
- * Token is automatically refreshed if expired.
165
- *
166
- * @example
167
- * const { accessToken } = await auten.providers.getCredentials('google-gmail');
168
- */
169
- getCredentials(slug: string): Promise<ProviderCredentials>;
170
- }
171
-
172
- /**
173
- * Auten SDK — Agent Client
174
- * Create, deploy, run, and manage agents.
175
- */
176
-
177
- declare class AgentClient {
178
- private client;
179
- constructor(client: HttpClient);
180
- /**
181
- * List all agents for the authenticated user.
182
- */
183
- list(): Promise<Agent[]>;
184
- /**
185
- * Get agent details including tools and schedule.
186
- */
187
- get(id: string): Promise<AgentDetail>;
188
- /**
189
- * Create a new agent.
190
- *
191
- * @example
192
- * const agent = await auten.agents.create({
193
- * name: 'Invoice Processor',
194
- * tools: [{ name: 'process-invoice', code: '...' }],
195
- * schedule: { cron: '0 9 * * *', timezone: 'Europe/Vilnius' },
196
- * });
197
- */
198
- create(options: CreateAgentOptions): Promise<CreateAgentResult>;
199
- /**
200
- * Deploy tools to an existing agent.
201
- * Upserts tool code and updates the agent configuration.
202
- *
203
- * @example
204
- * await auten.agents.deploy('agent-id', {
205
- * tools: [{ name: 'fetch-data', code: '...' }],
206
- * });
207
- */
208
- deploy(id: string, options: DeployAgentOptions): Promise<DeployResult>;
209
- /**
210
- * Trigger an agent run.
211
- *
212
- * @example
213
- * const { executionId } = await auten.agents.run('agent-id', { inputData: '...' });
214
- */
215
- run(id: string, data?: Record<string, any>): Promise<AgentRunResult>;
216
- /**
217
- * Get agent status.
218
- */
219
- status(id: string): Promise<{
220
- status: string;
221
- lastRunAt?: string;
222
- }>;
223
- /**
224
- * Get agent run history.
225
- */
226
- history(id: string): Promise<any[]>;
227
- /**
228
- * Delete an agent and all its knowledge/tools.
229
- */
230
- delete(id: string): Promise<void>;
231
- }
232
-
233
- /**
234
- * Auten SDK — AI Client
235
- * AI-powered provider interactions using natural language.
236
- */
237
-
238
- declare class AIClient {
239
- private client;
240
- constructor(client: HttpClient);
241
- /**
242
- * Execute a task using AI to interpret and call the right provider APIs.
243
- *
244
- * @example
245
- * const result = await auten.ai.execute(
246
- * 'google-sheets',
247
- * 'Find Q1 revenue totals and create a summary row'
248
- * );
249
- *
250
- * @example
251
- * const result = await auten.ai.execute(
252
- * 'zoho-crm',
253
- * 'Find all deals closing this month worth over $10k',
254
- * { currency: 'USD' }
255
- * );
256
- */
257
- execute(provider: string, task: string, context?: Record<string, any>): Promise<AIExecuteResult>;
258
- /**
259
- * Execute a cross-provider task using natural language.
260
- * AI breaks the task into steps, executes each with the right provider,
261
- * and transforms data between them automatically.
262
- *
263
- * @example
264
- * const result = await auten.ai.chain(
265
- * 'Paimk Shopify užsakymus ir sudėk į Google Sheets'
266
- * );
267
- *
268
- * @example
269
- * const result = await auten.ai.chain(
270
- * 'Find Jira bugs from this week, group by severity, and post summary to Slack #dev'
271
- * );
272
- */
273
- chain(task: string, context?: Record<string, any>): Promise<AIChainResult>;
274
- }
275
-
276
- /**
277
- * Auten SDK — Webhooks & Events Client
278
- * Register webhooks, poll events, listen to provider activity.
279
- */
280
-
281
- interface Webhook {
282
- id: string;
283
- event: string;
284
- provider: string | null;
285
- callbackUrl: string;
286
- filter: Record<string, any> | null;
287
- createdAt: string;
288
- }
289
- interface RegisterWebhookOptions {
290
- /** Event to listen for (e.g., "slack:message", "gmail:new_email", "*") */
291
- event: string;
292
- /** Your callback URL that will receive POST requests */
293
- callbackUrl: string;
294
- /** Filter to specific provider (optional) */
295
- provider?: string;
296
- /** Filter by event data fields (optional) */
297
- filter?: Record<string, any>;
298
- }
299
- interface SdkEvent {
300
- id: string;
301
- event: string;
302
- data: any;
303
- provider: string | null;
304
- timestamp: string;
305
- }
306
- interface PollResult {
307
- events: SdkEvent[];
308
- count: number;
309
- since: string;
310
- }
311
- declare class WebhookClient {
312
- private client;
313
- constructor(client: HttpClient);
314
- /**
315
- * List all registered webhooks.
316
- */
317
- list(): Promise<Webhook[]>;
318
- /**
319
- * Register a webhook to receive provider events.
320
- *
321
- * @example
322
- * await auten.webhooks.register({
323
- * event: 'slack:message:thread',
324
- * callbackUrl: 'https://myapp.com/api/auten-webhook',
325
- * provider: 'slack',
326
- * });
327
- */
328
- register(options: RegisterWebhookOptions): Promise<Webhook>;
329
- /**
330
- * Delete a webhook.
331
- */
332
- delete(id: string): Promise<void>;
333
- }
334
- declare class EventClient {
335
- private client;
336
- constructor(client: HttpClient);
337
- /**
338
- * Poll for new events since a timestamp.
339
- * Alternative to webhooks for serverless environments.
340
- *
341
- * @example
342
- * const { events } = await auten.events.poll({
343
- * since: new Date(Date.now() - 60000).toISOString(), // last minute
344
- * provider: 'slack',
345
- * });
346
- */
347
- poll(options?: {
348
- since?: string;
349
- provider?: string;
350
- limit?: number;
351
- }): Promise<PollResult>;
352
- }
353
-
354
- /**
355
- * Auten SDK — Conversations Client
356
- *
357
- * Create Slack ↔ Email conversation bridges with one API call.
358
- * Auten handles everything: AI email generation, thread tracking,
359
- * email replies back to Slack thread.
360
- */
361
-
362
- interface CreateConversationOptions {
363
- /** Customer's name */
364
- customerName: string;
365
- /** Customer's email */
366
- customerEmail: string;
367
- /** Customer's phone (optional) */
368
- customerPhone?: string;
369
- /** Subject or topic */
370
- subject?: string;
371
- /** Initial message from the customer */
372
- message: string;
373
- /** Slack channel to post to (default: #general) */
374
- channel?: string;
375
- /** Your brand/company name (used in AI-generated emails) */
376
- brandName?: string;
377
- /** Email signature (used in AI-generated emails) */
378
- brandSignOff?: string;
379
- }
380
- interface Conversation {
381
- conversationId: string;
382
- customerName: string;
383
- customerEmail: string;
384
- subject: string | null;
385
- status: 'new' | 'open' | 'replied' | 'closed';
386
- messageCount: number;
387
- createdAt: string;
388
- updatedAt: string;
389
- }
390
- interface ConversationCreated {
391
- conversationId: string;
392
- slackChannel: string;
393
- slackThreadTs: string;
394
- customerEmail: string;
395
- status: string;
396
- message: string;
397
- }
398
- declare class ConversationClient {
399
- private client;
400
- constructor(client: HttpClient);
401
- /**
402
- * Create a new conversation bridge.
403
- *
404
- * This posts to Slack and sets up the full bridge:
405
- * - You reply in Slack thread → AI generates professional email → sends to customer
406
- * - Customer replies to email → appears in Slack thread
407
- * - Repeat — full conversation via Slack
408
- *
409
- * @example
410
- * // From a contact form handler:
411
- * const conv = await auten.conversations.create({
412
- * customerName: 'Jonas Jonaitis',
413
- * customerEmail: 'jonas@test.lt',
414
- * message: 'Norėčiau sužinoti apie jūsų paslaugas',
415
- * channel: '#sales',
416
- * brandName: 'My Company',
417
- * brandSignOff: 'Pagarbiai,\nMy Company komanda\n+370 600 00000',
418
- * });
419
- * // That's it. Reply in Slack — AI handles the rest.
420
- */
421
- create(options: CreateConversationOptions): Promise<ConversationCreated>;
422
- /**
423
- * List all conversations.
424
- */
425
- list(): Promise<Conversation[]>;
426
- }
427
-
428
- /**
429
- * Auten SDK — Error Classes
430
- */
431
- declare class AutenError extends Error {
432
- constructor(message: string);
433
- }
434
- declare class AutenApiError extends AutenError {
435
- readonly code: string;
436
- readonly statusCode: number;
437
- readonly details: unknown;
438
- constructor(code: string, message: string, statusCode: number, details?: unknown);
439
- }
440
- declare class AutenAuthError extends AutenApiError {
441
- constructor(message: string, code?: string);
442
- }
443
- declare class AutenRateLimitError extends AutenApiError {
444
- readonly retryAfter: number;
445
- constructor(message: string, retryAfter: number);
446
- }
447
- declare class AutenNotFoundError extends AutenApiError {
448
- constructor(message: string);
449
- }
450
-
451
- /**
452
- * Auten.ai SDK v0.3.0
453
- *
454
- * AI-native integrations with managed OAuth, event-driven webhooks,
455
- * and per-user learning.
456
- *
457
- * @example
458
- * ```typescript
459
- * import { Auten } from '@autenai/sdk';
460
- *
461
- * const auten = new Auten({ apiKey: 'auten_live_...' });
462
- *
463
- * // List connected providers
464
- * const providers = await auten.providers.list();
465
- *
466
- * // AI-powered execution
467
- * const result = await auten.ai.execute('gmail', 'Find unread emails');
468
- *
469
- * // Cross-provider chain
470
- * await auten.ai.chain('Get Gmail emails and post summary to Slack #general');
471
- *
472
- * // Register webhook for real-time events
473
- * await auten.webhooks.register({
474
- * event: 'slack:message',
475
- * callbackUrl: 'https://myapp.com/api/webhook',
476
- * });
477
- *
478
- * // Or poll for events
479
- * const { events } = await auten.events.poll({ since: lastCheck });
480
- * ```
481
- */
482
-
483
- declare class Auten {
484
- /** Provider connections and execution */
485
- readonly providers: ProviderClient;
486
- /** Agent management */
487
- readonly agents: AgentClient;
488
- /** AI-powered execution */
489
- readonly ai: AIClient;
490
- /** Webhook registration */
491
- readonly webhooks: WebhookClient;
492
- /** Event polling */
493
- readonly events: EventClient;
494
- /** Conversation bridges (Slack ↔ Email) */
495
- readonly conversations: ConversationClient;
496
- private readonly client;
497
- constructor(config: AutenConfig);
498
- }
499
-
500
- export { type AIChainResult, type AIChainStep, type AIExecuteResult, type Agent, type AgentDetail, type AgentRunResult, type AgentSchedule, type AgentTool, Auten, AutenApiError, AutenAuthError, type AutenConfig, AutenError, AutenNotFoundError, AutenRateLimitError, type Conversation, type ConversationCreated, type CreateAgentOptions, type CreateAgentResult, type CreateConversationOptions, type DeployAgentOptions, type DeployResult, type ExecuteResult, type PollResult, type Provider, type ProviderCredentials, type RegisterWebhookOptions, type SdkEvent, type Webhook };