@autenai/sdk 0.1.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
@@ -53,9 +53,26 @@ interface ExecuteResult {
53
53
  interface AIExecuteResult {
54
54
  provider: string;
55
55
  task: string;
56
+ plan?: string;
56
57
  result: any;
58
+ callsMade?: number;
59
+ learned?: boolean;
60
+ cached?: boolean;
57
61
  duration?: number;
58
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
+ }
59
76
  interface Agent {
60
77
  id: string;
61
78
  name: string;
@@ -238,6 +255,100 @@ declare class AIClient {
238
255
  * );
239
256
  */
240
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>;
241
352
  }
242
353
 
243
354
  /**
@@ -264,9 +375,10 @@ declare class AutenNotFoundError extends AutenApiError {
264
375
  }
265
376
 
266
377
  /**
267
- * Auten.ai SDK
378
+ * Auten.ai SDK v0.3.0
268
379
  *
269
- * AI-native integrations with managed OAuth.
380
+ * AI-native integrations with managed OAuth, event-driven webhooks,
381
+ * and per-user learning.
270
382
  *
271
383
  * @example
272
384
  * ```typescript
@@ -277,20 +389,20 @@ declare class AutenNotFoundError extends AutenApiError {
277
389
  * // List connected providers
278
390
  * const providers = await auten.providers.list();
279
391
  *
280
- * // Execute provider action
281
- * const emails = await auten.providers.execute('google-gmail', 'listEmails', {
282
- * query: 'is:unread',
283
- * });
284
- *
285
392
  * // AI-powered execution
286
- * const result = await auten.ai.execute(
287
- * 'google-sheets',
288
- * 'Find Q1 revenue totals'
289
- * );
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
+ * });
290
403
  *
291
- * // Manage agents
292
- * const agents = await auten.agents.list();
293
- * await auten.agents.run('agent-id');
404
+ * // Or poll for events
405
+ * const { events } = await auten.events.poll({ since: lastCheck });
294
406
  * ```
295
407
  */
296
408
 
@@ -301,8 +413,12 @@ declare class Auten {
301
413
  readonly agents: AgentClient;
302
414
  /** AI-powered execution */
303
415
  readonly ai: AIClient;
416
+ /** Webhook registration */
417
+ readonly webhooks: WebhookClient;
418
+ /** Event polling */
419
+ readonly events: EventClient;
304
420
  private readonly client;
305
421
  constructor(config: AutenConfig);
306
422
  }
307
423
 
308
- export { 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
@@ -53,9 +53,26 @@ interface ExecuteResult {
53
53
  interface AIExecuteResult {
54
54
  provider: string;
55
55
  task: string;
56
+ plan?: string;
56
57
  result: any;
58
+ callsMade?: number;
59
+ learned?: boolean;
60
+ cached?: boolean;
57
61
  duration?: number;
58
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
+ }
59
76
  interface Agent {
60
77
  id: string;
61
78
  name: string;
@@ -238,6 +255,100 @@ declare class AIClient {
238
255
  * );
239
256
  */
240
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>;
241
352
  }
242
353
 
243
354
  /**
@@ -264,9 +375,10 @@ declare class AutenNotFoundError extends AutenApiError {
264
375
  }
265
376
 
266
377
  /**
267
- * Auten.ai SDK
378
+ * Auten.ai SDK v0.3.0
268
379
  *
269
- * AI-native integrations with managed OAuth.
380
+ * AI-native integrations with managed OAuth, event-driven webhooks,
381
+ * and per-user learning.
270
382
  *
271
383
  * @example
272
384
  * ```typescript
@@ -277,20 +389,20 @@ declare class AutenNotFoundError extends AutenApiError {
277
389
  * // List connected providers
278
390
  * const providers = await auten.providers.list();
279
391
  *
280
- * // Execute provider action
281
- * const emails = await auten.providers.execute('google-gmail', 'listEmails', {
282
- * query: 'is:unread',
283
- * });
284
- *
285
392
  * // AI-powered execution
286
- * const result = await auten.ai.execute(
287
- * 'google-sheets',
288
- * 'Find Q1 revenue totals'
289
- * );
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
+ * });
290
403
  *
291
- * // Manage agents
292
- * const agents = await auten.agents.list();
293
- * await auten.agents.run('agent-id');
404
+ * // Or poll for events
405
+ * const { events } = await auten.events.poll({ since: lastCheck });
294
406
  * ```
295
407
  */
296
408
 
@@ -301,8 +413,12 @@ declare class Auten {
301
413
  readonly agents: AgentClient;
302
414
  /** AI-powered execution */
303
415
  readonly ai: AIClient;
416
+ /** Webhook registration */
417
+ readonly webhooks: WebhookClient;
418
+ /** Event polling */
419
+ readonly events: EventClient;
304
420
  private readonly client;
305
421
  constructor(config: AutenConfig);
306
422
  }
307
423
 
308
- export { 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
@@ -289,6 +289,82 @@ var AIClient = class {
289
289
  context
290
290
  });
291
291
  }
292
+ /**
293
+ * Execute a cross-provider task using natural language.
294
+ * AI breaks the task into steps, executes each with the right provider,
295
+ * and transforms data between them automatically.
296
+ *
297
+ * @example
298
+ * const result = await auten.ai.chain(
299
+ * 'Paimk Shopify užsakymus ir sudėk į Google Sheets'
300
+ * );
301
+ *
302
+ * @example
303
+ * const result = await auten.ai.chain(
304
+ * 'Find Jira bugs from this week, group by severity, and post summary to Slack #dev'
305
+ * );
306
+ */
307
+ async chain(task, context) {
308
+ return this.client.post("/api/v1/sdk/ai/chain", {
309
+ task,
310
+ context
311
+ });
312
+ }
313
+ };
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
+ }
292
368
  };
