@algolia/agent-studio 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../client-common/src/cache/createBrowserLocalStorageCache.ts","../../../client-common/src/cache/createNullCache.ts","../../../client-common/src/cache/createFallbackableCache.ts","../../../client-common/src/cache/createMemoryCache.ts","../../../client-common/src/constants.ts","../../../client-common/src/createAlgoliaAgent.ts","../../../client-common/src/createAuth.ts","../../../client-common/src/createIterablePromise.ts","../../../client-common/src/getAlgoliaAgent.ts","../../../client-common/src/logger/createNullLogger.ts","../../../client-common/src/sse.ts","../../../client-common/src/transporter/compress.ts","../../../client-common/src/transporter/createStatefulHost.ts","../../../client-common/src/transporter/errors.ts","../../../client-common/src/transporter/helpers.ts","../../../client-common/src/transporter/responses.ts","../../../client-common/src/transporter/stackTrace.ts","../../../client-common/src/transporter/createTransporter.ts","../../../client-common/src/types/logger.ts","../../../client-common/src/validateParam.ts","../../../requester-browser-xhr/src/createXhrRequester.ts","../../src/agentStudioClient.ts","../../builds/browser.ts"],"sourcesContent":["import type { BrowserLocalStorageCacheItem, BrowserLocalStorageOptions, Cache, CacheEvents } from '../types';\n\nexport function createBrowserLocalStorageCache(options: BrowserLocalStorageOptions): Cache {\n let storage: Storage;\n // We've changed the namespace to avoid conflicts with v4, as this version is a huge breaking change\n const namespaceKey = `algolia-client-js-${options.key}`;\n\n function getStorage(): Storage {\n if (storage === undefined) {\n storage = options.localStorage || window.localStorage;\n }\n\n return storage;\n }\n\n function getNamespace<TValue>(): Record<string, TValue> {\n return JSON.parse(getStorage().getItem(namespaceKey) || '{}');\n }\n\n function setNamespace(namespace: Record<string, any>): void {\n getStorage().setItem(namespaceKey, JSON.stringify(namespace));\n }\n\n function yieldToMain(): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, 0));\n }\n\n function getFilteredNamespace(): {\n namespace: Record<string, BrowserLocalStorageCacheItem>;\n changed: boolean;\n } {\n const timeToLive = options.timeToLive ? options.timeToLive * 1000 : null;\n const namespace = getNamespace<BrowserLocalStorageCacheItem>();\n const currentTime = new Date().getTime();\n let changed = false;\n\n const filtered = Object.fromEntries(\n Object.entries(namespace).filter(([, cacheItem]) => {\n if (!cacheItem || cacheItem.timestamp === undefined) {\n changed = true;\n return false;\n }\n\n if (!timeToLive) {\n return true;\n }\n\n if (cacheItem.timestamp + timeToLive < currentTime) {\n changed = true;\n return false;\n }\n\n return true;\n }),\n );\n\n return { namespace: filtered, changed };\n }\n\n return {\n get<TValue>(\n key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: () => Promise.resolve(),\n },\n ): Promise<TValue> {\n return yieldToMain().then(() => {\n const { namespace, changed } = getFilteredNamespace();\n const cachedItem = namespace[JSON.stringify(key)];\n\n if (changed) {\n setNamespace(namespace);\n }\n\n if (cachedItem) {\n return cachedItem.value as TValue;\n }\n\n return defaultValue().then((value) => events.miss(value).then(() => value));\n });\n },\n\n set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {\n return yieldToMain().then(() => {\n const namespace = getNamespace();\n\n namespace[JSON.stringify(key)] = {\n timestamp: new Date().getTime(),\n value,\n };\n\n getStorage().setItem(namespaceKey, JSON.stringify(namespace));\n\n return value;\n });\n },\n\n delete(key: Record<string, any> | string): Promise<void> {\n return yieldToMain().then(() => {\n const namespace = getNamespace();\n\n delete namespace[JSON.stringify(key)];\n\n getStorage().setItem(namespaceKey, JSON.stringify(namespace));\n });\n },\n\n clear(): Promise<void> {\n return Promise.resolve().then(() => {\n getStorage().removeItem(namespaceKey);\n });\n },\n };\n}\n","import type { Cache, CacheEvents } from '../types';\n\nexport function createNullCache(): Cache {\n return {\n get<TValue>(\n _key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: (): Promise<void> => Promise.resolve(),\n },\n ): Promise<TValue> {\n const value = defaultValue();\n\n return value.then((result) => Promise.all([result, events.miss(result)])).then(([result]) => result);\n },\n\n set<TValue>(_key: Record<string, any> | string, value: TValue): Promise<TValue> {\n return Promise.resolve(value);\n },\n\n delete(_key: Record<string, any> | string): Promise<void> {\n return Promise.resolve();\n },\n\n clear(): Promise<void> {\n return Promise.resolve();\n },\n };\n}\n","import type { Cache, CacheEvents, FallbackableCacheOptions } from '../types';\nimport { createNullCache } from './createNullCache';\n\nexport function createFallbackableCache(options: FallbackableCacheOptions): Cache {\n const caches = [...options.caches];\n const current = caches.shift();\n\n if (current === undefined) {\n return createNullCache();\n }\n\n return {\n get<TValue>(\n key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: (): Promise<void> => Promise.resolve(),\n },\n ): Promise<TValue> {\n return current.get(key, defaultValue, events).catch(() => {\n return createFallbackableCache({ caches }).get(key, defaultValue, events);\n });\n },\n\n set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {\n return current.set(key, value).catch(() => {\n return createFallbackableCache({ caches }).set(key, value);\n });\n },\n\n delete(key: Record<string, any> | string): Promise<void> {\n return current.delete(key).catch(() => {\n return createFallbackableCache({ caches }).delete(key);\n });\n },\n\n clear(): Promise<void> {\n return current.clear().catch(() => {\n return createFallbackableCache({ caches }).clear();\n });\n },\n };\n}\n","import type { Cache, CacheEvents, MemoryCacheOptions } from '../types';\n\nexport function createMemoryCache(options: MemoryCacheOptions = { serializable: true }): Cache {\n let cache: Record<string, any> = {};\n\n return {\n get<TValue>(\n key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: (): Promise<void> => Promise.resolve(),\n },\n ): Promise<TValue> {\n const keyAsString = JSON.stringify(key);\n\n if (keyAsString in cache) {\n return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);\n }\n\n const promise = defaultValue();\n\n return promise.then((value: TValue) => events.miss(value)).then(() => promise);\n },\n\n set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {\n cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;\n\n return Promise.resolve(value);\n },\n\n delete(key: Record<string, unknown> | string): Promise<void> {\n delete cache[JSON.stringify(key)];\n\n return Promise.resolve();\n },\n\n clear(): Promise<void> {\n cache = {};\n\n return Promise.resolve();\n },\n };\n}\n","export const DEFAULT_CONNECT_TIMEOUT_BROWSER = 1000;\nexport const DEFAULT_READ_TIMEOUT_BROWSER = 2000;\nexport const DEFAULT_WRITE_TIMEOUT_BROWSER = 30000;\n\nexport const DEFAULT_CONNECT_TIMEOUT_NODE = 2000;\nexport const DEFAULT_READ_TIMEOUT_NODE = 5000;\nexport const DEFAULT_WRITE_TIMEOUT_NODE = 30000;\n","import type { AlgoliaAgent, AlgoliaAgentOptions } from './types';\n\nexport function createAlgoliaAgent(version: string): AlgoliaAgent {\n const algoliaAgent = {\n value: `Algolia for JavaScript (${version})`,\n add(options: AlgoliaAgentOptions): AlgoliaAgent {\n const addedAlgoliaAgent = `; ${options.segment}${options.version !== undefined ? ` (${options.version})` : ''}`;\n\n if (algoliaAgent.value.indexOf(addedAlgoliaAgent) === -1) {\n algoliaAgent.value = `${algoliaAgent.value}${addedAlgoliaAgent}`;\n }\n\n return algoliaAgent;\n },\n };\n\n return algoliaAgent;\n}\n","import type { AuthMode, Headers, QueryParameters } from './types';\n\nexport function createAuth(\n appId: string,\n apiKey: string,\n authMode: AuthMode = 'WithinHeaders',\n): {\n readonly headers: () => Headers;\n readonly queryParameters: () => QueryParameters;\n} {\n const credentials = {\n 'x-algolia-api-key': apiKey,\n 'x-algolia-application-id': appId,\n };\n\n return {\n headers(): Headers {\n return authMode === 'WithinHeaders' ? credentials : {};\n },\n\n queryParameters(): QueryParameters {\n return authMode === 'WithinQueryParameters' ? credentials : {};\n },\n };\n}\n","import type { CreateIterablePromise } from './types/createIterablePromise';\n\n/**\n * Helper: Returns the promise of a given `func` to iterate on, based on a given `validate` condition.\n *\n * @param createIterator - The createIterator options.\n * @param createIterator.func - The function to run, which returns a promise.\n * @param createIterator.validate - The validator function. It receives the resolved return of `func`.\n * @param createIterator.aggregator - The function that runs right after the `func` method has been executed, allows you to do anything with the response before `validate`.\n * @param createIterator.error - The `validate` condition to throw an error, and its message.\n * @param createIterator.timeout - The function to decide how long to wait between iterations.\n */\nexport function createIterablePromise<TResponse>({\n func,\n validate,\n aggregator,\n error,\n timeout = (): number => 0,\n}: CreateIterablePromise<TResponse>): Promise<TResponse> {\n const retry = (previousResponse?: TResponse | undefined): Promise<TResponse> => {\n return new Promise<TResponse>((resolve, reject) => {\n func(previousResponse)\n .then(async (response) => {\n if (aggregator) {\n await aggregator(response);\n }\n\n if (await validate(response)) {\n return resolve(response);\n }\n\n if (error && (await error.validate(response))) {\n return reject(new Error(await error.message(response)));\n }\n\n return setTimeout(\n () => {\n retry(response).then(resolve).catch(reject);\n },\n await timeout(),\n );\n })\n .catch((err) => {\n reject(err);\n });\n });\n };\n\n return retry();\n}\n","import { createAlgoliaAgent } from './createAlgoliaAgent';\nimport type { AlgoliaAgent, AlgoliaAgentOptions } from './types';\n\nexport type GetAlgoliaAgent = {\n algoliaAgents: AlgoliaAgentOptions[];\n client: string;\n version: string;\n};\n\nexport function getAlgoliaAgent({ algoliaAgents, client, version }: GetAlgoliaAgent): AlgoliaAgent {\n const defaultAlgoliaAgent = createAlgoliaAgent(version).add({\n segment: client,\n version,\n });\n\n algoliaAgents.forEach((algoliaAgent) => defaultAlgoliaAgent.add(algoliaAgent));\n\n return defaultAlgoliaAgent;\n}\n","import type { Logger } from '../types/logger';\n\nexport function createNullLogger(): Logger {\n return {\n debug(_message: string, _args?: any | undefined): Promise<void> {\n return Promise.resolve();\n },\n info(_message: string, _args?: any | undefined): Promise<void> {\n return Promise.resolve();\n },\n error(_message: string, _args?: any | undefined): Promise<void> {\n return Promise.resolve();\n },\n };\n}\n","/**\n * WHATWG-compliant Server-Sent Events parser.\n *\n * Three-layer architecture:\n * 1. iterLines() — byte chunking → line decoding\n * 2. SSEDecoder — line → SSE event decoding\n * 3. iterSSEEvents — top-level composer (exported)\n *\n * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation\n */\n\nconst MAX_LINE_BUFFER_SIZE = 10 * 1024 * 1024; // 10MB\n\n// ─── Types ──────────────────────────────────────────────────────────────────\n\nexport type ServerSentEvent = {\n /** Concatenated data: field values, joined by '\\n'. */\n data: string;\n /** Event type from the event: field. Defaults to \"\" (empty string). */\n event: string;\n /** Last event ID. Persists across dispatches until changed. */\n id: string | null;\n /** Reconnection time in ms. Persists across dispatches until changed. */\n retry: number | null;\n};\n\n/**\n * Wrapper for a parsed SSE event, yielded by the typed `*Stream` methods.\n *\n * - `data` is the JSON-parsed payload when parsing succeeds, `null` otherwise.\n * - `raw` is the original {@link ServerSentEvent} (always present).\n * - `error` is set when JSON parsing of `event.data` failed.\n */\nexport type StreamEvent<T = Record<string, unknown>> = {\n /** Parsed data from the event, or `null` if parsing failed. */\n data: T | null;\n /** The original, unparsed SSE event. */\n raw: ServerSentEvent;\n /** The error that occurred while parsing `event.data`, if any. */\n error?: Error;\n};\n\n// ─── Helpers ────────────────────────────────────────────────────────────────\n\n/**\n * Converts a ReadableStream into an AsyncIterable via getReader().\n * Fallback for environments where ReadableStream lacks Symbol.asyncIterator.\n */\nasync function* readableStreamToAsyncIterable(stream: ReadableStream<Uint8Array>): AsyncGenerator<Uint8Array> {\n const reader = stream.getReader();\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) return;\n yield value;\n }\n } finally {\n reader.releaseLock();\n }\n}\n\n/**\n * Normalizes the input to an AsyncIterable<Uint8Array>.\n * Prefers Symbol.asyncIterator if available; falls back to getReader().\n */\nfunction toAsyncIterable(stream: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n if (Symbol.asyncIterator in stream) {\n return stream as AsyncIterable<Uint8Array>;\n }\n return readableStreamToAsyncIterable(stream as ReadableStream<Uint8Array>);\n}\n\n// ─── Layer 1: Byte stream → Lines ──────────────────────────────────────────\n\n/**\n * Yields individual lines from a byte stream.\n *\n * Handles \\r, \\n, and \\r\\n line endings, including \\r\\n split across chunks.\n * Uses offset tracking within each decoded chunk to avoid O(n²) buffer growth.\n * Strips BOM (U+FEFF) from the very first line.\n * Throws if the internal line buffer exceeds 10MB.\n */\nasync function* iterLines(stream: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>): AsyncGenerator<string> {\n const decoder = new TextDecoder('utf-8');\n const buffer: string[] = [];\n let bufferSize = 0;\n let trailingCR = false;\n let isFirstLine = true;\n\n for await (const chunk of toAsyncIterable(stream)) {\n const text = decoder.decode(chunk, { stream: true });\n let offset = 0;\n\n // Handle \\r\\n split across chunks: if the previous chunk ended with \\r\n // and this one starts with \\n, skip the \\n (it's the second half of \\r\\n)\n if (trailingCR) {\n trailingCR = false;\n if (text.length > 0 && text[0] === '\\n') {\n offset = 1;\n }\n }\n\n while (offset < text.length) {\n const crIdx = text.indexOf('\\r', offset);\n const lfIdx = text.indexOf('\\n', offset);\n\n // No more line endings in this chunk — buffer the rest\n if (crIdx === -1 && lfIdx === -1) {\n const remaining = text.slice(offset);\n buffer.push(remaining);\n bufferSize += remaining.length;\n if (bufferSize > MAX_LINE_BUFFER_SIZE) {\n throw new Error('SSE line buffer exceeded 10MB');\n }\n break;\n }\n\n let endIdx: number;\n let skipLen: number;\n\n if (crIdx !== -1 && (lfIdx === -1 || crIdx < lfIdx)) {\n // \\r found before \\n (or no \\n at all)\n endIdx = crIdx;\n if (crIdx + 1 < text.length) {\n // Peek ahead: \\r\\n or bare \\r\n skipLen = text[crIdx + 1] === '\\n' ? 2 : 1;\n } else {\n // \\r at end of chunk — might be \\r\\n split across chunks\n trailingCR = true;\n skipLen = 1;\n }\n } else {\n // \\n found before \\r (or no \\r at all)\n // Safe: at least one of crIdx/lfIdx is != -1, and we're in the else\n // branch, so lfIdx must be != -1\n endIdx = lfIdx;\n skipLen = 1;\n }\n\n const segment = text.slice(offset, endIdx);\n buffer.push(segment);\n\n let line = buffer.length === 1 ? buffer[0]! : buffer.join('');\n buffer.length = 0;\n bufferSize = 0;\n\n // Strip BOM from the very first line only\n if (isFirstLine) {\n if (line.startsWith('\\uFEFF')) {\n line = line.slice(1);\n }\n isFirstLine = false;\n }\n\n yield line;\n offset = endIdx + skipLen;\n }\n }\n\n // Flush TextDecoder (handles any remaining bytes from multi-byte sequences)\n const remaining = decoder.decode();\n if (remaining) {\n buffer.push(remaining);\n }\n\n // Yield any remaining buffered content as the final line\n if (buffer.length > 0) {\n let line = buffer.join('');\n if (isFirstLine && line.startsWith('\\uFEFF')) {\n line = line.slice(1);\n }\n yield line;\n }\n}\n\n// ─── Layer 2: Lines → SSE Events ──────────────────────────────────────────\n\n/**\n * Stateful SSE event decoder. Feed lines one at a time via decode().\n * Returns a ServerSentEvent on blank lines (dispatch), null otherwise.\n *\n * Per WHATWG spec §9.2.6:\n * - lastEventId persists across dispatches\n * - retry persists across dispatches (global reconnection setting)\n * - eventType resets after every blank line (even when data is empty)\n * - data buffer resets after dispatch\n * - id field containing NULL (\\0) is ignored entirely\n * - retry field must be ASCII digits only\n */\nclass SSEDecoder {\n private data: string[] = [];\n private eventType = '';\n private lastEventId: string | null = null;\n private retry: number | null = null;\n\n decode(line: string): ServerSentEvent | null {\n // Blank line → dispatch event or reset\n if (line === '') {\n return this.dispatch();\n }\n\n // Comment line (starts with ':')\n if (line[0] === ':') {\n return null;\n }\n\n // Parse field:value\n const colonIdx = line.indexOf(':');\n let field: string;\n let value: string;\n\n if (colonIdx === -1) {\n // No colon → field is entire line, value is empty\n field = line;\n value = '';\n } else {\n field = line.slice(0, colonIdx);\n value = line.slice(colonIdx + 1);\n // Strip exactly ONE leading space (if present)\n if (value[0] === ' ') {\n value = value.slice(1);\n }\n }\n\n switch (field) {\n case 'data':\n this.data.push(value);\n break;\n case 'event':\n this.eventType = value;\n break;\n case 'id':\n // Ignore if value contains NULL character (security: WHATWG spec)\n if (!value.includes('\\0')) {\n this.lastEventId = value;\n }\n break;\n case 'retry':\n // Must consist of ASCII digits only (no negatives, no whitespace)\n if (/^[0-9]+$/.test(value)) {\n this.retry = parseInt(value, 10);\n }\n break;\n // Unknown fields: ignore silently\n }\n\n return null;\n }\n\n private dispatch(): ServerSentEvent | null {\n // eventType resets on every blank line per WHATWG spec,\n // regardless of whether we actually dispatch an event\n const currentEventType = this.eventType;\n this.eventType = '';\n\n // Suppress dispatch when no data: lines were received\n if (this.data.length === 0) {\n return null;\n }\n\n const event: ServerSentEvent = {\n data: this.data.join('\\n'),\n event: currentEventType,\n id: this.lastEventId,\n retry: this.retry,\n };\n\n // Reset data buffer; lastEventId and retry persist across dispatches\n this.data = [];\n\n return event;\n }\n}\n\n// ─── Layer 3: Top-level composer ──────────────────────────────────────────\n\n/**\n * Parses a byte stream as WHATWG Server-Sent Events.\n *\n * Accepts both ReadableStream<Uint8Array> (browser fetch) and\n * AsyncIterable<Uint8Array> (Node.js streams / Buffer chunks).\n *\n * @example\n * ```ts\n * const response = await fetch(url);\n * for await (const event of iterSSEEvents(response.body!)) {\n * console.log(event.event, event.data);\n * }\n * ```\n */\nexport async function* iterSSEEvents(\n stream: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>,\n): AsyncGenerator<ServerSentEvent> {\n const decoder = new SSEDecoder();\n for await (const line of iterLines(stream)) {\n const event = decoder.decode(line);\n if (event !== null) {\n yield event;\n }\n }\n}\n","export const COMPRESSION_THRESHOLD = 750;\n","import type { Host, StatefulHost } from '../types';\n\n// By default, API Clients at Algolia have expiration delay of 5 mins.\n// In the JavaScript client, we have 2 mins.\nconst EXPIRATION_DELAY = 2 * 60 * 1000;\n\nexport function createStatefulHost(host: Host, status: StatefulHost['status'] = 'up'): StatefulHost {\n const lastUpdate = Date.now();\n\n function isUp(): boolean {\n return status === 'up' || Date.now() - lastUpdate > EXPIRATION_DELAY;\n }\n\n function isTimedOut(): boolean {\n return status === 'timed out' && Date.now() - lastUpdate <= EXPIRATION_DELAY;\n }\n\n return { ...host, status, lastUpdate, isUp, isTimedOut };\n}\n","import type { Response, StackFrame } from '../types';\n\nexport class AlgoliaError extends Error {\n override name: string = 'AlgoliaError';\n\n constructor(message: string, name: string) {\n super(message);\n\n if (name) {\n this.name = name;\n }\n }\n}\n\nexport class IndexNotFoundError extends AlgoliaError {\n constructor(indexName: string) {\n super(`${indexName} does not exist`, 'IndexNotFoundError');\n }\n}\n\nexport class IndicesInSameAppError extends AlgoliaError {\n constructor() {\n super('Indices are in the same application. Use operationIndex instead.', 'IndicesInSameAppError');\n }\n}\n\nexport class IndexAlreadyExistsError extends AlgoliaError {\n constructor(indexName: string) {\n super(`${indexName} index already exists.`, 'IndexAlreadyExistsError');\n }\n}\n\nexport class ErrorWithStackTrace extends AlgoliaError {\n stackTrace: StackFrame[];\n\n constructor(message: string, stackTrace: StackFrame[], name: string) {\n super(message, name);\n // the array and object should be frozen to reflect the stackTrace at the time of the error\n this.stackTrace = stackTrace;\n }\n}\n\nexport class RetryError extends ErrorWithStackTrace {\n constructor(stackTrace: StackFrame[]) {\n super(\n 'Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support',\n stackTrace,\n 'RetryError',\n );\n }\n}\n\nexport class ApiError extends ErrorWithStackTrace {\n status: number;\n\n constructor(message: string, status: number, stackTrace: StackFrame[], name = 'ApiError') {\n super(message, stackTrace, name);\n this.status = status;\n }\n}\n\nexport class DeserializationError extends AlgoliaError {\n response: Response;\n\n constructor(message: string, response: Response) {\n super(message, 'DeserializationError');\n this.response = response;\n }\n}\n\nexport type DetailedErrorWithMessage = {\n message: string;\n label: string;\n};\n\nexport type DetailedErrorWithTypeID = {\n id: string;\n type: string;\n name?: string | undefined;\n};\n\nexport type DetailedError = {\n code: string;\n details?: DetailedErrorWithMessage[] | DetailedErrorWithTypeID[] | undefined;\n};\n\n// DetailedApiError is only used by the ingestion client to return more informative error, other clients will use ApiClient.\nexport class DetailedApiError extends ApiError {\n error: DetailedError;\n\n constructor(message: string, status: number, error: DetailedError, stackTrace: StackFrame[]) {\n super(message, status, stackTrace, 'DetailedApiError');\n this.error = error;\n }\n}\n","import type { Headers, Host, QueryParameters, Request, RequestOptions, Response, StackFrame } from '../types';\nimport { ApiError, DeserializationError, DetailedApiError } from './errors';\n\nexport function shuffle<TData>(array: TData[]): TData[] {\n const shuffledArray = array;\n\n for (let c = array.length - 1; c > 0; c--) {\n const b = Math.floor(Math.random() * (c + 1));\n const a = array[c];\n\n shuffledArray[c] = array[b];\n shuffledArray[b] = a;\n }\n\n return shuffledArray;\n}\n\nexport function serializeUrl(host: Host, path: string, queryParameters: QueryParameters): string {\n const queryParametersAsString = serializeQueryParameters(queryParameters);\n let url = `${host.protocol}://${host.url}${host.port ? `:${host.port}` : ''}/${\n path.charAt(0) === '/' ? path.substring(1) : path\n }`;\n\n if (queryParametersAsString.length) {\n url += `?${queryParametersAsString}`;\n }\n\n return url;\n}\n\nexport function serializeQueryParameters(parameters: QueryParameters): string {\n return Object.keys(parameters)\n .filter((key) => parameters[key] !== undefined)\n .sort()\n .map(\n (key) =>\n `${key}=${encodeURIComponent(\n Object.prototype.toString.call(parameters[key]) === '[object Array]'\n ? parameters[key].join(',')\n : parameters[key],\n ).replace(/\\+/g, '%20')}`,\n )\n .join('&');\n}\n\nexport function serializeData(request: Request, requestOptions: RequestOptions): string | undefined {\n if (request.method === 'GET' || (request.data === undefined && requestOptions.data === undefined)) {\n return undefined;\n }\n\n const data = Array.isArray(request.data) ? request.data : { ...request.data, ...requestOptions.data };\n\n return JSON.stringify(data);\n}\n\nexport function serializeHeaders(\n baseHeaders: Headers,\n requestHeaders: Headers,\n requestOptionsHeaders?: Headers | undefined,\n): Headers {\n const headers: Headers = {\n Accept: 'application/json',\n ...baseHeaders,\n ...requestHeaders,\n ...requestOptionsHeaders,\n };\n const serializedHeaders: Headers = {};\n\n Object.keys(headers).forEach((header) => {\n const value = headers[header];\n serializedHeaders[header.toLowerCase()] = value;\n });\n\n return serializedHeaders;\n}\n\nexport function deserializeSuccess<TObject>(response: Response): TObject {\n // Handle 204 No Content and other empty responses\n if (response.status === 204 || response.content.length === 0) {\n return undefined as unknown as TObject;\n }\n\n try {\n return JSON.parse(response.content);\n } catch (e) {\n throw new DeserializationError((e as Error).message, response);\n }\n}\n\nexport function deserializeFailure({ content, status }: Response, stackFrame: StackFrame[]): Error {\n try {\n const parsed = JSON.parse(content);\n if ('error' in parsed) {\n return new DetailedApiError(parsed.message, status, parsed.error, stackFrame);\n }\n return new ApiError(parsed.message, status, stackFrame);\n } catch {\n // ..\n }\n return new ApiError(content, status, stackFrame);\n}\n","import type { Response } from '../types';\n\nexport function isNetworkError({ isTimedOut, status }: Omit<Response, 'content'>): boolean {\n return !isTimedOut && ~~status === 0;\n}\n\nexport function isRetryable({ isTimedOut, status }: Omit<Response, 'content'>): boolean {\n return isTimedOut || isNetworkError({ isTimedOut, status }) || (~~(status / 100) !== 2 && ~~(status / 100) !== 4);\n}\n\nexport function isSuccess({ status }: Pick<Response, 'status'>): boolean {\n return ~~(status / 100) === 2;\n}\n","import type { Headers, StackFrame } from '../types';\n\nexport function stackTraceWithoutCredentials(stackTrace: StackFrame[]): StackFrame[] {\n return stackTrace.map((stackFrame) => stackFrameWithoutCredentials(stackFrame));\n}\n\nexport function stackFrameWithoutCredentials(stackFrame: StackFrame): StackFrame {\n const modifiedHeaders: Headers = stackFrame.request.headers['x-algolia-api-key']\n ? { 'x-algolia-api-key': '*****' }\n : {};\n\n return {\n ...stackFrame,\n request: {\n ...stackFrame.request,\n headers: {\n ...stackFrame.request.headers,\n ...modifiedHeaders,\n },\n },\n };\n}\n","import type { ServerSentEvent } from '../sse';\nimport { iterSSEEvents } from '../sse';\nimport type {\n EndRequest,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n Response,\n StackFrame,\n Transporter,\n TransporterOptions,\n} from '../types';\nimport { COMPRESSION_THRESHOLD } from './compress';\nimport { createStatefulHost } from './createStatefulHost';\nimport { RetryError } from './errors';\nimport { deserializeFailure, deserializeSuccess, serializeData, serializeHeaders, serializeUrl } from './helpers';\nimport { isRetryable, isSuccess } from './responses';\nimport { stackFrameWithoutCredentials, stackTraceWithoutCredentials } from './stackTrace';\n\ntype RetryableOptions = {\n hosts: Host[];\n getTimeout: (retryCount: number, timeout: number) => number;\n};\n\nexport function createTransporter({\n hosts,\n hostsCache,\n baseHeaders,\n logger,\n baseQueryParameters,\n algoliaAgent,\n timeouts,\n requester,\n requestsCache,\n responsesCache,\n compress,\n compression,\n}: TransporterOptions): Transporter {\n async function createRetryableOptions(compatibleHosts: Host[]): Promise<RetryableOptions> {\n const statefulHosts = await Promise.all(\n compatibleHosts.map((compatibleHost) => {\n return hostsCache.get(compatibleHost, () => {\n return Promise.resolve(createStatefulHost(compatibleHost));\n });\n }),\n );\n const hostsUp = statefulHosts.filter((host) => host.isUp());\n const hostsTimedOut = statefulHosts.filter((host) => host.isTimedOut());\n\n // Note, we put the hosts that previously timed out on the end of the list.\n const hostsAvailable = [...hostsUp, ...hostsTimedOut];\n const compatibleHostsAvailable = hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts;\n\n return {\n hosts: compatibleHostsAvailable,\n getTimeout(timeoutsCount: number, baseTimeout: number): number {\n /**\n * Imagine that you have 4 hosts, if timeouts will increase\n * on the following way: 1 (timed out) > 4 (timed out) > 5 (200).\n *\n * Note that, the very next request, we start from the previous timeout.\n *\n * 5 (timed out) > 6 (timed out) > 7 ...\n *\n * This strategy may need to be reviewed, but is the strategy on the our\n * current v3 version.\n */\n const timeoutMultiplier =\n hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount;\n\n return timeoutMultiplier * baseTimeout;\n },\n };\n }\n\n async function retryableRequest<TResponse>(\n request: Request,\n requestOptions: RequestOptions,\n isRead: boolean,\n ): Promise<TResponse> {\n const stackTrace: StackFrame[] = [];\n\n /**\n * First we prepare the payload that do not depend from hosts.\n */\n const serializedData = serializeData(request, requestOptions);\n const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);\n\n const wantsCompression =\n compression === 'gzip' &&\n serializedData !== undefined &&\n serializedData.length > COMPRESSION_THRESHOLD &&\n (request.method === 'POST' || request.method === 'PUT');\n\n if (wantsCompression && compress === undefined) {\n logger.info('Compression is disabled because no compress method is available.');\n }\n\n const shouldCompress = wantsCompression && compress !== undefined;\n const data = shouldCompress ? await compress(serializedData) : serializedData;\n if (shouldCompress) {\n headers['content-encoding'] = 'gzip';\n }\n\n // On `GET`, the data is proxied to query parameters.\n const dataQueryParameters: QueryParameters =\n request.method === 'GET'\n ? {\n ...request.data,\n ...requestOptions.data,\n }\n : {};\n\n const queryParameters: QueryParameters = {\n ...baseQueryParameters,\n ...request.queryParameters,\n ...dataQueryParameters,\n };\n\n if (algoliaAgent.value) {\n queryParameters['x-algolia-agent'] = algoliaAgent.value;\n }\n\n if (requestOptions && requestOptions.queryParameters) {\n for (const key of Object.keys(requestOptions.queryParameters)) {\n // We want to keep `undefined` and `null` values,\n // but also avoid stringifying `object`s, as they are\n // handled in the `serializeUrl` step right after.\n if (\n !requestOptions.queryParameters[key] ||\n Object.prototype.toString.call(requestOptions.queryParameters[key]) === '[object Object]'\n ) {\n queryParameters[key] = requestOptions.queryParameters[key];\n } else {\n queryParameters[key] = requestOptions.queryParameters[key].toString();\n }\n }\n }\n\n let timeoutsCount = 0;\n\n const retry = async (\n retryableHosts: Host[],\n getTimeout: (timeoutsCount: number, timeout: number) => number,\n ): Promise<TResponse> => {\n /**\n * We iterate on each host, until there is no host left.\n */\n const host = retryableHosts.pop();\n if (host === undefined) {\n throw new RetryError(stackTraceWithoutCredentials(stackTrace));\n }\n\n const timeout = { ...timeouts, ...requestOptions.timeouts };\n\n const payload: EndRequest = {\n data,\n headers,\n method: request.method,\n url: serializeUrl(host, request.path, queryParameters),\n connectTimeout: getTimeout(timeoutsCount, timeout.connect),\n responseTimeout: getTimeout(timeoutsCount, isRead ? timeout.read : timeout.write),\n };\n\n /**\n * The stackFrame is pushed to the stackTrace so we\n * can have information about onRetry and onFailure\n * decisions.\n */\n const pushToStackTrace = (response: Response): StackFrame => {\n const stackFrame: StackFrame = {\n request: payload,\n response,\n host,\n triesLeft: retryableHosts.length,\n };\n\n stackTrace.push(stackFrame);\n\n return stackFrame;\n };\n\n const response = await requester.send(payload);\n\n if (isRetryable(response)) {\n const stackFrame = pushToStackTrace(response);\n\n // If response is a timeout, we increase the number of timeouts so we can increase the timeout later.\n if (response.isTimedOut) {\n timeoutsCount++;\n }\n /**\n * Failures are individually sent to the logger, allowing\n * the end user to debug / store stack frames even\n * when a retry error does not happen.\n */\n logger.info('Retryable failure', stackFrameWithoutCredentials(stackFrame));\n\n /**\n * We also store the state of the host in failure cases. If the host, is\n * down it will remain down for the next 2 minutes. In a timeout situation,\n * this host will be added end of the list of hosts on the next request.\n */\n await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down'));\n\n return retry(retryableHosts, getTimeout);\n }\n\n if (isSuccess(response)) {\n return deserializeSuccess(response);\n }\n\n pushToStackTrace(response);\n throw deserializeFailure(response, stackTrace);\n };\n\n /**\n * Finally, for each retryable host perform request until we got a non\n * retryable response. Some notes here:\n *\n * 1. The reverse here is applied so we can apply a `pop` later on => more performant.\n * 2. We also get from the retryable options a timeout multiplier that is tailored\n * for the current context.\n */\n const compatibleHosts = hosts.filter(\n (host) => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'),\n );\n const options = await createRetryableOptions(compatibleHosts);\n\n return retry([...options.hosts].reverse(), options.getTimeout);\n }\n\n function createRequest<TResponse>(request: Request, requestOptions: RequestOptions = {}): Promise<TResponse> {\n const createRetryableRequest = (): Promise<TResponse> => {\n /**\n * Then, we prepare a function factory that contains the construction of\n * the retryable request. At this point, we may *not* perform the actual\n * request. But we want to have the function factory ready.\n */\n return retryableRequest<TResponse>(request, requestOptions, isRead);\n };\n\n /**\n * A read request is either a `GET` request, or a request that we make\n * via the `read` transporter (e.g. `search`).\n */\n const isRead = request.useReadTransporter || request.method === 'GET';\n\n /**\n * Once we have the function factory ready, we need to determine of the\n * request is \"cacheable\" - should be cached. Note that, once again,\n * the user can force this option.\n */\n const cacheable = requestOptions.cacheable || request.cacheable;\n\n /**\n * If is not \"cacheable\", we immediately trigger the retryable request, no\n * need to check cache implementations.\n */\n if (cacheable !== true) {\n return createRetryableRequest();\n }\n\n /**\n * If the request is \"cacheable\", we need to first compute the key to ask\n * the cache implementations if this request is on progress or if the\n * response already exists on the cache.\n */\n const key = {\n request,\n requestOptions,\n transporter: {\n queryParameters: baseQueryParameters,\n headers: baseHeaders,\n },\n };\n\n /**\n * With the computed key, we first ask the responses cache\n * implementation if this request was been resolved before.\n */\n return responsesCache.get(\n key,\n () => {\n /**\n * If the request has never resolved before, we actually ask if there\n * is a current request with the same key on progress.\n */\n return requestsCache.get(key, () =>\n /**\n * Finally, if there is no request in progress with the same key,\n * this `createRetryableRequest()` will actually trigger the\n * retryable request.\n */\n requestsCache\n .set(key, createRetryableRequest())\n .then(\n (response) => Promise.all([requestsCache.delete(key), response]),\n (err) => Promise.all([requestsCache.delete(key), Promise.reject(err)]),\n )\n .then(([_, response]) => response),\n );\n },\n {\n /**\n * Of course, once we get this response back from the server, we\n * tell response cache to actually store the received response\n * to be used later.\n */\n miss: (response) => responsesCache.set(key, response),\n },\n );\n }\n\n async function* requestStream(\n request: Request,\n requestOptions: RequestOptions = {},\n ): AsyncGenerator<ServerSentEvent> {\n if (!requester.sendStream) {\n throw new Error('This requester does not support streaming');\n }\n\n const data = serializeData(request, requestOptions);\n const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);\n headers['accept'] = 'text/event-stream';\n\n // On `GET`, the data is proxied to query parameters.\n const dataQueryParameters: QueryParameters =\n request.method === 'GET'\n ? {\n ...request.data,\n ...requestOptions.data,\n }\n : {};\n\n const queryParameters: QueryParameters = {\n ...baseQueryParameters,\n ...request.queryParameters,\n ...dataQueryParameters,\n };\n\n if (algoliaAgent.value) {\n queryParameters['x-algolia-agent'] = algoliaAgent.value;\n }\n\n if (requestOptions && requestOptions.queryParameters) {\n for (const key of Object.keys(requestOptions.queryParameters)) {\n if (\n !requestOptions.queryParameters[key] ||\n Object.prototype.toString.call(requestOptions.queryParameters[key]) === '[object Object]'\n ) {\n queryParameters[key] = requestOptions.queryParameters[key];\n } else {\n queryParameters[key] = requestOptions.queryParameters[key].toString();\n }\n }\n }\n\n const isRead = request.useReadTransporter || request.method === 'GET';\n const compatibleHosts = hosts.filter(\n (host) => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'),\n );\n const options = await createRetryableOptions(compatibleHosts);\n const host = options.hosts[0];\n if (!host) {\n throw new RetryError([]);\n }\n\n const timeout = { ...timeouts, ...requestOptions.timeouts };\n const payload: EndRequest = {\n data,\n headers,\n method: request.method,\n url: serializeUrl(host, request.path, queryParameters),\n connectTimeout: timeout.connect,\n responseTimeout: isRead ? timeout.read : timeout.write,\n };\n\n const stream = await requester.sendStream(payload);\n yield* iterSSEEvents(stream);\n }\n\n return {\n hostsCache,\n requester,\n timeouts,\n logger,\n algoliaAgent,\n baseHeaders,\n baseQueryParameters,\n hosts,\n request: createRequest,\n requestStream,\n requestsCache,\n responsesCache,\n };\n}\n","export const LogLevelEnum: Readonly<Record<string, LogLevelType>> = {\n Debug: 1,\n Info: 2,\n Error: 3,\n};\n\nexport type LogLevelType = 1 | 2 | 3;\n\nexport type Logger = {\n /**\n * Logs debug messages.\n */\n debug: (message: string, args?: any | undefined) => Promise<void>;\n\n /**\n * Logs info messages.\n */\n info: (message: string, args?: any | undefined) => Promise<void>;\n\n /**\n * Logs error messages.\n */\n error: (message: string, args?: any | undefined) => Promise<void>;\n};\n","export function validateRequired(field: string, method: string, value: unknown): void {\n if (value === null || value === undefined || (typeof value === 'string' && value.length === 0)) {\n throw new Error(`Parameter \\`${field}\\` is required when calling \\`${method}\\`.`);\n }\n}\n","import type { EndRequest, Requester, Response } from '@algolia/client-common';\n\ntype Timeout = ReturnType<typeof setTimeout>;\n\nexport function createXhrRequester(): Requester {\n function send(request: EndRequest): Promise<Response> {\n return new Promise((resolve) => {\n const baseRequester = new XMLHttpRequest();\n baseRequester.open(request.method, request.url, true);\n\n Object.keys(request.headers).forEach((key) => baseRequester.setRequestHeader(key, request.headers[key]));\n\n const createTimeout = (timeout: number, content: string): Timeout => {\n return setTimeout(() => {\n baseRequester.abort();\n\n resolve({\n status: 0,\n content,\n isTimedOut: true,\n });\n }, timeout);\n };\n\n const connectTimeout = createTimeout(request.connectTimeout, 'Connection timeout');\n\n let responseTimeout: Timeout | undefined;\n\n baseRequester.onreadystatechange = (): void => {\n if (baseRequester.readyState > baseRequester.OPENED && responseTimeout === undefined) {\n clearTimeout(connectTimeout);\n\n responseTimeout = createTimeout(request.responseTimeout, 'Socket timeout');\n }\n };\n\n baseRequester.onerror = (): void => {\n // istanbul ignore next\n if (baseRequester.status === 0) {\n clearTimeout(connectTimeout);\n clearTimeout(responseTimeout!);\n\n resolve({\n content: baseRequester.responseText || 'Network request failed',\n status: baseRequester.status,\n isTimedOut: false,\n });\n }\n };\n\n baseRequester.onload = (): void => {\n clearTimeout(connectTimeout);\n clearTimeout(responseTimeout!);\n\n resolve({\n content: baseRequester.responseText,\n status: baseRequester.status,\n isTimedOut: false,\n });\n };\n\n baseRequester.send(request.data as XMLHttpRequestBodyInit | null | undefined);\n });\n }\n\n return { send };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n ServerSentEvent,\n StreamEvent,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent, shuffle, validateRequired } from '@algolia/client-common';\n\nimport type { AgentConfigCreate } from '../model/agentConfigCreate';\nimport type { AgentWithVersionResponse } from '../model/agentWithVersionResponse';\nimport type { AllowedDomainListResponse } from '../model/allowedDomainListResponse';\nimport type { AllowedDomainResponse } from '../model/allowedDomainResponse';\nimport type { ApplicationConfigPatch } from '../model/applicationConfigPatch';\nimport type { ApplicationConfigResponse } from '../model/applicationConfigResponse';\nimport type { ConversationFullResponse } from '../model/conversationFullResponse';\nimport type { FeedbackCreationRequest } from '../model/feedbackCreationRequest';\nimport type { FeedbackResponse } from '../model/feedbackResponse';\nimport type { PaginatedAgentsResponse } from '../model/paginatedAgentsResponse';\nimport type { PaginatedConversationsResponse } from '../model/paginatedConversationsResponse';\nimport type { PaginatedProviderAuthenticationsResponse } from '../model/paginatedProviderAuthenticationsResponse';\nimport type { PaginatedSecretKeysResponse } from '../model/paginatedSecretKeysResponse';\nimport type { ProviderAuthenticationCreate } from '../model/providerAuthenticationCreate';\nimport type { ProviderAuthenticationResponse } from '../model/providerAuthenticationResponse';\nimport type { SecretKeyCreate } from '../model/secretKeyCreate';\nimport type { SecretKeyResponse } from '../model/secretKeyResponse';\nimport type { UserDataResponse } from '../model/userDataResponse';\n\nimport type {\n BulkCreateAllowedDomainsProps,\n BulkDeleteAllowedDomainsProps,\n CreateAgentAllowedDomainProps,\n CreateAgentCompletionProps,\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteAgentConversationsProps,\n DeleteAgentProps,\n DeleteAllowedDomainProps,\n DeleteConversationProps,\n DeleteProviderProps,\n DeleteSecretKeyProps,\n DeleteUserDataProps,\n ExportConversationsProps,\n GetAgentProps,\n GetAllowedDomainProps,\n GetConversationProps,\n GetProviderProps,\n GetSecretKeyProps,\n GetUserDataProps,\n InvalidateAgentCacheProps,\n ListAgentAllowedDomainsProps,\n ListAgentConversationsProps,\n ListAgentsProps,\n ListProviderModelsProps,\n ListProvidersProps,\n ListSecretKeysProps,\n PublishAgentProps,\n UnpublishAgentProps,\n UpdateAgentProps,\n UpdateProviderProps,\n UpdateSecretKeyProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '0.1.0-beta.0';\n\nfunction getDefaultHosts(appId: string): Host[] {\n return (\n [\n {\n url: `${appId}-dsn.algolia.net`,\n accept: 'read',\n protocol: 'https',\n },\n {\n url: `${appId}.algolia.net`,\n accept: 'write',\n protocol: 'https',\n },\n ] as Host[]\n ).concat(\n shuffle([\n {\n url: `${appId}-1.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n {\n url: `${appId}-2.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n {\n url: `${appId}-3.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n ]),\n );\n}\n\n/**\n * @beta\n * The Agent Studio API is not yet stable and may change without notice.\n * See {@link https://www.algolia.com/doc/rest-api/agent-studio | Agent Studio API docs}.\n */\nexport function createAgentStudioClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n ...options\n}: CreateClientOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(appIdOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'AgentStudio',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * Add multiple allowed domain patterns. Duplicates are skipped.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param bulkCreateAllowedDomains - The bulkCreateAllowedDomains object.\n * @param bulkCreateAllowedDomains.agentId - The agentId.\n * @param bulkCreateAllowedDomains.allowedDomainBulkInsert - The allowedDomainBulkInsert object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n bulkCreateAllowedDomains(\n { agentId, allowedDomainBulkInsert }: BulkCreateAllowedDomainsProps,\n requestOptions?: RequestOptions,\n ): Promise<AllowedDomainListResponse> {\n validateRequired('agentId', 'bulkCreateAllowedDomains', agentId);\n\n validateRequired('allowedDomainBulkInsert', 'bulkCreateAllowedDomains', allowedDomainBulkInsert);\n\n validateRequired('allowedDomainBulkInsert.domains', 'bulkCreateAllowedDomains', allowedDomainBulkInsert.domains);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/allowed-domains/bulk'.replace(\n '{agentId}',\n encodeURIComponent(agentId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: allowedDomainBulkInsert,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Delete allowed domains by id list.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param bulkDeleteAllowedDomains - The bulkDeleteAllowedDomains object.\n * @param bulkDeleteAllowedDomains.agentId - The agentId.\n * @param bulkDeleteAllowedDomains.allowedDomainBulkDelete - The allowedDomainBulkDelete object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n bulkDeleteAllowedDomains(\n { agentId, allowedDomainBulkDelete }: BulkDeleteAllowedDomainsProps,\n requestOptions?: RequestOptions,\n ): Promise<void> {\n validateRequired('agentId', 'bulkDeleteAllowedDomains', agentId);\n\n validateRequired('allowedDomainBulkDelete', 'bulkDeleteAllowedDomains', allowedDomainBulkDelete);\n\n validateRequired(\n 'allowedDomainBulkDelete.domainIds',\n 'bulkDeleteAllowedDomains',\n allowedDomainBulkDelete.domainIds,\n );\n\n const requestPath = '/agent-studio/1/agents/{agentId}/allowed-domains/bulk'.replace(\n '{agentId}',\n encodeURIComponent(agentId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n data: allowedDomainBulkDelete,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Create a new agent.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param agentConfigCreate - The agentConfigCreate object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n createAgent(\n agentConfigCreate: AgentConfigCreate,\n requestOptions?: RequestOptions,\n ): Promise<AgentWithVersionResponse> {\n validateRequired('agentConfigCreate', 'createAgent', agentConfigCreate);\n\n validateRequired('agentConfigCreate.name', 'createAgent', agentConfigCreate.name);\n validateRequired('agentConfigCreate.instructions', 'createAgent', agentConfigCreate.instructions);\n\n const requestPath = '/agent-studio/1/agents';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: agentConfigCreate,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Add a single allowed domain pattern (e.g. https://app.example.com or *.example.com).\n *\n * Required API Key ACLs:\n * - editSettings\n * @param createAgentAllowedDomain - The createAgentAllowedDomain object.\n * @param createAgentAllowedDomain.agentId - The agentId.\n * @param createAgentAllowedDomain.allowedDomainCreate - The allowedDomainCreate object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n createAgentAllowedDomain(\n { agentId, allowedDomainCreate }: CreateAgentAllowedDomainProps,\n requestOptions?: RequestOptions,\n ): Promise<AllowedDomainResponse> {\n validateRequired('agentId', 'createAgentAllowedDomain', agentId);\n\n validateRequired('allowedDomainCreate', 'createAgentAllowedDomain', allowedDomainCreate);\n\n validateRequired('allowedDomainCreate.domain', 'createAgentAllowedDomain', allowedDomainCreate.domain);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/allowed-domains'.replace(\n '{agentId}',\n encodeURIComponent(agentId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: allowedDomainCreate,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Create a completion for the specified agent. This endpoint handles two types of requests: 1. Normal completion request: User message -> Agent response 2. Tool approval response: User approval -> Execute tool -> Agent response Tool Approval Flow (for MCP tools with requiresApproval: true): - Request 1: User sends message -> Agent requests tool call -> Return approval request - Request 2: User approves -> Execute tool -> Agent continues with result.\n *\n * Required API Key ACLs:\n * - search\n * @param createAgentCompletion - The createAgentCompletion object.\n * @param createAgentCompletion.agentId - The agentId.\n * @param createAgentCompletion.compatibilityMode - Compatibility mode for the completion API.\n * @param createAgentCompletion.agentCompletionRequest - The agentCompletionRequest object.\n * @param createAgentCompletion.stream - Whether to stream the response or not.\n * @param createAgentCompletion.cache - Use cached responses if available.\n * @param createAgentCompletion.memory - Set to false to disable memory (enabled by default).\n * @param createAgentCompletion.analytics - Set to false to skip analytics for this completion (default: true). Disables Agent Studio BigQuery analytics, Algolia search analytics, click analytics, and query-suggestions training. Useful for offline-eval workflows.\n * @param createAgentCompletion.xAlgoliaSecureUserToken - The X-Algolia-Secure-User-Token.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n createAgentCompletion(\n {\n agentId,\n compatibilityMode,\n agentCompletionRequest,\n stream,\n cache,\n memory,\n analytics,\n xAlgoliaSecureUserToken,\n }: CreateAgentCompletionProps,\n requestOptions?: RequestOptions,\n ): Promise<{ [key: string]: any }> {\n validateRequired('agentId', 'createAgentCompletion', agentId);\n\n validateRequired('compatibilityMode', 'createAgentCompletion', compatibilityMode);\n\n validateRequired('agentCompletionRequest', 'createAgentCompletion', agentCompletionRequest);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/completions'.replace(\n '{agentId}',\n encodeURIComponent(agentId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (compatibilityMode !== undefined) {\n queryParameters['compatibilityMode'] = compatibilityMode.toString();\n }\n\n if (stream !== undefined) {\n queryParameters['stream'] = stream.toString();\n }\n\n if (cache !== undefined) {\n queryParameters['cache'] = cache.toString();\n }\n\n if (memory !== undefined) {\n queryParameters['memory'] = memory.toString();\n }\n\n if (analytics !== undefined) {\n queryParameters['analytics'] = analytics.toString();\n }\n\n if (xAlgoliaSecureUserToken !== undefined) {\n headers['X-Algolia-Secure-User-Token'] = xAlgoliaSecureUserToken.toString();\n }\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: agentCompletionRequest,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Create a completion for the specified agent. This endpoint handles two types of requests: 1. Normal completion request: User message -> Agent response 2. Tool approval response: User approval -> Execute tool -> Agent response Tool Approval Flow (for MCP tools with requiresApproval: true): - Request 1: User sends message -> Agent requests tool call -> Return approval request - Request 2: User approves -> Execute tool -> Agent continues with result. (raw streaming version).\n *\n * Yields raw {@link ServerSentEvent} objects. Each event's `data` field contains a JSON-encoded `{ [key: string]: any; }` string.\n *\n * @see createAgentCompletionStream for the parsed variant.\n * @see createAgentCompletion for the non-streaming version.\n */\n createAgentCompletionStreamRaw(\n {\n agentId,\n compatibilityMode,\n agentCompletionRequest,\n stream,\n cache,\n memory,\n analytics,\n xAlgoliaSecureUserToken,\n }: CreateAgentCompletionProps,\n requestOptions?: RequestOptions,\n ): AsyncGenerator<ServerSentEvent> {\n validateRequired('agentId', 'createAgentCompletionStreamRaw', agentId);\n\n validateRequired('compatibilityMode', 'createAgentCompletionStreamRaw', compatibilityMode);\n\n validateRequired('agentCompletionRequest', 'createAgentCompletionStreamRaw', agentCompletionRequest);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/completions'.replace(\n '{agentId}',\n encodeURIComponent(agentId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (compatibilityMode !== undefined) {\n queryParameters['compatibilityMode'] = compatibilityMode.toString();\n }\n\n if (stream !== undefined) {\n queryParameters['stream'] = stream.toString();\n }\n\n if (cache !== undefined) {\n queryParameters['cache'] = cache.toString();\n }\n\n if (memory !== undefined) {\n queryParameters['memory'] = memory.toString();\n }\n\n if (analytics !== undefined) {\n queryParameters['analytics'] = analytics.toString();\n }\n\n if (xAlgoliaSecureUserToken !== undefined) {\n headers['X-Algolia-Secure-User-Token'] = xAlgoliaSecureUserToken.toString();\n }\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: agentCompletionRequest,\n };\n\n return transporter.requestStream(request, requestOptions);\n },\n /**\n * Create a completion for the specified agent. This endpoint handles two types of requests: 1. Normal completion request: User message -> Agent response 2. Tool approval response: User approval -> Execute tool -> Agent response Tool Approval Flow (for MCP tools with requiresApproval: true): - Request 1: User sends message -> Agent requests tool call -> Return approval request - Request 2: User approves -> Execute tool -> Agent continues with result. (streaming version).\n *\n * Yields {@link StreamEvent} objects wrapping parsed `{ [key: string]: any; }` payloads.\n *\n * @see createAgentCompletionStreamRaw for the raw variant.\n * @see createAgentCompletion for the non-streaming version.\n */\n async *createAgentCompletionStream(\n {\n agentId,\n compatibilityMode,\n agentCompletionRequest,\n stream,\n cache,\n memory,\n analytics,\n xAlgoliaSecureUserToken,\n }: CreateAgentCompletionProps,\n requestOptions?: RequestOptions,\n ): AsyncGenerator<StreamEvent<{ [key: string]: any }>> {\n for await (const event of this.createAgentCompletionStreamRaw(\n {\n agentId,\n compatibilityMode,\n agentCompletionRequest,\n stream,\n cache,\n memory,\n analytics,\n xAlgoliaSecureUserToken,\n },\n requestOptions,\n )) {\n try {\n const data = JSON.parse(event.data) as { [key: string]: any };\n yield { data, raw: event };\n } catch (e) {\n yield { data: null, raw: event, error: e as Error };\n }\n }\n },\n\n /**\n * Create new feedback entry.\n *\n * Required API Key ACLs:\n * - search\n * @param feedbackCreationRequest - The feedbackCreationRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n createFeedback(\n feedbackCreationRequest: FeedbackCreationRequest,\n requestOptions?: RequestOptions,\n ): Promise<FeedbackResponse> {\n validateRequired('feedbackCreationRequest', 'createFeedback', feedbackCreationRequest);\n\n validateRequired('feedbackCreationRequest.messageId', 'createFeedback', feedbackCreationRequest.messageId);\n validateRequired('feedbackCreationRequest.agentId', 'createFeedback', feedbackCreationRequest.agentId);\n validateRequired('feedbackCreationRequest.vote', 'createFeedback', feedbackCreationRequest.vote);\n\n const requestPath = '/agent-studio/1/feedback';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: feedbackCreationRequest,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Create Provider.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param providerAuthenticationCreate - The providerAuthenticationCreate object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n createProvider(\n providerAuthenticationCreate: ProviderAuthenticationCreate,\n requestOptions?: RequestOptions,\n ): Promise<ProviderAuthenticationResponse> {\n validateRequired('providerAuthenticationCreate', 'createProvider', providerAuthenticationCreate);\n\n validateRequired('providerAuthenticationCreate.name', 'createProvider', providerAuthenticationCreate.name);\n validateRequired(\n 'providerAuthenticationCreate.providerName',\n 'createProvider',\n providerAuthenticationCreate.providerName,\n );\n validateRequired('providerAuthenticationCreate.input', 'createProvider', providerAuthenticationCreate.input);\n\n const requestPath = '/agent-studio/1/providers';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: providerAuthenticationCreate,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Create Secret Key.\n *\n * Required API Key ACLs:\n * - admin\n * @param secretKeyCreate - The secretKeyCreate object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n createSecretKey(secretKeyCreate: SecretKeyCreate, requestOptions?: RequestOptions): Promise<SecretKeyResponse> {\n validateRequired('secretKeyCreate', 'createSecretKey', secretKeyCreate);\n\n validateRequired('secretKeyCreate.name', 'createSecretKey', secretKeyCreate.name);\n\n const requestPath = '/agent-studio/1/secret-keys';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: secretKeyCreate,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customDelete', path);\n\n const requestPath = '/agent-studio/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n validateRequired('path', 'customGet', path);\n\n const requestPath = '/agent-studio/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPost', path);\n\n const requestPath = '/agent-studio/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPut', path);\n\n const requestPath = '/agent-studio/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Delete the specified agent.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteAgent - The deleteAgent object.\n * @param deleteAgent.agentId - The agentId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteAgent({ agentId }: DeleteAgentProps, requestOptions?: RequestOptions): Promise<void> {\n validateRequired('agentId', 'deleteAgent', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}'.replace('{agentId}', encodeURIComponent(agentId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes the conversations matching the given filers.\n *\n * Required API Key ACLs:\n * - logs\n * @param deleteAgentConversations - The deleteAgentConversations object.\n * @param deleteAgentConversations.agentId - The agentId.\n * @param deleteAgentConversations.startDate - Filter conversations created after this date (format: YYYY-MM-DD).\n * @param deleteAgentConversations.endDate - Filter conversations created before this date (format: YYYY-MM-DD).\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteAgentConversations(\n { agentId, startDate, endDate }: DeleteAgentConversationsProps,\n requestOptions?: RequestOptions,\n ): Promise<void> {\n validateRequired('agentId', 'deleteAgentConversations', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/conversations'.replace(\n '{agentId}',\n encodeURIComponent(agentId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (startDate !== undefined) {\n queryParameters['startDate'] = startDate.toString();\n }\n\n if (endDate !== undefined) {\n queryParameters['endDate'] = endDate.toString();\n }\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Remove an allowed domain by id.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteAllowedDomain - The deleteAllowedDomain object.\n * @param deleteAllowedDomain.domainId - The domainId.\n * @param deleteAllowedDomain.agentId - The agentId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteAllowedDomain(\n { domainId, agentId }: DeleteAllowedDomainProps,\n requestOptions?: RequestOptions,\n ): Promise<void> {\n validateRequired('domainId', 'deleteAllowedDomain', domainId);\n\n validateRequired('agentId', 'deleteAllowedDomain', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/allowed-domains/{domainId}'\n .replace('{domainId}', encodeURIComponent(domainId))\n .replace('{agentId}', encodeURIComponent(agentId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes the conversation with the given ID.\n *\n * Required API Key ACLs:\n * - logs\n * @param deleteConversation - The deleteConversation object.\n * @param deleteConversation.conversationId - The conversationId.\n * @param deleteConversation.agentId - The agentId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteConversation(\n { conversationId, agentId }: DeleteConversationProps,\n requestOptions?: RequestOptions,\n ): Promise<void> {\n validateRequired('conversationId', 'deleteConversation', conversationId);\n\n validateRequired('agentId', 'deleteConversation', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/conversations/{conversationId}'\n .replace('{conversationId}', encodeURIComponent(conversationId))\n .replace('{agentId}', encodeURIComponent(agentId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Delete Provider.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteProvider - The deleteProvider object.\n * @param deleteProvider.providerId - The providerId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteProvider({ providerId }: DeleteProviderProps, requestOptions?: RequestOptions): Promise<void> {\n validateRequired('providerId', 'deleteProvider', providerId);\n\n const requestPath = '/agent-studio/1/providers/{providerId}'.replace(\n '{providerId}',\n encodeURIComponent(providerId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Delete Secret Key.\n *\n * Required API Key ACLs:\n * - admin\n * @param deleteSecretKey - The deleteSecretKey object.\n * @param deleteSecretKey.secretKeyId - The secretKeyId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteSecretKey({ secretKeyId }: DeleteSecretKeyProps, requestOptions?: RequestOptions): Promise<void> {\n validateRequired('secretKeyId', 'deleteSecretKey', secretKeyId);\n\n const requestPath = '/agent-studio/1/secret-keys/{secretKeyId}'.replace(\n '{secretKeyId}',\n encodeURIComponent(secretKeyId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Permanently deletes all messages for the given user token. Does not delete conversations.\n *\n * Required API Key ACLs:\n * - logs\n * @param deleteUserData - The deleteUserData object.\n * @param deleteUserData.userToken - The userToken.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserData({ userToken }: DeleteUserDataProps, requestOptions?: RequestOptions): Promise<void> {\n validateRequired('userToken', 'deleteUserData', userToken);\n\n const requestPath = '/agent-studio/1/user-data/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Exports all conversations based on the passed filters.\n *\n * Required API Key ACLs:\n * - logs\n * @param exportConversations - The exportConversations object.\n * @param exportConversations.agentId - The agentId.\n * @param exportConversations.startDate - Filter conversations created after this date (format: YYYY-MM-DD).\n * @param exportConversations.endDate - Filter conversations created before this date (format: YYYY-MM-DD).\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n exportConversations(\n { agentId, startDate, endDate }: ExportConversationsProps,\n requestOptions?: RequestOptions,\n ): Promise<Array<ConversationFullResponse>> {\n validateRequired('agentId', 'exportConversations', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/conversations/export'.replace(\n '{agentId}',\n encodeURIComponent(agentId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (startDate !== undefined) {\n queryParameters['startDate'] = startDate.toString();\n }\n\n if (endDate !== undefined) {\n queryParameters['endDate'] = endDate.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieve details of the specified agent.\n *\n * Required API Key ACLs:\n * - settings\n * @param getAgent - The getAgent object.\n * @param getAgent.agentId - The agentId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getAgent({ agentId }: GetAgentProps, requestOptions?: RequestOptions): Promise<AgentWithVersionResponse> {\n validateRequired('agentId', 'getAgent', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}'.replace('{agentId}', encodeURIComponent(agentId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Get a single allowed domain by id.\n *\n * Required API Key ACLs:\n * - settings\n * @param getAllowedDomain - The getAllowedDomain object.\n * @param getAllowedDomain.domainId - The domainId.\n * @param getAllowedDomain.agentId - The agentId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getAllowedDomain(\n { domainId, agentId }: GetAllowedDomainProps,\n requestOptions?: RequestOptions,\n ): Promise<AllowedDomainResponse> {\n validateRequired('domainId', 'getAllowedDomain', domainId);\n\n validateRequired('agentId', 'getAllowedDomain', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/allowed-domains/{domainId}'\n .replace('{domainId}', encodeURIComponent(domainId))\n .replace('{agentId}', encodeURIComponent(agentId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Get Configuration.\n *\n * Required API Key ACLs:\n * - logs\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getConfiguration(requestOptions?: RequestOptions | undefined): Promise<ApplicationConfigResponse> {\n const requestPath = '/agent-studio/1/configuration';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the conversation and its messages for the given ID.\n *\n * Required API Key ACLs:\n * - logs\n * @param getConversation - The getConversation object.\n * @param getConversation.conversationId - The conversationId.\n * @param getConversation.agentId - The agentId.\n * @param getConversation.includeFeedback - Include feedback for the conversation.\n * @param getConversation.xAlgoliaSecureUserToken - The X-Algolia-Secure-User-Token.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getConversation(\n { conversationId, agentId, includeFeedback, xAlgoliaSecureUserToken }: GetConversationProps,\n requestOptions?: RequestOptions,\n ): Promise<ConversationFullResponse> {\n validateRequired('conversationId', 'getConversation', conversationId);\n\n validateRequired('agentId', 'getConversation', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/conversations/{conversationId}'\n .replace('{conversationId}', encodeURIComponent(conversationId))\n .replace('{agentId}', encodeURIComponent(agentId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (includeFeedback !== undefined) {\n queryParameters['includeFeedback'] = includeFeedback.toString();\n }\n\n if (xAlgoliaSecureUserToken !== undefined) {\n headers['X-Algolia-Secure-User-Token'] = xAlgoliaSecureUserToken.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Get Provider.\n *\n * Required API Key ACLs:\n * - settings\n * @param getProvider - The getProvider object.\n * @param getProvider.providerId - The providerId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getProvider(\n { providerId }: GetProviderProps,\n requestOptions?: RequestOptions,\n ): Promise<ProviderAuthenticationResponse> {\n validateRequired('providerId', 'getProvider', providerId);\n\n const requestPath = '/agent-studio/1/providers/{providerId}'.replace(\n '{providerId}',\n encodeURIComponent(providerId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Get Secret Key.\n *\n * Required API Key ACLs:\n * - settings\n * @param getSecretKey - The getSecretKey object.\n * @param getSecretKey.secretKeyId - The secretKeyId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getSecretKey({ secretKeyId }: GetSecretKeyProps, requestOptions?: RequestOptions): Promise<SecretKeyResponse> {\n validateRequired('secretKeyId', 'getSecretKey', secretKeyId);\n\n const requestPath = '/agent-studio/1/secret-keys/{secretKeyId}'.replace(\n '{secretKeyId}',\n encodeURIComponent(secretKeyId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves all memories, conversations and their messages for the given user token.\n *\n * Required API Key ACLs:\n * - logs\n * @param getUserData - The getUserData object.\n * @param getUserData.userToken - The userToken.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUserData({ userToken }: GetUserDataProps, requestOptions?: RequestOptions): Promise<UserDataResponse> {\n validateRequired('userToken', 'getUserData', userToken);\n\n const requestPath = '/agent-studio/1/user-data/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Invalidate cached completions for this agent. Filter with `before` (exclusive).\n *\n * Required API Key ACLs:\n * - editSettings\n * @param invalidateAgentCache - The invalidateAgentCache object.\n * @param invalidateAgentCache.agentId - The agentId.\n * @param invalidateAgentCache.before - Delete entries strictly before this date (exclusive, YYYY-MM-DD).\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n invalidateAgentCache(\n { agentId, before }: InvalidateAgentCacheProps,\n requestOptions?: RequestOptions,\n ): Promise<void> {\n validateRequired('agentId', 'invalidateAgentCache', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/cache'.replace('{agentId}', encodeURIComponent(agentId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (before !== undefined) {\n queryParameters['before'] = before.toString();\n }\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * List all allowed domain patterns for this agent.\n *\n * Required API Key ACLs:\n * - settings\n * @param listAgentAllowedDomains - The listAgentAllowedDomains object.\n * @param listAgentAllowedDomains.agentId - The agentId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listAgentAllowedDomains(\n { agentId }: ListAgentAllowedDomainsProps,\n requestOptions?: RequestOptions,\n ): Promise<AllowedDomainListResponse> {\n validateRequired('agentId', 'listAgentAllowedDomains', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/allowed-domains'.replace(\n '{agentId}',\n encodeURIComponent(agentId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the conversations for the given agent ID.\n *\n * Required API Key ACLs:\n * - logs\n * @param listAgentConversations - The listAgentConversations object.\n * @param listAgentConversations.agentId - The agentId.\n * @param listAgentConversations.startDate - Filter conversations created after this date (format: YYYY-MM-DD).\n * @param listAgentConversations.endDate - Filter conversations created before this date (format: YYYY-MM-DD).\n * @param listAgentConversations.includeFeedback - Include feedback per conversation.\n * @param listAgentConversations.feedbackVote - Filter by feedback value (requires includeFeedback=true).\n * @param listAgentConversations.page - Page number.\n * @param listAgentConversations.limit - Items per page.\n * @param listAgentConversations.xAlgoliaSecureUserToken - The X-Algolia-Secure-User-Token.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listAgentConversations(\n {\n agentId,\n startDate,\n endDate,\n includeFeedback,\n feedbackVote,\n page,\n limit,\n xAlgoliaSecureUserToken,\n }: ListAgentConversationsProps,\n requestOptions?: RequestOptions,\n ): Promise<PaginatedConversationsResponse> {\n validateRequired('agentId', 'listAgentConversations', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/conversations'.replace(\n '{agentId}',\n encodeURIComponent(agentId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (startDate !== undefined) {\n queryParameters['startDate'] = startDate.toString();\n }\n\n if (endDate !== undefined) {\n queryParameters['endDate'] = endDate.toString();\n }\n\n if (includeFeedback !== undefined) {\n queryParameters['includeFeedback'] = includeFeedback.toString();\n }\n\n if (feedbackVote !== undefined) {\n queryParameters['feedbackVote'] = feedbackVote.toString();\n }\n\n if (page !== undefined) {\n queryParameters['page'] = page.toString();\n }\n\n if (limit !== undefined) {\n queryParameters['limit'] = limit.toString();\n }\n\n if (xAlgoliaSecureUserToken !== undefined) {\n headers['X-Algolia-Secure-User-Token'] = xAlgoliaSecureUserToken.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * List all agents with pagination and filtering.\n *\n * Required API Key ACLs:\n * - settings\n * @param listAgents - The listAgents object.\n * @param listAgents.page - Page number.\n * @param listAgents.limit - Items per page.\n * @param listAgents.providerId - Filter by provider id.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listAgents(\n { page, limit, providerId }: ListAgentsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<PaginatedAgentsResponse> {\n const requestPath = '/agent-studio/1/agents';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (page !== undefined) {\n queryParameters['page'] = page.toString();\n }\n\n if (limit !== undefined) {\n queryParameters['limit'] = limit.toString();\n }\n\n if (providerId !== undefined) {\n queryParameters['providerId'] = providerId.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Get Provider Models.\n *\n * Required API Key ACLs:\n * - settings\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listModels(requestOptions?: RequestOptions | undefined): Promise<{ [key: string]: Array<string> }> {\n const requestPath = '/agent-studio/1/providers/models';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Get available models for a specific provider.\n *\n * Required API Key ACLs:\n * - settings\n * @param listProviderModels - The listProviderModels object.\n * @param listProviderModels.providerId - The providerId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listProviderModels(\n { providerId }: ListProviderModelsProps,\n requestOptions?: RequestOptions,\n ): Promise<Array<string>> {\n validateRequired('providerId', 'listProviderModels', providerId);\n\n const requestPath = '/agent-studio/1/providers/{providerId}/models'.replace(\n '{providerId}',\n encodeURIComponent(providerId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * List Providers.\n *\n * Required API Key ACLs:\n * - settings\n * @param listProviders - The listProviders object.\n * @param listProviders.page - Page number.\n * @param listProviders.limit - Items per page.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listProviders(\n { page, limit }: ListProvidersProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<PaginatedProviderAuthenticationsResponse> {\n const requestPath = '/agent-studio/1/providers';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (page !== undefined) {\n queryParameters['page'] = page.toString();\n }\n\n if (limit !== undefined) {\n queryParameters['limit'] = limit.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * List Secret Keys.\n *\n * Required API Key ACLs:\n * - settings\n * @param listSecretKeys - The listSecretKeys object.\n * @param listSecretKeys.page - Page number.\n * @param listSecretKeys.limit - Items per page.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listSecretKeys(\n { page, limit }: ListSecretKeysProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<PaginatedSecretKeysResponse> {\n const requestPath = '/agent-studio/1/secret-keys';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (page !== undefined) {\n queryParameters['page'] = page.toString();\n }\n\n if (limit !== undefined) {\n queryParameters['limit'] = limit.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Publish the specified agent.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param publishAgent - The publishAgent object.\n * @param publishAgent.agentId - The agentId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n publishAgent({ agentId }: PublishAgentProps, requestOptions?: RequestOptions): Promise<AgentWithVersionResponse> {\n validateRequired('agentId', 'publishAgent', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/publish'.replace('{agentId}', encodeURIComponent(agentId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Unpublish the specified agent.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param unpublishAgent - The unpublishAgent object.\n * @param unpublishAgent.agentId - The agentId.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n unpublishAgent(\n { agentId }: UnpublishAgentProps,\n requestOptions?: RequestOptions,\n ): Promise<AgentWithVersionResponse> {\n validateRequired('agentId', 'unpublishAgent', agentId);\n\n const requestPath = '/agent-studio/1/agents/{agentId}/unpublish'.replace(\n '{agentId}',\n encodeURIComponent(agentId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Update the specified agent.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param updateAgent - The updateAgent object.\n * @param updateAgent.agentId - The agentId.\n * @param updateAgent.agentConfigUpdate - The agentConfigUpdate object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n updateAgent(\n { agentId, agentConfigUpdate }: UpdateAgentProps,\n requestOptions?: RequestOptions,\n ): Promise<AgentWithVersionResponse> {\n validateRequired('agentId', 'updateAgent', agentId);\n\n validateRequired('agentConfigUpdate', 'updateAgent', agentConfigUpdate);\n\n const requestPath = '/agent-studio/1/agents/{agentId}'.replace('{agentId}', encodeURIComponent(agentId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'PATCH',\n path: requestPath,\n queryParameters,\n headers,\n data: agentConfigUpdate,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Patch Configuration.\n *\n * Required API Key ACLs:\n * - logs\n * @param applicationConfigPatch - The applicationConfigPatch object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n updateConfiguration(\n applicationConfigPatch: ApplicationConfigPatch,\n requestOptions?: RequestOptions,\n ): Promise<ApplicationConfigResponse> {\n validateRequired('applicationConfigPatch', 'updateConfiguration', applicationConfigPatch);\n\n const requestPath = '/agent-studio/1/configuration';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'PATCH',\n path: requestPath,\n queryParameters,\n headers,\n data: applicationConfigPatch,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Update Provider.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param updateProvider - The updateProvider object.\n * @param updateProvider.providerId - The providerId.\n * @param updateProvider.providerAuthenticationPatch - The providerAuthenticationPatch object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n updateProvider(\n { providerId, providerAuthenticationPatch }: UpdateProviderProps,\n requestOptions?: RequestOptions,\n ): Promise<ProviderAuthenticationResponse> {\n validateRequired('providerId', 'updateProvider', providerId);\n\n validateRequired('providerAuthenticationPatch', 'updateProvider', providerAuthenticationPatch);\n\n const requestPath = '/agent-studio/1/providers/{providerId}'.replace(\n '{providerId}',\n encodeURIComponent(providerId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'PATCH',\n path: requestPath,\n queryParameters,\n headers,\n data: providerAuthenticationPatch,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Patch Secret Key.\n *\n * Required API Key ACLs:\n * - admin\n * @param updateSecretKey - The updateSecretKey object.\n * @param updateSecretKey.secretKeyId - The secretKeyId.\n * @param updateSecretKey.secretKeyPatch - The secretKeyPatch object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n updateSecretKey(\n { secretKeyId, secretKeyPatch }: UpdateSecretKeyProps,\n requestOptions?: RequestOptions,\n ): Promise<SecretKeyResponse> {\n validateRequired('secretKeyId', 'updateSecretKey', secretKeyId);\n\n validateRequired('secretKeyPatch', 'updateSecretKey', secretKeyPatch);\n\n const requestPath = '/agent-studio/1/secret-keys/{secretKeyId}'.replace(\n '{secretKeyId}',\n encodeURIComponent(secretKeyId),\n );\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'PATCH',\n path: requestPath,\n queryParameters,\n headers,\n data: secretKeyPatch,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createAgentStudioClient } from '../src/agentStudioClient';\n\nexport { apiClientVersion } from '../src/agentStudioClient';\n\nexport * from '../model';\n\nexport function agentStudioClient(\n appId: string,\n apiKey: string,\n options?: ClientOptions | undefined,\n): AgentStudioClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n const { compression: _compression, ...browserOptions } = options || {};\n\n return createAgentStudioClient({\n appId,\n apiKey,\n timeouts: {\n connect: 25000,\n read: 25000,\n write: 25000,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...browserOptions,\n });\n}\n\nexport type AgentStudioClient = ReturnType<typeof createAgentStudioClient>;\n"],"mappings":"AAEO,SAASA,EAA+BC,EAA4C,CACzF,IAAIC,EAEEC,EAAe,qBAAqBF,EAAQ,GAAG,GAErD,SAASG,GAAsB,CAC7B,OAAIF,IAAY,SACdA,EAAUD,EAAQ,cAAgB,OAAO,cAGpCC,CACT,CAEA,SAASG,GAA+C,CACtD,OAAO,KAAK,MAAMD,EAAW,EAAE,QAAQD,CAAY,GAAK,IAAI,CAC9D,CAEA,SAASG,EAAaC,EAAsC,CAC1DH,EAAW,EAAE,QAAQD,EAAc,KAAK,UAAUI,CAAS,CAAC,CAC9D,CAEA,SAASC,GAA6B,CACpC,OAAO,IAAI,QAASC,GAAY,WAAWA,EAAS,CAAC,CAAC,CACxD,CAEA,SAASC,GAGP,CACA,IAAMC,EAAaV,EAAQ,WAAaA,EAAQ,WAAa,IAAO,KAC9DM,EAAYF,EAA2C,EACvDO,EAAc,IAAI,KAAK,EAAE,QAAQ,EACnCC,EAAU,GAsBd,MAAO,CAAE,UApBQ,OAAO,YACtB,OAAO,QAAQN,CAAS,EAAE,OAAO,CAAC,CAAC,CAAEO,CAAS,IACxC,CAACA,GAAaA,EAAU,YAAc,QAKrCH,GAIDG,EAAU,UAAYH,EAAaC,GARrCC,EAAU,GACH,IAIA,EASV,CACH,EAE8B,QAAAA,CAAQ,CACxC,CAEA,MAAO,CACL,IACEE,EACAC,EACAC,EAA8B,CAC5B,KAAM,IAAM,QAAQ,QAAQ,CAC9B,EACiB,CACjB,OAAOT,EAAY,EAAE,KAAK,IAAM,CAC9B,GAAM,CAAE,UAAAD,EAAW,QAAAM,CAAQ,EAAIH,EAAqB,EAC9CQ,EAAaX,EA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B,CAC5BC,EAAiB,cAAe,kBAAmB4B,CAAW,EAE9D5B,EAAiB,iBAAkB,kBAAmBsC,CAAc,EASpE,IAAMrC,EAAmB,CACvB,OAAQ,QACR,KATkB,4CAA4C,QAC9D,gBACA,mBAAmB2B,CAAW,CAChC,EAOE,gBALuC,CAAC,EAMxC,QAPuB,CAAC,EAQxB,KAAMU,CACR,EAEA,OAAO/C,EAAY,QAAQU,EAASF,CAAc,CACpD,CACF,CACF,CC5pDO,SAASwC,GACdC,EACAC,EACAC,EACmB,CACnB,GAAI,CAACF,GAAS,OAAOA,GAAU,SAC7B,MAAM,IAAI,MAAM,qBAAqB,EAGvC,GAAI,CAACC,GAAU,OAAOA,GAAW,SAC/B,MAAM,IAAI,MAAM,sBAAsB,EAGxC,GAAM,CAAE,YAAaE,EAAc,GAAGC,CAAe,EAAIF,GAAW,CAAC,EAErE,OAAOG,GAAwB,CAC7B,MAAAL,EACA,OAAAC,EACA,SAAU,CACR,QAAS,KACT,KAAM,KACN,MAAO,IACT,EACA,OAAQK,GAAiB,EACzB,UAAWC,GAAmB,EAC9B,cAAe,CAAC,CAAE,QAAS,SAAU,CAAC,EACtC,SAAU,wBACV,eAAgBC,EAAkB,EAClC,cAAeA,EAAkB,CAAE,aAAc,EAAM,CAAC,EACxD,WAAYC,EAAwB,CAClC,OAAQ,CAACC,EAA+B,CAAE,IAAK,GAAGC,CAAgB,IAAIX,CAAK,EAAG,CAAC,EAAGQ,EAAkB,CAAC,CACvG,CAAC,EACD,GAAGJ,CACL,CAAC,CACH","names":["createBrowserLocalStorageCache","options","storage","namespaceKey","getStorage","getNamespace","setNamespace","namespace","yieldToMain","resolve","getFilteredNamespace","timeToLive","currentTime","changed","cacheItem","key","defaultValue","events","cachedItem","value","createNullCache","_key","result","createFallbackableCache","caches","current","createMemoryCache","cache","keyAsString","promise","createAlgoliaAgent","version","algoliaAgent","options","addedAlgoliaAgent","createAuth","appId","apiKey","authMode","credentials","getAlgoliaAgent","algoliaAgents","client","version","defaultAlgoliaAgent","createAlgoliaAgent","algoliaAgent","createNullLogger","_message","_args","MAX_LINE_BUFFER_SIZE","readableStreamToAsyncIterable","stream","reader","done","value","toAsyncIterable","iterLines","decoder","buffer","bufferSize","trailingCR","isFirstLine","chunk","text","offset","crIdx","lfIdx","remaining","endIdx","skipLen","segment","line","SSEDecoder","colonIdx","field","currentEventType","event","iterSSEEvents","COMPRESSION_THRESHOLD","EXPIRATION_DELAY","createStatefulHost","host","status","lastUpdate","isUp","isTimedOut","AlgoliaError","message","name","ErrorWithStackTrace","AlgoliaError","message","stackTrace","name","RetryError","ApiError","status","DeserializationError","response","DetailedApiError","error","shuffle","array","shuffledArray","c","b","a","serializeUrl","host","path","queryParameters","queryParametersAsString","serializeQueryParameters","url","parameters","key","serializeData","request","requestOptions","data","serializeHeaders","baseHeaders","requestHeaders","requestOptionsHeaders","headers","serializedHeaders","header","value","deserializeSuccess","e","deserializeFailure","content","stackFrame","parsed","isNetworkError","isTimedOut","isRetryable","isSuccess","stackTraceWithoutCredentials","stackFrameWithoutCredentials","modifiedHeaders","createTransporter","hosts","hostsCache","logger","baseQueryParameters","algoliaAgent","timeouts","requester","requestsCache","responsesCache","compress","compression","createRetryableOptions","compatibleHosts","statefulHosts","compatibleHost","createStatefulHost","hostsUp","hostsTimedOut","hostsAvailable","timeoutsCount","baseTimeout","retryableRequest","isRead","serializedData","wantsCompression","COMPRESSION_THRESHOLD","shouldCompress","dataQueryParameters","retry","retryableHosts","getTimeout","timeout","payload","pushToStackTrace","options","createRequest","createRetryableRequest","err","_","requestStream","stream","iterSSEEvents","validateRequired","field","method","value","createXhrRequester","send","request","resolve","baseRequester","key","createTimeout","timeout","content","connectTimeout","responseTimeout","apiClientVersion","getDefaultHosts","appId","shuffle","createAgentStudioClient","appIdOption","apiKeyOption","authMode","algoliaAgents","options","auth","createAuth","transporter","createTransporter","getAlgoliaAgent","segment","version","apiKey","agentId","allowedDomainBulkInsert","requestOptions","validateRequired","request","allowedDomainBulkDelete","agentConfigCreate","allowedDomainCreate","compatibilityMode","agentCompletionRequest","stream","cache","memory","analytics","xAlgoliaSecureUserToken","requestPath","headers","queryParameters","event","e","feedbackCreationRequest","providerAuthenticationCreate","secretKeyCreate","path","parameters","body","startDate","endDate","domainId","conversationId","providerId","secretKeyId","userToken","includeFeedback","before","feedbackVote","page","limit","agentConfigUpdate","applicationConfigPatch","providerAuthenticationPatch","secretKeyPatch","agentStudioClient","appId","apiKey","options","_compression","browserOptions","createAgentStudioClient","createNullLogger","m","createMemoryCache","createFallbackableCache","createBrowserLocalStorageCache","apiClientVersion"]}
@@ -0,0 +1,16 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@algolia/agent-studio"] = {}));
5
+ })(this, (function (exports) { 'use strict';
6
+
7
+ function X(r){let o,n=`algolia-client-js-${r.key}`;function a(){return o===void 0&&(o=r.localStorage||window.localStorage),o}function l(){return JSON.parse(a().getItem(n)||"{}")}function q(t){a().setItem(n,JSON.stringify(t));}function c(){return new Promise(t=>setTimeout(t,0))}function e(){let t=r.timeToLive?r.timeToLive*1e3:null,s=l(),u=new Date().getTime(),d=false;return {namespace:Object.fromEntries(Object.entries(s).filter(([,m])=>!m||m.timestamp===void 0||t&&m.timestamp+t<u?(d=true,false):true)),changed:d}}return {get(t,s,u={miss:()=>Promise.resolve()}){return c().then(()=>{let{namespace:d,changed:i}=e(),m=d[JSON.stringify(t)];return i&&q(d),m?m.value:s().then(g=>u.miss(g).then(()=>g))})},set(t,s){return c().then(()=>{let u=l();return u[JSON.stringify(t)]={timestamp:new Date().getTime(),value:s},a().setItem(n,JSON.stringify(u)),s})},delete(t){return c().then(()=>{let s=l();delete s[JSON.stringify(t)],a().setItem(n,JSON.stringify(s));})},clear(){return Promise.resolve().then(()=>{a().removeItem(n);})}}}function ue(){return {get(r,o,n={miss:()=>Promise.resolve()}){return o().then(l=>Promise.all([l,n.miss(l)])).then(([l])=>l)},set(r,o){return Promise.resolve(o)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function w(r){let o=[...r.caches],n=o.shift();return n===void 0?ue():{get(a,l,q={miss:()=>Promise.resolve()}){return n.get(a,l,q).catch(()=>w({caches:o}).get(a,l,q))},set(a,l){return n.set(a,l).catch(()=>w({caches:o}).set(a,l))},delete(a){return n.delete(a).catch(()=>w({caches:o}).delete(a))},clear(){return n.clear().catch(()=>w({caches:o}).clear())}}}function U(r={serializable:true}){let o={};return {get(n,a,l={miss:()=>Promise.resolve()}){let q=JSON.stringify(n);if(q in o)return Promise.resolve(r.serializable?JSON.parse(o[q]):o[q]);let c=a();return c.then(e=>l.miss(e)).then(()=>c)},set(n,a){return o[JSON.stringify(n)]=r.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(n){return delete o[JSON.stringify(n)],Promise.resolve()},clear(){return o={},Promise.resolve()}}}function de(r){let o={value:`Algolia for JavaScript (${r})`,add(n){let a=`; ${n.segment}${n.version!==void 0?` (${n.version})`:""}`;return o.value.indexOf(a)===-1&&(o.value=`${o.value}${a}`),o}};return o}function Y(r,o,n="WithinHeaders"){let a={"x-algolia-api-key":o,"x-algolia-application-id":r};return {headers(){return n==="WithinHeaders"?a:{}},queryParameters(){return n==="WithinQueryParameters"?a:{}}}}function Z({algoliaAgents:r,client:o,version:n}){let a=de(n).add({segment:o,version:n});return r.forEach(l=>a.add(l)),a}function ee(){return {debug(r,o){return Promise.resolve()},info(r,o){return Promise.resolve()},error(r,o){return Promise.resolve()}}}var ce=10*1024*1024;async function*me(r){let o=r.getReader();try{for(;;){let{done:n,value:a}=await o.read();if(n)return;yield a;}}finally{o.releaseLock();}}function pe(r){return Symbol.asyncIterator in r?r:me(r)}async function*le(r){let o=new TextDecoder("utf-8"),n=[],a=0,l=false,q=true;for await(let e of pe(r)){let t=o.decode(e,{stream:true}),s=0;for(l&&(l=false,t.length>0&&t[0]===`
8
+ `&&(s=1));s<t.length;){let u=t.indexOf("\r",s),d=t.indexOf(`
9
+ `,s);if(u===-1&&d===-1){let P=t.slice(s);if(n.push(P),a+=P.length,a>ce)throw new Error("SSE line buffer exceeded 10MB");break}let i,m;u!==-1&&(d===-1||u<d)?(i=u,u+1<t.length?m=t[u+1]===`
10
+ `?2:1:(l=true,m=1)):(i=d,m=1);let g=t.slice(s,i);n.push(g);let v=n.length===1?n[0]:n.join("");n.length=0,a=0,q&&(v.startsWith("\uFEFF")&&(v=v.slice(1)),q=false),yield v,s=i+m;}}let c=o.decode();if(c&&n.push(c),n.length>0){let e=n.join("");q&&e.startsWith("\uFEFF")&&(e=e.slice(1)),yield e;}}var he=class{data=[];eventType="";lastEventId=null;retry=null;decode(r){if(r==="")return this.dispatch();if(r[0]===":")return null;let o=r.indexOf(":"),n,a;switch(o===-1?(n=r,a=""):(n=r.slice(0,o),a=r.slice(o+1),a[0]===" "&&(a=a.slice(1))),n){case "data":this.data.push(a);break;case "event":this.eventType=a;break;case "id":a.includes("\0")||(this.lastEventId=a);break;case "retry":/^[0-9]+$/.test(a)&&(this.retry=parseInt(a,10));break}return null}dispatch(){let r=this.eventType;if(this.eventType="",this.data.length===0)return null;let o={data:this.data.join(`
11
+ `),event:r,id:this.lastEventId,retry:this.retry};return this.data=[],o}};async function*Pe(r){let o=new he;for await(let n of le(r)){let a=o.decode(n);a!==null&&(yield a);}}var fe=750,j=120*1e3;function M(r,o="up"){let n=Date.now();function a(){return o==="up"||Date.now()-n>j}function l(){return o==="timed out"&&Date.now()-n<=j}return {...r,status:o,lastUpdate:n,isUp:a,isTimedOut:l}}var te=class extends Error{name="AlgoliaError";constructor(r,o){super(r),o&&(this.name=o);}};var re=class extends te{stackTrace;constructor(r,o,n){super(r,n),this.stackTrace=o;}},z=class extends re{constructor(r){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",r,"RetryError");}},K=class extends re{status;constructor(r,o,n,a="ApiError"){super(r,n,a),this.status=o;}},ge=class extends te{response;constructor(r,o){super(r,"DeserializationError"),this.response=o;}},qe=class extends K{error;constructor(r,o,n,a){super(r,o,a,"DetailedApiError"),this.error=n;}};function oe(r){let o=r;for(let n=r.length-1;n>0;n--){let a=Math.floor(Math.random()*(n+1)),l=r[n];o[n]=r[a],o[a]=l;}return o}function J(r,o,n){let a=ye(n),l=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${o.charAt(0)==="/"?o.substring(1):o}`;return a.length&&(l+=`?${a}`),l}function ye(r){return Object.keys(r).filter(o=>r[o]!==void 0).sort().map(o=>`${o}=${encodeURIComponent(Object.prototype.toString.call(r[o])==="[object Array]"?r[o].join(","):r[o]).replace(/\+/g,"%20")}`).join("&")}function B(r,o){if(r.method==="GET"||r.data===void 0&&o.data===void 0)return;let n=Array.isArray(r.data)?r.data:{...r.data,...o.data};return JSON.stringify(n)}function V(r,o,n){let a={Accept:"application/json",...r,...o,...n},l={};return Object.keys(a).forEach(q=>{let c=a[q];l[q.toLowerCase()]=c;}),l}function Re(r){if(!(r.status===204||r.content.length===0))try{return JSON.parse(r.content)}catch(o){throw new ge(o.message,r)}}function ve({content:r,status:o},n){try{let a=JSON.parse(r);return "error"in a?new qe(a.message,o,a.error,n):new K(a.message,o,n)}catch{}return new K(r,o,n)}function Ae({isTimedOut:r,status:o}){return !r&&~~o===0}function xe({isTimedOut:r,status:o}){return r||Ae({isTimedOut:r,status:o})||~~(o/100)!==2&&~~(o/100)!==4}function Ce({status:r}){return ~~(r/100)===2}function Se(r){return r.map(o=>se(o))}function se(r){let o=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...r,request:{...r.request,headers:{...r.request.headers,...o}}}}function ne({hosts:r,hostsCache:o,baseHeaders:n,logger:a,baseQueryParameters:l,algoliaAgent:q,timeouts:c,requester:e,requestsCache:t,responsesCache:s,compress:u,compression:d}){async function i(P){let h=await Promise.all(P.map(y=>o.get(y,()=>Promise.resolve(M(y))))),f=h.filter(y=>y.isUp()),R=h.filter(y=>y.isTimedOut()),S=[...f,...R];return {hosts:S.length>0?S:P,getTimeout(y,I){return (R.length===0&&y===0?1:R.length+3+y)*I}}}async function m(P,h,f){let R=[],S=B(P,h),A=V(n,P.headers,h.headers),y=d==="gzip"&&S!==void 0&&S.length>fe&&(P.method==="POST"||P.method==="PUT");y&&u===void 0&&a.info("Compression is disabled because no compress method is available.");let I=y&&u!==void 0,L=I?await u(S):S;I&&(A["content-encoding"]="gzip");let b=P.method==="GET"?{...P.data,...h.data}:{},E={...l,...P.queryParameters,...b};if(q.value&&(E["x-algolia-agent"]=q.value),h&&h.queryParameters)for(let x of Object.keys(h.queryParameters))!h.queryParameters[x]||Object.prototype.toString.call(h.queryParameters[x])==="[object Object]"?E[x]=h.queryParameters[x]:E[x]=h.queryParameters[x].toString();let D=0,k=async(x,Q)=>{let O=x.pop();if(O===void 0)throw new z(Se(R));let G={...c,...h.timeouts},F={data:L,headers:A,method:P.method,url:J(O,P.path,E),connectTimeout:Q(D,G.connect),responseTimeout:Q(D,f?G.read:G.write)},W=N=>{let $={request:F,response:N,host:O,triesLeft:x.length};return R.push($),$},T=await e.send(F);if(xe(T)){let N=W(T);return T.isTimedOut&&D++,a.info("Retryable failure",se(N)),await o.set(O,M(O,T.isTimedOut?"timed out":"down")),k(x,Q)}if(Ce(T))return Re(T);throw W(T),ve(T,R)},C=r.filter(x=>x.accept==="readWrite"||(f?x.accept==="read":x.accept==="write")),_=await i(C);return k([..._.hosts].reverse(),_.getTimeout)}function g(P,h={}){let f=()=>m(P,h,R),R=P.useReadTransporter||P.method==="GET";if((h.cacheable||P.cacheable)!==true)return f();let A={request:P,requestOptions:h,transporter:{queryParameters:l,headers:n}};return s.get(A,()=>t.get(A,()=>t.set(A,f()).then(y=>Promise.all([t.delete(A),y]),y=>Promise.all([t.delete(A),Promise.reject(y)])).then(([y,I])=>I)),{miss:y=>s.set(A,y)})}async function*v(P,h={}){if(!e.sendStream)throw new Error("This requester does not support streaming");let f=B(P,h),R=V(n,P.headers,h.headers);R.accept="text/event-stream";let S=P.method==="GET"?{...P.data,...h.data}:{},A={...l,...P.queryParameters,...S};if(q.value&&(A["x-algolia-agent"]=q.value),h&&h.queryParameters)for(let C of Object.keys(h.queryParameters))!h.queryParameters[C]||Object.prototype.toString.call(h.queryParameters[C])==="[object Object]"?A[C]=h.queryParameters[C]:A[C]=h.queryParameters[C].toString();let y=P.useReadTransporter||P.method==="GET",I=r.filter(C=>C.accept==="readWrite"||(y?C.accept==="read":C.accept==="write")),b=(await i(I)).hosts[0];if(!b)throw new z([]);let E={...c,...h.timeouts},D={data:f,headers:R,method:P.method,url:J(b,P.path,A),connectTimeout:E.connect,responseTimeout:y?E.read:E.write},k=await e.sendStream(D);yield*Pe(k);}return {hostsCache:o,requester:e,timeouts:c,logger:a,algoliaAgent:q,baseHeaders:n,baseQueryParameters:l,hosts:r,request:g,requestStream:v,requestsCache:t,responsesCache:s}}function p(r,o,n){if(n==null||typeof n=="string"&&n.length===0)throw new Error(`Parameter \`${r}\` is required when calling \`${o}\`.`)}function ae(){function r(o){return new Promise(n=>{let a=new XMLHttpRequest;a.open(o.method,o.url,true),Object.keys(o.headers).forEach(e=>a.setRequestHeader(e,o.headers[e]));let l=(e,t)=>setTimeout(()=>{a.abort(),n({status:0,content:t,isTimedOut:true});},e),q=l(o.connectTimeout,"Connection timeout"),c;a.onreadystatechange=()=>{a.readyState>a.OPENED&&c===void 0&&(clearTimeout(q),c=l(o.responseTimeout,"Socket timeout"));},a.onerror=()=>{a.status===0&&(clearTimeout(q),clearTimeout(c),n({content:a.responseText||"Network request failed",status:a.status,isTimedOut:false}));},a.onload=()=>{clearTimeout(q),clearTimeout(c),n({content:a.responseText,status:a.status,isTimedOut:false});},a.send(o.data);})}return {send:r}}var H="0.1.0-beta.0";function Ie(r){return [{url:`${r}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${r}.algolia.net`,accept:"write",protocol:"https"}].concat(oe([{url:`${r}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${r}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${r}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function ie({appId:r,apiKey:o,authMode:n,algoliaAgents:a,...l}){let q=Y(r,o,n),c=ne({hosts:Ie(r),...l,algoliaAgent:Z({algoliaAgents:a,client:"AgentStudio",version:H}),baseHeaders:{"content-type":"text/plain",...q.headers(),...l.baseHeaders},baseQueryParameters:{...q.queryParameters(),...l.baseQueryParameters}});return {transporter:c,appId:r,apiKey:o,clearCache(){return Promise.all([c.requestsCache.clear(),c.responsesCache.clear()]).then(()=>{})},get _ua(){return c.algoliaAgent.value},addAlgoliaAgent(e,t){c.algoliaAgent.add({segment:e,version:t});},setClientApiKey({apiKey:e}){!n||n==="WithinHeaders"?c.baseHeaders["x-algolia-api-key"]=e:c.baseQueryParameters["x-algolia-api-key"]=e;},bulkCreateAllowedDomains({agentId:e,allowedDomainBulkInsert:t},s){p("agentId","bulkCreateAllowedDomains",e),p("allowedDomainBulkInsert","bulkCreateAllowedDomains",t),p("allowedDomainBulkInsert.domains","bulkCreateAllowedDomains",t.domains);let m={method:"POST",path:"/agent-studio/1/agents/{agentId}/allowed-domains/bulk".replace("{agentId}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return c.request(m,s)},bulkDeleteAllowedDomains({agentId:e,allowedDomainBulkDelete:t},s){p("agentId","bulkDeleteAllowedDomains",e),p("allowedDomainBulkDelete","bulkDeleteAllowedDomains",t),p("allowedDomainBulkDelete.domainIds","bulkDeleteAllowedDomains",t.domainIds);let m={method:"DELETE",path:"/agent-studio/1/agents/{agentId}/allowed-domains/bulk".replace("{agentId}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return c.request(m,s)},createAgent(e,t){p("agentConfigCreate","createAgent",e),p("agentConfigCreate.name","createAgent",e.name),p("agentConfigCreate.instructions","createAgent",e.instructions);let i={method:"POST",path:"/agent-studio/1/agents",queryParameters:{},headers:{},data:e};return c.request(i,t)},createAgentAllowedDomain({agentId:e,allowedDomainCreate:t},s){p("agentId","createAgentAllowedDomain",e),p("allowedDomainCreate","createAgentAllowedDomain",t),p("allowedDomainCreate.domain","createAgentAllowedDomain",t.domain);let m={method:"POST",path:"/agent-studio/1/agents/{agentId}/allowed-domains".replace("{agentId}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return c.request(m,s)},createAgentCompletion({agentId:e,compatibilityMode:t,agentCompletionRequest:s,stream:u,cache:d,memory:i,analytics:m,xAlgoliaSecureUserToken:g},v){p("agentId","createAgentCompletion",e),p("compatibilityMode","createAgentCompletion",t),p("agentCompletionRequest","createAgentCompletion",s);let P="/agent-studio/1/agents/{agentId}/completions".replace("{agentId}",encodeURIComponent(e)),h={},f={};t!==void 0&&(f.compatibilityMode=t.toString()),u!==void 0&&(f.stream=u.toString()),d!==void 0&&(f.cache=d.toString()),i!==void 0&&(f.memory=i.toString()),m!==void 0&&(f.analytics=m.toString()),g!==void 0&&(h["X-Algolia-Secure-User-Token"]=g.toString());let R={method:"POST",path:P,queryParameters:f,headers:h,data:s};return c.request(R,v)},createAgentCompletionStreamRaw({agentId:e,compatibilityMode:t,agentCompletionRequest:s,stream:u,cache:d,memory:i,analytics:m,xAlgoliaSecureUserToken:g},v){p("agentId","createAgentCompletionStreamRaw",e),p("compatibilityMode","createAgentCompletionStreamRaw",t),p("agentCompletionRequest","createAgentCompletionStreamRaw",s);let P="/agent-studio/1/agents/{agentId}/completions".replace("{agentId}",encodeURIComponent(e)),h={},f={};t!==void 0&&(f.compatibilityMode=t.toString()),u!==void 0&&(f.stream=u.toString()),d!==void 0&&(f.cache=d.toString()),i!==void 0&&(f.memory=i.toString()),m!==void 0&&(f.analytics=m.toString()),g!==void 0&&(h["X-Algolia-Secure-User-Token"]=g.toString());let R={method:"POST",path:P,queryParameters:f,headers:h,data:s};return c.requestStream(R,v)},async*createAgentCompletionStream({agentId:e,compatibilityMode:t,agentCompletionRequest:s,stream:u,cache:d,memory:i,analytics:m,xAlgoliaSecureUserToken:g},v){for await(let P of this.createAgentCompletionStreamRaw({agentId:e,compatibilityMode:t,agentCompletionRequest:s,stream:u,cache:d,memory:i,analytics:m,xAlgoliaSecureUserToken:g},v))try{yield {data:JSON.parse(P.data),raw:P};}catch(h){yield {data:null,raw:P,error:h};}},createFeedback(e,t){p("feedbackCreationRequest","createFeedback",e),p("feedbackCreationRequest.messageId","createFeedback",e.messageId),p("feedbackCreationRequest.agentId","createFeedback",e.agentId),p("feedbackCreationRequest.vote","createFeedback",e.vote);let i={method:"POST",path:"/agent-studio/1/feedback",queryParameters:{},headers:{},data:e};return c.request(i,t)},createProvider(e,t){p("providerAuthenticationCreate","createProvider",e),p("providerAuthenticationCreate.name","createProvider",e.name),p("providerAuthenticationCreate.providerName","createProvider",e.providerName),p("providerAuthenticationCreate.input","createProvider",e.input);let i={method:"POST",path:"/agent-studio/1/providers",queryParameters:{},headers:{},data:e};return c.request(i,t)},createSecretKey(e,t){p("secretKeyCreate","createSecretKey",e),p("secretKeyCreate.name","createSecretKey",e.name);let i={method:"POST",path:"/agent-studio/1/secret-keys",queryParameters:{},headers:{},data:e};return c.request(i,t)},customDelete({path:e,parameters:t},s){p("path","customDelete",e);let m={method:"DELETE",path:"/agent-studio/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return c.request(m,s)},customGet({path:e,parameters:t},s){p("path","customGet",e);let m={method:"GET",path:"/agent-studio/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return c.request(m,s)},customPost({path:e,parameters:t,body:s},u){p("path","customPost",e);let g={method:"POST",path:"/agent-studio/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return c.request(g,u)},customPut({path:e,parameters:t,body:s},u){p("path","customPut",e);let g={method:"PUT",path:"/agent-studio/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:s||{}};return c.request(g,u)},deleteAgent({agentId:e},t){p("agentId","deleteAgent",e);let i={method:"DELETE",path:"/agent-studio/1/agents/{agentId}".replace("{agentId}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},deleteAgentConversations({agentId:e,startDate:t,endDate:s},u){p("agentId","deleteAgentConversations",e);let d="/agent-studio/1/agents/{agentId}/conversations".replace("{agentId}",encodeURIComponent(e)),i={},m={};t!==void 0&&(m.startDate=t.toString()),s!==void 0&&(m.endDate=s.toString());let g={method:"DELETE",path:d,queryParameters:m,headers:i};return c.request(g,u)},deleteAllowedDomain({domainId:e,agentId:t},s){p("domainId","deleteAllowedDomain",e),p("agentId","deleteAllowedDomain",t);let m={method:"DELETE",path:"/agent-studio/1/agents/{agentId}/allowed-domains/{domainId}".replace("{domainId}",encodeURIComponent(e)).replace("{agentId}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(m,s)},deleteConversation({conversationId:e,agentId:t},s){p("conversationId","deleteConversation",e),p("agentId","deleteConversation",t);let m={method:"DELETE",path:"/agent-studio/1/agents/{agentId}/conversations/{conversationId}".replace("{conversationId}",encodeURIComponent(e)).replace("{agentId}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(m,s)},deleteProvider({providerId:e},t){p("providerId","deleteProvider",e);let i={method:"DELETE",path:"/agent-studio/1/providers/{providerId}".replace("{providerId}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},deleteSecretKey({secretKeyId:e},t){p("secretKeyId","deleteSecretKey",e);let i={method:"DELETE",path:"/agent-studio/1/secret-keys/{secretKeyId}".replace("{secretKeyId}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},deleteUserData({userToken:e},t){p("userToken","deleteUserData",e);let i={method:"DELETE",path:"/agent-studio/1/user-data/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},exportConversations({agentId:e,startDate:t,endDate:s},u){p("agentId","exportConversations",e);let d="/agent-studio/1/agents/{agentId}/conversations/export".replace("{agentId}",encodeURIComponent(e)),i={},m={};t!==void 0&&(m.startDate=t.toString()),s!==void 0&&(m.endDate=s.toString());let g={method:"GET",path:d,queryParameters:m,headers:i};return c.request(g,u)},getAgent({agentId:e},t){p("agentId","getAgent",e);let i={method:"GET",path:"/agent-studio/1/agents/{agentId}".replace("{agentId}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},getAllowedDomain({domainId:e,agentId:t},s){p("domainId","getAllowedDomain",e),p("agentId","getAllowedDomain",t);let m={method:"GET",path:"/agent-studio/1/agents/{agentId}/allowed-domains/{domainId}".replace("{domainId}",encodeURIComponent(e)).replace("{agentId}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(m,s)},getConfiguration(e){let d={method:"GET",path:"/agent-studio/1/configuration",queryParameters:{},headers:{}};return c.request(d,e)},getConversation({conversationId:e,agentId:t,includeFeedback:s,xAlgoliaSecureUserToken:u},d){p("conversationId","getConversation",e),p("agentId","getConversation",t);let i="/agent-studio/1/agents/{agentId}/conversations/{conversationId}".replace("{conversationId}",encodeURIComponent(e)).replace("{agentId}",encodeURIComponent(t)),m={},g={};s!==void 0&&(g.includeFeedback=s.toString()),u!==void 0&&(m["X-Algolia-Secure-User-Token"]=u.toString());let v={method:"GET",path:i,queryParameters:g,headers:m};return c.request(v,d)},getProvider({providerId:e},t){p("providerId","getProvider",e);let i={method:"GET",path:"/agent-studio/1/providers/{providerId}".replace("{providerId}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},getSecretKey({secretKeyId:e},t){p("secretKeyId","getSecretKey",e);let i={method:"GET",path:"/agent-studio/1/secret-keys/{secretKeyId}".replace("{secretKeyId}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},getUserData({userToken:e},t){p("userToken","getUserData",e);let i={method:"GET",path:"/agent-studio/1/user-data/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},invalidateAgentCache({agentId:e,before:t},s){p("agentId","invalidateAgentCache",e);let u="/agent-studio/1/agents/{agentId}/cache".replace("{agentId}",encodeURIComponent(e)),d={},i={};t!==void 0&&(i.before=t.toString());let m={method:"DELETE",path:u,queryParameters:i,headers:d};return c.request(m,s)},listAgentAllowedDomains({agentId:e},t){p("agentId","listAgentAllowedDomains",e);let i={method:"GET",path:"/agent-studio/1/agents/{agentId}/allowed-domains".replace("{agentId}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},listAgentConversations({agentId:e,startDate:t,endDate:s,includeFeedback:u,feedbackVote:d,page:i,limit:m,xAlgoliaSecureUserToken:g},v){p("agentId","listAgentConversations",e);let P="/agent-studio/1/agents/{agentId}/conversations".replace("{agentId}",encodeURIComponent(e)),h={},f={};t!==void 0&&(f.startDate=t.toString()),s!==void 0&&(f.endDate=s.toString()),u!==void 0&&(f.includeFeedback=u.toString()),d!==void 0&&(f.feedbackVote=d.toString()),i!==void 0&&(f.page=i.toString()),m!==void 0&&(f.limit=m.toString()),g!==void 0&&(h["X-Algolia-Secure-User-Token"]=g.toString());let R={method:"GET",path:P,queryParameters:f,headers:h};return c.request(R,v)},listAgents({page:e,limit:t,providerId:s}={},u=void 0){let d="/agent-studio/1/agents",i={},m={};e!==void 0&&(m.page=e.toString()),t!==void 0&&(m.limit=t.toString()),s!==void 0&&(m.providerId=s.toString());let g={method:"GET",path:d,queryParameters:m,headers:i};return c.request(g,u)},listModels(e){let d={method:"GET",path:"/agent-studio/1/providers/models",queryParameters:{},headers:{}};return c.request(d,e)},listProviderModels({providerId:e},t){p("providerId","listProviderModels",e);let i={method:"GET",path:"/agent-studio/1/providers/{providerId}/models".replace("{providerId}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},listProviders({page:e,limit:t}={},s=void 0){let u="/agent-studio/1/providers",d={},i={};e!==void 0&&(i.page=e.toString()),t!==void 0&&(i.limit=t.toString());let m={method:"GET",path:u,queryParameters:i,headers:d};return c.request(m,s)},listSecretKeys({page:e,limit:t}={},s=void 0){let u="/agent-studio/1/secret-keys",d={},i={};e!==void 0&&(i.page=e.toString()),t!==void 0&&(i.limit=t.toString());let m={method:"GET",path:u,queryParameters:i,headers:d};return c.request(m,s)},publishAgent({agentId:e},t){p("agentId","publishAgent",e);let i={method:"POST",path:"/agent-studio/1/agents/{agentId}/publish".replace("{agentId}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},unpublishAgent({agentId:e},t){p("agentId","unpublishAgent",e);let i={method:"POST",path:"/agent-studio/1/agents/{agentId}/unpublish".replace("{agentId}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(i,t)},updateAgent({agentId:e,agentConfigUpdate:t},s){p("agentId","updateAgent",e),p("agentConfigUpdate","updateAgent",t);let m={method:"PATCH",path:"/agent-studio/1/agents/{agentId}".replace("{agentId}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return c.request(m,s)},updateConfiguration(e,t){p("applicationConfigPatch","updateConfiguration",e);let i={method:"PATCH",path:"/agent-studio/1/configuration",queryParameters:{},headers:{},data:e};return c.request(i,t)},updateProvider({providerId:e,providerAuthenticationPatch:t},s){p("providerId","updateProvider",e),p("providerAuthenticationPatch","updateProvider",t);let m={method:"PATCH",path:"/agent-studio/1/providers/{providerId}".replace("{providerId}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return c.request(m,s)},updateSecretKey({secretKeyId:e,secretKeyPatch:t},s){p("secretKeyId","updateSecretKey",e),p("secretKeyPatch","updateSecretKey",t);let m={method:"PATCH",path:"/agent-studio/1/secret-keys/{secretKeyId}".replace("{secretKeyId}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return c.request(m,s)}}}function so(r,o,n){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!o||typeof o!="string")throw new Error("`apiKey` is missing.");let{compression:a,...l}=n||{};return ie({appId:r,apiKey:o,timeouts:{connect:25e3,read:25e3,write:25e3},logger:ee(),requester:ae(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:U(),requestsCache:U({serializable:false}),hostsCache:w({caches:[X({key:`${H}-${r}`}),U()]}),...l})}
12
+
13
+ exports.agentStudioClient = so;
14
+ exports.apiClientVersion = H;
15
+
16
+ }));