@autenai/sdk 0.4.0 → 0.5.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/README.md +154 -0
- package/bin/auten.js +2 -0
- package/dist/cli/add-phone.d.ts +2 -0
- package/dist/cli/add-phone.d.ts.map +1 -0
- package/dist/cli/add-phone.js +254 -0
- package/dist/cli/add-phone.js.map +1 -0
- package/dist/cli/autocomplete.d.ts +31 -0
- package/dist/cli/autocomplete.d.ts.map +1 -0
- package/dist/cli/autocomplete.js +438 -0
- package/dist/cli/autocomplete.js.map +1 -0
- package/dist/cli/build-apk.d.ts +2 -0
- package/dist/cli/build-apk.d.ts.map +1 -0
- package/dist/cli/build-apk.js +97 -0
- package/dist/cli/build-apk.js.map +1 -0
- package/dist/cli/creds.d.ts +2 -0
- package/dist/cli/creds.d.ts.map +1 -0
- package/dist/cli/creds.js +147 -0
- package/dist/cli/creds.js.map +1 -0
- package/dist/cli/devices.d.ts +2 -0
- package/dist/cli/devices.d.ts.map +1 -0
- package/dist/cli/devices.js +38 -0
- package/dist/cli/devices.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +111 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/keys.d.ts +2 -0
- package/dist/cli/keys.d.ts.map +1 -0
- package/dist/cli/keys.js +88 -0
- package/dist/cli/keys.js.map +1 -0
- package/dist/cli/login.d.ts +2 -0
- package/dist/cli/login.d.ts.map +1 -0
- package/dist/cli/login.js +35 -0
- package/dist/cli/login.js.map +1 -0
- package/dist/cli/logo.d.ts +2 -0
- package/dist/cli/logo.d.ts.map +1 -0
- package/dist/cli/logo.js +11 -0
- package/dist/cli/logo.js.map +1 -0
- package/dist/cli/me.d.ts +2 -0
- package/dist/cli/me.d.ts.map +1 -0
- package/dist/cli/me.js +19 -0
- package/dist/cli/me.js.map +1 -0
- package/dist/cli/shell.d.ts +2 -0
- package/dist/cli/shell.d.ts.map +1 -0
- package/dist/cli/shell.js +22 -0
- package/dist/cli/shell.js.map +1 -0
- package/dist/cli/task.d.ts +2 -0
- package/dist/cli/task.d.ts.map +1 -0
- package/dist/cli/task.js +148 -0
- package/dist/cli/task.js.map +1 -0
- package/dist/cli/tasks.d.ts +2 -0
- package/dist/cli/tasks.d.ts.map +1 -0
- package/dist/cli/tasks.js +76 -0
- package/dist/cli/tasks.js.map +1 -0
- package/dist/cli/util.d.ts +46 -0
- package/dist/cli/util.d.ts.map +1 -0
- package/dist/cli/util.js +134 -0
- package/dist/cli/util.js.map +1 -0
- package/dist/package.json +56 -0
- package/dist/src/client.d.ts +81 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/client.js +116 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/errors.d.ts +16 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +31 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/phone.d.ts +115 -0
- package/dist/src/phone.d.ts.map +1 -0
- package/dist/src/phone.js +123 -0
- package/dist/src/phone.js.map +1 -0
- package/dist/src/transport.d.ts +14 -0
- package/dist/src/transport.d.ts.map +1 -0
- package/dist/src/transport.js +71 -0
- package/dist/src/transport.js.map +1 -0
- package/dist/src/types.d.ts +138 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +43 -26
- package/dist/index.d.mts +0 -500
- package/dist/index.d.ts +0 -500
- package/dist/index.js +0 -450
- package/dist/index.mjs +0 -418
package/dist/index.js
DELETED
|
@@ -1,450 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
Auten: () => Auten,
|
|
24
|
-
AutenApiError: () => AutenApiError,
|
|
25
|
-
AutenAuthError: () => AutenAuthError,
|
|
26
|
-
AutenError: () => AutenError,
|
|
27
|
-
AutenNotFoundError: () => AutenNotFoundError,
|
|
28
|
-
AutenRateLimitError: () => AutenRateLimitError
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(index_exports);
|
|
31
|
-
|
|
32
|
-
// src/errors.ts
|
|
33
|
-
var AutenError = class extends Error {
|
|
34
|
-
constructor(message) {
|
|
35
|
-
super(message);
|
|
36
|
-
this.name = "AutenError";
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
var AutenApiError = class extends AutenError {
|
|
40
|
-
code;
|
|
41
|
-
statusCode;
|
|
42
|
-
details;
|
|
43
|
-
constructor(code, message, statusCode, details) {
|
|
44
|
-
super(message);
|
|
45
|
-
this.name = "AutenApiError";
|
|
46
|
-
this.code = code;
|
|
47
|
-
this.statusCode = statusCode;
|
|
48
|
-
this.details = details;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var AutenAuthError = class extends AutenApiError {
|
|
52
|
-
constructor(message, code = "UNAUTHORIZED") {
|
|
53
|
-
super(code, message, 401);
|
|
54
|
-
this.name = "AutenAuthError";
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var AutenRateLimitError = class extends AutenApiError {
|
|
58
|
-
retryAfter;
|
|
59
|
-
constructor(message, retryAfter) {
|
|
60
|
-
super("RATE_LIMIT_EXCEEDED", message, 429, { retryAfter });
|
|
61
|
-
this.name = "AutenRateLimitError";
|
|
62
|
-
this.retryAfter = retryAfter;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
var AutenNotFoundError = class extends AutenApiError {
|
|
66
|
-
constructor(message) {
|
|
67
|
-
super("RESOURCE_NOT_FOUND", message, 404);
|
|
68
|
-
this.name = "AutenNotFoundError";
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// src/client.ts
|
|
73
|
-
var HttpClient = class {
|
|
74
|
-
config;
|
|
75
|
-
constructor(config) {
|
|
76
|
-
this.config = config;
|
|
77
|
-
}
|
|
78
|
-
async get(path) {
|
|
79
|
-
return this.request("GET", path);
|
|
80
|
-
}
|
|
81
|
-
async post(path, body) {
|
|
82
|
-
return this.request("POST", path, body);
|
|
83
|
-
}
|
|
84
|
-
async del(path) {
|
|
85
|
-
return this.request("DELETE", path);
|
|
86
|
-
}
|
|
87
|
-
async request(method, path, body) {
|
|
88
|
-
const url = `${this.config.baseUrl}${path}`;
|
|
89
|
-
let lastError = null;
|
|
90
|
-
for (let attempt = 0; attempt <= this.config.retries; attempt++) {
|
|
91
|
-
try {
|
|
92
|
-
const controller = new AbortController();
|
|
93
|
-
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
94
|
-
const response = await fetch(url, {
|
|
95
|
-
method,
|
|
96
|
-
headers: {
|
|
97
|
-
"Authorization": `Bearer ${this.config.apiKey}`,
|
|
98
|
-
"Content-Type": "application/json",
|
|
99
|
-
"User-Agent": "@auten/sdk"
|
|
100
|
-
},
|
|
101
|
-
body: body ? JSON.stringify(body) : void 0,
|
|
102
|
-
signal: controller.signal
|
|
103
|
-
});
|
|
104
|
-
clearTimeout(timeoutId);
|
|
105
|
-
if (response.status === 204) {
|
|
106
|
-
return void 0;
|
|
107
|
-
}
|
|
108
|
-
const data = await response.json();
|
|
109
|
-
if (response.ok && data.success) {
|
|
110
|
-
return data.data;
|
|
111
|
-
}
|
|
112
|
-
const errorData = data;
|
|
113
|
-
const errorCode = errorData.error?.code || "UNKNOWN";
|
|
114
|
-
const errorMessage = errorData.error?.message || "Unknown error";
|
|
115
|
-
const errorDetails = errorData.error?.details;
|
|
116
|
-
if (response.status === 429) {
|
|
117
|
-
const retryAfter = errorDetails?.retryAfter || 5;
|
|
118
|
-
if (attempt < this.config.retries) {
|
|
119
|
-
await this.sleep(retryAfter * 1e3);
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
throw new AutenRateLimitError(errorMessage, retryAfter);
|
|
123
|
-
}
|
|
124
|
-
if (response.status === 401) {
|
|
125
|
-
throw new AutenAuthError(errorMessage, errorCode);
|
|
126
|
-
}
|
|
127
|
-
if (response.status === 404) {
|
|
128
|
-
throw new AutenNotFoundError(errorMessage);
|
|
129
|
-
}
|
|
130
|
-
if (response.status >= 500 && attempt < this.config.retries) {
|
|
131
|
-
lastError = new AutenApiError(errorCode, errorMessage, response.status, errorDetails);
|
|
132
|
-
await this.sleep(Math.pow(2, attempt) * 1e3);
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
throw new AutenApiError(errorCode, errorMessage, response.status, errorDetails);
|
|
136
|
-
} catch (error) {
|
|
137
|
-
if (error instanceof AutenApiError) {
|
|
138
|
-
throw error;
|
|
139
|
-
}
|
|
140
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
141
|
-
lastError = new AutenError(`Request timed out after ${this.config.timeout}ms`);
|
|
142
|
-
} else {
|
|
143
|
-
lastError = error;
|
|
144
|
-
}
|
|
145
|
-
if (attempt < this.config.retries) {
|
|
146
|
-
await this.sleep(Math.pow(2, attempt) * 1e3);
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
throw lastError || new AutenError("Request failed after retries");
|
|
152
|
-
}
|
|
153
|
-
sleep(ms) {
|
|
154
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
// src/providers.ts
|
|
159
|
-
var ProviderClient = class {
|
|
160
|
-
constructor(client) {
|
|
161
|
-
this.client = client;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* List all connected providers for the authenticated user.
|
|
165
|
-
*/
|
|
166
|
-
async list() {
|
|
167
|
-
return this.client.get("/api/v1/sdk/providers");
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Execute an action on a provider.
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* const result = await auten.providers.execute('google-gmail', 'listEmails', { query: 'is:unread' });
|
|
174
|
-
*/
|
|
175
|
-
async execute(slug, action, params) {
|
|
176
|
-
return this.client.post(`/api/v1/sdk/providers/${slug}/execute`, {
|
|
177
|
-
action,
|
|
178
|
-
params
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Get a valid access token for a provider.
|
|
183
|
-
* Token is automatically refreshed if expired.
|
|
184
|
-
*
|
|
185
|
-
* @example
|
|
186
|
-
* const { accessToken } = await auten.providers.getCredentials('google-gmail');
|
|
187
|
-
*/
|
|
188
|
-
async getCredentials(slug) {
|
|
189
|
-
return this.client.get(`/api/v1/sdk/providers/${slug}/credentials`);
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
// src/agents.ts
|
|
194
|
-
var AgentClient = class {
|
|
195
|
-
constructor(client) {
|
|
196
|
-
this.client = client;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* List all agents for the authenticated user.
|
|
200
|
-
*/
|
|
201
|
-
async list() {
|
|
202
|
-
return this.client.get("/api/v1/sdk/agents");
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Get agent details including tools and schedule.
|
|
206
|
-
*/
|
|
207
|
-
async get(id) {
|
|
208
|
-
return this.client.get(`/api/v1/sdk/agents/${id}`);
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Create a new agent.
|
|
212
|
-
*
|
|
213
|
-
* @example
|
|
214
|
-
* const agent = await auten.agents.create({
|
|
215
|
-
* name: 'Invoice Processor',
|
|
216
|
-
* tools: [{ name: 'process-invoice', code: '...' }],
|
|
217
|
-
* schedule: { cron: '0 9 * * *', timezone: 'Europe/Vilnius' },
|
|
218
|
-
* });
|
|
219
|
-
*/
|
|
220
|
-
async create(options) {
|
|
221
|
-
return this.client.post("/api/v1/sdk/agents", options);
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Deploy tools to an existing agent.
|
|
225
|
-
* Upserts tool code and updates the agent configuration.
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* await auten.agents.deploy('agent-id', {
|
|
229
|
-
* tools: [{ name: 'fetch-data', code: '...' }],
|
|
230
|
-
* });
|
|
231
|
-
*/
|
|
232
|
-
async deploy(id, options) {
|
|
233
|
-
return this.client.post(`/api/v1/sdk/agents/${id}/deploy`, options);
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Trigger an agent run.
|
|
237
|
-
*
|
|
238
|
-
* @example
|
|
239
|
-
* const { executionId } = await auten.agents.run('agent-id', { inputData: '...' });
|
|
240
|
-
*/
|
|
241
|
-
async run(id, data) {
|
|
242
|
-
return this.client.post(`/api/v1/agents/${id}/run`, data);
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Get agent status.
|
|
246
|
-
*/
|
|
247
|
-
async status(id) {
|
|
248
|
-
return this.client.get(`/api/v1/agents/${id}/status`);
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Get agent run history.
|
|
252
|
-
*/
|
|
253
|
-
async history(id) {
|
|
254
|
-
return this.client.get(`/api/v1/agents/${id}/history`);
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Delete an agent and all its knowledge/tools.
|
|
258
|
-
*/
|
|
259
|
-
async delete(id) {
|
|
260
|
-
await this.client.del(`/api/v1/sdk/agents/${id}`);
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
// src/ai.ts
|
|
265
|
-
var AIClient = class {
|
|
266
|
-
constructor(client) {
|
|
267
|
-
this.client = client;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Execute a task using AI to interpret and call the right provider APIs.
|
|
271
|
-
*
|
|
272
|
-
* @example
|
|
273
|
-
* const result = await auten.ai.execute(
|
|
274
|
-
* 'google-sheets',
|
|
275
|
-
* 'Find Q1 revenue totals and create a summary row'
|
|
276
|
-
* );
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* const result = await auten.ai.execute(
|
|
280
|
-
* 'zoho-crm',
|
|
281
|
-
* 'Find all deals closing this month worth over $10k',
|
|
282
|
-
* { currency: 'USD' }
|
|
283
|
-
* );
|
|
284
|
-
*/
|
|
285
|
-
async execute(provider, task, context) {
|
|
286
|
-
return this.client.post("/api/v1/sdk/ai/execute", {
|
|
287
|
-
provider,
|
|
288
|
-
task,
|
|
289
|
-
context
|
|
290
|
-
});
|
|
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
|
-
}
|
|
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
|
-
|
|
406
|
-
// src/index.ts
|
|
407
|
-
var DEFAULT_BASE_URL = "https://auten.ai";
|
|
408
|
-
var DEFAULT_TIMEOUT = 3e4;
|
|
409
|
-
var DEFAULT_RETRIES = 3;
|
|
410
|
-
var Auten = class {
|
|
411
|
-
/** Provider connections and execution */
|
|
412
|
-
providers;
|
|
413
|
-
/** Agent management */
|
|
414
|
-
agents;
|
|
415
|
-
/** AI-powered execution */
|
|
416
|
-
ai;
|
|
417
|
-
/** Webhook registration */
|
|
418
|
-
webhooks;
|
|
419
|
-
/** Event polling */
|
|
420
|
-
events;
|
|
421
|
-
/** Conversation bridges (Slack ↔ Email) */
|
|
422
|
-
conversations;
|
|
423
|
-
client;
|
|
424
|
-
constructor(config) {
|
|
425
|
-
if (!config.apiKey) {
|
|
426
|
-
throw new AutenError("apiKey is required. Get one at https://auten.ai/settings \u2192 API Keys");
|
|
427
|
-
}
|
|
428
|
-
this.client = new HttpClient({
|
|
429
|
-
apiKey: config.apiKey,
|
|
430
|
-
baseUrl: (config.baseUrl || DEFAULT_BASE_URL).replace(/\/$/, ""),
|
|
431
|
-
timeout: config.timeout || DEFAULT_TIMEOUT,
|
|
432
|
-
retries: config.retries ?? DEFAULT_RETRIES
|
|
433
|
-
});
|
|
434
|
-
this.providers = new ProviderClient(this.client);
|
|
435
|
-
this.agents = new AgentClient(this.client);
|
|
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);
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
443
|
-
0 && (module.exports = {
|
|
444
|
-
Auten,
|
|
445
|
-
AutenApiError,
|
|
446
|
-
AutenAuthError,
|
|
447
|
-
AutenError,
|
|
448
|
-
AutenNotFoundError,
|
|
449
|
-
AutenRateLimitError
|
|
450
|
-
});
|