293
369
 
294
370
  // src/index.ts
@@ -302,6 +378,10 @@ var Auten = class {
302
378
  agents;
303
379
  /** AI-powered execution */
304
380
  ai;
381
+ /** Webhook registration */
382
+ webhooks;
383
+ /** Event polling */
384
+ events;
305
385
  client;
306
386
  constructor(config) {
307
387
  if (!config.apiKey) {
@@ -316,6 +396,8 @@ var Auten = class {
316
396
  this.providers = new ProviderClient(this.client);
317
397
  this.agents = new AgentClient(this.client);
318
398
  this.ai = new AIClient(this.client);
399
+ this.webhooks = new WebhookClient(this.client);
400
+ this.events = new EventClient(this.client);
319
401
  }
320
402
  };
321
403
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -258,6 +258,82 @@ var AIClient = class {
258
258
  context
259
259
  });
260
260
  }
261
+ /**
262
+ * Execute a cross-provider task using natural language.
263
+ * AI breaks the task into steps, executes each with the right provider,
264
+ * and transforms data between them automatically.
265
+ *
266
+ * @example
267
+ * const result = await auten.ai.chain(
268
+ * 'Paimk Shopify užsakymus ir sudėk į Google Sheets'
269
+ * );
270
+ *
271
+ * @example
272
+ * const result = await auten.ai.chain(
273
+ * 'Find Jira bugs from this week, group by severity, and post summary to Slack #dev'
274
+ * );
275
+ */
276
+ async chain(task, context) {
277
+ return this.client.post("/api/v1/sdk/ai/chain", {
278
+ task,
279
+ context
280
+ });
281
+ }
282
+ };
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
+ }
261
337
  };
262
338
 
263
339
  // src/index.ts
@@ -271,6 +347,10 @@ var Auten = class {
271
347
  agents;
272
348
  /** AI-powered execution */
273
349
  ai;
350
+ /** Webhook registration */
351
+ webhooks;
352
+ /** Event polling */
353
+ events;
274
354
  client;
275
355
  constructor(config) {
276
356
  if (!config.apiKey) {
@@ -285,6 +365,8 @@ var Auten = class {
285
365
  this.providers = new ProviderClient(this.client);
286
366
  this.agents = new AgentClient(this.client);
287
367
  this.ai = new AIClient(this.client);
368
+ this.webhooks = new WebhookClient(this.client);
369
+ this.events = new EventClient(this.client);
288
370
  }
289
371
  };
290
372
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autenai/sdk",
3
- "version": "0.1.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",