@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.
- package/LICENSE +21 -0
- package/README.md +192 -0
- package/dist/index.cjs +803 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +478 -0
- package/dist/index.d.ts +478 -0
- package/dist/index.js +774 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/version.ts","../src/core/envelope.ts","../src/core/errors.ts","../src/core/headers.ts","../src/core/request-id.ts","../src/core/idempotency.ts","../src/core/retries.ts","../src/core/http-client.ts","../src/resources/agents/actions.ts","../src/core/pagination.ts","../src/resources/agents/channels.ts","../src/resources/agents/conversation-flows.ts","../src/resources/agents/integrations.ts","../src/resources/agents/knowledge-bases.ts","../src/resources/agents/agents.ts","../src/resources/calls/calls.ts","../src/resources/conversations/messages.ts","../src/resources/conversations/conversations.ts","../src/resources/workflows/workflows.ts","../src/client.ts"],"names":[],"mappings":";;;AAAO,IAAM,OAAA,GAAU;;;ACahB,SAAS,eAAkB,IAAA,EAA6B;AAC7D,EAAA,IAAI,CAAC,UAAA,CAAW,IAAI,CAAA,EAAG;AACrB,IAAA,MAAM,IAAI,UAAU,8DAA8D,CAAA;AAAA,EACpF;AACA,EAAA,OAAO;AAAA,IACL,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,IAAA,EAAM,KAAK,IAAA,IAAQ;AAAA,GACrB;AACF;AAEA,SAAS,WAAW,KAAA,EAAmC;AACrD,EAAA,OACE,OAAO,UAAU,QAAA,IACjB,KAAA,KAAU,QACV,SAAA,IAAa,KAAA,IACb,OAAQ,KAAA,CAA+B,OAAA,KAAY,QAAA;AAEvD;;;AC5BO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EACtC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAA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AA;AAAA,EAEjB,YAAY,MAAA,EAAuB;AACjC,IAAA,IAAA,CAAK,IAAA,GAAO,IAAI,UAAA,CAAW,MAAM,CAAA;AACjC,IAAA,IAAA,CAAK,MAAA,GAAS,IAAI,MAAA,CAAO,IAAA,CAAK,IAAI,CAAA;AAClC,IAAA,IAAA,CAAK,SAAA,GAAY,IAAI,SAAA,CAAU,IAAA,CAAK,IAAI,CAAA;AACxC,IAAA,IAAA,CAAK,aAAA,GAAgB,IAAI,aAAA,CAAc,IAAA,CAAK,IAAI,CAAA;AAChD,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA;AAAA,EAClC;AAAA,EAEA,QAAW,IAAA,EAAqE;AAC9E,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,OAAA,CAAW,IAAI,CAAA;AAAA,EAClC;AACF","file":"index.cjs","sourcesContent":["export const VERSION = '0.0.0-beta-20260606071952';\n","import type { PaginationMeta } from './types';\n\nexport interface Unwrapped<T> {\n readonly data: T;\n readonly meta: PaginationMeta | null;\n}\n\ninterface Envelope {\n message: string;\n data: unknown;\n meta?: PaginationMeta;\n}\n\nexport function unwrapEnvelope<T>(body: unknown): Unwrapped<T> {\n if (!isEnvelope(body)) {\n throw new TypeError('Response is not a BimpeAI envelope (missing `message` field)');\n }\n return {\n data: body.data as T,\n meta: body.meta ?? null,\n };\n}\n\nfunction isEnvelope(value: unknown): value is Envelope {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'message' in value &&\n typeof (value as { message: unknown }).message === 'string'\n );\n}\n","import type { ErrorBody } from './types';\n\nexport class BimpeAIError extends Error {\n constructor(message: string) {\n super(message);\n this.name = new.target.name;\n }\n}\n\nexport class UserError extends BimpeAIError {}\n\nexport class ConnectionError extends BimpeAIError {\n override readonly cause?: unknown;\n constructor(message: string, cause?: unknown) {\n super(message);\n this.cause = cause;\n }\n}\n\nexport class ConnectionTimeoutError extends ConnectionError {}\n\nexport interface ApiErrorInit {\n message: string;\n status: number;\n code: string | null;\n requestId: string | null;\n headers: Headers;\n body: unknown;\n}\n\nexport class ApiError extends BimpeAIError {\n readonly status: number;\n readonly code: string | null;\n readonly requestId: string | null;\n readonly headers: Headers;\n readonly body: unknown;\n\n constructor(init: ApiErrorInit) {\n super(init.message);\n this.status = init.status;\n this.code = init.code;\n this.requestId = init.requestId;\n this.headers = init.headers;\n this.body = init.body;\n }\n}\n\nexport class BadRequestError extends ApiError {}\n\nexport interface FieldError {\n readonly path: string;\n readonly message: string;\n}\n\nexport interface ValidationErrorInit extends ApiErrorInit {\n fieldErrors: readonly FieldError[];\n}\n\nexport class ValidationError extends BadRequestError {\n readonly fieldErrors: readonly FieldError[];\n constructor(init: ValidationErrorInit) {\n super(init);\n this.fieldErrors = init.fieldErrors;\n }\n}\n\nexport class AuthenticationError extends ApiError {}\nexport class PermissionDeniedError extends ApiError {}\nexport class NotFoundError extends ApiError {}\nexport class ConflictError extends ApiError {}\n\nexport interface RateLimitErrorInit extends ApiErrorInit {\n retryAfter?: number | null;\n limit?: number | null;\n remaining?: number | null;\n resetAt?: Date | null;\n}\n\nexport class RateLimitError extends ApiError {\n readonly retryAfter: number | null;\n readonly limit: number | null;\n readonly remaining: number | null;\n readonly resetAt: Date | null;\n constructor(init: RateLimitErrorInit) {\n super(init);\n this.retryAfter = init.retryAfter ?? null;\n this.limit = init.limit ?? null;\n this.remaining = init.remaining ?? null;\n this.resetAt = init.resetAt ?? null;\n }\n}\n\nexport class InternalServerError extends ApiError {}\nexport class NotImplementedError extends ApiError {}\n\nexport function mapApiError(status: number, body: unknown, headers: Headers): ApiError {\n const errBody = (body ?? {}) as ErrorBody;\n const message = normaliseMessage(errBody.message) ?? `HTTP ${status}`;\n const code = errBody.code ?? null;\n const requestId = headers.get('x-request-id') ?? errBody.request_id ?? null;\n const init: ApiErrorInit = { message, status, code, requestId, headers, body };\n\n if (status === 400) {\n if (code === 'validation_error') {\n return new ValidationError({ ...init, fieldErrors: parseFieldErrors(errBody.message) });\n }\n return new BadRequestError(init);\n }\n if (status === 401) return new AuthenticationError(init);\n if (status === 403) return new PermissionDeniedError(init);\n if (status === 404) return new NotFoundError(init);\n if (status === 409) return new ConflictError(init);\n if (status === 429) {\n return new RateLimitError({\n ...init,\n retryAfter: parseRetryAfter(headers.get('retry-after')),\n limit: numOrNull(headers.get('x-ratelimit-limit')),\n remaining: numOrNull(headers.get('x-ratelimit-remaining')),\n resetAt: parseReset(headers.get('x-ratelimit-reset')),\n });\n }\n if (status === 501) return new NotImplementedError(init);\n if (status >= 500) return new InternalServerError(init);\n return new ApiError(init);\n}\n\nfunction normaliseMessage(m: ErrorBody['message']): string | null {\n if (Array.isArray(m)) return m.join('; ');\n if (typeof m === 'string') return m;\n return null;\n}\n\nfunction parseFieldErrors(m: ErrorBody['message']): FieldError[] {\n if (!Array.isArray(m)) return [];\n const out: FieldError[] = [];\n for (const entry of m) {\n if (typeof entry !== 'string') continue;\n const idx = entry.indexOf(':');\n if (idx === -1) out.push({ path: '', message: entry });\n else out.push({ path: entry.slice(0, idx).trim(), message: entry.slice(idx + 1).trim() });\n }\n return out;\n}\n\nfunction parseRetryAfter(raw: string | null): number | null {\n if (!raw) return null;\n const asNumber = Number(raw);\n if (Number.isFinite(asNumber)) return Math.max(0, Math.floor(asNumber));\n const asDate = Date.parse(raw);\n if (Number.isFinite(asDate)) return Math.max(0, Math.ceil((asDate - Date.now()) / 1000));\n return null;\n}\n\nfunction parseReset(raw: string | null): Date | null {\n if (!raw) return null;\n const seconds = Number(raw);\n if (!Number.isFinite(seconds)) return null;\n return new Date(seconds * 1000);\n}\n\nfunction numOrNull(raw: string | null): number | null {\n if (raw === null) return null;\n const n = Number(raw);\n return Number.isFinite(n) ? n : null;\n}\n","export type HeaderInput = Headers | Record<string, string> | undefined;\n\nexport function mergeHeaders(...sources: HeaderInput[]): Headers {\n const out = new Headers();\n for (const src of sources) {\n if (!src) continue;\n if (src instanceof Headers) {\n src.forEach((value, key) => out.set(key, value));\n } else {\n for (const [key, value] of Object.entries(src)) out.set(key, value);\n }\n }\n return out;\n}\n","const HAS_RANDOM_UUID =\n typeof globalThis.crypto !== 'undefined' && typeof globalThis.crypto.randomUUID === 'function';\n\nexport function generateRequestId(): string {\n if (HAS_RANDOM_UUID) return globalThis.crypto.randomUUID();\n return fallbackUuidV4();\n}\n\nfunction fallbackUuidV4(): string {\n const bytes = new Uint8Array(16);\n if (typeof globalThis.crypto?.getRandomValues === 'function') {\n globalThis.crypto.getRandomValues(bytes);\n } else {\n for (let i = 0; i < 16; i += 1) bytes[i] = Math.floor(Math.random() * 256);\n }\n bytes[6] = ((bytes[6] ?? 0) & 0x0f) | 0x40;\n bytes[8] = ((bytes[8] ?? 0) & 0x3f) | 0x80;\n const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0'));\n return `${hex.slice(0, 4).join('')}-${hex.slice(4, 6).join('')}-${hex.slice(6, 8).join('')}-${hex.slice(8, 10).join('')}-${hex.slice(10, 16).join('')}`;\n}\n","import { generateRequestId } from './request-id';\n\nexport interface ResolveIdempotencyArgs {\n supplied: string | undefined;\n maxRetries: number;\n}\n\nexport function resolveIdempotencyKey({\n supplied,\n maxRetries,\n}: ResolveIdempotencyArgs): string | null {\n if (supplied) return supplied;\n if (maxRetries > 0) return generateRequestId();\n return null;\n}\n","import {\n ApiError,\n BimpeAIError,\n ConflictError,\n ConnectionError,\n ConnectionTimeoutError,\n NotImplementedError,\n} from './errors';\n\nexport const DEFAULT_BASE_MS = 500;\nexport const DEFAULT_MAX_BACKOFF_MS = 8000;\n\nconst RETRYABLE_STATUSES = new Set([408, 429]);\n\nexport function shouldRetry(error: unknown, attempt: number, maxRetries: number): boolean {\n if (attempt >= maxRetries) return false;\n if (!(error instanceof BimpeAIError)) return false;\n if (error instanceof ConnectionTimeoutError || error instanceof ConnectionError) return true;\n if (error instanceof NotImplementedError) return false;\n if (error instanceof ConflictError) return false;\n if (error instanceof ApiError) {\n if (RETRYABLE_STATUSES.has(error.status)) return true;\n if (error.status >= 500 && error.status !== 501) return true;\n }\n return false;\n}\n\nexport function computeBackoff(\n attempt: number,\n baseMs: number = DEFAULT_BASE_MS,\n maxMs: number = DEFAULT_MAX_BACKOFF_MS,\n retryAfterMs?: number,\n): number {\n if (typeof retryAfterMs === 'number' && retryAfterMs >= 0) {\n return Math.min(retryAfterMs, maxMs);\n }\n const exponential = Math.min(maxMs, baseMs * 2 ** attempt);\n const jitter = 0.5 + Math.random() * 0.5;\n return Math.floor(exponential * jitter);\n}\n","import { VERSION } from '../version';\nimport { unwrapEnvelope } from './envelope';\nimport {\n ApiError,\n BimpeAIError,\n ConnectionError,\n ConnectionTimeoutError,\n UserError,\n mapApiError,\n} from './errors';\nimport { mergeHeaders } from './headers';\nimport { resolveIdempotencyKey } from './idempotency';\nimport { generateRequestId } from './request-id';\nimport { DEFAULT_BASE_MS, DEFAULT_MAX_BACKOFF_MS, computeBackoff, shouldRetry } from './retries';\nimport type { ApiResponse, Fetch, InternalRequestSpec, Logger, RequestOptions } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.bimpeai.com';\nconst API_PATH_PREFIX = '/api/v1/console';\n\nexport interface HttpClientConfig {\n apiKey: string;\n baseUrl?: string;\n timeout?: number;\n maxRetries?: number;\n fetch?: Fetch;\n defaultHeaders?: Record<string, string>;\n logger?: Logger;\n}\n\nexport class HttpClient {\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly timeout: number;\n private readonly maxRetries: number;\n private readonly fetchImpl: Fetch;\n private readonly defaultHeaders: Record<string, string>;\n private readonly logger: Logger | undefined;\n private readonly userAgent: string;\n\n constructor(config: HttpClientConfig) {\n if (!config.apiKey) throw new UserError('apiKey is required');\n this.apiKey = config.apiKey;\n this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '');\n this.timeout = config.timeout ?? 30_000;\n this.maxRetries = config.maxRetries ?? 2;\n this.fetchImpl = config.fetch ?? globalThis.fetch.bind(globalThis);\n this.defaultHeaders = config.defaultHeaders ?? {};\n this.logger = config.logger;\n this.userAgent = buildUserAgent();\n }\n\n async request<T>(spec: InternalRequestSpec & RequestOptions): Promise<ApiResponse<T>> {\n const url = this.buildUrl(spec.path, spec.query);\n const maxRetries = spec.maxRetries ?? this.maxRetries;\n const timeout = spec.timeout ?? this.timeout;\n const idempotencyKey = isWrite(spec.method)\n ? resolveIdempotencyKey({ supplied: spec.idempotencyKey, maxRetries })\n : null;\n const requestId = readHeader(spec.headers, 'x-request-id') ?? generateRequestId();\n\n let attempt = 0;\n while (true) {\n try {\n return await this.send<T>(url, spec, idempotencyKey, requestId, timeout);\n } catch (error) {\n if (!shouldRetry(error, attempt, maxRetries)) throw error;\n const retryAfter =\n error instanceof ApiError\n ? parseRetryAfterMs(error.headers.get('retry-after'))\n : undefined;\n const delay = computeBackoff(attempt, DEFAULT_BASE_MS, DEFAULT_MAX_BACKOFF_MS, retryAfter);\n this.logger?.debug('retrying request', { attempt, delay, requestId });\n await sleep(delay);\n attempt += 1;\n }\n }\n }\n\n private async send<T>(\n url: string,\n spec: InternalRequestSpec & RequestOptions,\n idempotencyKey: string | null,\n requestId: string,\n timeout: number,\n ): Promise<ApiResponse<T>> {\n const headers = mergeHeaders(\n this.defaultHeaders,\n {\n Authorization: `Bearer ${this.apiKey}`,\n Accept: 'application/json',\n 'User-Agent': this.userAgent,\n 'X-Request-Id': requestId,\n ...(spec.body !== undefined ? { 'Content-Type': 'application/json' } : {}),\n ...(idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : {}),\n },\n spec.headers,\n );\n\n const controller = new AbortController();\n const timeoutHandle = setTimeout(\n () => controller.abort(new DOMException('timeout', 'TimeoutError')),\n timeout,\n );\n const { signal, cleanup } = composeSignals(controller.signal, spec.signal);\n\n let response: Response;\n try {\n response = await this.fetchImpl(url, {\n method: spec.method,\n headers,\n body: spec.body !== undefined ? JSON.stringify(spec.body) : null,\n signal,\n });\n } catch (cause) {\n if (isAbortError(cause)) {\n if (controller.signal.aborted) throw new ConnectionTimeoutError('request timed out', cause);\n throw new ConnectionError('request aborted', cause);\n }\n throw new ConnectionError('network error', cause);\n } finally {\n clearTimeout(timeoutHandle);\n cleanup();\n }\n\n const text = await response.text();\n const parsed = text.length ? safeJson(text) : null;\n\n if (!response.ok) {\n throw mapApiError(response.status, parsed, response.headers);\n }\n\n let unwrapped: { data: T; meta: ApiResponse<T>['meta'] };\n try {\n unwrapped = unwrapEnvelope<T>(parsed);\n } catch {\n throw new BimpeAIError(\n `Expected a BimpeAI response envelope but got an unrecognised body (status ${response.status})`,\n );\n }\n\n return {\n data: unwrapped.data,\n meta: unwrapped.meta,\n requestId: response.headers.get('x-request-id') ?? requestId,\n status: response.status,\n headers: response.headers,\n };\n }\n\n private buildUrl(path: string, query?: InternalRequestSpec['query']): string {\n const url = new URL(`${this.baseUrl}${API_PATH_PREFIX}${path}`);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined) continue;\n url.searchParams.set(key, String(value));\n }\n }\n return url.toString();\n }\n}\n\nfunction buildUserAgent(): string {\n const runtime = detectRuntime();\n const platform =\n typeof process !== 'undefined' ? `${process.platform}/${process.arch}` : 'unknown';\n return `bimpeai-sdk-typescript/${VERSION} (${runtime}; ${platform})`;\n}\n\nfunction detectRuntime(): string {\n const g = globalThis as {\n Bun?: { version: string };\n Deno?: { version: { deno: string } };\n };\n if (typeof g.Bun !== 'undefined') return `Bun/${g.Bun.version}`;\n if (typeof g.Deno !== 'undefined') return `Deno/${g.Deno.version.deno}`;\n if (typeof process !== 'undefined' && process.versions?.node)\n return `Node/${process.versions.node}`;\n return 'Browser';\n}\n\nfunction isWrite(method: string): boolean {\n return method === 'POST' || method === 'PATCH' || method === 'PUT' || method === 'DELETE';\n}\n\nfunction readHeader(headers: Record<string, string> | undefined, name: string): string | undefined {\n if (!headers) return undefined;\n const lower = name.toLowerCase();\n for (const [key, value] of Object.entries(headers)) {\n if (key.toLowerCase() === lower) return value;\n }\n return undefined;\n}\n\nfunction isAbortError(e: unknown): boolean {\n return (\n typeof e === 'object' &&\n e !== null &&\n 'name' in e &&\n ((e as { name: string }).name === 'AbortError' ||\n (e as { name: string }).name === 'TimeoutError')\n );\n}\n\ninterface ComposedSignal {\n signal: AbortSignal;\n cleanup: () => void;\n}\n\nfunction composeSignals(a: AbortSignal, b?: AbortSignal): ComposedSignal {\n const noop = () => {};\n if (!b) return { signal: a, cleanup: noop };\n\n const anyFn = (AbortSignal as { any?: (signals: AbortSignal[]) => AbortSignal }).any;\n if (typeof anyFn === 'function') return { signal: anyFn([a, b]), cleanup: noop };\n\n const ctrl = new AbortController();\n const onA = () => ctrl.abort(a.reason);\n const onB = () => ctrl.abort(b.reason);\n if (a.aborted) ctrl.abort(a.reason);\n else a.addEventListener('abort', onA, { once: true });\n if (b.aborted) ctrl.abort(b.reason);\n else b.addEventListener('abort', onB, { once: true });\n\n const cleanup = () => {\n a.removeEventListener('abort', onA);\n b.removeEventListener('abort', onB);\n };\n return { signal: ctrl.signal, cleanup };\n}\n\nfunction safeJson(text: string): unknown {\n try {\n return JSON.parse(text);\n } catch {\n return null;\n }\n}\n\nfunction parseRetryAfterMs(raw: string | null): number | undefined {\n if (!raw || !raw.trim()) return undefined;\n const seconds = Number(raw);\n if (Number.isFinite(seconds)) return Math.max(0, Math.floor(seconds)) * 1000;\n const asDate = Date.parse(raw);\n if (Number.isFinite(asDate)) return Math.max(0, asDate - Date.now());\n return undefined;\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n","import type { RequestExecutor } from '../../core/types';\nimport type { AgentActionSummary } from './types';\n\nexport class AgentActions {\n constructor(private readonly client: RequestExecutor) {}\n\n async list(agentId: string): Promise<readonly AgentActionSummary[]> {\n const res = await this.client.request<AgentActionSummary[]>({\n method: 'GET',\n path: `/agents/${agentId}/actions`,\n });\n return res.data;\n }\n}\n","import type { PaginationMeta } from './types';\n\nexport type PageFetcher<T> = (page: number) => Promise<Page<T>>;\n\nexport interface PageInit<T> {\n data: readonly T[];\n meta: PaginationMeta | null;\n requestId: string | null;\n fetcher: PageFetcher<T>;\n}\n\nexport class Page<T> implements AsyncIterable<T> {\n readonly data: readonly T[];\n readonly meta: PaginationMeta | null;\n readonly requestId: string | null;\n private readonly fetcher: PageFetcher<T>;\n\n constructor(init: PageInit<T>) {\n this.data = init.data;\n this.meta = init.meta;\n this.requestId = init.requestId;\n this.fetcher = init.fetcher;\n }\n\n get hasNextPage(): boolean {\n return this.meta?.has_next_page === true;\n }\n\n async getNextPage(): Promise<Page<T> | null> {\n if (!this.hasNextPage || !this.meta) return null;\n return this.fetcher(this.meta.current_page + 1);\n }\n\n async *[Symbol.asyncIterator](): AsyncIterator<T> {\n let cursor: Page<T> | null = this;\n while (cursor) {\n for (const item of cursor.data) yield item;\n cursor = await cursor.getNextPage();\n }\n }\n\n async *pages(): AsyncGenerator<Page<T>> {\n let cursor: Page<T> | null = this;\n while (cursor) {\n yield cursor;\n cursor = await cursor.getNextPage();\n }\n }\n}\n\n/**\n * The return value of a `list` call. Awaiting it yields the first `Page`; iterating\n * it with `for await` walks every item across all pages, fetching lazily.\n */\nexport class PagePromise<T> implements PromiseLike<Page<T>>, AsyncIterable<T> {\n private readonly load: () => Promise<Page<T>>;\n\n constructor(load: () => Promise<Page<T>>) {\n this.load = load;\n }\n\n // biome-ignore lint/suspicious/noThenProperty: this is an intentional thenable so list() can be awaited\n then<TResult1 = Page<T>, TResult2 = never>(\n onfulfilled?: ((value: Page<T>) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null,\n ): Promise<TResult1 | TResult2> {\n return this.load().then(onfulfilled, onrejected);\n }\n\n catch<TResult = never>(\n onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null,\n ): Promise<Page<T> | TResult> {\n return this.load().then(undefined, onrejected);\n }\n\n finally(onfinally?: (() => void) | null): Promise<Page<T>> {\n return this.load().finally(onfinally);\n }\n\n async *[Symbol.asyncIterator](): AsyncIterator<T> {\n const first = await this.load();\n yield* first;\n }\n\n pages(): AsyncIterable<Page<T>> {\n const load = this.load;\n return {\n async *[Symbol.asyncIterator]() {\n const first = await load();\n yield* first.pages();\n },\n };\n }\n}\n","import type { RequestExecutor } from '../../core/types';\nimport type { AgentChannel } from './types';\n\nexport class AgentChannels {\n constructor(private readonly client: RequestExecutor) {}\n\n async list(agentId: string): Promise<readonly AgentChannel[]> {\n const res = await this.client.request<AgentChannel[]>({\n method: 'GET',\n path: `/agents/${agentId}/channels`,\n });\n return res.data;\n }\n}\n","import type { RequestExecutor } from '../../core/types';\nimport type { AgentConversationFlow } from './types';\n\nexport class AgentConversationFlows {\n constructor(private readonly client: RequestExecutor) {}\n\n async list(agentId: string): Promise<readonly AgentConversationFlow[]> {\n const res = await this.client.request<AgentConversationFlow[]>({\n method: 'GET',\n path: `/agents/${agentId}/conversation_flows`,\n });\n return res.data;\n }\n}\n","import type { RequestExecutor } from '../../core/types';\nimport type { AgentIntegration } from './types';\n\nexport class AgentIntegrations {\n constructor(private readonly client: RequestExecutor) {}\n\n async list(agentId: string): Promise<readonly AgentIntegration[]> {\n const res = await this.client.request<AgentIntegration[]>({\n method: 'GET',\n path: `/agents/${agentId}/integrations`,\n });\n return res.data;\n }\n}\n","import type { RequestExecutor, RequestOptions } from '../../core/types';\nimport type {\n CreateKnowledgeBaseBody,\n KnowledgeBaseSummary,\n UpdateKnowledgeBaseBody,\n} from './types';\n\nexport class AgentKnowledgeBases {\n constructor(private readonly client: RequestExecutor) {}\n\n async list(agentId: string): Promise<readonly KnowledgeBaseSummary[]> {\n const res = await this.client.request<KnowledgeBaseSummary[]>({\n method: 'GET',\n path: `/agents/${agentId}/knowledge_bases`,\n });\n return res.data;\n }\n\n async create(\n agentId: string,\n body: CreateKnowledgeBaseBody,\n options: RequestOptions = {},\n ): Promise<KnowledgeBaseSummary> {\n const res = await this.client.request<KnowledgeBaseSummary>({\n method: 'POST',\n path: `/agents/${agentId}/knowledge_bases`,\n body,\n ...options,\n });\n return res.data;\n }\n\n async update(\n agentId: string,\n kbId: string,\n body: UpdateKnowledgeBaseBody,\n ): Promise<KnowledgeBaseSummary> {\n const res = await this.client.request<KnowledgeBaseSummary>({\n method: 'PATCH',\n path: `/agents/${agentId}/knowledge_bases/${kbId}`,\n body,\n });\n return res.data;\n }\n\n async delete(agentId: string, kbId: string): Promise<void> {\n await this.client.request<null>({\n method: 'DELETE',\n path: `/agents/${agentId}/knowledge_bases/${kbId}`,\n });\n }\n}\n","import { Page, PagePromise } from '../../core/pagination';\nimport type { ListQuery, RequestExecutor, RequestOptions } from '../../core/types';\nimport { AgentActions } from './actions';\nimport { AgentChannels } from './channels';\nimport { AgentConversationFlows } from './conversation-flows';\nimport { AgentIntegrations } from './integrations';\nimport { AgentKnowledgeBases } from './knowledge-bases';\nimport type { Agent, AgentDetail, CreateAgentBody, UpdateAgentBody } from './types';\n\ntype Client = RequestExecutor;\n\nexport class Agents {\n readonly integrations: AgentIntegrations;\n readonly channels: AgentChannels;\n readonly conversationFlows: AgentConversationFlows;\n readonly actions: AgentActions;\n readonly knowledgeBases: AgentKnowledgeBases;\n\n constructor(private readonly client: Client) {\n this.integrations = new AgentIntegrations(client);\n this.channels = new AgentChannels(client);\n this.conversationFlows = new AgentConversationFlows(client);\n this.actions = new AgentActions(client);\n this.knowledgeBases = new AgentKnowledgeBases(client);\n }\n\n list(query: ListQuery = {}): PagePromise<Agent> {\n return new PagePromise(() => this.fetchPage(query.page ?? 1, query));\n }\n\n async create(body: CreateAgentBody, options: RequestOptions = {}): Promise<Agent> {\n const res = await this.client.request<Agent>({\n method: 'POST',\n path: '/agents',\n body,\n ...options,\n });\n return res.data;\n }\n\n async retrieve(agentId: string): Promise<AgentDetail> {\n const res = await this.client.request<AgentDetail>({\n method: 'GET',\n path: `/agents/${agentId}`,\n });\n return res.data;\n }\n\n async update(agentId: string, body: UpdateAgentBody): Promise<Agent> {\n const res = await this.client.request<Agent>({\n method: 'PATCH',\n path: `/agents/${agentId}`,\n body,\n });\n return res.data;\n }\n\n private async fetchPage(page: number, query: ListQuery): Promise<Page<Agent>> {\n const res = await this.client.request<Agent[]>({\n method: 'GET',\n path: '/agents',\n query: { page, limit: query.limit, search: query.search, sort: query.sort },\n });\n return new Page<Agent>({\n data: res.data,\n meta: res.meta,\n requestId: res.requestId,\n fetcher: (next) => this.fetchPage(next, query),\n });\n }\n}\n","import type { RequestExecutor } from '../../core/types';\nimport type { Call } from './types';\n\nexport class Calls {\n constructor(private readonly client: RequestExecutor) {}\n\n async list(): Promise<readonly Call[]> {\n const res = await this.client.request<Call[]>({ method: 'GET', path: '/calls' });\n return res.data;\n }\n}\n","import { Page, PagePromise } from '../../core/pagination';\nimport type { RequestExecutor, RequestOptions } from '../../core/types';\nimport type { ListMessagesQuery, Message, SendMessageBody } from './types';\n\ntype Client = RequestExecutor;\n\nexport class Messages {\n constructor(private readonly client: Client) {}\n\n list(\n agentId: string,\n conversationId: string,\n query: ListMessagesQuery = {},\n ): PagePromise<Message> {\n return new PagePromise(() => this.fetchPage(agentId, conversationId, query.page ?? 1, query));\n }\n\n async send(\n agentId: string,\n conversationId: string,\n body: SendMessageBody,\n options: RequestOptions = {},\n ): Promise<Message> {\n const res = await this.client.request<Message>({\n method: 'POST',\n path: `/agents/${agentId}/conversations/${conversationId}/messages`,\n body,\n ...options,\n });\n return res.data;\n }\n\n private async fetchPage(\n agentId: string,\n conversationId: string,\n page: number,\n query: ListMessagesQuery,\n ): Promise<Page<Message>> {\n const res = await this.client.request<Message[]>({\n method: 'GET',\n path: `/agents/${agentId}/conversations/${conversationId}/messages`,\n query: { page, limit: query.limit },\n });\n return new Page<Message>({\n data: res.data,\n meta: res.meta,\n requestId: res.requestId,\n fetcher: (next) => this.fetchPage(agentId, conversationId, next, query),\n });\n }\n}\n","import { Page, PagePromise } from '../../core/pagination';\nimport type { RequestExecutor } from '../../core/types';\nimport { Messages } from './messages';\nimport type { Conversation, ListConversationsQuery } from './types';\n\ntype Client = RequestExecutor;\n\nexport class Conversations {\n readonly messages: Messages;\n\n constructor(private readonly client: Client) {\n this.messages = new Messages(client);\n }\n\n list(agentId: string, query: ListConversationsQuery = {}): PagePromise<Conversation> {\n return new PagePromise(() => this.fetchPage(agentId, query.page ?? 1, query));\n }\n\n async retrieve(agentId: string, conversationId: string): Promise<Conversation> {\n const res = await this.client.request<Conversation>({\n method: 'GET',\n path: `/agents/${agentId}/conversations/${conversationId}`,\n });\n return res.data;\n }\n\n private async fetchPage(\n agentId: string,\n page: number,\n query: ListConversationsQuery,\n ): Promise<Page<Conversation>> {\n const res = await this.client.request<Conversation[]>({\n method: 'GET',\n path: `/agents/${agentId}/conversations`,\n query: { page, limit: query.limit, search: query.search, channel: query.channel },\n });\n return new Page<Conversation>({\n data: res.data,\n meta: res.meta,\n requestId: res.requestId,\n fetcher: (next) => this.fetchPage(agentId, next, query),\n });\n }\n}\n","import { Page, PagePromise } from '../../core/pagination';\nimport type { RequestExecutor, RequestOptions } from '../../core/types';\nimport type {\n CreateWorkflowBody,\n ListWorkflowsQuery,\n UpdateWorkflowBody,\n Workflow,\n WorkflowSummary,\n} from './types';\n\ntype Client = RequestExecutor;\n\nexport class Workflows {\n constructor(private readonly client: Client) {}\n\n list(query: ListWorkflowsQuery = {}): PagePromise<WorkflowSummary> {\n return new PagePromise(() => this.fetchPage(query.page ?? 1, query));\n }\n\n async create(body: CreateWorkflowBody, options: RequestOptions = {}): Promise<Workflow> {\n const res = await this.client.request<Workflow>({\n method: 'POST',\n path: '/workflows',\n body,\n ...options,\n });\n return res.data;\n }\n\n async retrieve(workflowId: string): Promise<Workflow> {\n const res = await this.client.request<Workflow>({\n method: 'GET',\n path: `/workflows/${workflowId}`,\n });\n return res.data;\n }\n\n async update(workflowId: string, body: UpdateWorkflowBody): Promise<Workflow> {\n const res = await this.client.request<Workflow>({\n method: 'PATCH',\n path: `/workflows/${workflowId}`,\n body,\n });\n return res.data;\n }\n\n async delete(workflowId: string): Promise<void> {\n await this.client.request<null>({\n method: 'DELETE',\n path: `/workflows/${workflowId}`,\n });\n }\n\n private async fetchPage(page: number, query: ListWorkflowsQuery): Promise<Page<WorkflowSummary>> {\n const res = await this.client.request<WorkflowSummary[]>({\n method: 'GET',\n path: '/workflows',\n query: {\n page,\n limit: query.limit,\n search: query.search,\n sort: query.sort,\n scope: query.scope,\n },\n });\n return new Page<WorkflowSummary>({\n data: res.data,\n meta: res.meta,\n requestId: res.requestId,\n fetcher: (next) => this.fetchPage(next, query),\n });\n }\n}\n","import { HttpClient, type HttpClientConfig } from './core/http-client';\nimport type {\n ApiResponse,\n InternalRequestSpec,\n RequestExecutor,\n RequestOptions,\n} from './core/types';\nimport { Agents } from './resources/agents';\nimport { Calls } from './resources/calls';\nimport { Conversations } from './resources/conversations';\nimport { Workflows } from './resources/workflows';\n\nexport type BimpeAIConfig = HttpClientConfig;\n\nexport class BimpeAI {\n readonly agents: Agents;\n readonly workflows: Workflows;\n readonly conversations: Conversations;\n readonly calls: Calls;\n private readonly http: RequestExecutor;\n\n constructor(config: BimpeAIConfig) {\n this.http = new HttpClient(config);\n this.agents = new Agents(this.http);\n this.workflows = new Workflows(this.http);\n this.conversations = new Conversations(this.http);\n this.calls = new Calls(this.http);\n }\n\n request<T>(spec: InternalRequestSpec & RequestOptions): Promise<ApiResponse<T>> {\n return this.http.request<T>(spec);\n }\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -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 };
|