@autenai/sdk 0.2.0 → 0.4.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.
- package/dist/index.d.mts +174 -15
- package/dist/index.d.ts +174 -15
- package/dist/index.js +100 -0
- package/dist/index.mjs +100 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -273,6 +273,158 @@ declare class AIClient {
|
|
|
273
273
|
chain(task: string, context?: Record<string, any>): Promise<AIChainResult>;
|
|
274
274
|
}
|
|
275
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
|
+
|
|
276
428
|
/**
|
|
277
429
|
* Auten SDK — Error Classes
|
|
278
430
|
*/
|
|
@@ -297,9 +449,10 @@ declare class AutenNotFoundError extends AutenApiError {
|
|
|
297
449
|
}
|
|
298
450
|
|
|
299
451
|
/**
|
|
300
|
-
* Auten.ai SDK
|
|
452
|
+
* Auten.ai SDK v0.3.0
|
|
301
453
|
*
|
|
302
|
-
* AI-native integrations with managed OAuth
|
|
454
|
+
* AI-native integrations with managed OAuth, event-driven webhooks,
|
|
455
|
+
* and per-user learning.
|
|
303
456
|
*
|
|
304
457
|
* @example
|
|
305
458
|
* ```typescript
|
|
@@ -310,20 +463,20 @@ declare class AutenNotFoundError extends AutenApiError {
|
|
|
310
463
|
* // List connected providers
|
|
311
464
|
* const providers = await auten.providers.list();
|
|
312
465
|
*
|
|
313
|
-
* // Execute provider action
|
|
314
|
-
* const emails = await auten.providers.execute('google-gmail', 'listEmails', {
|
|
315
|
-
* query: 'is:unread',
|
|
316
|
-
* });
|
|
317
|
-
*
|
|
318
466
|
* // AI-powered execution
|
|
319
|
-
* const result = await auten.ai.execute(
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
* );
|
|
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
|
+
* });
|
|
323
477
|
*
|
|
324
|
-
* //
|
|
325
|
-
* const
|
|
326
|
-
* await auten.agents.run('agent-id');
|
|
478
|
+
* // Or poll for events
|
|
479
|
+
* const { events } = await auten.events.poll({ since: lastCheck });
|
|
327
480
|
* ```
|
|
328
481
|
*/
|
|
329
482
|
|
|
@@ -334,8 +487,14 @@ declare class Auten {
|
|
|
334
487
|
readonly agents: AgentClient;
|
|
335
488
|
/** AI-powered execution */
|
|
336
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;
|
|
337
496
|
private readonly client;
|
|
338
497
|
constructor(config: AutenConfig);
|
|
339
498
|
}
|
|
340
499
|
|
|
341
|
-
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 CreateAgentOptions, type CreateAgentResult, type DeployAgentOptions, type DeployResult, type ExecuteResult, type Provider, type ProviderCredentials };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -273,6 +273,158 @@ declare class AIClient {
|
|
|
273
273
|
chain(task: string, context?: Record<string, any>): Promise<AIChainResult>;
|
|
274
274
|
}
|
|
275
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
|
+
|
|
276
428
|
/**
|
|
277
429
|
* Auten SDK — Error Classes
|
|
278
430
|
*/
|
|
@@ -297,9 +449,10 @@ declare class AutenNotFoundError extends AutenApiError {
|
|
|
297
449
|
}
|
|
298
450
|
|
|
299
451
|
/**
|
|
300
|
-
* Auten.ai SDK
|
|
452
|
+
* Auten.ai SDK v0.3.0
|
|
301
453
|
*
|
|
302
|
-
* AI-native integrations with managed OAuth
|
|
454
|
+
* AI-native integrations with managed OAuth, event-driven webhooks,
|
|
455
|
+
* and per-user learning.
|
|
303
456
|
*
|
|
304
457
|
* @example
|
|
305
458
|
* ```typescript
|
|
@@ -310,20 +463,20 @@ declare class AutenNotFoundError extends AutenApiError {
|
|
|
310
463
|
* // List connected providers
|
|
311
464
|
* const providers = await auten.providers.list();
|
|
312
465
|
*
|
|
313
|
-
* // Execute provider action
|
|
314
|
-
* const emails = await auten.providers.execute('google-gmail', 'listEmails', {
|
|
315
|
-
* query: 'is:unread',
|
|
316
|
-
* });
|
|
317
|
-
*
|
|
318
466
|
* // AI-powered execution
|
|
319
|
-
* const result = await auten.ai.execute(
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
* );
|
|
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
|
+
* });
|
|
323
477
|
*
|
|
324
|
-
* //
|
|
325
|
-
* const
|
|
326
|
-
* await auten.agents.run('agent-id');
|
|
478
|
+
* // Or poll for events
|
|
479
|
+
* const { events } = await auten.events.poll({ since: lastCheck });
|
|
327
480
|
* ```
|
|
328
481
|
*/
|
|
329
482
|
|
|
@@ -334,8 +487,14 @@ declare class Auten {
|
|
|
334
487
|
readonly agents: AgentClient;
|
|
335
488
|
/** AI-powered execution */
|
|
336
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;
|
|
337
496
|
private readonly client;
|
|
338
497
|
constructor(config: AutenConfig);
|
|
339
498
|
}
|
|
340
499
|
|
|
341
|
-
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 CreateAgentOptions, type CreateAgentResult, type DeployAgentOptions, type DeployResult, type ExecuteResult, type Provider, type ProviderCredentials };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -312,6 +312,97 @@ var AIClient = class {
|
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
314
|
|
|
315
|
+
// src/webhooks.ts
|
|
316
|
+
var WebhookClient = class {
|
|
317
|
+
constructor(client) {
|
|
318
|
+
this.client = client;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* List all registered webhooks.
|
|
322
|
+
*/
|
|
323
|
+
async list() {
|
|
324
|
+
return this.client.get("/api/v1/sdk/webhooks");
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Register a webhook to receive provider events.
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* await auten.webhooks.register({
|
|
331
|
+
* event: 'slack:message:thread',
|
|
332
|
+
* callbackUrl: 'https://myapp.com/api/auten-webhook',
|
|
333
|
+
* provider: 'slack',
|
|
334
|
+
* });
|
|
335
|
+
*/
|
|
336
|
+
async register(options) {
|
|
337
|
+
return this.client.post("/api/v1/sdk/webhooks", options);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Delete a webhook.
|
|
341
|
+
*/
|
|
342
|
+
async delete(id) {
|
|
343
|
+
await this.client.del(`/api/v1/sdk/webhooks?id=${id}`);
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
var EventClient = class {
|
|
347
|
+
constructor(client) {
|
|
348
|
+
this.client = client;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Poll for new events since a timestamp.
|
|
352
|
+
* Alternative to webhooks for serverless environments.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* const { events } = await auten.events.poll({
|
|
356
|
+
* since: new Date(Date.now() - 60000).toISOString(), // last minute
|
|
357
|
+
* provider: 'slack',
|
|
358
|
+
* });
|
|
359
|
+
*/
|
|
360
|
+
async poll(options) {
|
|
361
|
+
const params = new URLSearchParams();
|
|
362
|
+
if (options?.since) params.set("since", options.since);
|
|
363
|
+
if (options?.provider) params.set("provider", options.provider);
|
|
364
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
365
|
+
const query = params.toString();
|
|
366
|
+
return this.client.get(`/api/v1/sdk/events${query ? "?" + query : ""}`);
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
// src/conversations.ts
|
|
371
|
+
var ConversationClient = class {
|
|
372
|
+
constructor(client) {
|
|
373
|
+
this.client = client;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Create a new conversation bridge.
|
|
377
|
+
*
|
|
378
|
+
* This posts to Slack and sets up the full bridge:
|
|
379
|
+
* - You reply in Slack thread → AI generates professional email → sends to customer
|
|
380
|
+
* - Customer replies to email → appears in Slack thread
|
|
381
|
+
* - Repeat — full conversation via Slack
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* // From a contact form handler:
|
|
385
|
+
* const conv = await auten.conversations.create({
|
|
386
|
+
* customerName: 'Jonas Jonaitis',
|
|
387
|
+
* customerEmail: 'jonas@test.lt',
|
|
388
|
+
* message: 'Norėčiau sužinoti apie jūsų paslaugas',
|
|
389
|
+
* channel: '#sales',
|
|
390
|
+
* brandName: 'My Company',
|
|
391
|
+
* brandSignOff: 'Pagarbiai,\nMy Company komanda\n+370 600 00000',
|
|
392
|
+
* });
|
|
393
|
+
* // That's it. Reply in Slack — AI handles the rest.
|
|
394
|
+
*/
|
|
395
|
+
async create(options) {
|
|
396
|
+
return this.client.post("/api/v1/sdk/conversations", options);
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* List all conversations.
|
|
400
|
+
*/
|
|
401
|
+
async list() {
|
|
402
|
+
return this.client.get("/api/v1/sdk/conversations");
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
|
|
315
406
|
// src/index.ts
|
|
316
407
|
var DEFAULT_BASE_URL = "https://auten.ai";
|
|
317
408
|
var DEFAULT_TIMEOUT = 3e4;
|
|
@@ -323,6 +414,12 @@ var Auten = class {
|
|
|
323
414
|
agents;
|
|
324
415
|
/** AI-powered execution */
|
|
325
416
|
ai;
|
|
417
|
+
/** Webhook registration */
|
|
418
|
+
webhooks;
|
|
419
|
+
/** Event polling */
|
|
420
|
+
events;
|
|
421
|
+
/** Conversation bridges (Slack ↔ Email) */
|
|
422
|
+
conversations;
|
|
326
423
|
client;
|
|
327
424
|
constructor(config) {
|
|
328
425
|
if (!config.apiKey) {
|
|
@@ -337,6 +434,9 @@ var Auten = class {
|
|
|
337
434
|
this.providers = new ProviderClient(this.client);
|
|
338
435
|
this.agents = new AgentClient(this.client);
|
|
339
436
|
this.ai = new AIClient(this.client);
|
|
437
|
+
this.webhooks = new WebhookClient(this.client);
|
|
438
|
+
this.events = new EventClient(this.client);
|
|
439
|
+
this.conversations = new ConversationClient(this.client);
|
|
340
440
|
}
|
|
341
441
|
};
|
|
342
442
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -281,6 +281,97 @@ var AIClient = class {
|
|
|
281
281
|
}
|
|
282
282
|
};
|
|
283
283
|
|
|
284
|
+
// src/webhooks.ts
|
|
285
|
+
var WebhookClient = class {
|
|
286
|
+
constructor(client) {
|
|
287
|
+
this.client = client;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* List all registered webhooks.
|
|
291
|
+
*/
|
|
292
|
+
async list() {
|
|
293
|
+
return this.client.get("/api/v1/sdk/webhooks");
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Register a webhook to receive provider events.
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* await auten.webhooks.register({
|
|
300
|
+
* event: 'slack:message:thread',
|
|
301
|
+
* callbackUrl: 'https://myapp.com/api/auten-webhook',
|
|
302
|
+
* provider: 'slack',
|
|
303
|
+
* });
|
|
304
|
+
*/
|
|
305
|
+
async register(options) {
|
|
306
|
+
return this.client.post("/api/v1/sdk/webhooks", options);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Delete a webhook.
|
|
310
|
+
*/
|
|
311
|
+
async delete(id) {
|
|
312
|
+
await this.client.del(`/api/v1/sdk/webhooks?id=${id}`);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
var EventClient = class {
|
|
316
|
+
constructor(client) {
|
|
317
|
+
this.client = client;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Poll for new events since a timestamp.
|
|
321
|
+
* Alternative to webhooks for serverless environments.
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* const { events } = await auten.events.poll({
|
|
325
|
+
* since: new Date(Date.now() - 60000).toISOString(), // last minute
|
|
326
|
+
* provider: 'slack',
|
|
327
|
+
* });
|
|
328
|
+
*/
|
|
329
|
+
async poll(options) {
|
|
330
|
+
const params = new URLSearchParams();
|
|
331
|
+
if (options?.since) params.set("since", options.since);
|
|
332
|
+
if (options?.provider) params.set("provider", options.provider);
|
|
333
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
334
|
+
const query = params.toString();
|
|
335
|
+
return this.client.get(`/api/v1/sdk/events${query ? "?" + query : ""}`);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
// src/conversations.ts
|
|
340
|
+
var ConversationClient = class {
|
|
341
|
+
constructor(client) {
|
|
342
|
+
this.client = client;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Create a new conversation bridge.
|
|
346
|
+
*
|
|
347
|
+
* This posts to Slack and sets up the full bridge:
|
|
348
|
+
* - You reply in Slack thread → AI generates professional email → sends to customer
|
|
349
|
+
* - Customer replies to email → appears in Slack thread
|
|
350
|
+
* - Repeat — full conversation via Slack
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* // From a contact form handler:
|
|
354
|
+
* const conv = await auten.conversations.create({
|
|
355
|
+
* customerName: 'Jonas Jonaitis',
|
|
356
|
+
* customerEmail: 'jonas@test.lt',
|
|
357
|
+
* message: 'Norėčiau sužinoti apie jūsų paslaugas',
|
|
358
|
+
* channel: '#sales',
|
|
359
|
+
* brandName: 'My Company',
|
|
360
|
+
* brandSignOff: 'Pagarbiai,\nMy Company komanda\n+370 600 00000',
|
|
361
|
+
* });
|
|
362
|
+
* // That's it. Reply in Slack — AI handles the rest.
|
|
363
|
+
*/
|
|
364
|
+
async create(options) {
|
|
365
|
+
return this.client.post("/api/v1/sdk/conversations", options);
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* List all conversations.
|
|
369
|
+
*/
|
|
370
|
+
async list() {
|
|
371
|
+
return this.client.get("/api/v1/sdk/conversations");
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
|
|
284
375
|
// src/index.ts
|
|
285
376
|
var DEFAULT_BASE_URL = "https://auten.ai";
|
|
286
377
|
var DEFAULT_TIMEOUT = 3e4;
|
|
@@ -292,6 +383,12 @@ var Auten = class {
|
|
|
292
383
|
agents;
|
|
293
384
|
/** AI-powered execution */
|
|
294
385
|
ai;
|
|
386
|
+
/** Webhook registration */
|
|
387
|
+
webhooks;
|
|
388
|
+
/** Event polling */
|
|
389
|
+
events;
|
|
390
|
+
/** Conversation bridges (Slack ↔ Email) */
|
|
391
|
+
conversations;
|
|
295
392
|
client;
|
|
296
393
|
constructor(config) {
|
|
297
394
|
if (!config.apiKey) {
|
|
@@ -306,6 +403,9 @@ var Auten = class {
|
|
|
306
403
|
this.providers = new ProviderClient(this.client);
|
|
307
404
|
this.agents = new AgentClient(this.client);
|
|
308
405
|
this.ai = new AIClient(this.client);
|
|
406
|
+
this.webhooks = new WebhookClient(this.client);
|
|
407
|
+
this.events = new EventClient(this.client);
|
|
408
|
+
this.conversations = new ConversationClient(this.client);
|
|
309
409
|
}
|
|
310
410
|
};
|
|
311
411
|
export {
|