@amigo-ai/sdk 0.19.0 → 0.20.1

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.js CHANGED
@@ -510,6 +510,10 @@ var ConversationResource = class {
510
510
  }
511
511
  async interactWithConversation(conversationId, input, queryParams, headers, options) {
512
512
  let bodyToSend;
513
+ const mergedHeaders = {
514
+ Accept: "application/x-ndjson",
515
+ ...headers ?? {}
516
+ };
513
517
  if (queryParams.request_format === "text") {
514
518
  if (typeof input !== "string") {
515
519
  throw new BadRequestError("textMessage is required when request_format is 'text'");
@@ -528,6 +532,17 @@ var ConversationResource = class {
528
532
  } else {
529
533
  throw new BadRequestError("Unsupported or missing request_format in params");
530
534
  }
535
+ if (queryParams.request_format === "text") {
536
+ delete mergedHeaders["content-type"];
537
+ delete mergedHeaders["Content-Type"];
538
+ }
539
+ if (queryParams.request_format === "voice") {
540
+ const hasContentType = mergedHeaders["content-type"] !== void 0 || mergedHeaders["Content-Type"] !== void 0;
541
+ if (!hasContentType && typeof Blob !== "undefined" && input instanceof Blob && input.type) {
542
+ mergedHeaders["content-type"] = input.type;
543
+ }
544
+ }
545
+ const headersToSend = mergedHeaders;
531
546
  const normalizedQuery = {
532
547
  ...queryParams,
533
548
  request_audio_config: typeof queryParams.request_audio_config === "object" && queryParams.request_audio_config !== null ? JSON.stringify(queryParams.request_audio_config) : queryParams.request_audio_config ?? void 0
@@ -535,13 +550,10 @@ var ConversationResource = class {
535
550
  const resp = await this.c.POST("/v1/{organization}/conversation/{conversation_id}/interact", {
536
551
  params: {
537
552
  path: { organization: this.orgId, conversation_id: conversationId },
538
- query: normalizedQuery
553
+ query: normalizedQuery,
554
+ header: headersToSend
539
555
  },
540
556
  body: bodyToSend,
541
- headers: {
542
- Accept: "application/x-ndjson",
543
- ...headers ?? {}
544
- },
545
557
  parseAs: "stream",
546
558
  ...options?.signal && { signal: options.signal }
547
559
  });
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/core/errors.ts", "../src/core/utils.ts", "../src/core/openapi-client.ts", "../src/core/auth.ts", "../src/core/retry.ts", "../src/resources/organization.ts", "../src/resources/conversation.ts", "../src/resources/services.ts", "../src/resources/user.ts", "../src/index.ts"],
4
- "sourcesContent": ["import type { Middleware } from 'openapi-fetch'\nimport { isNetworkError, parseResponseBody } from './utils'\n\n/**\n * Base error class for all Amigo SDK errors.\n * Provides common functionality and error identification.\n */\nexport class AmigoError extends Error {\n /**\n * Unique error code for programmatic error handling\n */\n readonly errorCode?: string\n\n /**\n * HTTP status code if applicable\n */\n readonly statusCode?: number\n\n /**\n * Additional context data\n */\n context?: Record<string, unknown>\n\n constructor(message: string, options?: Record<string, unknown>) {\n super(message)\n this.name = this.constructor.name\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, new.target.prototype)\n\n // Capture stack trace\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor)\n }\n\n // copies status, code, etc.\n Object.assign(this, options)\n }\n\n /**\n * Returns a JSON-serializable representation of the error\n */\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n message: this.message,\n code: this.errorCode,\n statusCode: this.statusCode,\n context: this.context,\n stack: this.stack,\n }\n }\n}\n\n/* 4xx client errors */\nexport class BadRequestError extends AmigoError {}\nexport class AuthenticationError extends AmigoError {}\nexport class PermissionError extends AmigoError {}\nexport class NotFoundError extends AmigoError {}\nexport class ConflictError extends AmigoError {}\nexport class RateLimitError extends AmigoError {}\n\n/* 5xx server errors */\nexport class ServerError extends AmigoError {}\nexport class ServiceUnavailableError extends ServerError {}\n\n/* Internal SDK errors */\nexport class ConfigurationError extends AmigoError {\n constructor(\n message: string,\n public field?: string\n ) {\n super(message)\n this.context = { field }\n }\n}\n\n/* Validation errors */\nexport class ValidationError extends BadRequestError {\n constructor(\n msg: string,\n public fieldErrors?: Record<string, string>\n ) {\n super(msg)\n }\n}\n\n/* Network-related errors */\nexport class NetworkError extends AmigoError {\n constructor(\n message: string,\n public readonly originalError?: Error,\n public readonly request?: {\n url?: string\n method?: string\n }\n ) {\n super(message, { cause: originalError })\n this.context = { request }\n }\n}\n\n/* Parsing errors */\nexport class ParseError extends AmigoError {\n constructor(\n message: string,\n public readonly parseType: 'json' | 'response' | 'other',\n public readonly originalError?: Error\n ) {\n super(message, { cause: originalError })\n this.context = { parseType }\n }\n}\n\n/* Type guard functions */\nexport function isAmigoError(error: unknown): error is AmigoError {\n return error instanceof AmigoError\n}\n\n/* Error factory to create appropriate error instances from API responses */\nexport function createApiError(response: Response, body?: unknown): AmigoError {\n const map: Record<number, typeof AmigoError> = {\n 400: BadRequestError,\n 401: AuthenticationError,\n 403: PermissionError,\n 404: NotFoundError,\n 409: ConflictError,\n 422: ValidationError,\n 429: RateLimitError,\n 500: ServerError,\n 503: ServiceUnavailableError,\n }\n\n const errorMessageKeys = ['message', 'error', 'detail']\n\n const ErrorClass = map[response.status] ?? AmigoError\n let message = `HTTP ${response.status} ${response.statusText}`\n\n if (body && typeof body === 'object') {\n for (const key of errorMessageKeys) {\n if (key in body) {\n message = String((body as Record<string, unknown>)[key])\n break\n }\n }\n }\n\n const options = {\n status: response.status,\n code:\n body && typeof body === 'object' && 'code' in body\n ? (body as Record<string, unknown>).code\n : undefined,\n response: body,\n }\n\n const error = new ErrorClass(message, options)\n\n return error\n}\n\nexport function createErrorMiddleware(): Middleware {\n return {\n onResponse: async ({ response }) => {\n if (!response.ok) {\n const body = await parseResponseBody(response)\n throw createApiError(response, body)\n }\n },\n onError: async ({ error, request }) => {\n // Handle network-related errors consistently\n if (isNetworkError(error)) {\n throw new NetworkError(\n `Network error: ${error instanceof Error ? error.message : String(error)}`,\n error instanceof Error ? error : new Error(String(error)),\n {\n url: request?.url,\n method: request?.method,\n }\n )\n }\n throw error\n },\n }\n}\n", "import { ParseError } from './errors'\n\n// Type helper to extract the data type from openapi-fetch responses\nexport type ExtractDataType<T> = T extends { data?: infer D } ? NonNullable<D> : never\n\n// Helper function to extract data from openapi-fetch responses\n// Since our middleware throws on errors, successful responses will have data\nexport async function extractData<T extends { data?: unknown }>(\n responsePromise: Promise<T>\n): Promise<ExtractDataType<T>> {\n const result = await responsePromise\n const data = (result as { data?: ExtractDataType<T> }).data\n\n if (data === undefined || data === null) {\n // Invariant: our error middleware throws for non-2xx responses.\n // If we reach here without data, treat as a parse/protocol error.\n throw new ParseError('Expected response data to be present for successful request', 'response')\n }\n\n return data\n}\n\n/**\n * Parse an NDJSON HTTP response body into an async generator of parsed JSON objects.\n * The generator yields one parsed object per line. Empty lines are skipped.\n */\nexport async function* parseNdjsonStream<T = unknown>(response: Response): AsyncGenerator<T> {\n const body = response.body\n if (!body) return\n\n const reader = body.getReader()\n const decoder = new TextDecoder()\n let bufferedText = ''\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n bufferedText += decoder.decode(value, { stream: true })\n\n let newlineIndex: number\n // Process all complete lines in the buffer\n while ((newlineIndex = bufferedText.indexOf('\\n')) !== -1) {\n const line = bufferedText.slice(0, newlineIndex).trim()\n bufferedText = bufferedText.slice(newlineIndex + 1)\n if (!line) continue\n try {\n yield JSON.parse(line) as T\n } catch (err) {\n throw new ParseError('Failed to parse NDJSON line', 'json', err as Error)\n }\n }\n }\n\n // Flush any trailing line without a newline\n const trailing = bufferedText.trim()\n if (trailing) {\n try {\n yield JSON.parse(trailing) as T\n } catch (err) {\n throw new ParseError('Failed to parse trailing NDJSON line', 'json', err as Error)\n }\n }\n } finally {\n reader.releaseLock()\n }\n}\n\n// Utility function to safely parse response bodies without throwing errors\nexport async function parseResponseBody(response: Response): Promise<unknown> {\n try {\n const text = await response.text()\n if (!text) return undefined\n try {\n return JSON.parse(text)\n } catch {\n return text // Return as string if not valid JSON\n }\n } catch {\n return undefined // Return undefined if any error occurs\n }\n}\n\n// Helper to detect network-related errors\nexport function isNetworkError(error: unknown): boolean {\n if (!(error instanceof Error)) return false\n\n return (\n error instanceof TypeError ||\n error.message.includes('fetch') ||\n error.message.includes('Failed to fetch') ||\n error.message.includes('Network request failed') ||\n error.message.includes('ECONNREFUSED') ||\n error.message.includes('ETIMEDOUT') ||\n error.message.includes('ENOTFOUND') ||\n error.message.includes('network')\n )\n}\n", "import createClient, { type Client } from 'openapi-fetch'\nimport { createErrorMiddleware } from './errors'\nimport { createAuthMiddleware } from './auth'\nimport type { paths } from '../generated/api-types'\nimport type { AmigoSdkConfig } from '..'\nimport { createRetryingFetch } from './retry'\n\nexport type AmigoFetch = Client<paths>\n\nexport function createAmigoFetch(config: AmigoSdkConfig, mockFetch?: typeof fetch): AmigoFetch {\n const wrappedFetch = createRetryingFetch(\n config.retry,\n mockFetch ?? (globalThis.fetch as typeof fetch)\n )\n\n const client = createClient<paths>({\n baseUrl: config.baseUrl,\n fetch: wrappedFetch,\n })\n\n // Apply error handling middleware first (to catch all errors)\n client.use(createErrorMiddleware())\n\n // Apply auth middleware after error handling (so auth errors are properly handled)\n client.use(createAuthMiddleware(config))\n\n return client\n}\n", "import type { Middleware } from 'openapi-fetch'\nimport type { components } from '../generated/api-types'\nimport type { AmigoSdkConfig } from '..'\nimport { AmigoError, AuthenticationError, NetworkError, ParseError, createApiError } from './errors'\nimport { isNetworkError, parseResponseBody } from './utils'\n\ntype SignInWithApiKeyResponse = components['schemas']['user__sign_in_with_api_key__Response']\n\n/** Helper function to trade API key for a bearer token */\nexport async function getBearerToken(config: AmigoSdkConfig): Promise<SignInWithApiKeyResponse> {\n const url = `${config.baseUrl}/v1/${config.orgId}/user/signin_with_api_key`\n\n try {\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n 'x-api-key': config.apiKey,\n 'x-api-key-id': config.apiKeyId,\n 'x-user-id': config.userId,\n },\n })\n\n if (!response.ok) {\n const body = await parseResponseBody(response)\n const apiError = createApiError(response, body)\n\n // Enhance authentication errors with additional context\n if (response.status === 401) {\n throw new AuthenticationError(`Authentication failed: ${apiError.message}`, {\n ...apiError,\n context: { ...apiError.context, endpoint: 'signin_with_api_key' },\n })\n }\n throw apiError\n }\n\n return (await response.json()) as SignInWithApiKeyResponse\n } catch (err) {\n // Re-throw our custom errors as-is\n if (err instanceof AmigoError) {\n throw err\n }\n\n // Handle network errors\n if (isNetworkError(err)) {\n throw new NetworkError('Failed to connect to authentication endpoint', err as Error, {\n url,\n method: 'POST',\n })\n }\n\n // Handle JSON parsing errors\n throw new ParseError(\n 'Failed to parse authentication response',\n 'json',\n err instanceof Error ? err : new Error(String(err))\n )\n }\n}\n\nexport function createAuthMiddleware(config: AmigoSdkConfig): Middleware {\n let token: SignInWithApiKeyResponse | null = null\n let refreshPromise: Promise<SignInWithApiKeyResponse> | null = null\n\n const shouldRefreshToken = (tokenData: SignInWithApiKeyResponse): boolean => {\n if (!tokenData.expires_at) return false\n\n const expiryTime = new Date(tokenData.expires_at).getTime()\n const currentTime = Date.now()\n const timeUntilExpiry = expiryTime - currentTime\n const refreshThreshold = 5 * 60 * 1000 // 5 minutes in milliseconds\n\n return timeUntilExpiry <= refreshThreshold\n }\n\n const ensureValidToken = async (): Promise<SignInWithApiKeyResponse> => {\n if (!token || shouldRefreshToken(token)) {\n if (!refreshPromise) {\n refreshPromise = getBearerToken(config)\n try {\n token = await refreshPromise\n } finally {\n refreshPromise = null\n }\n } else {\n token = await refreshPromise\n }\n }\n return token\n }\n\n return {\n onRequest: async ({ request }) => {\n try {\n const validToken = await ensureValidToken()\n if (validToken?.id_token) {\n request.headers.set('Authorization', `Bearer ${validToken.id_token}`)\n }\n } catch (error) {\n // Clear token and re-throw - getBearerToken already provides proper error types\n token = null\n throw error\n }\n return request\n },\n\n onResponse: async ({ response }) => {\n // Handle 401 responses by clearing token to force refresh on next request\n if (response.status === 401) {\n token = null\n }\n },\n\n onError: async ({ error }) => {\n // Clear token on any error to force refresh\n token = null\n throw error\n },\n }\n}\n", "export type RetryOptions = {\n /** Maximum number of attempts to make (default: 3) */\n maxAttempts?: number\n /** Base delay between attempts (default: 250ms) */\n backoffBaseMs?: number\n /** Maximum delay between attempts (default: 30s) */\n maxDelayMs?: number\n /** Status codes to retry on (default: 408, 429, 500, 502, 503, 504) */\n retryOnStatus?: Set<number>\n /** Methods to retry on (default: GET) */\n retryOnMethods?: Set<string>\n}\n\nconst DEFAULT_RETRYABLE_STATUS = new Set([408, 429, 500, 502, 503, 504])\nconst DEFAULT_RETRYABLE_METHODS = new Set(['GET']) as Set<string>\n\nexport function resolveRetryOptions(options?: RetryOptions): Required<RetryOptions> {\n return {\n maxAttempts: options?.maxAttempts ?? 3,\n backoffBaseMs: options?.backoffBaseMs ?? 250,\n maxDelayMs: options?.maxDelayMs ?? 30_000,\n retryOnStatus: new Set(options?.retryOnStatus ?? DEFAULT_RETRYABLE_STATUS),\n retryOnMethods: new Set(options?.retryOnMethods ?? DEFAULT_RETRYABLE_METHODS),\n }\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.max(min, Math.min(max, value))\n}\n\nfunction parseRetryAfterMs(headerValue: string | null, maxDelayMs: number): number | null {\n if (!headerValue) return null\n const seconds = Number(headerValue)\n if (Number.isFinite(seconds)) {\n return clamp(seconds * 1000, 0, maxDelayMs)\n }\n const date = new Date(headerValue)\n const ms = date.getTime() - Date.now()\n if (Number.isFinite(ms)) {\n return clamp(ms, 0, maxDelayMs)\n }\n return null\n}\n\nfunction computeBackoffWithJitterMs(\n attemptIndexZeroBased: number,\n baseMs: number,\n capMs: number\n): number {\n const windowMs = Math.min(capMs, baseMs * Math.pow(2, attemptIndexZeroBased))\n return Math.random() * windowMs\n}\n\nfunction isAbortError(err: unknown): boolean {\n return typeof err === 'object' && err !== null && 'name' in err && err['name'] === 'AbortError'\n}\n\nfunction isNetworkError(err: unknown): boolean {\n // Undici & browsers use TypeError for network failures\n return err instanceof TypeError && !isAbortError(err)\n}\n\nasync function abortableSleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (ms <= 0) {\n signal?.throwIfAborted?.()\n return\n }\n await new Promise<void>((resolve, reject) => {\n const rejectWith =\n signal?.reason instanceof Error ? signal.reason : (signal?.reason ?? new Error('AbortError'))\n\n if (signal?.aborted) {\n reject(rejectWith)\n return\n }\n const t = setTimeout(() => {\n off()\n resolve()\n }, ms)\n const onAbort = () => {\n off()\n clearTimeout(t)\n reject(rejectWith)\n }\n const off = () => signal?.removeEventListener('abort', onAbort)\n signal?.addEventListener('abort', onAbort, { once: true })\n })\n}\n\nexport function createRetryingFetch(\n retryOptions?: RetryOptions,\n baseFetch?: typeof fetch\n): typeof fetch {\n const resolved = resolveRetryOptions(retryOptions)\n const underlying: typeof fetch = baseFetch ?? (globalThis.fetch as typeof fetch)\n\n const retryingFetch: typeof fetch = async (\n input: RequestInfo | URL,\n init?: RequestInit\n ): Promise<Response> => {\n const inputMethod =\n typeof Request !== 'undefined' && input instanceof Request ? input.method : undefined\n const method = ((init?.method ?? inputMethod ?? 'GET') as string).toUpperCase()\n const signal = init?.signal\n\n const isMethodRetryableByDefault = resolved.retryOnMethods.has(method)\n const maxAttempts = Math.max(1, resolved.maxAttempts)\n\n for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n let response: Response | null = null\n let error: unknown = null\n\n try {\n response = await underlying(input, init)\n } catch (err) {\n error = err\n }\n\n if (!error && response && response.ok) {\n return response\n }\n\n let shouldRetry = false\n let delayMs: number | null = null\n\n if (isNetworkError(error)) {\n shouldRetry = isMethodRetryableByDefault\n if (shouldRetry) {\n delayMs = computeBackoffWithJitterMs(\n attempt - 1,\n resolved.backoffBaseMs,\n resolved.maxDelayMs\n )\n }\n } else if (response) {\n const status = response.status\n if (method === 'POST') {\n if (status === 429) {\n const ra = response.headers.get('Retry-After')\n const parsed = parseRetryAfterMs(ra, resolved.maxDelayMs)\n if (parsed !== null) {\n shouldRetry = true\n delayMs = parsed\n }\n }\n } else if (isMethodRetryableByDefault && resolved.retryOnStatus.has(status)) {\n const ra = response.headers.get('Retry-After')\n delayMs =\n parseRetryAfterMs(ra, resolved.maxDelayMs) ??\n computeBackoffWithJitterMs(attempt - 1, resolved.backoffBaseMs, resolved.maxDelayMs)\n shouldRetry = true\n }\n }\n\n const attemptsRemain = attempt < maxAttempts\n if (!shouldRetry || !attemptsRemain) {\n if (error) throw error\n return response as Response\n }\n\n if (signal?.aborted) {\n if (error) throw error\n return response as Response\n }\n\n await abortableSleep(delayMs ?? 0, signal ?? undefined)\n }\n\n throw new Error('Retry loop exited unexpectedly')\n }\n\n return retryingFetch\n}\n\nexport type { RetryOptions as AmigoRetryOptions }\n", "import type { AmigoFetch } from '../core/openapi-client'\nimport { extractData } from '../core/utils'\nimport type { operations } from '../generated/api-types'\n\nexport class OrganizationResource {\n constructor(\n private c: AmigoFetch,\n private orgId: string\n ) {}\n\n /**\n * Get organization details\n * @param headers - The headers\n * @returns The organization details\n */\n async getOrganization(headers?: operations['get-organization']['parameters']['header']) {\n return extractData(\n this.c.GET('/v1/{organization}/organization/', {\n params: { path: { organization: this.orgId } },\n headers,\n })\n )\n }\n}\n", "import { BadRequestError } from '../core/errors'\nimport type { AmigoFetch } from '../core/openapi-client'\nimport { extractData, parseNdjsonStream } from '../core/utils'\nimport type { components, operations } from '../generated/api-types'\n\ntype VoiceData = Blob | Uint8Array | ReadableStream<Uint8Array>\nexport type InteractionInput = string | VoiceData\n\ntype InteractQuery = operations['interact-with-conversation']['parameters']['query']\ntype InteractQuerySerialized = Omit<InteractQuery, 'request_audio_config'> & {\n request_audio_config?: string | null\n}\n\nexport class ConversationResource {\n constructor(\n private c: AmigoFetch,\n private orgId: string\n ) {}\n\n async createConversation(\n body: components['schemas']['conversation__create_conversation__Request'],\n queryParams: operations['create-conversation']['parameters']['query'],\n headers?: operations['create-conversation']['parameters']['header'],\n options?: { signal?: AbortSignal }\n ) {\n const resp = await this.c.POST('/v1/{organization}/conversation/', {\n params: { path: { organization: this.orgId }, query: queryParams },\n body,\n headers: {\n Accept: 'application/x-ndjson',\n ...(headers ?? {}),\n } as operations['create-conversation']['parameters']['header'],\n // Ensure we receive a stream for NDJSON\n parseAs: 'stream',\n ...(options?.signal && { signal: options.signal }),\n })\n\n // onResponse middleware throws for non-2xx; if we reach here, it's OK.\n return parseNdjsonStream<components['schemas']['conversation__create_conversation__Response']>(\n resp.response\n )\n }\n\n async interactWithConversation(\n conversationId: string,\n input: InteractionInput,\n queryParams: operations['interact-with-conversation']['parameters']['query'],\n headers?: operations['interact-with-conversation']['parameters']['header'],\n options?: { signal?: AbortSignal }\n ) {\n // Build body based on requested format, then perform a single POST\n let bodyToSend: FormData | VoiceData\n\n if (queryParams.request_format === 'text') {\n if (typeof input !== 'string') {\n throw new BadRequestError(\"textMessage is required when request_format is 'text'\")\n }\n const form = new FormData()\n const blob = new Blob([input], { type: 'text/plain; charset=utf-8' })\n form.append('recorded_message', blob, 'message.txt')\n bodyToSend = form\n } else if (queryParams.request_format === 'voice') {\n if (typeof input === 'string') {\n throw new BadRequestError(\n \"voice input must be a byte source when request_format is 'voice'\"\n )\n }\n bodyToSend = input\n } else {\n throw new BadRequestError('Unsupported or missing request_format in params')\n }\n\n // Normalize nested object params that must be sent as JSON strings\n const normalizedQuery: InteractQuerySerialized = {\n ...queryParams,\n request_audio_config:\n typeof queryParams.request_audio_config === 'object' &&\n queryParams.request_audio_config !== null\n ? JSON.stringify(queryParams.request_audio_config)\n : (queryParams.request_audio_config ?? undefined),\n }\n\n const resp = await this.c.POST('/v1/{organization}/conversation/{conversation_id}/interact', {\n params: {\n path: { organization: this.orgId, conversation_id: conversationId },\n query: normalizedQuery as unknown as InteractQuery,\n },\n body: bodyToSend,\n headers: {\n Accept: 'application/x-ndjson',\n ...(headers ?? {}),\n } as operations['interact-with-conversation']['parameters']['header'],\n parseAs: 'stream',\n ...(options?.signal && { signal: options.signal }),\n })\n\n return parseNdjsonStream<\n components['schemas']['conversation__interact_with_conversation__Response']\n >(resp.response)\n }\n\n async getConversations(\n queryParams?: operations['get-conversations']['parameters']['query'],\n headers?: operations['get-conversations']['parameters']['header']\n ) {\n return extractData(\n this.c.GET('/v1/{organization}/conversation/', {\n params: { path: { organization: this.orgId }, query: queryParams },\n headers,\n })\n )\n }\n\n async getConversationMessages(\n conversationId: string,\n queryParams?: operations['get-conversation-messages']['parameters']['query'],\n headers?: operations['get-conversation-messages']['parameters']['header']\n ) {\n return extractData(\n this.c.GET('/v1/{organization}/conversation/{conversation_id}/messages/', {\n params: {\n path: { organization: this.orgId, conversation_id: conversationId },\n query: queryParams,\n },\n headers,\n })\n )\n }\n\n async finishConversation(\n conversationId: string,\n headers?: operations['finish-conversation']['parameters']['header']\n ) {\n await this.c.POST('/v1/{organization}/conversation/{conversation_id}/finish/', {\n params: { path: { organization: this.orgId, conversation_id: conversationId } },\n headers,\n // No content is expected; parse as text to access raw Response\n parseAs: 'text',\n })\n return\n }\n\n async recommendResponsesForInteraction(\n conversationId: string,\n interactionId: string,\n headers?: operations['recommend-responses-for-interaction']['parameters']['header']\n ) {\n return extractData(\n this.c.GET(\n '/v1/{organization}/conversation/{conversation_id}/interaction/{interaction_id}/recommend_responses',\n {\n params: {\n path: {\n organization: this.orgId,\n conversation_id: conversationId,\n interaction_id: interactionId,\n },\n },\n headers,\n }\n )\n )\n }\n\n async getInteractionInsights(\n conversationId: string,\n interactionId: string,\n headers?: operations['get-interaction-insights']['parameters']['header']\n ) {\n return extractData(\n this.c.GET(\n '/v1/{organization}/conversation/{conversation_id}/interaction/{interaction_id}/insights',\n {\n params: {\n path: {\n organization: this.orgId,\n conversation_id: conversationId,\n interaction_id: interactionId,\n },\n },\n headers,\n }\n )\n )\n }\n\n // Note: the OpenAPI response schema isn't correct for this endpoint.\n // TODO -- fix response typing.\n async getMessageSource(\n conversationId: string,\n messageId: string,\n headers?: operations['retrieve-message-source']['parameters']['header']\n ) {\n return extractData(\n this.c.GET('/v1/{organization}/conversation/{conversation_id}/messages/{message_id}/source', {\n params: {\n path: {\n organization: this.orgId,\n conversation_id: conversationId,\n message_id: messageId,\n },\n },\n headers,\n })\n )\n }\n\n async generateConversationStarters(\n body: components['schemas']['conversation__generate_conversation_starter__Request'],\n headers?: operations['generate-conversation-starter']['parameters']['header']\n ) {\n return extractData(\n this.c.POST('/v1/{organization}/conversation/conversation_starter', {\n params: { path: { organization: this.orgId } },\n body,\n headers,\n })\n )\n }\n}\n", "import type { AmigoFetch } from '../core/openapi-client'\nimport { extractData } from '../core/utils'\nimport type { operations } from '../generated/api-types'\n\nexport class ServiceResource {\n constructor(\n private c: AmigoFetch,\n private orgId: string\n ) {}\n\n /**\n * Get services\n * @param headers - The headers\n * @returns The services\n */\n async getServices(\n queryParams?: operations['get-services']['parameters']['query'],\n headers?: operations['get-services']['parameters']['header']\n ) {\n return extractData(\n this.c.GET('/v1/{organization}/service/', {\n params: { path: { organization: this.orgId }, query: queryParams },\n headers,\n })\n )\n }\n}\n", "import type { AmigoFetch } from '../core/openapi-client'\nimport { extractData } from '../core/utils'\nimport type { components, operations } from '../generated/api-types'\n\nexport class UserResource {\n constructor(\n private c: AmigoFetch,\n private orgId: string\n ) {}\n\n async getUsers(\n queryParams?: operations['get-users']['parameters']['query'],\n headers?: operations['get-users']['parameters']['header']\n ) {\n return extractData(\n this.c.GET('/v1/{organization}/user/', {\n params: { path: { organization: this.orgId }, query: queryParams },\n headers,\n })\n )\n }\n\n async createUser(\n body: components['schemas']['user__create_invited_user__Request'],\n headers?: operations['create-invited-user']['parameters']['header']\n ) {\n return extractData(\n this.c.POST('/v1/{organization}/user/invite', {\n params: { path: { organization: this.orgId } },\n body,\n headers,\n })\n )\n }\n\n async deleteUser(userId: string, headers?: operations['delete-user']['parameters']['header']) {\n // DELETE endpoints returns no content (e.g., 204 No Content).\n // Our middleware already throws on non-2xx responses, so simply await the call.\n await this.c.DELETE('/v1/{organization}/user/{requested_user_id}', {\n params: { path: { organization: this.orgId, requested_user_id: userId } },\n headers,\n })\n return\n }\n\n async updateUser(\n userId: string,\n body: components['schemas']['user__update_user_info__Request'],\n headers?: operations['update-user-info']['parameters']['header']\n ) {\n // UPDATE endpoint returns no content (e.g., 204 No Content).\n // Our middleware already throws on non-2xx responses, so simply await the call.\n await this.c.POST('/v1/{organization}/user/{requested_user_id}/user', {\n params: { path: { organization: this.orgId, requested_user_id: userId } },\n body,\n headers,\n })\n return\n }\n}\n", "import { ConfigurationError } from './core/errors'\nimport { createAmigoFetch } from './core/openapi-client'\nimport { OrganizationResource } from './resources/organization'\nimport { ConversationResource } from './resources/conversation'\nimport { ServiceResource } from './resources/services'\nimport { UserResource } from './resources/user'\nimport type { RetryOptions } from './core/retry'\n\nexport interface AmigoSdkConfig {\n /** API key from Amigo dashboard */\n apiKey: string\n /** API-key ID from Amigo dashboard */\n apiKeyId: string\n /** User ID on whose behalf the request is made */\n userId: string\n /** The Organization ID */\n orgId: string\n /** Base URL of the Amigo API */\n baseUrl?: string\n /** Retry configuration for HTTP requests */\n retry?: RetryOptions\n}\n\nconst defaultBaseUrl = 'https://api.amigo.ai'\n\nexport class AmigoClient {\n readonly organizations: OrganizationResource\n readonly conversations: ConversationResource\n readonly services: ServiceResource\n readonly users: UserResource\n readonly config: AmigoSdkConfig\n\n constructor(config: AmigoSdkConfig) {\n this.config = validateConfig(config)\n\n const api = createAmigoFetch(this.config)\n this.organizations = new OrganizationResource(api, this.config.orgId)\n this.conversations = new ConversationResource(api, this.config.orgId)\n this.services = new ServiceResource(api, this.config.orgId)\n this.users = new UserResource(api, this.config.orgId)\n }\n}\n\nfunction validateConfig(config: AmigoSdkConfig) {\n if (!config.apiKey) {\n throw new ConfigurationError('API key is required', 'apiKey')\n }\n if (!config.apiKeyId) {\n throw new ConfigurationError('API key ID is required', 'apiKeyId')\n }\n if (!config.userId) {\n throw new ConfigurationError('User ID is required', 'userId')\n }\n if (!config.orgId) {\n throw new ConfigurationError('Organization ID is required', 'orgId')\n }\n if (!config.baseUrl) {\n config.baseUrl = defaultBaseUrl\n }\n return config\n}\n\n// Export all errors as a namespace to avoid polluting the main import space\nexport * as errors from './core/errors'\n\n// Re-export useful types for consumers\nexport type { components, operations, paths } from './generated/api-types'\n"],
5
- "mappings": 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xE;AAAA,IACF,CAAC;AACD;AAAA,EACF;AAAA,EAEA,MAAM,WACJ,QACA,MACA,SACA;AAGA,UAAM,KAAK,EAAE,KAAK,oDAAoD;AAAA,MACpE,QAAQ,EAAE,MAAM,EAAE,cAAc,KAAK,OAAO,mBAAmB,OAAO,EAAE;AAAA,MACxE;AAAA,MACA;AAAA,IACF,CAAC;AACD;AAAA,EACF;AACF;;;ACpCA,IAAM,iBAAiB;AAEhB,IAAM,cAAN,MAAkB;AAAA,EAOvB,YAAY,QAAwB;AANpC,wBAAS;AACT,wBAAS;AACT,wBAAS;AACT,wBAAS;AACT,wBAAS;AAGP,SAAK,SAAS,eAAe,MAAM;AAEnC,UAAM,MAAM,iBAAiB,KAAK,MAAM;AACxC,SAAK,gBAAgB,IAAI,qBAAqB,KAAK,KAAK,OAAO,KAAK;AACpE,SAAK,gBAAgB,IAAI,qBAAqB,KAAK,KAAK,OAAO,KAAK;AACpE,SAAK,WAAW,IAAI,gBAAgB,KAAK,KAAK,OAAO,KAAK;AAC1D,SAAK,QAAQ,IAAI,aAAa,KAAK,KAAK,OAAO,KAAK;AAAA,EACtD;AACF;AAEA,SAAS,eAAe,QAAwB;AAC9C,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,mBAAmB,uBAAuB,QAAQ;AAAA,EAC9D;AACA,MAAI,CAAC,OAAO,UAAU;AACpB,UAAM,IAAI,mBAAmB,0BAA0B,UAAU;AAAA,EACnE;AACA,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,mBAAmB,uBAAuB,QAAQ;AAAA,EAC9D;AACA,MAAI,CAAC,OAAO,OAAO;AACjB,UAAM,IAAI,mBAAmB,+BAA+B,OAAO;AAAA,EACrE;AACA,MAAI,CAAC,OAAO,SAAS;AACnB,WAAO,UAAU;AAAA,EACnB;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import type { Middleware } from 'openapi-fetch'\nimport { isNetworkError, parseResponseBody } from './utils'\n\n/**\n * Base error class for all Amigo SDK errors.\n * Provides common functionality and error identification.\n */\nexport class AmigoError extends Error {\n /**\n * Unique error code for programmatic error handling\n */\n readonly errorCode?: string\n\n /**\n * HTTP status code if applicable\n */\n readonly statusCode?: number\n\n /**\n * Additional context data\n */\n context?: Record<string, unknown>\n\n constructor(message: string, options?: Record<string, unknown>) {\n super(message)\n this.name = this.constructor.name\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, new.target.prototype)\n\n // Capture stack trace\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor)\n }\n\n // copies status, code, etc.\n Object.assign(this, options)\n }\n\n /**\n * Returns a JSON-serializable representation of the error\n */\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n message: this.message,\n code: this.errorCode,\n statusCode: this.statusCode,\n context: this.context,\n stack: this.stack,\n }\n }\n}\n\n/* 4xx client errors */\nexport class BadRequestError extends AmigoError {}\nexport class AuthenticationError extends AmigoError {}\nexport class PermissionError extends AmigoError {}\nexport class NotFoundError extends AmigoError {}\nexport class ConflictError extends AmigoError {}\nexport class RateLimitError extends AmigoError {}\n\n/* 5xx server errors */\nexport class ServerError extends AmigoError {}\nexport class ServiceUnavailableError extends ServerError {}\n\n/* Internal SDK errors */\nexport class ConfigurationError extends AmigoError {\n constructor(\n message: string,\n public field?: string\n ) {\n super(message)\n this.context = { field }\n }\n}\n\n/* Validation errors */\nexport class ValidationError extends BadRequestError {\n constructor(\n msg: string,\n public fieldErrors?: Record<string, string>\n ) {\n super(msg)\n }\n}\n\n/* Network-related errors */\nexport class NetworkError extends AmigoError {\n constructor(\n message: string,\n public readonly originalError?: Error,\n public readonly request?: {\n url?: string\n method?: string\n }\n ) {\n super(message, { cause: originalError })\n this.context = { request }\n }\n}\n\n/* Parsing errors */\nexport class ParseError extends AmigoError {\n constructor(\n message: string,\n public readonly parseType: 'json' | 'response' | 'other',\n public readonly originalError?: Error\n ) {\n super(message, { cause: originalError })\n this.context = { parseType }\n }\n}\n\n/* Type guard functions */\nexport function isAmigoError(error: unknown): error is AmigoError {\n return error instanceof AmigoError\n}\n\n/* Error factory to create appropriate error instances from API responses */\nexport function createApiError(response: Response, body?: unknown): AmigoError {\n const map: Record<number, typeof AmigoError> = {\n 400: BadRequestError,\n 401: AuthenticationError,\n 403: PermissionError,\n 404: NotFoundError,\n 409: ConflictError,\n 422: ValidationError,\n 429: RateLimitError,\n 500: ServerError,\n 503: ServiceUnavailableError,\n }\n\n const errorMessageKeys = ['message', 'error', 'detail']\n\n const ErrorClass = map[response.status] ?? AmigoError\n let message = `HTTP ${response.status} ${response.statusText}`\n\n if (body && typeof body === 'object') {\n for (const key of errorMessageKeys) {\n if (key in body) {\n message = String((body as Record<string, unknown>)[key])\n break\n }\n }\n }\n\n const options = {\n status: response.status,\n code:\n body && typeof body === 'object' && 'code' in body\n ? (body as Record<string, unknown>).code\n : undefined,\n response: body,\n }\n\n const error = new ErrorClass(message, options)\n\n return error\n}\n\nexport function createErrorMiddleware(): Middleware {\n return {\n onResponse: async ({ response }) => {\n if (!response.ok) {\n const body = await parseResponseBody(response)\n throw createApiError(response, body)\n }\n },\n onError: async ({ error, request }) => {\n // Handle network-related errors consistently\n if (isNetworkError(error)) {\n throw new NetworkError(\n `Network error: ${error instanceof Error ? error.message : String(error)}`,\n error instanceof Error ? error : new Error(String(error)),\n {\n url: request?.url,\n method: request?.method,\n }\n )\n }\n throw error\n },\n }\n}\n", "import { ParseError } from './errors'\n\n// Type helper to extract the data type from openapi-fetch responses\nexport type ExtractDataType<T> = T extends { data?: infer D } ? NonNullable<D> : never\n\n// Helper function to extract data from openapi-fetch responses\n// Since our middleware throws on errors, successful responses will have data\nexport async function extractData<T extends { data?: unknown }>(\n responsePromise: Promise<T>\n): Promise<ExtractDataType<T>> {\n const result = await responsePromise\n const data = (result as { data?: ExtractDataType<T> }).data\n\n if (data === undefined || data === null) {\n // Invariant: our error middleware throws for non-2xx responses.\n // If we reach here without data, treat as a parse/protocol error.\n throw new ParseError('Expected response data to be present for successful request', 'response')\n }\n\n return data\n}\n\n/**\n * Parse an NDJSON HTTP response body into an async generator of parsed JSON objects.\n * The generator yields one parsed object per line. Empty lines are skipped.\n */\nexport async function* parseNdjsonStream<T = unknown>(response: Response): AsyncGenerator<T> {\n const body = response.body\n if (!body) return\n\n const reader = body.getReader()\n const decoder = new TextDecoder()\n let bufferedText = ''\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n bufferedText += decoder.decode(value, { stream: true })\n\n let newlineIndex: number\n // Process all complete lines in the buffer\n while ((newlineIndex = bufferedText.indexOf('\\n')) !== -1) {\n const line = bufferedText.slice(0, newlineIndex).trim()\n bufferedText = bufferedText.slice(newlineIndex + 1)\n if (!line) continue\n try {\n yield JSON.parse(line) as T\n } catch (err) {\n throw new ParseError('Failed to parse NDJSON line', 'json', err as Error)\n }\n }\n }\n\n // Flush any trailing line without a newline\n const trailing = bufferedText.trim()\n if (trailing) {\n try {\n yield JSON.parse(trailing) as T\n } catch (err) {\n throw new ParseError('Failed to parse trailing NDJSON line', 'json', err as Error)\n }\n }\n } finally {\n reader.releaseLock()\n }\n}\n\n// Utility function to safely parse response bodies without throwing errors\nexport async function parseResponseBody(response: Response): Promise<unknown> {\n try {\n const text = await response.text()\n if (!text) return undefined\n try {\n return JSON.parse(text)\n } catch {\n return text // Return as string if not valid JSON\n }\n } catch {\n return undefined // Return undefined if any error occurs\n }\n}\n\n// Helper to detect network-related errors\nexport function isNetworkError(error: unknown): boolean {\n if (!(error instanceof Error)) return false\n\n return (\n error instanceof TypeError ||\n error.message.includes('fetch') ||\n error.message.includes('Failed to fetch') ||\n error.message.includes('Network request failed') ||\n error.message.includes('ECONNREFUSED') ||\n error.message.includes('ETIMEDOUT') ||\n error.message.includes('ENOTFOUND') ||\n error.message.includes('network')\n )\n}\n", "import createClient, { type Client } from 'openapi-fetch'\nimport { createErrorMiddleware } from './errors'\nimport { createAuthMiddleware } from './auth'\nimport type { paths } from '../generated/api-types'\nimport type { AmigoSdkConfig } from '..'\nimport { createRetryingFetch } from './retry'\n\nexport type AmigoFetch = Client<paths>\n\nexport function createAmigoFetch(config: AmigoSdkConfig, mockFetch?: typeof fetch): AmigoFetch {\n const wrappedFetch = createRetryingFetch(\n config.retry,\n mockFetch ?? (globalThis.fetch as typeof fetch)\n )\n\n const client = createClient<paths>({\n baseUrl: config.baseUrl,\n fetch: wrappedFetch,\n })\n\n // Apply error handling middleware first (to catch all errors)\n client.use(createErrorMiddleware())\n\n // Apply auth middleware after error handling (so auth errors are properly handled)\n client.use(createAuthMiddleware(config))\n\n return client\n}\n", "import type { Middleware } from 'openapi-fetch'\nimport type { components } from '../generated/api-types'\nimport type { AmigoSdkConfig } from '..'\nimport { AmigoError, AuthenticationError, NetworkError, ParseError, createApiError } from './errors'\nimport { isNetworkError, parseResponseBody } from './utils'\n\ntype SignInWithApiKeyResponse = components['schemas']['user__sign_in_with_api_key__Response']\n\n/** Helper function to trade API key for a bearer token */\nexport async function getBearerToken(config: AmigoSdkConfig): Promise<SignInWithApiKeyResponse> {\n const url = `${config.baseUrl}/v1/${config.orgId}/user/signin_with_api_key`\n\n try {\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n 'x-api-key': config.apiKey,\n 'x-api-key-id': config.apiKeyId,\n 'x-user-id': config.userId,\n },\n })\n\n if (!response.ok) {\n const body = await parseResponseBody(response)\n const apiError = createApiError(response, body)\n\n // Enhance authentication errors with additional context\n if (response.status === 401) {\n throw new AuthenticationError(`Authentication failed: ${apiError.message}`, {\n ...apiError,\n context: { ...apiError.context, endpoint: 'signin_with_api_key' },\n })\n }\n throw apiError\n }\n\n return (await response.json()) as SignInWithApiKeyResponse\n } catch (err) {\n // Re-throw our custom errors as-is\n if (err instanceof AmigoError) {\n throw err\n }\n\n // Handle network errors\n if (isNetworkError(err)) {\n throw new NetworkError('Failed to connect to authentication endpoint', err as Error, {\n url,\n method: 'POST',\n })\n }\n\n // Handle JSON parsing errors\n throw new ParseError(\n 'Failed to parse authentication response',\n 'json',\n err instanceof Error ? err : new Error(String(err))\n )\n }\n}\n\nexport function createAuthMiddleware(config: AmigoSdkConfig): Middleware {\n let token: SignInWithApiKeyResponse | null = null\n let refreshPromise: Promise<SignInWithApiKeyResponse> | null = null\n\n const shouldRefreshToken = (tokenData: SignInWithApiKeyResponse): boolean => {\n if (!tokenData.expires_at) return false\n\n const expiryTime = new Date(tokenData.expires_at).getTime()\n const currentTime = Date.now()\n const timeUntilExpiry = expiryTime - currentTime\n const refreshThreshold = 5 * 60 * 1000 // 5 minutes in milliseconds\n\n return timeUntilExpiry <= refreshThreshold\n }\n\n const ensureValidToken = async (): Promise<SignInWithApiKeyResponse> => {\n if (!token || shouldRefreshToken(token)) {\n if (!refreshPromise) {\n refreshPromise = getBearerToken(config)\n try {\n token = await refreshPromise\n } finally {\n refreshPromise = null\n }\n } else {\n token = await refreshPromise\n }\n }\n return token\n }\n\n return {\n onRequest: async ({ request }) => {\n try {\n const validToken = await ensureValidToken()\n if (validToken?.id_token) {\n request.headers.set('Authorization', `Bearer ${validToken.id_token}`)\n }\n } catch (error) {\n // Clear token and re-throw - getBearerToken already provides proper error types\n token = null\n throw error\n }\n return request\n },\n\n onResponse: async ({ response }) => {\n // Handle 401 responses by clearing token to force refresh on next request\n if (response.status === 401) {\n token = null\n }\n },\n\n onError: async ({ error }) => {\n // Clear token on any error to force refresh\n token = null\n throw error\n },\n }\n}\n", "export type RetryOptions = {\n /** Maximum number of attempts to make (default: 3) */\n maxAttempts?: number\n /** Base delay between attempts (default: 250ms) */\n backoffBaseMs?: number\n /** Maximum delay between attempts (default: 30s) */\n maxDelayMs?: number\n /** Status codes to retry on (default: 408, 429, 500, 502, 503, 504) */\n retryOnStatus?: Set<number>\n /** Methods to retry on (default: GET) */\n retryOnMethods?: Set<string>\n}\n\nconst DEFAULT_RETRYABLE_STATUS = new Set([408, 429, 500, 502, 503, 504])\nconst DEFAULT_RETRYABLE_METHODS = new Set(['GET']) as Set<string>\n\nexport function resolveRetryOptions(options?: RetryOptions): Required<RetryOptions> {\n return {\n maxAttempts: options?.maxAttempts ?? 3,\n backoffBaseMs: options?.backoffBaseMs ?? 250,\n maxDelayMs: options?.maxDelayMs ?? 30_000,\n retryOnStatus: new Set(options?.retryOnStatus ?? DEFAULT_RETRYABLE_STATUS),\n retryOnMethods: new Set(options?.retryOnMethods ?? DEFAULT_RETRYABLE_METHODS),\n }\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.max(min, Math.min(max, value))\n}\n\nfunction parseRetryAfterMs(headerValue: string | null, maxDelayMs: number): number | null {\n if (!headerValue) return null\n const seconds = Number(headerValue)\n if (Number.isFinite(seconds)) {\n return clamp(seconds * 1000, 0, maxDelayMs)\n }\n const date = new Date(headerValue)\n const ms = date.getTime() - Date.now()\n if (Number.isFinite(ms)) {\n return clamp(ms, 0, maxDelayMs)\n }\n return null\n}\n\nfunction computeBackoffWithJitterMs(\n attemptIndexZeroBased: number,\n baseMs: number,\n capMs: number\n): number {\n const windowMs = Math.min(capMs, baseMs * Math.pow(2, attemptIndexZeroBased))\n return Math.random() * windowMs\n}\n\nfunction isAbortError(err: unknown): boolean {\n return typeof err === 'object' && err !== null && 'name' in err && err['name'] === 'AbortError'\n}\n\nfunction isNetworkError(err: unknown): boolean {\n // Undici & browsers use TypeError for network failures\n return err instanceof TypeError && !isAbortError(err)\n}\n\nasync function abortableSleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (ms <= 0) {\n signal?.throwIfAborted?.()\n return\n }\n await new Promise<void>((resolve, reject) => {\n const rejectWith =\n signal?.reason instanceof Error ? signal.reason : (signal?.reason ?? new Error('AbortError'))\n\n if (signal?.aborted) {\n reject(rejectWith)\n return\n }\n const t = setTimeout(() => {\n off()\n resolve()\n }, ms)\n const onAbort = () => {\n off()\n clearTimeout(t)\n reject(rejectWith)\n }\n const off = () => signal?.removeEventListener('abort', onAbort)\n signal?.addEventListener('abort', onAbort, { once: true })\n })\n}\n\nexport function createRetryingFetch(\n retryOptions?: RetryOptions,\n baseFetch?: typeof fetch\n): typeof fetch {\n const resolved = resolveRetryOptions(retryOptions)\n const underlying: typeof fetch = baseFetch ?? (globalThis.fetch as typeof fetch)\n\n const retryingFetch: typeof fetch = async (\n input: RequestInfo | URL,\n init?: RequestInit\n ): Promise<Response> => {\n const inputMethod =\n typeof Request !== 'undefined' && input instanceof Request ? input.method : undefined\n const method = ((init?.method ?? inputMethod ?? 'GET') as string).toUpperCase()\n const signal = init?.signal\n\n const isMethodRetryableByDefault = resolved.retryOnMethods.has(method)\n const maxAttempts = Math.max(1, resolved.maxAttempts)\n\n for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n let response: Response | null = null\n let error: unknown = null\n\n try {\n response = await underlying(input, init)\n } catch (err) {\n error = err\n }\n\n if (!error && response && response.ok) {\n return response\n }\n\n let shouldRetry = false\n let delayMs: number | null = null\n\n if (isNetworkError(error)) {\n shouldRetry = isMethodRetryableByDefault\n if (shouldRetry) {\n delayMs = computeBackoffWithJitterMs(\n attempt - 1,\n resolved.backoffBaseMs,\n resolved.maxDelayMs\n )\n }\n } else if (response) {\n const status = response.status\n if (method === 'POST') {\n if (status === 429) {\n const ra = response.headers.get('Retry-After')\n const parsed = parseRetryAfterMs(ra, resolved.maxDelayMs)\n if (parsed !== null) {\n shouldRetry = true\n delayMs = parsed\n }\n }\n } else if (isMethodRetryableByDefault && resolved.retryOnStatus.has(status)) {\n const ra = response.headers.get('Retry-After')\n delayMs =\n parseRetryAfterMs(ra, resolved.maxDelayMs) ??\n computeBackoffWithJitterMs(attempt - 1, resolved.backoffBaseMs, resolved.maxDelayMs)\n shouldRetry = true\n }\n }\n\n const attemptsRemain = attempt < maxAttempts\n if (!shouldRetry || !attemptsRemain) {\n if (error) throw error\n return response as Response\n }\n\n if (signal?.aborted) {\n if (error) throw error\n return response as Response\n }\n\n await abortableSleep(delayMs ?? 0, signal ?? undefined)\n }\n\n throw new Error('Retry loop exited unexpectedly')\n }\n\n return retryingFetch\n}\n\nexport type { RetryOptions as AmigoRetryOptions }\n", "import type { AmigoFetch } from '../core/openapi-client'\nimport { extractData } from '../core/utils'\nimport type { operations } from '../generated/api-types'\n\nexport class OrganizationResource {\n constructor(\n private c: AmigoFetch,\n private orgId: string\n ) {}\n\n /**\n * Get organization details\n * @param headers - The headers\n * @returns The organization details\n */\n async getOrganization(headers?: operations['get-organization']['parameters']['header']) {\n return extractData(\n this.c.GET('/v1/{organization}/organization/', {\n params: { path: { organization: this.orgId } },\n headers,\n })\n )\n }\n}\n", "import { BadRequestError } from '../core/errors'\nimport type { AmigoFetch } from '../core/openapi-client'\nimport { extractData, parseNdjsonStream } from '../core/utils'\nimport type { components, operations } from '../generated/api-types'\n\ntype VoiceData = Blob | Uint8Array | ReadableStream<Uint8Array>\nexport type InteractionInput = string | VoiceData\n\ntype InteractQuery = operations['interact-with-conversation']['parameters']['query']\ntype InteractQuerySerialized = Omit<InteractQuery, 'request_audio_config'> & {\n request_audio_config?: string | null\n}\n\nexport class ConversationResource {\n constructor(\n private c: AmigoFetch,\n private orgId: string\n ) {}\n\n async createConversation(\n body: components['schemas']['conversation__create_conversation__Request'],\n queryParams: operations['create-conversation']['parameters']['query'],\n headers?: operations['create-conversation']['parameters']['header'],\n options?: { signal?: AbortSignal }\n ) {\n const resp = await this.c.POST('/v1/{organization}/conversation/', {\n params: { path: { organization: this.orgId }, query: queryParams },\n body,\n headers: {\n Accept: 'application/x-ndjson',\n ...(headers ?? {}),\n } as operations['create-conversation']['parameters']['header'],\n // Ensure we receive a stream for NDJSON\n parseAs: 'stream',\n ...(options?.signal && { signal: options.signal }),\n })\n\n // onResponse middleware throws for non-2xx; if we reach here, it's OK.\n return parseNdjsonStream<components['schemas']['conversation__create_conversation__Response']>(\n resp.response\n )\n }\n\n async interactWithConversation(\n conversationId: string,\n input: InteractionInput,\n queryParams: operations['interact-with-conversation']['parameters']['query'],\n headers?: operations['interact-with-conversation']['parameters']['header'],\n options?: { signal?: AbortSignal }\n ) {\n // Build body based on requested format, then perform a single POST\n let bodyToSend: FormData | VoiceData\n\n // Prepare headers; we'll merge user-supplied headers and adjust per format\n const mergedHeaders: Record<string, unknown> = {\n Accept: 'application/x-ndjson',\n ...(headers ?? {}),\n }\n\n if (queryParams.request_format === 'text') {\n if (typeof input !== 'string') {\n throw new BadRequestError(\"textMessage is required when request_format is 'text'\")\n }\n const form = new FormData()\n const blob = new Blob([input], { type: 'text/plain; charset=utf-8' })\n form.append('recorded_message', blob, 'message.txt')\n bodyToSend = form\n } else if (queryParams.request_format === 'voice') {\n if (typeof input === 'string') {\n throw new BadRequestError(\n \"voice input must be a byte source when request_format is 'voice'\"\n )\n }\n bodyToSend = input\n } else {\n throw new BadRequestError('Unsupported or missing request_format in params')\n }\n\n // For text/FormData, do NOT set Content-Type; fetch will set multipart boundary\n if (queryParams.request_format === 'text') {\n delete mergedHeaders['content-type']\n delete mergedHeaders['Content-Type']\n }\n\n // For voice bytes, allow caller to specify Content-Type; if absent and input is a Blob with a type, use it\n if (queryParams.request_format === 'voice') {\n const hasContentType =\n mergedHeaders['content-type'] !== undefined || mergedHeaders['Content-Type'] !== undefined\n if (!hasContentType && typeof Blob !== 'undefined' && input instanceof Blob && input.type) {\n mergedHeaders['content-type'] = input.type\n }\n }\n\n const headersToSend =\n mergedHeaders as unknown as operations['interact-with-conversation']['parameters']['header']\n\n // Normalize nested object params that must be sent as JSON strings\n const normalizedQuery: InteractQuerySerialized = {\n ...queryParams,\n request_audio_config:\n typeof queryParams.request_audio_config === 'object' &&\n queryParams.request_audio_config !== null\n ? JSON.stringify(queryParams.request_audio_config)\n : (queryParams.request_audio_config ?? undefined),\n }\n\n const resp = await this.c.POST('/v1/{organization}/conversation/{conversation_id}/interact', {\n params: {\n path: { organization: this.orgId, conversation_id: conversationId },\n query: normalizedQuery as unknown as InteractQuery,\n header: headersToSend,\n },\n body: bodyToSend,\n parseAs: 'stream',\n ...(options?.signal && { signal: options.signal }),\n })\n\n return parseNdjsonStream<\n components['schemas']['conversation__interact_with_conversation__Response']\n >(resp.response)\n }\n\n async getConversations(\n queryParams?: operations['get-conversations']['parameters']['query'],\n headers?: operations['get-conversations']['parameters']['header']\n ) {\n return extractData(\n this.c.GET('/v1/{organization}/conversation/', {\n params: { path: { organization: this.orgId }, query: queryParams },\n headers,\n })\n )\n }\n\n async getConversationMessages(\n conversationId: string,\n queryParams?: operations['get-conversation-messages']['parameters']['query'],\n headers?: operations['get-conversation-messages']['parameters']['header']\n ) {\n return extractData(\n this.c.GET('/v1/{organization}/conversation/{conversation_id}/messages/', {\n params: {\n path: { organization: this.orgId, conversation_id: conversationId },\n query: queryParams,\n },\n headers,\n })\n )\n }\n\n async finishConversation(\n conversationId: string,\n headers?: operations['finish-conversation']['parameters']['header']\n ) {\n await this.c.POST('/v1/{organization}/conversation/{conversation_id}/finish/', {\n params: { path: { organization: this.orgId, conversation_id: conversationId } },\n headers,\n // No content is expected; parse as text to access raw Response\n parseAs: 'text',\n })\n return\n }\n\n async recommendResponsesForInteraction(\n conversationId: string,\n interactionId: string,\n headers?: operations['recommend-responses-for-interaction']['parameters']['header']\n ) {\n return extractData(\n this.c.GET(\n '/v1/{organization}/conversation/{conversation_id}/interaction/{interaction_id}/recommend_responses',\n {\n params: {\n path: {\n organization: this.orgId,\n conversation_id: conversationId,\n interaction_id: interactionId,\n },\n },\n headers,\n }\n )\n )\n }\n\n async getInteractionInsights(\n conversationId: string,\n interactionId: string,\n headers?: operations['get-interaction-insights']['parameters']['header']\n ) {\n return extractData(\n this.c.GET(\n '/v1/{organization}/conversation/{conversation_id}/interaction/{interaction_id}/insights',\n {\n params: {\n path: {\n organization: this.orgId,\n conversation_id: conversationId,\n interaction_id: interactionId,\n },\n },\n headers,\n }\n )\n )\n }\n\n // Note: the OpenAPI response schema isn't correct for this endpoint.\n // TODO -- fix response typing.\n async getMessageSource(\n conversationId: string,\n messageId: string,\n headers?: operations['retrieve-message-source']['parameters']['header']\n ) {\n return extractData(\n this.c.GET('/v1/{organization}/conversation/{conversation_id}/messages/{message_id}/source', {\n params: {\n path: {\n organization: this.orgId,\n conversation_id: conversationId,\n message_id: messageId,\n },\n },\n headers,\n })\n )\n }\n\n async generateConversationStarters(\n body: components['schemas']['conversation__generate_conversation_starter__Request'],\n headers?: operations['generate-conversation-starter']['parameters']['header']\n ) {\n return extractData(\n this.c.POST('/v1/{organization}/conversation/conversation_starter', {\n params: { path: { organization: this.orgId } },\n body,\n headers,\n })\n )\n }\n}\n", "import type { AmigoFetch } from '../core/openapi-client'\nimport { extractData } from '../core/utils'\nimport type { operations } from '../generated/api-types'\n\nexport class ServiceResource {\n constructor(\n private c: AmigoFetch,\n private orgId: string\n ) {}\n\n /**\n * Get services\n * @param headers - The headers\n * @returns The services\n */\n async getServices(\n queryParams?: operations['get-services']['parameters']['query'],\n headers?: operations['get-services']['parameters']['header']\n ) {\n return extractData(\n this.c.GET('/v1/{organization}/service/', {\n params: { path: { organization: this.orgId }, query: queryParams },\n headers,\n })\n )\n }\n}\n", "import type { AmigoFetch } from '../core/openapi-client'\nimport { extractData } from '../core/utils'\nimport type { components, operations } from '../generated/api-types'\n\nexport class UserResource {\n constructor(\n private c: AmigoFetch,\n private orgId: string\n ) {}\n\n async getUsers(\n queryParams?: operations['get-users']['parameters']['query'],\n headers?: operations['get-users']['parameters']['header']\n ) {\n return extractData(\n this.c.GET('/v1/{organization}/user/', {\n params: { path: { organization: this.orgId }, query: queryParams },\n headers,\n })\n )\n }\n\n async createUser(\n body: components['schemas']['user__create_invited_user__Request'],\n headers?: operations['create-invited-user']['parameters']['header']\n ) {\n return extractData(\n this.c.POST('/v1/{organization}/user/invite', {\n params: { path: { organization: this.orgId } },\n body,\n headers,\n })\n )\n }\n\n async deleteUser(userId: string, headers?: operations['delete-user']['parameters']['header']) {\n // DELETE endpoints returns no content (e.g., 204 No Content).\n // Our middleware already throws on non-2xx responses, so simply await the call.\n await this.c.DELETE('/v1/{organization}/user/{requested_user_id}', {\n params: { path: { organization: this.orgId, requested_user_id: userId } },\n headers,\n })\n return\n }\n\n async updateUser(\n userId: string,\n body: components['schemas']['user__update_user_info__Request'],\n headers?: operations['update-user-info']['parameters']['header']\n ) {\n // UPDATE endpoint returns no content (e.g., 204 No Content).\n // Our middleware already throws on non-2xx responses, so simply await the call.\n await this.c.POST('/v1/{organization}/user/{requested_user_id}/user', {\n params: { path: { organization: this.orgId, requested_user_id: userId } },\n body,\n headers,\n })\n return\n }\n}\n", "import { ConfigurationError } from './core/errors'\nimport { createAmigoFetch } from './core/openapi-client'\nimport { OrganizationResource } from './resources/organization'\nimport { ConversationResource } from './resources/conversation'\nimport { ServiceResource } from './resources/services'\nimport { UserResource } from './resources/user'\nimport type { RetryOptions } from './core/retry'\n\nexport interface AmigoSdkConfig {\n /** API key from Amigo dashboard */\n apiKey: string\n /** API-key ID from Amigo dashboard */\n apiKeyId: string\n /** User ID on whose behalf the request is made */\n userId: string\n /** The Organization ID */\n orgId: string\n /** Base URL of the Amigo API */\n baseUrl?: string\n /** Retry configuration for HTTP requests */\n retry?: RetryOptions\n}\n\nconst defaultBaseUrl = 'https://api.amigo.ai'\n\nexport class AmigoClient {\n readonly organizations: OrganizationResource\n readonly conversations: ConversationResource\n readonly services: ServiceResource\n readonly users: UserResource\n readonly config: AmigoSdkConfig\n\n constructor(config: AmigoSdkConfig) {\n this.config = validateConfig(config)\n\n const api = createAmigoFetch(this.config)\n this.organizations = new OrganizationResource(api, this.config.orgId)\n this.conversations = new ConversationResource(api, this.config.orgId)\n this.services = new ServiceResource(api, this.config.orgId)\n this.users = new UserResource(api, this.config.orgId)\n }\n}\n\nfunction validateConfig(config: AmigoSdkConfig) {\n if (!config.apiKey) {\n throw new ConfigurationError('API key is required', 'apiKey')\n }\n if (!config.apiKeyId) {\n throw new ConfigurationError('API key ID is required', 'apiKeyId')\n }\n if (!config.userId) {\n throw new ConfigurationError('User ID is required', 'userId')\n }\n if (!config.orgId) {\n throw new ConfigurationError('Organization ID is required', 'orgId')\n }\n if (!config.baseUrl) {\n config.baseUrl = defaultBaseUrl\n }\n return config\n}\n\n// Export all errors as a namespace to avoid polluting the main import space\nexport * as errors from './core/errors'\n\n// Re-export useful types for consumers\nexport type { components, operations, paths } from './generated/api-types'\n"],
5
+ "mappings": ";;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOA,eAAsB,YACpB,iBAC6B;AAC7B,QAAM,SAAS,MAAM;AACrB,QAAM,OAAQ,OAAyC;AAEvD,MAAI,SAAS,UAAa,SAAS,MAAM;AAGvC,UAAM,IAAI,WAAW,+DAA+D,UAAU;AAAA,EAChG;AAEA,SAAO;AACT;AAMA,gBAAuB,kBAA+B,UAAuC;AAC3F,QAAM,OAAO,SAAS;AACtB,MAAI,CAAC,KAAM;AAEX,QAAM,SAAS,KAAK,UAAU;AAC9B,QAAM,UAAU,IAAI,YAAY;AAChC,MAAI,eAAe;AAEnB,MAAI;AACF,WAAO,MAAM;AACX,YAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK;AAC1C,UAAI,KAAM;AACV,sBAAgB,QAAQ,OAAO,OAAO,EAAE,QAAQ,KAAK,CAAC;AAEtD,UAAI;AAEJ,cAAQ,eAAe,aAAa,QAAQ,IAAI,OAAO,IAAI;AACzD,cAAM,OAAO,aAAa,MAAM,GAAG,YAAY,EAAE,KAAK;AACtD,uBAAe,aAAa,MAAM,eAAe,CAAC;AAClD,YAAI,CAAC,KAAM;AACX,YAAI;AACF,gBAAM,KAAK,MAAM,IAAI;AAAA,QACvB,SAAS,KAAK;AACZ,gBAAM,IAAI,WAAW,+BAA+B,QAAQ,GAAY;AAAA,QAC1E;AAAA,MACF;AAAA,IACF;AAGA,UAAM,WAAW,aAAa,KAAK;AACnC,QAAI,UAAU;AACZ,UAAI;AACF,cAAM,KAAK,MAAM,QAAQ;AAAA,MAC3B,SAAS,KAAK;AACZ,cAAM,IAAI,WAAW,wC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,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,mBAAmB,uBAAuB,QAAQ;AAAA,EAC9D;AACA,MAAI,CAAC,OAAO,UAAU;AACpB,UAAM,IAAI,mBAAmB,0BAA0B,UAAU;AAAA,EACnE;AACA,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,mBAAmB,uBAAuB,QAAQ;AAAA,EAC9D;AACA,MAAI,CAAC,OAAO,OAAO;AACjB,UAAM,IAAI,mBAAmB,+BAA+B,OAAO;AAAA,EACrE;AACA,MAAI,CAAC,OAAO,SAAS;AACnB,WAAO,UAAU;AAAA,EACnB;AACA,SAAO;AACT;",
6
6
  "names": ["isNetworkError"]
7
7
  }
@@ -1090,6 +1090,29 @@ export interface paths {
1090
1090
  patch?: never;
1091
1091
  trace?: never;
1092
1092
  };
1093
+ "/v1/{organization}/admin/sql_query": {
1094
+ parameters: {
1095
+ query?: never;
1096
+ header?: never;
1097
+ path?: never;
1098
+ cookie?: never;
1099
+ };
1100
+ get?: never;
1101
+ put?: never;
1102
+ /**
1103
+ * Submit a SQL query
1104
+ * @description Execute a read-only SQL query on Amigo's databases for the specified organization.
1105
+ *
1106
+ * #### Permissions
1107
+ * This endpoint requires the authenticated user to have greater privileges than the `DefaultAdministratorRole`.
1108
+ */
1109
+ post: operations["submit-sql-query"];
1110
+ delete?: never;
1111
+ options?: never;
1112
+ head?: never;
1113
+ patch?: never;
1114
+ trace?: never;
1115
+ };
1093
1116
  "/v1/{organization}/webhook_destination/": {
1094
1117
  parameters: {
1095
1118
  query?: never;
@@ -2482,6 +2505,19 @@ export interface components {
2482
2505
  /** Queries */
2483
2506
  queries: string[];
2484
2507
  };
2508
+ /** Column */
2509
+ Column: {
2510
+ /**
2511
+ * Name
2512
+ * @description The name of the column.
2513
+ */
2514
+ name: string;
2515
+ /**
2516
+ * Type
2517
+ * @description The data type of the column.
2518
+ */
2519
+ type: string;
2520
+ };
2485
2521
  Condition: components["schemas"]["EqualCondition"] | components["schemas"]["InCondition"] | components["schemas"]["NotEqualCondition"];
2486
2522
  /** Conversation */
2487
2523
  Conversation: {
@@ -3067,8 +3103,14 @@ export interface components {
3067
3103
  * @enum {string}
3068
3104
  */
3069
3105
  type: "external-event";
3070
- /** @description The message of the initial external event. */
3071
- message: components["schemas"]["amigo_lib__pydantic__base_model__StrippedNonemptyString__1"];
3106
+ /**
3107
+ * Message And Offsets
3108
+ * @description A list of tuples, each containing a message and its offset in milliseconds from the conversation start time. These must be sorted by offset in the ascending order, and must not contain repeated offsets.
3109
+ */
3110
+ message_and_offsets: [
3111
+ components["schemas"]["amigo_lib__pydantic__base_model__StrippedNonemptyString__1"],
3112
+ number
3113
+ ][];
3072
3114
  };
3073
3115
  /** InitialExternalEventConfig */
3074
3116
  "InitialExternalEventConfig-Output": {
@@ -3077,8 +3119,14 @@ export interface components {
3077
3119
  * @enum {string}
3078
3120
  */
3079
3121
  type: "external-event";
3080
- /** Message */
3081
- message: string;
3122
+ /**
3123
+ * Message And Offsets
3124
+ * @description A list of tuples, each containing a message and its offset in milliseconds from the conversation start time.
3125
+ */
3126
+ message_and_offsets: [
3127
+ string,
3128
+ number
3129
+ ][];
3082
3130
  };
3083
3131
  "InitialMessageConfig-Input": components["schemas"]["InitialUserMessageConfig"] | components["schemas"]["InitialExternalEventConfig-Input"];
3084
3132
  "InitialMessageConfig-Output": components["schemas"]["InitialUserMessageConfig"] | components["schemas"]["InitialExternalEventConfig-Output"];
@@ -3237,9 +3285,9 @@ export interface components {
3237
3285
  };
3238
3286
  };
3239
3287
  /** @enum {string} */
3240
- LLMLoadBalancingSetType: "o4-mini-2025-04-16" | "gpt-5-2025-08-07" | "gpt-5-mini-2025-08-07" | "gpt-5-nano-2025-08-07" | "gpt-5-chat-2025-08-07" | "claude-sonnet-4-20250514";
3288
+ LLMLoadBalancingSetType: "o4-mini-2025-04-16" | "gpt-5-2025-08-07" | "gpt-5-mini-2025-08-07" | "gpt-5-nano-2025-08-07" | "claude-sonnet-4-20250514";
3241
3289
  /** @enum {string} */
3242
- LLMType: "openai_o4-mini-2025-04-16" | "openai_gpt-5-2025-08-07" | "openai_gpt-5-mini-2025-08-07" | "openai_gpt-5-nano-2025-08-07" | "openai_gpt-5-chat-2025-08-07" | "azure_o4-mini-2025-04-16" | "azure_gpt-4.1-2025-04-14" | "azure_gpt-4.1-mini-2025-04-14" | "azure_gpt-5-2025-08-07" | "azure_gpt-5-mini-2025-08-07" | "azure_gpt-5-nano-2025-08-07" | "azure_gpt-5-chat-2025-08-07" | "google_claude-sonnet-4@20250514" | "aws_claude-sonnet-4-20250514" | "anthropic_claude-sonnet-4-20250514" | "google_gemini-2.5-pro" | "google_gemini-2.5-flash";
3290
+ LLMType: "openai_o4-mini-2025-04-16" | "openai_gpt-5-2025-08-07" | "openai_gpt-5-mini-2025-08-07" | "openai_gpt-5-nano-2025-08-07" | "azure_o4-mini-2025-04-16" | "azure_gpt-4.1-2025-04-14" | "azure_gpt-4.1-mini-2025-04-14" | "azure_gpt-5-2025-08-07" | "azure_gpt-5-mini-2025-08-07" | "azure_gpt-5-nano-2025-08-07" | "google_claude-sonnet-4@20250514" | "aws_claude-sonnet-4-20250514" | "anthropic_claude-sonnet-4-20250514" | "google_gemini-2.5-pro" | "google_gemini-2.5-flash";
3243
3291
  /** MP3UserMessageAudioConfig */
3244
3292
  MP3UserMessageAudioConfig: {
3245
3293
  /**
@@ -4570,6 +4618,11 @@ export interface components {
4570
4618
  * @description The timezone of the simulation persona in the IANA tz database format. If unspecified, UTC is used.
4571
4619
  */
4572
4620
  timezone: string | null;
4621
+ /**
4622
+ * User Models
4623
+ * @description The user models associated with the simulation persona.
4624
+ */
4625
+ user_models: string[];
4573
4626
  };
4574
4627
  /** SimulationScenarioInstance */
4575
4628
  SimulationScenarioInstance: {
@@ -4655,6 +4708,12 @@ export interface components {
4655
4708
  */
4656
4709
  instructions: string;
4657
4710
  initial_message_config: components["schemas"]["InitialMessageConfig-Output"] | null;
4711
+ /**
4712
+ * Conversation Starts At
4713
+ * Format: date-time
4714
+ * @description The time at which the conversation starts. This must be a timestamp in UTC.
4715
+ */
4716
+ conversation_starts_at: string;
4658
4717
  };
4659
4718
  /** SimulationUnitTest */
4660
4719
  SimulationUnitTest: {
@@ -5693,7 +5752,7 @@ export interface components {
5693
5752
  /**
5694
5753
  * Voice Id
5695
5754
  * @description The Elevenlabs voice ID for this agent.
5696
- * @default iP95p4xoKVk53GoZ742B
5755
+ * @default 4rgS68aOYqDjxDQQVXXK
5697
5756
  */
5698
5757
  voice_id?: string;
5699
5758
  /**
@@ -5717,7 +5776,7 @@ export interface components {
5717
5776
  /**
5718
5777
  * Voice Id
5719
5778
  * @description The Elevenlabs voice ID for this agent.
5720
- * @default iP95p4xoKVk53GoZ742B
5779
+ * @default 4rgS68aOYqDjxDQQVXXK
5721
5780
  */
5722
5781
  voice_id?: string;
5723
5782
  /**
@@ -5978,6 +6037,41 @@ export interface components {
5978
6037
  in_maintenance_mode: boolean;
5979
6038
  };
5980
6039
  /** Request */
6040
+ admin__submit_sql_query__Request: {
6041
+ /** @description The SQL query to execute. */
6042
+ sql_query: components["schemas"]["amigo_lib__pydantic__base_model__StrippedNonemptyString__1"];
6043
+ /**
6044
+ * Async Query
6045
+ * @description Whether the query is asynchronous. If true, a signed URL will be returned to download the results once the query is complete. If false, the results will be returned in the response, but at most
6046
+ * 1000 rows will be returned, and the query is subject to a 30 second execution timeout.
6047
+ * @constant
6048
+ */
6049
+ async_query: false;
6050
+ };
6051
+ /** SyncQueryResponse */
6052
+ admin__submit_sql_query__Response: {
6053
+ /**
6054
+ * Execution Time Ms
6055
+ * @description The time taken to execute the query in milliseconds.
6056
+ */
6057
+ execution_time_ms: number;
6058
+ /**
6059
+ * Result
6060
+ * @description The result of the query as a list of rows, where each row is a list of column values.
6061
+ */
6062
+ result: string[][];
6063
+ /**
6064
+ * Truncated
6065
+ * @description Whether the result was truncated due to the row limit.
6066
+ */
6067
+ truncated: boolean;
6068
+ /**
6069
+ * Columns
6070
+ * @description Description of the columns in the result.
6071
+ */
6072
+ columns: components["schemas"]["Column"][];
6073
+ };
6074
+ /** Request */
5981
6075
  conversation__create_conversation__Request: {
5982
6076
  /**
5983
6077
  * Service Id
@@ -7261,6 +7355,11 @@ export interface components {
7261
7355
  * @default {}
7262
7356
  */
7263
7357
  timezone?: ("Africa/Abidjan" | "Africa/Accra" | "Africa/Addis_Ababa" | "Africa/Algiers" | "Africa/Asmara" | "Africa/Asmera" | "Africa/Bamako" | "Africa/Bangui" | "Africa/Banjul" | "Africa/Bissau" | "Africa/Blantyre" | "Africa/Brazzaville" | "Africa/Bujumbura" | "Africa/Cairo" | "Africa/Casablanca" | "Africa/Ceuta" | "Africa/Conakry" | "Africa/Dakar" | "Africa/Dar_es_Salaam" | "Africa/Djibouti" | "Africa/Douala" | "Africa/El_Aaiun" | "Africa/Freetown" | "Africa/Gaborone" | "Africa/Harare" | "Africa/Johannesburg" | "Africa/Juba" | "Africa/Kampala" | "Africa/Khartoum" | "Africa/Kigali" | "Africa/Kinshasa" | "Africa/Lagos" | "Africa/Libreville" | "Africa/Lome" | "Africa/Luanda" | "Africa/Lubumbashi" | "Africa/Lusaka" | "Africa/Malabo" | "Africa/Maputo" | "Africa/Maseru" | "Africa/Mbabane" | "Africa/Mogadishu" | "Africa/Monrovia" | "Africa/Nairobi" | "Africa/Ndjamena" | "Africa/Niamey" | "Africa/Nouakchott" | "Africa/Ouagadougou" | "Africa/Porto-Novo" | "Africa/Sao_Tome" | "Africa/Timbuktu" | "Africa/Tripoli" | "Africa/Tunis" | "Africa/Windhoek" | "America/Adak" | "America/Anchorage" | "America/Anguilla" | "America/Antigua" | "America/Araguaina" | "America/Argentina/Buenos_Aires" | "America/Argentina/Catamarca" | "America/Argentina/ComodRivadavia" | "America/Argentina/Cordoba" | "America/Argentina/Jujuy" | "America/Argentina/La_Rioja" | "America/Argentina/Mendoza" | "America/Argentina/Rio_Gallegos" | "America/Argentina/Salta" | "America/Argentina/San_Juan" | "America/Argentina/San_Luis" | "America/Argentina/Tucuman" | "America/Argentina/Ushuaia" | "America/Aruba" | "America/Asuncion" | "America/Atikokan" | "America/Atka" | "America/Bahia" | "America/Bahia_Banderas" | "America/Barbados" | "America/Belem" | "America/Belize" | "America/Blanc-Sablon" | "America/Boa_Vista" | "America/Bogota" | "America/Boise" | "America/Buenos_Aires" | "America/Cambridge_Bay" | "America/Campo_Grande" | "America/Cancun" | "America/Caracas" | "America/Catamarca" | "America/Cayenne" | "America/Cayman" | "America/Chicago" | "America/Chihuahua" | "America/Ciudad_Juarez" | "America/Coral_Harbour" | "America/Cordoba" | "America/Costa_Rica" | "America/Coyhaique" | "America/Creston" | "America/Cuiaba" | "America/Curacao" | "America/Danmarkshavn" | "America/Dawson" | "America/Dawson_Creek" | "America/Denver" | "America/Detroit" | "America/Dominica" | "America/Edmonton" | "America/Eirunepe" | "America/El_Salvador" | "America/Ensenada" | "America/Fort_Nelson" | "America/Fort_Wayne" | "America/Fortaleza" | "America/Glace_Bay" | "America/Godthab" | "America/Goose_Bay" | "America/Grand_Turk" | "America/Grenada" | "America/Guadeloupe" | "America/Guatemala" | "America/Guayaquil" | "America/Guyana" | "America/Halifax" | "America/Havana" | "America/Hermosillo" | "America/Indiana/Indianapolis" | "America/Indiana/Knox" | "America/Indiana/Marengo" | "America/Indiana/Petersburg" | "America/Indiana/Tell_City" | "America/Indiana/Vevay" | "America/Indiana/Vincennes" | "America/Indiana/Winamac" | "America/Indianapolis" | "America/Inuvik" | "America/Iqaluit" | "America/Jamaica" | "America/Jujuy" | "America/Juneau" | "America/Kentucky/Louisville" | "America/Kentucky/Monticello" | "America/Knox_IN" | "America/Kralendijk" | "America/La_Paz" | "America/Lima" | "America/Los_Angeles" | "America/Louisville" | "America/Lower_Princes" | "America/Maceio" | "America/Managua" | "America/Manaus" | "America/Marigot" | "America/Martinique" | "America/Matamoros" | "America/Mazatlan" | "America/Mendoza" | "America/Menominee" | "America/Merida" | "America/Metlakatla" | "America/Mexico_City" | "America/Miquelon" | "America/Moncton" | "America/Monterrey" | "America/Montevideo" | "America/Montreal" | "America/Montserrat" | "America/Nassau" | "America/New_York" | "America/Nipigon" | "America/Nome" | "America/Noronha" | "America/North_Dakota/Beulah" | "America/North_Dakota/Center" | "America/North_Dakota/New_Salem" | "America/Nuuk" | "America/Ojinaga" | "America/Panama" | "America/Pangnirtung" | "America/Paramaribo" | "America/Phoenix" | "America/Port-au-Prince" | "America/Port_of_Spain" | "America/Porto_Acre" | "America/Porto_Velho" | "America/Puerto_Rico" | "America/Punta_Arenas" | "America/Rainy_River" | "America/Rankin_Inlet" | "America/Recife" | "America/Regina" | "America/Resolute" | "America/Rio_Branco" | "America/Rosario" | "America/Santa_Isabel" | "America/Santarem" | "America/Santiago" | "America/Santo_Domingo" | "America/Sao_Paulo" | "America/Scoresbysund" | "America/Shiprock" | "America/Sitka" | "America/St_Barthelemy" | "America/St_Johns" | "America/St_Kitts" | "America/St_Lucia" | "America/St_Thomas" | "America/St_Vincent" | "America/Swift_Current" | "America/Tegucigalpa" | "America/Thule" | "America/Thunder_Bay" | "America/Tijuana" | "America/Toronto" | "America/Tortola" | "America/Vancouver" | "America/Virgin" | "America/Whitehorse" | "America/Winnipeg" | "America/Yakutat" | "America/Yellowknife" | "Antarctica/Casey" | "Antarctica/Davis" | "Antarctica/DumontDUrville" | "Antarctica/Macquarie" | "Antarctica/Mawson" | "Antarctica/McMurdo" | "Antarctica/Palmer" | "Antarctica/Rothera" | "Antarctica/South_Pole" | "Antarctica/Syowa" | "Antarctica/Troll" | "Antarctica/Vostok" | "Arctic/Longyearbyen" | "Asia/Aden" | "Asia/Almaty" | "Asia/Amman" | "Asia/Anadyr" | "Asia/Aqtau" | "Asia/Aqtobe" | "Asia/Ashgabat" | "Asia/Ashkhabad" | "Asia/Atyrau" | "Asia/Baghdad" | "Asia/Bahrain" | "Asia/Baku" | "Asia/Bangkok" | "Asia/Barnaul" | "Asia/Beirut" | "Asia/Bishkek" | "Asia/Brunei" | "Asia/Calcutta" | "Asia/Chita" | "Asia/Choibalsan" | "Asia/Chongqing" | "Asia/Chungking" | "Asia/Colombo" | "Asia/Dacca" | "Asia/Damascus" | "Asia/Dhaka" | "Asia/Dili" | "Asia/Dubai" | "Asia/Dushanbe" | "Asia/Famagusta" | "Asia/Gaza" | "Asia/Harbin" | "Asia/Hebron" | "Asia/Ho_Chi_Minh" | "Asia/Hong_Kong" | "Asia/Hovd" | "Asia/Irkutsk" | "Asia/Istanbul" | "Asia/Jakarta" | "Asia/Jayapura" | "Asia/Jerusalem" | "Asia/Kabul" | "Asia/Kamchatka" | "Asia/Karachi" | "Asia/Kashgar" | "Asia/Kathmandu" | "Asia/Katmandu" | "Asia/Khandyga" | "Asia/Kolkata" | "Asia/Krasnoyarsk" | "Asia/Kuala_Lumpur" | "Asia/Kuching" | "Asia/Kuwait" | "Asia/Macao" | "Asia/Macau" | "Asia/Magadan" | "Asia/Makassar" | "Asia/Manila" | "Asia/Muscat" | "Asia/Nicosia" | "Asia/Novokuznetsk" | "Asia/Novosibirsk" | "Asia/Omsk" | "Asia/Oral" | "Asia/Phnom_Penh" | "Asia/Pontianak" | "Asia/Pyongyang" | "Asia/Qatar" | "Asia/Qostanay" | "Asia/Qyzylorda" | "Asia/Rangoon" | "Asia/Riyadh" | "Asia/Saigon" | "Asia/Sakhalin" | "Asia/Samarkand" | "Asia/Seoul" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Srednekolymsk" | "Asia/Taipei" | "Asia/Tashkent" | "Asia/Tbilisi" | "Asia/Tehran" | "Asia/Tel_Aviv" | "Asia/Thimbu" | "Asia/Thimphu" | "Asia/Tokyo" | "Asia/Tomsk" | "Asia/Ujung_Pandang" | "Asia/Ulaanbaatar" | "Asia/Ulan_Bator" | "Asia/Urumqi" | "Asia/Ust-Nera" | "Asia/Vientiane" | "Asia/Vladivostok" | "Asia/Yakutsk" | "Asia/Yangon" | "Asia/Yekaterinburg" | "Asia/Yerevan" | "Atlantic/Azores" | "Atlantic/Bermuda" | "Atlantic/Canary" | "Atlantic/Cape_Verde" | "Atlantic/Faeroe" | "Atlantic/Faroe" | "Atlantic/Jan_Mayen" | "Atlantic/Madeira" | "Atlantic/Reykjavik" | "Atlantic/South_Georgia" | "Atlantic/St_Helena" | "Atlantic/Stanley" | "Australia/ACT" | "Australia/Adelaide" | "Australia/Brisbane" | "Australia/Broken_Hill" | "Australia/Canberra" | "Australia/Currie" | "Australia/Darwin" | "Australia/Eucla" | "Australia/Hobart" | "Australia/LHI" | "Australia/Lindeman" | "Australia/Lord_Howe" | "Australia/Melbourne" | "Australia/NSW" | "Australia/North" | "Australia/Perth" | "Australia/Queensland" | "Australia/South" | "Australia/Sydney" | "Australia/Tasmania" | "Australia/Victoria" | "Australia/West" | "Australia/Yancowinna" | "Brazil/Acre" | "Brazil/DeNoronha" | "Brazil/East" | "Brazil/West" | "CET" | "CST6CDT" | "Canada/Atlantic" | "Canada/Central" | "Canada/Eastern" | "Canada/Mountain" | "Canada/Newfoundland" | "Canada/Pacific" | "Canada/Saskatchewan" | "Canada/Yukon" | "Chile/Continental" | "Chile/EasterIsland" | "Cuba" | "EET" | "EST" | "EST5EDT" | "Egypt" | "Eire" | "Etc/GMT" | "Etc/GMT+0" | "Etc/GMT+1" | "Etc/GMT+10" | "Etc/GMT+11" | "Etc/GMT+12" | "Etc/GMT+2" | "Etc/GMT+3" | "Etc/GMT+4" | "Etc/GMT+5" | "Etc/GMT+6" | "Etc/GMT+7" | "Etc/GMT+8" | "Etc/GMT+9" | "Etc/GMT-0" | "Etc/GMT-1" | "Etc/GMT-10" | "Etc/GMT-11" | "Etc/GMT-12" | "Etc/GMT-13" | "Etc/GMT-14" | "Etc/GMT-2" | "Etc/GMT-3" | "Etc/GMT-4" | "Etc/GMT-5" | "Etc/GMT-6" | "Etc/GMT-7" | "Etc/GMT-8" | "Etc/GMT-9" | "Etc/GMT0" | "Etc/Greenwich" | "Etc/UCT" | "Etc/UTC" | "Etc/Universal" | "Etc/Zulu" | "Europe/Amsterdam" | "Europe/Andorra" | "Europe/Astrakhan" | "Europe/Athens" | "Europe/Belfast" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Bratislava" | "Europe/Brussels" | "Europe/Bucharest" | "Europe/Budapest" | "Europe/Busingen" | "Europe/Chisinau" | "Europe/Copenhagen" | "Europe/Dublin" | "Europe/Gibraltar" | "Europe/Guernsey" | "Europe/Helsinki" | "Europe/Isle_of_Man" | "Europe/Istanbul" | "Europe/Jersey" | "Europe/Kaliningrad" | "Europe/Kiev" | "Europe/Kirov" | "Europe/Kyiv" | "Europe/Lisbon" | "Europe/Ljubljana" | "Europe/London" | "Europe/Luxembourg" | "Europe/Madrid" | "Europe/Malta" | "Europe/Mariehamn" | "Europe/Minsk" | "Europe/Monaco" | "Europe/Moscow" | "Europe/Nicosia" | "Europe/Oslo" | "Europe/Paris" | "Europe/Podgorica" | "Europe/Prague" | "Europe/Riga" | "Europe/Rome" | "Europe/Samara" | "Europe/San_Marino" | "Europe/Sarajevo" | "Europe/Saratov" | "Europe/Simferopol" | "Europe/Skopje" | "Europe/Sofia" | "Europe/Stockholm" | "Europe/Tallinn" | "Europe/Tirane" | "Europe/Tiraspol" | "Europe/Ulyanovsk" | "Europe/Uzhgorod" | "Europe/Vaduz" | "Europe/Vatican" | "Europe/Vienna" | "Europe/Vilnius" | "Europe/Volgograd" | "Europe/Warsaw" | "Europe/Zagreb" | "Europe/Zaporozhye" | "Europe/Zurich" | "Factory" | "GB" | "GB-Eire" | "GMT" | "GMT+0" | "GMT-0" | "GMT0" | "Greenwich" | "HST" | "Hongkong" | "Iceland" | "Indian/Antananarivo" | "Indian/Chagos" | "Indian/Christmas" | "Indian/Cocos" | "Indian/Comoro" | "Indian/Kerguelen" | "Indian/Mahe" | "Indian/Maldives" | "Indian/Mauritius" | "Indian/Mayotte" | "Indian/Reunion" | "Iran" | "Israel" | "Jamaica" | "Japan" | "Kwajalein" | "Libya" | "MET" | "MST" | "MST7MDT" | "Mexico/BajaNorte" | "Mexico/BajaSur" | "Mexico/General" | "NZ" | "NZ-CHAT" | "Navajo" | "PRC" | "PST8PDT" | "Pacific/Apia" | "Pacific/Auckland" | "Pacific/Bougainville" | "Pacific/Chatham" | "Pacific/Chuuk" | "Pacific/Easter" | "Pacific/Efate" | "Pacific/Enderbury" | "Pacific/Fakaofo" | "Pacific/Fiji" | "Pacific/Funafuti" | "Pacific/Galapagos" | "Pacific/Gambier" | "Pacific/Guadalcanal" | "Pacific/Guam" | "Pacific/Honolulu" | "Pacific/Johnston" | "Pacific/Kanton" | "Pacific/Kiritimati" | "Pacific/Kosrae" | "Pacific/Kwajalein" | "Pacific/Majuro" | "Pacific/Marquesas" | "Pacific/Midway" | "Pacific/Nauru" | "Pacific/Niue" | "Pacific/Norfolk" | "Pacific/Noumea" | "Pacific/Pago_Pago" | "Pacific/Palau" | "Pacific/Pitcairn" | "Pacific/Pohnpei" | "Pacific/Ponape" | "Pacific/Port_Moresby" | "Pacific/Rarotonga" | "Pacific/Saipan" | "Pacific/Samoa" | "Pacific/Tahiti" | "Pacific/Tarawa" | "Pacific/Tongatapu" | "Pacific/Truk" | "Pacific/Wake" | "Pacific/Wallis" | "Pacific/Yap" | "Poland" | "Portugal" | "ROC" | "ROK" | "Singapore" | "Turkey" | "UCT" | "US/Alaska" | "US/Aleutian" | "US/Arizona" | "US/Central" | "US/East-Indiana" | "US/Eastern" | "US/Hawaii" | "US/Indiana-Starke" | "US/Michigan" | "US/Mountain" | "US/Pacific" | "US/Samoa" | "UTC" | "Universal" | "W-SU" | "WET" | "Zulu" | "localtime") | components["schemas"]["_NotSet"] | null;
7358
+ /**
7359
+ * User Models
7360
+ * @description A list of strings representing the user models associated with the simulation persona.
7361
+ */
7362
+ user_models: components["schemas"]["amigo_lib__pydantic__base_model__StrippedNonemptyString__1"][];
7264
7363
  };
7265
7364
  /** Response */
7266
7365
  simulation__create_simulation_persona__Response: {
@@ -7286,6 +7385,11 @@ export interface components {
7286
7385
  * @default {}
7287
7386
  */
7288
7387
  timezone?: ("Africa/Abidjan" | "Africa/Accra" | "Africa/Addis_Ababa" | "Africa/Algiers" | "Africa/Asmara" | "Africa/Asmera" | "Africa/Bamako" | "Africa/Bangui" | "Africa/Banjul" | "Africa/Bissau" | "Africa/Blantyre" | "Africa/Brazzaville" | "Africa/Bujumbura" | "Africa/Cairo" | "Africa/Casablanca" | "Africa/Ceuta" | "Africa/Conakry" | "Africa/Dakar" | "Africa/Dar_es_Salaam" | "Africa/Djibouti" | "Africa/Douala" | "Africa/El_Aaiun" | "Africa/Freetown" | "Africa/Gaborone" | "Africa/Harare" | "Africa/Johannesburg" | "Africa/Juba" | "Africa/Kampala" | "Africa/Khartoum" | "Africa/Kigali" | "Africa/Kinshasa" | "Africa/Lagos" | "Africa/Libreville" | "Africa/Lome" | "Africa/Luanda" | "Africa/Lubumbashi" | "Africa/Lusaka" | "Africa/Malabo" | "Africa/Maputo" | "Africa/Maseru" | "Africa/Mbabane" | "Africa/Mogadishu" | "Africa/Monrovia" | "Africa/Nairobi" | "Africa/Ndjamena" | "Africa/Niamey" | "Africa/Nouakchott" | "Africa/Ouagadougou" | "Africa/Porto-Novo" | "Africa/Sao_Tome" | "Africa/Timbuktu" | "Africa/Tripoli" | "Africa/Tunis" | "Africa/Windhoek" | "America/Adak" | "America/Anchorage" | "America/Anguilla" | "America/Antigua" | "America/Araguaina" | "America/Argentina/Buenos_Aires" | "America/Argentina/Catamarca" | "America/Argentina/ComodRivadavia" | "America/Argentina/Cordoba" | "America/Argentina/Jujuy" | "America/Argentina/La_Rioja" | "America/Argentina/Mendoza" | "America/Argentina/Rio_Gallegos" | "America/Argentina/Salta" | "America/Argentina/San_Juan" | "America/Argentina/San_Luis" | "America/Argentina/Tucuman" | "America/Argentina/Ushuaia" | "America/Aruba" | "America/Asuncion" | "America/Atikokan" | "America/Atka" | "America/Bahia" | "America/Bahia_Banderas" | "America/Barbados" | "America/Belem" | "America/Belize" | "America/Blanc-Sablon" | "America/Boa_Vista" | "America/Bogota" | "America/Boise" | "America/Buenos_Aires" | "America/Cambridge_Bay" | "America/Campo_Grande" | "America/Cancun" | "America/Caracas" | "America/Catamarca" | "America/Cayenne" | "America/Cayman" | "America/Chicago" | "America/Chihuahua" | "America/Ciudad_Juarez" | "America/Coral_Harbour" | "America/Cordoba" | "America/Costa_Rica" | "America/Coyhaique" | "America/Creston" | "America/Cuiaba" | "America/Curacao" | "America/Danmarkshavn" | "America/Dawson" | "America/Dawson_Creek" | "America/Denver" | "America/Detroit" | "America/Dominica" | "America/Edmonton" | "America/Eirunepe" | "America/El_Salvador" | "America/Ensenada" | "America/Fort_Nelson" | "America/Fort_Wayne" | "America/Fortaleza" | "America/Glace_Bay" | "America/Godthab" | "America/Goose_Bay" | "America/Grand_Turk" | "America/Grenada" | "America/Guadeloupe" | "America/Guatemala" | "America/Guayaquil" | "America/Guyana" | "America/Halifax" | "America/Havana" | "America/Hermosillo" | "America/Indiana/Indianapolis" | "America/Indiana/Knox" | "America/Indiana/Marengo" | "America/Indiana/Petersburg" | "America/Indiana/Tell_City" | "America/Indiana/Vevay" | "America/Indiana/Vincennes" | "America/Indiana/Winamac" | "America/Indianapolis" | "America/Inuvik" | "America/Iqaluit" | "America/Jamaica" | "America/Jujuy" | "America/Juneau" | "America/Kentucky/Louisville" | "America/Kentucky/Monticello" | "America/Knox_IN" | "America/Kralendijk" | "America/La_Paz" | "America/Lima" | "America/Los_Angeles" | "America/Louisville" | "America/Lower_Princes" | "America/Maceio" | "America/Managua" | "America/Manaus" | "America/Marigot" | "America/Martinique" | "America/Matamoros" | "America/Mazatlan" | "America/Mendoza" | "America/Menominee" | "America/Merida" | "America/Metlakatla" | "America/Mexico_City" | "America/Miquelon" | "America/Moncton" | "America/Monterrey" | "America/Montevideo" | "America/Montreal" | "America/Montserrat" | "America/Nassau" | "America/New_York" | "America/Nipigon" | "America/Nome" | "America/Noronha" | "America/North_Dakota/Beulah" | "America/North_Dakota/Center" | "America/North_Dakota/New_Salem" | "America/Nuuk" | "America/Ojinaga" | "America/Panama" | "America/Pangnirtung" | "America/Paramaribo" | "America/Phoenix" | "America/Port-au-Prince" | "America/Port_of_Spain" | "America/Porto_Acre" | "America/Porto_Velho" | "America/Puerto_Rico" | "America/Punta_Arenas" | "America/Rainy_River" | "America/Rankin_Inlet" | "America/Recife" | "America/Regina" | "America/Resolute" | "America/Rio_Branco" | "America/Rosario" | "America/Santa_Isabel" | "America/Santarem" | "America/Santiago" | "America/Santo_Domingo" | "America/Sao_Paulo" | "America/Scoresbysund" | "America/Shiprock" | "America/Sitka" | "America/St_Barthelemy" | "America/St_Johns" | "America/St_Kitts" | "America/St_Lucia" | "America/St_Thomas" | "America/St_Vincent" | "America/Swift_Current" | "America/Tegucigalpa" | "America/Thule" | "America/Thunder_Bay" | "America/Tijuana" | "America/Toronto" | "America/Tortola" | "America/Vancouver" | "America/Virgin" | "America/Whitehorse" | "America/Winnipeg" | "America/Yakutat" | "America/Yellowknife" | "Antarctica/Casey" | "Antarctica/Davis" | "Antarctica/DumontDUrville" | "Antarctica/Macquarie" | "Antarctica/Mawson" | "Antarctica/McMurdo" | "Antarctica/Palmer" | "Antarctica/Rothera" | "Antarctica/South_Pole" | "Antarctica/Syowa" | "Antarctica/Troll" | "Antarctica/Vostok" | "Arctic/Longyearbyen" | "Asia/Aden" | "Asia/Almaty" | "Asia/Amman" | "Asia/Anadyr" | "Asia/Aqtau" | "Asia/Aqtobe" | "Asia/Ashgabat" | "Asia/Ashkhabad" | "Asia/Atyrau" | "Asia/Baghdad" | "Asia/Bahrain" | "Asia/Baku" | "Asia/Bangkok" | "Asia/Barnaul" | "Asia/Beirut" | "Asia/Bishkek" | "Asia/Brunei" | "Asia/Calcutta" | "Asia/Chita" | "Asia/Choibalsan" | "Asia/Chongqing" | "Asia/Chungking" | "Asia/Colombo" | "Asia/Dacca" | "Asia/Damascus" | "Asia/Dhaka" | "Asia/Dili" | "Asia/Dubai" | "Asia/Dushanbe" | "Asia/Famagusta" | "Asia/Gaza" | "Asia/Harbin" | "Asia/Hebron" | "Asia/Ho_Chi_Minh" | "Asia/Hong_Kong" | "Asia/Hovd" | "Asia/Irkutsk" | "Asia/Istanbul" | "Asia/Jakarta" | "Asia/Jayapura" | "Asia/Jerusalem" | "Asia/Kabul" | "Asia/Kamchatka" | "Asia/Karachi" | "Asia/Kashgar" | "Asia/Kathmandu" | "Asia/Katmandu" | "Asia/Khandyga" | "Asia/Kolkata" | "Asia/Krasnoyarsk" | "Asia/Kuala_Lumpur" | "Asia/Kuching" | "Asia/Kuwait" | "Asia/Macao" | "Asia/Macau" | "Asia/Magadan" | "Asia/Makassar" | "Asia/Manila" | "Asia/Muscat" | "Asia/Nicosia" | "Asia/Novokuznetsk" | "Asia/Novosibirsk" | "Asia/Omsk" | "Asia/Oral" | "Asia/Phnom_Penh" | "Asia/Pontianak" | "Asia/Pyongyang" | "Asia/Qatar" | "Asia/Qostanay" | "Asia/Qyzylorda" | "Asia/Rangoon" | "Asia/Riyadh" | "Asia/Saigon" | "Asia/Sakhalin" | "Asia/Samarkand" | "Asia/Seoul" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Srednekolymsk" | "Asia/Taipei" | "Asia/Tashkent" | "Asia/Tbilisi" | "Asia/Tehran" | "Asia/Tel_Aviv" | "Asia/Thimbu" | "Asia/Thimphu" | "Asia/Tokyo" | "Asia/Tomsk" | "Asia/Ujung_Pandang" | "Asia/Ulaanbaatar" | "Asia/Ulan_Bator" | "Asia/Urumqi" | "Asia/Ust-Nera" | "Asia/Vientiane" | "Asia/Vladivostok" | "Asia/Yakutsk" | "Asia/Yangon" | "Asia/Yekaterinburg" | "Asia/Yerevan" | "Atlantic/Azores" | "Atlantic/Bermuda" | "Atlantic/Canary" | "Atlantic/Cape_Verde" | "Atlantic/Faeroe" | "Atlantic/Faroe" | "Atlantic/Jan_Mayen" | "Atlantic/Madeira" | "Atlantic/Reykjavik" | "Atlantic/South_Georgia" | "Atlantic/St_Helena" | "Atlantic/Stanley" | "Australia/ACT" | "Australia/Adelaide" | "Australia/Brisbane" | "Australia/Broken_Hill" | "Australia/Canberra" | "Australia/Currie" | "Australia/Darwin" | "Australia/Eucla" | "Australia/Hobart" | "Australia/LHI" | "Australia/Lindeman" | "Australia/Lord_Howe" | "Australia/Melbourne" | "Australia/NSW" | "Australia/North" | "Australia/Perth" | "Australia/Queensland" | "Australia/South" | "Australia/Sydney" | "Australia/Tasmania" | "Australia/Victoria" | "Australia/West" | "Australia/Yancowinna" | "Brazil/Acre" | "Brazil/DeNoronha" | "Brazil/East" | "Brazil/West" | "CET" | "CST6CDT" | "Canada/Atlantic" | "Canada/Central" | "Canada/Eastern" | "Canada/Mountain" | "Canada/Newfoundland" | "Canada/Pacific" | "Canada/Saskatchewan" | "Canada/Yukon" | "Chile/Continental" | "Chile/EasterIsland" | "Cuba" | "EET" | "EST" | "EST5EDT" | "Egypt" | "Eire" | "Etc/GMT" | "Etc/GMT+0" | "Etc/GMT+1" | "Etc/GMT+10" | "Etc/GMT+11" | "Etc/GMT+12" | "Etc/GMT+2" | "Etc/GMT+3" | "Etc/GMT+4" | "Etc/GMT+5" | "Etc/GMT+6" | "Etc/GMT+7" | "Etc/GMT+8" | "Etc/GMT+9" | "Etc/GMT-0" | "Etc/GMT-1" | "Etc/GMT-10" | "Etc/GMT-11" | "Etc/GMT-12" | "Etc/GMT-13" | "Etc/GMT-14" | "Etc/GMT-2" | "Etc/GMT-3" | "Etc/GMT-4" | "Etc/GMT-5" | "Etc/GMT-6" | "Etc/GMT-7" | "Etc/GMT-8" | "Etc/GMT-9" | "Etc/GMT0" | "Etc/Greenwich" | "Etc/UCT" | "Etc/UTC" | "Etc/Universal" | "Etc/Zulu" | "Europe/Amsterdam" | "Europe/Andorra" | "Europe/Astrakhan" | "Europe/Athens" | "Europe/Belfast" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Bratislava" | "Europe/Brussels" | "Europe/Bucharest" | "Europe/Budapest" | "Europe/Busingen" | "Europe/Chisinau" | "Europe/Copenhagen" | "Europe/Dublin" | "Europe/Gibraltar" | "Europe/Guernsey" | "Europe/Helsinki" | "Europe/Isle_of_Man" | "Europe/Istanbul" | "Europe/Jersey" | "Europe/Kaliningrad" | "Europe/Kiev" | "Europe/Kirov" | "Europe/Kyiv" | "Europe/Lisbon" | "Europe/Ljubljana" | "Europe/London" | "Europe/Luxembourg" | "Europe/Madrid" | "Europe/Malta" | "Europe/Mariehamn" | "Europe/Minsk" | "Europe/Monaco" | "Europe/Moscow" | "Europe/Nicosia" | "Europe/Oslo" | "Europe/Paris" | "Europe/Podgorica" | "Europe/Prague" | "Europe/Riga" | "Europe/Rome" | "Europe/Samara" | "Europe/San_Marino" | "Europe/Sarajevo" | "Europe/Saratov" | "Europe/Simferopol" | "Europe/Skopje" | "Europe/Sofia" | "Europe/Stockholm" | "Europe/Tallinn" | "Europe/Tirane" | "Europe/Tiraspol" | "Europe/Ulyanovsk" | "Europe/Uzhgorod" | "Europe/Vaduz" | "Europe/Vatican" | "Europe/Vienna" | "Europe/Vilnius" | "Europe/Volgograd" | "Europe/Warsaw" | "Europe/Zagreb" | "Europe/Zaporozhye" | "Europe/Zurich" | "Factory" | "GB" | "GB-Eire" | "GMT" | "GMT+0" | "GMT-0" | "GMT0" | "Greenwich" | "HST" | "Hongkong" | "Iceland" | "Indian/Antananarivo" | "Indian/Chagos" | "Indian/Christmas" | "Indian/Cocos" | "Indian/Comoro" | "Indian/Kerguelen" | "Indian/Mahe" | "Indian/Maldives" | "Indian/Mauritius" | "Indian/Mayotte" | "Indian/Reunion" | "Iran" | "Israel" | "Jamaica" | "Japan" | "Kwajalein" | "Libya" | "MET" | "MST" | "MST7MDT" | "Mexico/BajaNorte" | "Mexico/BajaSur" | "Mexico/General" | "NZ" | "NZ-CHAT" | "Navajo" | "PRC" | "PST8PDT" | "Pacific/Apia" | "Pacific/Auckland" | "Pacific/Bougainville" | "Pacific/Chatham" | "Pacific/Chuuk" | "Pacific/Easter" | "Pacific/Efate" | "Pacific/Enderbury" | "Pacific/Fakaofo" | "Pacific/Fiji" | "Pacific/Funafuti" | "Pacific/Galapagos" | "Pacific/Gambier" | "Pacific/Guadalcanal" | "Pacific/Guam" | "Pacific/Honolulu" | "Pacific/Johnston" | "Pacific/Kanton" | "Pacific/Kiritimati" | "Pacific/Kosrae" | "Pacific/Kwajalein" | "Pacific/Majuro" | "Pacific/Marquesas" | "Pacific/Midway" | "Pacific/Nauru" | "Pacific/Niue" | "Pacific/Norfolk" | "Pacific/Noumea" | "Pacific/Pago_Pago" | "Pacific/Palau" | "Pacific/Pitcairn" | "Pacific/Pohnpei" | "Pacific/Ponape" | "Pacific/Port_Moresby" | "Pacific/Rarotonga" | "Pacific/Saipan" | "Pacific/Samoa" | "Pacific/Tahiti" | "Pacific/Tarawa" | "Pacific/Tongatapu" | "Pacific/Truk" | "Pacific/Wake" | "Pacific/Wallis" | "Pacific/Yap" | "Poland" | "Portugal" | "ROC" | "ROK" | "Singapore" | "Turkey" | "UCT" | "US/Alaska" | "US/Aleutian" | "US/Arizona" | "US/Central" | "US/East-Indiana" | "US/Eastern" | "US/Hawaii" | "US/Indiana-Starke" | "US/Michigan" | "US/Mountain" | "US/Pacific" | "US/Samoa" | "UTC" | "Universal" | "W-SU" | "WET" | "Zulu" | "localtime") | components["schemas"]["_NotSet"] | null;
7388
+ /**
7389
+ * User Models
7390
+ * @description A list of strings representing the user models associated with the simulation persona.
7391
+ */
7392
+ user_models: components["schemas"]["amigo_lib__pydantic__base_model__StrippedNonemptyString__1"][];
7289
7393
  };
7290
7394
  /** Response */
7291
7395
  simulation__create_simulation_persona_version__Response: {
@@ -7317,6 +7421,12 @@ export interface components {
7317
7421
  instructions: components["schemas"]["amigo_lib__pydantic__base_model__StrippedNonemptyString__1"];
7318
7422
  /** @description The initial message configuration for the simulation scenario version. If not specified, an agent message opens the simulated conversation. */
7319
7423
  initial_message_config: components["schemas"]["InitialMessageConfig-Input"] | null;
7424
+ /**
7425
+ * Conversation Starts At
7426
+ * Format: date-time
7427
+ * @description The time at which the conversation starts. This must be a timestamp in UTC.
7428
+ */
7429
+ conversation_starts_at: string;
7320
7430
  };
7321
7431
  /** Response */
7322
7432
  simulation__create_simulation_scenario__Response: {
@@ -7334,6 +7444,12 @@ export interface components {
7334
7444
  instructions: components["schemas"]["amigo_lib__pydantic__base_model__StrippedNonemptyString__1"];
7335
7445
  /** @description The initial message configuration for the simulation scenario version. If not specified, an agent message opens the simulated conversation. */
7336
7446
  initial_message_config: components["schemas"]["InitialMessageConfig-Input"] | null;
7447
+ /**
7448
+ * Conversation Starts At
7449
+ * Format: date-time
7450
+ * @description The time at which the conversation starts. This must be a timestamp in UTC.
7451
+ */
7452
+ conversation_starts_at: string;
7337
7453
  };
7338
7454
  /** Response */
7339
7455
  simulation__create_simulation_scenario_version__Response: {
@@ -8619,7 +8735,7 @@ export interface operations {
8619
8735
  };
8620
8736
  content?: never;
8621
8737
  };
8622
- /** @description The user has exceeded the rate limit of 50 requests per minute for this endpoint. */
8738
+ /** @description The user has exceeded the rate limit of 20 requests per minute for this endpoint. */
8623
8739
  429: {
8624
8740
  headers: {
8625
8741
  [name: string]: unknown;
@@ -8950,7 +9066,7 @@ export interface operations {
8950
9066
  };
8951
9067
  content?: never;
8952
9068
  };
8953
- /** @description The user has exceeded the rate limit of 50 requests per minute for this endpoint. */
9069
+ /** @description The user has exceeded the rate limit of 20 requests per minute for this endpoint. */
8954
9070
  429: {
8955
9071
  headers: {
8956
9072
  [name: string]: unknown;
@@ -9274,7 +9390,7 @@ export interface operations {
9274
9390
  };
9275
9391
  content?: never;
9276
9392
  };
9277
- /** @description The user has exceeded the rate limit of 50 requests per minute for this endpoint. */
9393
+ /** @description The user has exceeded the rate limit of 10 requests per minute for this endpoint. */
9278
9394
  429: {
9279
9395
  headers: {
9280
9396
  [name: string]: unknown;
@@ -9653,7 +9769,7 @@ export interface operations {
9653
9769
  };
9654
9770
  content?: never;
9655
9771
  };
9656
- /** @description The user has exceeded the rate limit of 20 requests per minute for this endpoint. */
9772
+ /** @description The user has exceeded the rate limit of 5 requests per minute for this endpoint. */
9657
9773
  429: {
9658
9774
  headers: {
9659
9775
  [name: string]: unknown;
@@ -9721,7 +9837,7 @@ export interface operations {
9721
9837
  };
9722
9838
  content?: never;
9723
9839
  };
9724
- /** @description The user has exceeded the rate limit of 50 requests per minute for this endpoint. */
9840
+ /** @description The user has exceeded the rate limit of 20 requests per minute for this endpoint. */
9725
9841
  429: {
9726
9842
  headers: {
9727
9843
  [name: string]: unknown;
@@ -10238,10 +10354,10 @@ export interface operations {
10238
10354
  query: {
10239
10355
  /** @description The format of the response that will be sent to the user. */
10240
10356
  response_format: "text" | "voice";
10241
- /** @description The format of the audio response, if `response_format` is set to `voice`. */
10242
- audio_format?: ("mp3" | "pcm") | null;
10243
10357
  /** @description A regex for filtering the type of the current agent action to return. By default, all are returned. If you don't want to receive any events, set this to a regex that matches nothing, for instance `^$`. */
10244
10358
  current_agent_action_type?: string;
10359
+ /** @description The format of the audio response, if `response_format` is set to `voice`. */
10360
+ audio_format?: ("mp3" | "pcm") | null;
10245
10361
  };
10246
10362
  header?: {
10247
10363
  /** @description The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database. */
@@ -10396,7 +10512,7 @@ export interface operations {
10396
10512
  };
10397
10513
  content?: never;
10398
10514
  };
10399
- /** @description The user has exceeded the rate limit of 60 requests per minute for this endpoint. */
10515
+ /** @description The user has exceeded the rate limit of 20 requests per minute for this endpoint. */
10400
10516
  429: {
10401
10517
  headers: {
10402
10518
  [name: string]: unknown;
@@ -10629,7 +10745,7 @@ export interface operations {
10629
10745
  };
10630
10746
  content?: never;
10631
10747
  };
10632
- /** @description The user has exceeded the rate limit of 500 requests per minute for this endpoint. */
10748
+ /** @description The user has exceeded the rate limit of 20 requests per minute for this endpoint. */
10633
10749
  429: {
10634
10750
  headers: {
10635
10751
  [name: string]: unknown;
@@ -10652,14 +10768,16 @@ export interface operations {
10652
10768
  request_format: "text" | "voice";
10653
10769
  /** @description The format of the response that will be sent to the user. */
10654
10770
  response_format: "text" | "voice";
10771
+ /** @description A regex for filtering the type of the current agent action to return. By default, all are returned. If you don't want to receive any events, set this to a regex that matches nothing, for instance `^$`. */
10772
+ current_agent_action_type?: string;
10655
10773
  /** @description Configuration for the user message audio. This is only required if `request_format` is set to `voice`. */
10656
10774
  request_audio_config?: components["schemas"]["UserMessageAudioConfig"] | null;
10657
10775
  /** @description The format of the audio response, if `response_format` is set to `voice`. */
10658
10776
  audio_format?: ("mp3" | "pcm") | null;
10659
- /** @description An RE2 style regex pattern for filtering the type of the current agent action to return. By default, all are returned. If you don't want to receive any events, set this to a regex that matches nothing, for instance `^$`. */
10660
- current_agent_action_type?: string;
10661
10777
  };
10662
- header?: {
10778
+ header: {
10779
+ /** @description The content type of the request body, which must be `multipart/form-data` followed by a boundary. */
10780
+ "content-type": string;
10663
10781
  /** @description The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database. */
10664
10782
  "x-mongo-cluster-name"?: string | null;
10665
10783
  "Sec-WebSocket-Protocol"?: string[];
@@ -10813,7 +10931,7 @@ export interface operations {
10813
10931
  };
10814
10932
  content?: never;
10815
10933
  };
10816
- /** @description The user has exceeded the rate limit of 10 request per minute for this endpoint. */
10934
+ /** @description The user has exceeded the rate limit of 30 request per minute for this endpoint. */
10817
10935
  429: {
10818
10936
  headers: {
10819
10937
  [name: string]: unknown;
@@ -10885,7 +11003,7 @@ export interface operations {
10885
11003
  };
10886
11004
  content?: never;
10887
11005
  };
10888
- /** @description The user has exceeded the rate limit of 40 requests per minute for this endpoint. */
11006
+ /** @description The user has exceeded the rate limit of 10 requests per minute for this endpoint. */
10889
11007
  429: {
10890
11008
  headers: {
10891
11009
  [name: string]: unknown;
@@ -10910,9 +11028,9 @@ export interface operations {
10910
11028
  "Sec-WebSocket-Protocol"?: string[];
10911
11029
  };
10912
11030
  path: {
10913
- organization: string;
10914
11031
  /** @description The identifier of the user to update information for. */
10915
11032
  requested_user_id: string;
11033
+ organization: string;
10916
11034
  };
10917
11035
  cookie?: never;
10918
11036
  };
@@ -10964,7 +11082,7 @@ export interface operations {
10964
11082
  };
10965
11083
  content?: never;
10966
11084
  };
10967
- /** @description The user has exceeded the rate limit of 100 requests per minute for this endpoint. */
11085
+ /** @description The user has exceeded the rate limit of 50 requests per minute for this endpoint. */
10968
11086
  429: {
10969
11087
  headers: {
10970
11088
  [name: string]: unknown;
@@ -11306,7 +11424,7 @@ export interface operations {
11306
11424
  };
11307
11425
  content?: never;
11308
11426
  };
11309
- /** @description The user has exceeded the rate limit of 1000 requests per minute for this endpoint. */
11427
+ /** @description The user has exceeded the rate limit of 50 requests per minute for this endpoint. */
11310
11428
  429: {
11311
11429
  headers: {
11312
11430
  [name: string]: unknown;
@@ -11331,9 +11449,9 @@ export interface operations {
11331
11449
  "Sec-WebSocket-Protocol"?: string[];
11332
11450
  };
11333
11451
  path: {
11334
- organization: string;
11335
11452
  /** @description The identifier of the user to delete. */
11336
11453
  requested_user_id: string;
11454
+ organization: string;
11337
11455
  };
11338
11456
  cookie?: never;
11339
11457
  };
@@ -11381,7 +11499,7 @@ export interface operations {
11381
11499
  };
11382
11500
  content?: never;
11383
11501
  };
11384
- /** @description The user has exceeded the rate limit of 1000 requests per minute for this endpoint. */
11502
+ /** @description The user has exceeded the rate limit of 500 requests per minute for this endpoint. */
11385
11503
  429: {
11386
11504
  headers: {
11387
11505
  [name: string]: unknown;
@@ -11953,7 +12071,93 @@ export interface operations {
11953
12071
  };
11954
12072
  content?: never;
11955
12073
  };
11956
- /** @description The user has exceeded the rate limit of 5 requests per minute for this endpoint. */
12074
+ /** @description The user has exceeded the rate limit of 20 requests per minute for this endpoint. */
12075
+ 429: {
12076
+ headers: {
12077
+ [name: string]: unknown;
12078
+ };
12079
+ content?: never;
12080
+ };
12081
+ /** @description The service is going through temporary maintenance. */
12082
+ 503: {
12083
+ headers: {
12084
+ [name: string]: unknown;
12085
+ };
12086
+ content?: never;
12087
+ };
12088
+ };
12089
+ };
12090
+ "submit-sql-query": {
12091
+ parameters: {
12092
+ query?: never;
12093
+ header?: {
12094
+ /** @description The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database. */
12095
+ "x-mongo-cluster-name"?: string | null;
12096
+ "Sec-WebSocket-Protocol"?: string[];
12097
+ };
12098
+ path: {
12099
+ organization: string;
12100
+ };
12101
+ cookie?: never;
12102
+ };
12103
+ requestBody: {
12104
+ content: {
12105
+ "application/json": components["schemas"]["admin__submit_sql_query__Request"];
12106
+ };
12107
+ };
12108
+ responses: {
12109
+ /** @description Succeeded. */
12110
+ 200: {
12111
+ headers: {
12112
+ [name: string]: unknown;
12113
+ };
12114
+ content: {
12115
+ "application/json": components["schemas"]["admin__submit_sql_query__Response"];
12116
+ };
12117
+ };
12118
+ /** @description This endpoint is not supported in the current environment, or the SQL query is invalid. */
12119
+ 400: {
12120
+ headers: {
12121
+ [name: string]: unknown;
12122
+ };
12123
+ content?: never;
12124
+ };
12125
+ /** @description Invalid authorization credentials. */
12126
+ 401: {
12127
+ headers: {
12128
+ [name: string]: unknown;
12129
+ };
12130
+ content?: never;
12131
+ };
12132
+ /** @description Missing required permissions. */
12133
+ 403: {
12134
+ headers: {
12135
+ [name: string]: unknown;
12136
+ };
12137
+ content?: never;
12138
+ };
12139
+ /** @description The specified organization does not exist. */
12140
+ 404: {
12141
+ headers: {
12142
+ [name: string]: unknown;
12143
+ };
12144
+ content?: never;
12145
+ };
12146
+ /** @description The supplied query cannot be executed within the time limit. */
12147
+ 408: {
12148
+ headers: {
12149
+ [name: string]: unknown;
12150
+ };
12151
+ content?: never;
12152
+ };
12153
+ /** @description Invalid request path parameter or request body failed validation. */
12154
+ 422: {
12155
+ headers: {
12156
+ [name: string]: unknown;
12157
+ };
12158
+ content?: never;
12159
+ };
12160
+ /** @description The user has exceeded the rate limit of 6 requests per minute for this endpoint. */
11957
12161
  429: {
11958
12162
  headers: {
11959
12163
  [name: string]: unknown;
@@ -12490,7 +12694,7 @@ export interface operations {
12490
12694
  };
12491
12695
  content?: never;
12492
12696
  };
12493
- /** @description The user has exceeded the rate limit of 50 requests per minute for this endpoint. */
12697
+ /** @description The user has exceeded the rate limit of 500 requests per minute for this endpoint. */
12494
12698
  429: {
12495
12699
  headers: {
12496
12700
  [name: string]: unknown;
@@ -12569,7 +12773,7 @@ export interface operations {
12569
12773
  };
12570
12774
  content?: never;
12571
12775
  };
12572
- /** @description The user has exceeded the rate limit of 500 requests per minute for this endpoint. */
12776
+ /** @description The user has exceeded the rate limit of 200 requests per minute for this endpoint. */
12573
12777
  429: {
12574
12778
  headers: {
12575
12779
  [name: string]: unknown;
@@ -12797,7 +13001,7 @@ export interface operations {
12797
13001
  };
12798
13002
  content?: never;
12799
13003
  };
12800
- /** @description The user has exceeded the rate limit of 500 requests per minute for this endpoint. */
13004
+ /** @description The user has exceeded the rate limit of 1000 requests per minute for this endpoint. */
12801
13005
  429: {
12802
13006
  headers: {
12803
13007
  [name: string]: unknown;
@@ -12881,7 +13085,7 @@ export interface operations {
12881
13085
  };
12882
13086
  content?: never;
12883
13087
  };
12884
- /** @description The user has exceeded the rate limit of 500 requests per minute for this endpoint. */
13088
+ /** @description The user has exceeded the rate limit of 200 requests per minute for this endpoint. */
12885
13089
  429: {
12886
13090
  headers: {
12887
13091
  [name: string]: unknown;
@@ -13124,7 +13328,7 @@ export interface operations {
13124
13328
  };
13125
13329
  content?: never;
13126
13330
  };
13127
- /** @description The user has exceeded the rate limit of 10 requests per minute for this endpoint. */
13331
+ /** @description The user has exceeded the rate limit of 20 requests per minute for this endpoint. */
13128
13332
  429: {
13129
13333
  headers: {
13130
13334
  [name: string]: unknown;
@@ -13277,7 +13481,7 @@ export interface operations {
13277
13481
  };
13278
13482
  content?: never;
13279
13483
  };
13280
- /** @description The user has exceeded the rate limit of 100 requests per minute for this endpoint. */
13484
+ /** @description The user has exceeded the rate limit of 20 requests per minute for this endpoint. */
13281
13485
  429: {
13282
13486
  headers: {
13283
13487
  [name: string]: unknown;
@@ -13433,7 +13637,7 @@ export interface operations {
13433
13637
  };
13434
13638
  content?: never;
13435
13639
  };
13436
- /** @description The user has exceeded the rate limit of 10 requests per minute for this endpoint. */
13640
+ /** @description The user has exceeded the rate limit of 20 requests per minute for this endpoint. */
13437
13641
  429: {
13438
13642
  headers: {
13439
13643
  [name: string]: unknown;
@@ -14152,7 +14356,7 @@ export interface operations {
14152
14356
  };
14153
14357
  content?: never;
14154
14358
  };
14155
- /** @description The user has exceeded the rate limit of 50 requests per minute for this endpoint. */
14359
+ /** @description The user has exceeded the rate limit of 500 requests per minute for this endpoint. */
14156
14360
  429: {
14157
14361
  headers: {
14158
14362
  [name: string]: unknown;
@@ -15821,7 +16025,7 @@ export interface operations {
15821
16025
  };
15822
16026
  content?: never;
15823
16027
  };
15824
- /** @description The user has exceeded the rate limit of 100 requests per minute for this endpoint. */
16028
+ /** @description The user has exceeded the rate limit of 10 requests per minute for this endpoint. */
15825
16029
  429: {
15826
16030
  headers: {
15827
16031
  [name: string]: unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amigo-ai/sdk",
3
- "version": "0.19.0",
3
+ "version": "0.20.1",
4
4
  "description": "Amigo TypeScript SDK",
5
5
  "publishConfig": {
6
6
  "access": "public"