@autenai/sdk 0.2.0 → 0.3.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 CHANGED
@@ -273,6 +273,84 @@ 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
+
276
354
  /**
277
355
  * Auten SDK — Error Classes
278
356
  */
@@ -297,9 +375,10 @@ declare class AutenNotFoundError extends AutenApiError {
297
375
  }
298
376
 
299
377
  /**
300
- * Auten.ai SDK
378
+ * Auten.ai SDK v0.3.0
301
379
  *
302
- * AI-native integrations with managed OAuth.
380
+ * AI-native integrations with managed OAuth, event-driven webhooks,
381
+ * and per-user learning.
303
382
  *
304
383
  * @example
305
384
  * ```typescript
@@ -310,20 +389,20 @@ declare class AutenNotFoundError extends AutenApiError {
310
389
  * // List connected providers
311
390
  * const providers = await auten.providers.list();
312
391
  *
313
- * // Execute provider action
314
- * const emails = await auten.providers.execute('google-gmail', 'listEmails', {
315
- * query: 'is:unread',
316
- * });
317
- *
318
392
  * // AI-powered execution
319
- * const result = await auten.ai.execute(
320
- * 'google-sheets',
321
- * 'Find Q1 revenue totals'
322
- * );
393
+ * const result = await auten.ai.execute('gmail', 'Find unread emails');
394
+ *
395
+ * // Cross-provider chain
396
+ * await auten.ai.chain('Get Gmail emails and post summary to Slack #general');
397
+ *
398
+ * // Register webhook for real-time events
399
+ * await auten.webhooks.register({
400
+ * event: 'slack:message',
401
+ * callbackUrl: 'https://myapp.com/api/webhook',
402
+ * });
323
403
  *
324
- * // Manage agents
325
- * const agents = await auten.agents.list();
326
- * await auten.agents.run('agent-id');
404
+ * // Or poll for events
405
+ * const { events } = await auten.events.poll({ since: lastCheck });
327
406
  * ```
328
407
  */
329
408
 
@@ -334,8 +413,12 @@ declare class Auten {
334
413
  readonly agents: AgentClient;
335
414
  /** AI-powered execution */
336
415
  readonly ai: AIClient;
416
+ /** Webhook registration */
417
+ readonly webhooks: WebhookClient;
418
+ /** Event polling */
419
+ readonly events: EventClient;
337
420
  private readonly client;
338
421
  constructor(config: AutenConfig);
339
422
  }
340
423
 
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 };
424
+ 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 PollResult, type Provider, type ProviderCredentials, type RegisterWebhookOptions, type SdkEvent, type Webhook };
package/dist/index.d.ts CHANGED
@@ -273,6 +273,84 @@ 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
+
276
354
  /**
277
355
  * Auten SDK — Error Classes
278
356
  */
@@ -297,9 +375,10 @@ declare class AutenNotFoundError extends AutenApiError {
297
375
  }
298
376
 
299
377
  /**
300
- * Auten.ai SDK
378
+ * Auten.ai SDK v0.3.0
301
379
  *
302
- * AI-native integrations with managed OAuth.
380
+ * AI-native integrations with managed OAuth, event-driven webhooks,
381
+ * and per-user learning.
303
382
  *
304
383
  * @example
305
384
  * ```typescript
@@ -310,20 +389,20 @@ declare class AutenNotFoundError extends AutenApiError {
310
389
  * // List connected providers
311
390
  * const providers = await auten.providers.list();
312
391
  *
313
- * // Execute provider action
314
- * const emails = await auten.providers.execute('google-gmail', 'listEmails', {
315
- * query: 'is:unread',
316
- * });
317
- *
318
392
  * // AI-powered execution
319
- * const result = await auten.ai.execute(
320
- * 'google-sheets',
321
- * 'Find Q1 revenue totals'
322
- * );
393
+ * const result = await auten.ai.execute('gmail', 'Find unread emails');
394
+ *
395
+ * // Cross-provider chain
396
+ * await auten.ai.chain('Get Gmail emails and post summary to Slack #general');
397
+ *
398
+ * // Register webhook for real-time events
399
+ * await auten.webhooks.register({
400
+ * event: 'slack:message',
401
+ * callbackUrl: 'https://myapp.com/api/webhook',
402
+ * });
323
403
  *
324
- * // Manage agents
325
- * const agents = await auten.agents.list();
326
- * await auten.agents.run('agent-id');
404
+ * // Or poll for events
405
+ * const { events } = await auten.events.poll({ since: lastCheck });
327
406
  * ```
328
407
  */
329
408
 
@@ -334,8 +413,12 @@ declare class Auten {
334
413
  readonly agents: AgentClient;
335
414
  /** AI-powered execution */
336
415
  readonly ai: AIClient;
416
+ /** Webhook registration */
417
+ readonly webhooks: WebhookClient;
418
+ /** Event polling */
419
+ readonly events: EventClient;
337
420
  private readonly client;
338
421
  constructor(config: AutenConfig);
339
422
  }
340
423
 
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 };
424
+ 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 PollResult, type Provider, type ProviderCredentials, type RegisterWebhookOptions, type SdkEvent, type Webhook };
package/dist/index.js CHANGED
@@ -312,6 +312,61 @@ 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
+
315
370
  // src/index.ts
316
371
  var DEFAULT_BASE_URL = "https://auten.ai";
317
372
  var DEFAULT_TIMEOUT = 3e4;
@@ -323,6 +378,10 @@ var Auten = class {
323
378
  agents;
324
379
  /** AI-powered execution */
325
380
  ai;
381
+ /** Webhook registration */
382
+ webhooks;
383
+ /** Event polling */
384
+ events;
326
385
  client;
327
386
  constructor(config) {
328
387
  if (!config.apiKey) {
@@ -337,6 +396,8 @@ var Auten = class {
337
396
  this.providers = new ProviderClient(this.client);
338
397
  this.agents = new AgentClient(this.client);
339
398
  this.ai = new AIClient(this.client);
399
+ this.webhooks = new WebhookClient(this.client);
400
+ this.events = new EventClient(this.client);
340
401
  }
341
402
  };
342
403
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -281,6 +281,61 @@ 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
+
284
339
  // src/index.ts
285
340
  var DEFAULT_BASE_URL = "https://auten.ai";
286
341
  var DEFAULT_TIMEOUT = 3e4;
@@ -292,6 +347,10 @@ var Auten = class {
292
347
  agents;
293
348
  /** AI-powered execution */
294
349
  ai;
350
+ /** Webhook registration */
351
+ webhooks;
352
+ /** Event polling */
353
+ events;
295
354
  client;
296
355
  constructor(config) {
297
356
  if (!config.apiKey) {
@@ -306,6 +365,8 @@ var Auten = class {
306
365
  this.providers = new ProviderClient(this.client);
307
366
  this.agents = new AgentClient(this.client);
308
367
  this.ai = new AIClient(this.client);
368
+ this.webhooks = new WebhookClient(this.client);
369
+ this.events = new EventClient(this.client);
309
370
  }
310
371
  };
311
372
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autenai/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Auten.ai SDK — AI-native integrations with managed OAuth",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",