@bimpeai/sdk 0.0.0-beta-20260606071952

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.
@@ -0,0 +1,478 @@
1
+ interface PaginationMeta {
2
+ readonly total_count: number;
3
+ readonly page_count: number;
4
+ readonly current_page: number;
5
+ readonly limit: number;
6
+ readonly has_next_page: boolean;
7
+ readonly has_previous_page: boolean;
8
+ }
9
+ interface ListQuery {
10
+ page?: number;
11
+ limit?: number;
12
+ search?: string;
13
+ sort?: string;
14
+ }
15
+ interface ApiResponse<T> {
16
+ readonly data: T;
17
+ readonly meta: PaginationMeta | null;
18
+ readonly requestId: string | null;
19
+ readonly status: number;
20
+ readonly headers: Headers;
21
+ }
22
+ interface RequestOptions {
23
+ idempotencyKey?: string;
24
+ signal?: AbortSignal;
25
+ timeout?: number;
26
+ maxRetries?: number;
27
+ headers?: Record<string, string>;
28
+ }
29
+ interface InternalRequestSpec {
30
+ method: 'GET' | 'POST' | 'PATCH' | 'DELETE' | 'PUT';
31
+ path: string;
32
+ query?: Record<string, string | number | boolean | undefined>;
33
+ body?: unknown;
34
+ headers?: Record<string, string>;
35
+ signal?: AbortSignal;
36
+ timeout?: number;
37
+ maxRetries?: number;
38
+ idempotencyKey?: string;
39
+ }
40
+ type Fetch = typeof globalThis.fetch;
41
+ interface Logger {
42
+ debug(message: string, context?: Record<string, unknown>): void;
43
+ warn(message: string, context?: Record<string, unknown>): void;
44
+ }
45
+ /**
46
+ * The slice of the transport that resources depend on. Depending on this rather
47
+ * than the concrete HttpClient keeps the transport class out of the public types.
48
+ */
49
+ interface RequestExecutor {
50
+ request<T>(spec: InternalRequestSpec & RequestOptions): Promise<ApiResponse<T>>;
51
+ }
52
+
53
+ interface HttpClientConfig {
54
+ apiKey: string;
55
+ baseUrl?: string;
56
+ timeout?: number;
57
+ maxRetries?: number;
58
+ fetch?: Fetch;
59
+ defaultHeaders?: Record<string, string>;
60
+ logger?: Logger;
61
+ }
62
+
63
+ interface Rule {
64
+ readonly id: string;
65
+ readonly name: string;
66
+ readonly trigger: string;
67
+ readonly condition: string | null;
68
+ readonly response: string;
69
+ readonly action: string | null;
70
+ readonly enabled: boolean;
71
+ }
72
+ interface RuleInput {
73
+ id: string;
74
+ name: string;
75
+ trigger: string;
76
+ condition?: string | null;
77
+ response: string;
78
+ action?: string | null;
79
+ enabled: boolean;
80
+ }
81
+ interface Agent {
82
+ readonly id: string;
83
+ readonly name: string;
84
+ readonly description: string | null;
85
+ readonly system_prompt: string | null;
86
+ readonly language: string | null;
87
+ readonly persona: string | null;
88
+ readonly agent_workflow_id: string | null;
89
+ readonly rules: readonly Rule[] | null;
90
+ readonly timezone: string | null;
91
+ readonly logo: string | null;
92
+ readonly business_name: string | null;
93
+ readonly business_address: string | null;
94
+ readonly business_email: string | null;
95
+ readonly business_description: string | null;
96
+ readonly test_channel_code: string | null;
97
+ readonly status: string;
98
+ readonly status_reason: string | null;
99
+ readonly escalation_email: string | null;
100
+ readonly created_at: string;
101
+ readonly updated_at: string;
102
+ }
103
+ interface AgentDetail extends Agent {
104
+ readonly integration: readonly AgentIntegration[];
105
+ readonly channel: readonly AgentChannel[];
106
+ readonly conversation_flow: readonly AgentConversationFlow[];
107
+ readonly actions: readonly AgentActionSummary[];
108
+ readonly knowledge_bases: readonly KnowledgeBaseSummary[];
109
+ }
110
+ interface CreateAgentBody {
111
+ name: string;
112
+ description?: string | null;
113
+ system_prompt?: string | null;
114
+ language?: string | null;
115
+ persona?: string | null;
116
+ agent_workflow_id?: string | null;
117
+ rules?: RuleInput[] | null;
118
+ timezone?: string | null;
119
+ logo?: string | null;
120
+ business_name?: string | null;
121
+ business_address?: string | null;
122
+ business_email?: string | null;
123
+ business_description?: string | null;
124
+ escalation_email?: string | null;
125
+ }
126
+ type UpdateAgentBody = Partial<CreateAgentBody>;
127
+ interface IntegrationConfigField {
128
+ readonly key: string;
129
+ readonly label: string;
130
+ readonly type: string;
131
+ readonly required: boolean;
132
+ }
133
+ interface IntegrationAction {
134
+ readonly action_name: string;
135
+ readonly name: string;
136
+ readonly description: string | null;
137
+ readonly category: string;
138
+ readonly is_enabled: boolean;
139
+ readonly require_human_approval: boolean;
140
+ }
141
+ interface AgentIntegration {
142
+ readonly id: string;
143
+ readonly type: string;
144
+ readonly status: string;
145
+ readonly is_connected: boolean;
146
+ readonly config_fields: readonly IntegrationConfigField[];
147
+ readonly actions: readonly IntegrationAction[];
148
+ }
149
+ interface AgentChannel {
150
+ readonly id: string;
151
+ readonly type: string;
152
+ readonly status: string;
153
+ readonly is_connected: boolean;
154
+ }
155
+ interface AgentConversationFlow {
156
+ readonly name: string;
157
+ readonly description: string | null;
158
+ readonly category: string | null;
159
+ readonly priority: number;
160
+ readonly is_active: boolean;
161
+ }
162
+ interface AgentActionSummary {
163
+ readonly id: string;
164
+ readonly integration_type: string;
165
+ readonly integration_name: string;
166
+ readonly name: string;
167
+ readonly action_name: string;
168
+ readonly description: string | null;
169
+ readonly is_enabled: boolean;
170
+ }
171
+ interface KnowledgeBaseSummary {
172
+ readonly id: string;
173
+ readonly type: 'text' | 'url';
174
+ readonly name: string;
175
+ readonly description: string | null;
176
+ }
177
+ interface CreateKnowledgeBaseTextBody {
178
+ type: 'text';
179
+ name: string;
180
+ description?: string | null;
181
+ content: string;
182
+ }
183
+ interface CreateKnowledgeBaseUrlBody {
184
+ type: 'url';
185
+ name: string;
186
+ description?: string | null;
187
+ url: string;
188
+ }
189
+ type CreateKnowledgeBaseBody = CreateKnowledgeBaseTextBody | CreateKnowledgeBaseUrlBody;
190
+ interface UpdateKnowledgeBaseBody {
191
+ name?: string;
192
+ description?: string | null;
193
+ content?: string | null;
194
+ url?: string | null;
195
+ }
196
+
197
+ declare class AgentActions {
198
+ private readonly client;
199
+ constructor(client: RequestExecutor);
200
+ list(agentId: string): Promise<readonly AgentActionSummary[]>;
201
+ }
202
+
203
+ type PageFetcher<T> = (page: number) => Promise<Page<T>>;
204
+ interface PageInit<T> {
205
+ data: readonly T[];
206
+ meta: PaginationMeta | null;
207
+ requestId: string | null;
208
+ fetcher: PageFetcher<T>;
209
+ }
210
+ declare class Page<T> implements AsyncIterable<T> {
211
+ readonly data: readonly T[];
212
+ readonly meta: PaginationMeta | null;
213
+ readonly requestId: string | null;
214
+ private readonly fetcher;
215
+ constructor(init: PageInit<T>);
216
+ get hasNextPage(): boolean;
217
+ getNextPage(): Promise<Page<T> | null>;
218
+ [Symbol.asyncIterator](): AsyncIterator<T>;
219
+ pages(): AsyncGenerator<Page<T>>;
220
+ }
221
+ /**
222
+ * The return value of a `list` call. Awaiting it yields the first `Page`; iterating
223
+ * it with `for await` walks every item across all pages, fetching lazily.
224
+ */
225
+ declare class PagePromise<T> implements PromiseLike<Page<T>>, AsyncIterable<T> {
226
+ private readonly load;
227
+ constructor(load: () => Promise<Page<T>>);
228
+ then<TResult1 = Page<T>, TResult2 = never>(onfulfilled?: ((value: Page<T>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
229
+ catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<Page<T> | TResult>;
230
+ finally(onfinally?: (() => void) | null): Promise<Page<T>>;
231
+ [Symbol.asyncIterator](): AsyncIterator<T>;
232
+ pages(): AsyncIterable<Page<T>>;
233
+ }
234
+
235
+ declare class AgentChannels {
236
+ private readonly client;
237
+ constructor(client: RequestExecutor);
238
+ list(agentId: string): Promise<readonly AgentChannel[]>;
239
+ }
240
+
241
+ declare class AgentConversationFlows {
242
+ private readonly client;
243
+ constructor(client: RequestExecutor);
244
+ list(agentId: string): Promise<readonly AgentConversationFlow[]>;
245
+ }
246
+
247
+ declare class AgentIntegrations {
248
+ private readonly client;
249
+ constructor(client: RequestExecutor);
250
+ list(agentId: string): Promise<readonly AgentIntegration[]>;
251
+ }
252
+
253
+ declare class AgentKnowledgeBases {
254
+ private readonly client;
255
+ constructor(client: RequestExecutor);
256
+ list(agentId: string): Promise<readonly KnowledgeBaseSummary[]>;
257
+ create(agentId: string, body: CreateKnowledgeBaseBody, options?: RequestOptions): Promise<KnowledgeBaseSummary>;
258
+ update(agentId: string, kbId: string, body: UpdateKnowledgeBaseBody): Promise<KnowledgeBaseSummary>;
259
+ delete(agentId: string, kbId: string): Promise<void>;
260
+ }
261
+
262
+ type Client$3 = RequestExecutor;
263
+ declare class Agents {
264
+ private readonly client;
265
+ readonly integrations: AgentIntegrations;
266
+ readonly channels: AgentChannels;
267
+ readonly conversationFlows: AgentConversationFlows;
268
+ readonly actions: AgentActions;
269
+ readonly knowledgeBases: AgentKnowledgeBases;
270
+ constructor(client: Client$3);
271
+ list(query?: ListQuery): PagePromise<Agent>;
272
+ create(body: CreateAgentBody, options?: RequestOptions): Promise<Agent>;
273
+ retrieve(agentId: string): Promise<AgentDetail>;
274
+ update(agentId: string, body: UpdateAgentBody): Promise<Agent>;
275
+ private fetchPage;
276
+ }
277
+
278
+ interface Call {
279
+ readonly id: string;
280
+ }
281
+
282
+ declare class Calls {
283
+ private readonly client;
284
+ constructor(client: RequestExecutor);
285
+ list(): Promise<readonly Call[]>;
286
+ }
287
+
288
+ type ConversationChannel = 'whatsapp' | 'messenger' | 'instagram' | 'webchat' | 'test_whatsapp' | 'test_messenger' | 'test_instagram';
289
+ interface Conversation {
290
+ readonly id: string;
291
+ readonly channel_type: string;
292
+ readonly channel_id: string | null;
293
+ readonly is_test_channel: boolean;
294
+ readonly full_name: string | null;
295
+ readonly email: string | null;
296
+ readonly phone_number: string | null;
297
+ readonly channel_username: string | null;
298
+ readonly is_ai_chat_paused: boolean;
299
+ readonly last_message_at: string | null;
300
+ readonly last_message_preview: string | null;
301
+ readonly created_at: string;
302
+ readonly updated_at: string;
303
+ }
304
+ interface ListConversationsQuery {
305
+ page?: number;
306
+ limit?: number;
307
+ search?: string;
308
+ channel?: ConversationChannel;
309
+ }
310
+ interface Message {
311
+ readonly id: string;
312
+ readonly role: string;
313
+ readonly message: string | null;
314
+ readonly message_type: string | null;
315
+ readonly created_at: string;
316
+ }
317
+ interface MessageAttachment {
318
+ type: string;
319
+ url: string;
320
+ }
321
+ interface SendMessageBody {
322
+ message: string;
323
+ attachments?: MessageAttachment[];
324
+ }
325
+ interface ListMessagesQuery {
326
+ page?: number;
327
+ limit?: number;
328
+ }
329
+
330
+ type Client$2 = RequestExecutor;
331
+ declare class Messages {
332
+ private readonly client;
333
+ constructor(client: Client$2);
334
+ list(agentId: string, conversationId: string, query?: ListMessagesQuery): PagePromise<Message>;
335
+ send(agentId: string, conversationId: string, body: SendMessageBody, options?: RequestOptions): Promise<Message>;
336
+ private fetchPage;
337
+ }
338
+
339
+ type Client$1 = RequestExecutor;
340
+ declare class Conversations {
341
+ private readonly client;
342
+ readonly messages: Messages;
343
+ constructor(client: Client$1);
344
+ list(agentId: string, query?: ListConversationsQuery): PagePromise<Conversation>;
345
+ retrieve(agentId: string, conversationId: string): Promise<Conversation>;
346
+ private fetchPage;
347
+ }
348
+
349
+ type WorkflowVisibility = 'private' | 'public';
350
+ type WorkflowScope = 'owned' | 'public';
351
+ interface WorkflowSummary {
352
+ readonly id: string;
353
+ readonly name: string;
354
+ readonly description: string | null;
355
+ readonly category: string | null;
356
+ readonly visibility: WorkflowVisibility;
357
+ readonly is_owner: boolean;
358
+ readonly created_at: string;
359
+ readonly updated_at: string;
360
+ }
361
+ interface Workflow extends WorkflowSummary {
362
+ readonly system_prompt: string | null;
363
+ readonly rules: readonly Rule[];
364
+ readonly flows: readonly Record<string, unknown>[];
365
+ readonly tags: readonly string[];
366
+ readonly prompt_config: Record<string, unknown>;
367
+ }
368
+ interface CreateWorkflowBody {
369
+ name: string;
370
+ description?: string;
371
+ category?: string;
372
+ system_prompt?: string;
373
+ rules?: RuleInput[];
374
+ flows?: Record<string, unknown>[];
375
+ tags?: string[];
376
+ prompt_config?: Record<string, unknown>;
377
+ }
378
+ type UpdateWorkflowBody = Partial<CreateWorkflowBody>;
379
+ interface ListWorkflowsQuery {
380
+ page?: number;
381
+ limit?: number;
382
+ search?: string;
383
+ sort?: string;
384
+ scope?: WorkflowScope;
385
+ }
386
+
387
+ type Client = RequestExecutor;
388
+ declare class Workflows {
389
+ private readonly client;
390
+ constructor(client: Client);
391
+ list(query?: ListWorkflowsQuery): PagePromise<WorkflowSummary>;
392
+ create(body: CreateWorkflowBody, options?: RequestOptions): Promise<Workflow>;
393
+ retrieve(workflowId: string): Promise<Workflow>;
394
+ update(workflowId: string, body: UpdateWorkflowBody): Promise<Workflow>;
395
+ delete(workflowId: string): Promise<void>;
396
+ private fetchPage;
397
+ }
398
+
399
+ type BimpeAIConfig = HttpClientConfig;
400
+ declare class BimpeAI {
401
+ readonly agents: Agents;
402
+ readonly workflows: Workflows;
403
+ readonly conversations: Conversations;
404
+ readonly calls: Calls;
405
+ private readonly http;
406
+ constructor(config: BimpeAIConfig);
407
+ request<T>(spec: InternalRequestSpec & RequestOptions): Promise<ApiResponse<T>>;
408
+ }
409
+
410
+ declare class BimpeAIError extends Error {
411
+ constructor(message: string);
412
+ }
413
+ declare class UserError extends BimpeAIError {
414
+ }
415
+ declare class ConnectionError extends BimpeAIError {
416
+ readonly cause?: unknown;
417
+ constructor(message: string, cause?: unknown);
418
+ }
419
+ declare class ConnectionTimeoutError extends ConnectionError {
420
+ }
421
+ interface ApiErrorInit {
422
+ message: string;
423
+ status: number;
424
+ code: string | null;
425
+ requestId: string | null;
426
+ headers: Headers;
427
+ body: unknown;
428
+ }
429
+ declare class ApiError extends BimpeAIError {
430
+ readonly status: number;
431
+ readonly code: string | null;
432
+ readonly requestId: string | null;
433
+ readonly headers: Headers;
434
+ readonly body: unknown;
435
+ constructor(init: ApiErrorInit);
436
+ }
437
+ declare class BadRequestError extends ApiError {
438
+ }
439
+ interface FieldError {
440
+ readonly path: string;
441
+ readonly message: string;
442
+ }
443
+ interface ValidationErrorInit extends ApiErrorInit {
444
+ fieldErrors: readonly FieldError[];
445
+ }
446
+ declare class ValidationError extends BadRequestError {
447
+ readonly fieldErrors: readonly FieldError[];
448
+ constructor(init: ValidationErrorInit);
449
+ }
450
+ declare class AuthenticationError extends ApiError {
451
+ }
452
+ declare class PermissionDeniedError extends ApiError {
453
+ }
454
+ declare class NotFoundError extends ApiError {
455
+ }
456
+ declare class ConflictError extends ApiError {
457
+ }
458
+ interface RateLimitErrorInit extends ApiErrorInit {
459
+ retryAfter?: number | null;
460
+ limit?: number | null;
461
+ remaining?: number | null;
462
+ resetAt?: Date | null;
463
+ }
464
+ declare class RateLimitError extends ApiError {
465
+ readonly retryAfter: number | null;
466
+ readonly limit: number | null;
467
+ readonly remaining: number | null;
468
+ readonly resetAt: Date | null;
469
+ constructor(init: RateLimitErrorInit);
470
+ }
471
+ declare class InternalServerError extends ApiError {
472
+ }
473
+ declare class NotImplementedError extends ApiError {
474
+ }
475
+
476
+ declare const VERSION = "0.0.0-beta-20260606071952";
477
+
478
+ export { type Agent, type AgentActionSummary, AgentActions, type AgentChannel, AgentChannels, type AgentConversationFlow, AgentConversationFlows, type AgentDetail, type AgentIntegration, AgentIntegrations, AgentKnowledgeBases, Agents, ApiError, type ApiResponse, AuthenticationError, BadRequestError, BimpeAI, type BimpeAIConfig, BimpeAIError, type Call, Calls, ConflictError, ConnectionError, ConnectionTimeoutError, type Conversation, type ConversationChannel, Conversations, type CreateAgentBody, type CreateKnowledgeBaseBody, type CreateKnowledgeBaseTextBody, type CreateKnowledgeBaseUrlBody, type CreateWorkflowBody, type FieldError, type IntegrationAction, type IntegrationConfigField, InternalServerError, type KnowledgeBaseSummary, type ListConversationsQuery, type ListMessagesQuery, type ListQuery, type ListWorkflowsQuery, type Message, type MessageAttachment, Messages, NotFoundError, NotImplementedError, Page, PagePromise, type PaginationMeta, PermissionDeniedError, RateLimitError, type RequestOptions, type Rule, type RuleInput, type SendMessageBody, type UpdateAgentBody, type UpdateKnowledgeBaseBody, type UpdateWorkflowBody, UserError, VERSION, ValidationError, type Workflow, type WorkflowScope, type WorkflowSummary, type WorkflowVisibility, Workflows };