codemie-sdk 0.1.340 → 0.1.341
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +161 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +173 -1
- package/dist/index.d.ts +173 -1
- package/dist/index.js +149 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/auth/credentials.ts","../src/utils/helpers.ts","../src/mappers/assistant.mapper.ts","../src/services/assistant.ts","../src/schemas/assistant.ts","../src/utils/http.ts","../src/exceptions/exceptions.ts","../src/schemas/conversation.ts","../src/services/conversation.ts","../src/services/datasource.ts","../src/models/datasource.ts","../src/mappers/datasource.mapper.ts","../src/models/integration.ts","../src/schemas/integration.ts","../src/services/integration.ts","../src/services/llm.ts","../src/services/task.ts","../src/mappers/user.mapper.ts","../src/services/user.ts","../src/mappers/workflow.mapper.ts","../src/schemas/workflow.ts","../src/models/workflow.ts","../src/services/workflow_execution_state.ts","../src/services/workflow_execution.ts","../src/services/workflow.ts","../src/client/client.ts","../src/models/assistant.ts","../src/models/llm.ts","../src/models/task.ts"],"sourcesContent":["export * from \"./client\";\nexport * from \"./exceptions\";\nexport * from \"./models\";\nexport * from \"./schemas\";\nexport { formatCookies } from \"./utils/http\";\n","import { Agent } from \"node:https\";\nimport axios from \"axios\";\nimport type { KeycloakCredentialsConfig, TokenPayload, TokenResponse } from \"./types\";\n\nconst DEFAULT_CLIENT_ID = \"codemie-sdk\";\n\nexport class KeycloakCredentials {\n private config: KeycloakCredentialsConfig;\n private httpAgent: Agent;\n\n constructor(config: KeycloakCredentialsConfig) {\n this.validateConfigCredentials(config);\n this.config = config;\n\n this.httpAgent = new Agent({\n rejectUnauthorized: config.verifySSL,\n });\n }\n\n async getToken(): Promise<string> {\n const { serverUrl, realmName } = this.config;\n const url = `${serverUrl}/realms/${realmName}/protocol/openid-connect/token`;\n\n const payload =\n this.config.username && this.config.password\n ? this.createResourceOwnerCredentialsPayload()\n : this.createClientCredentialsPayload();\n\n const { data } = await axios.post<TokenResponse>(url, this.createSearchParams(payload), {\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n httpsAgent: this.httpAgent,\n });\n\n return data.access_token;\n }\n\n private createResourceOwnerCredentialsPayload(): TokenPayload {\n const { username, password, clientId } = this.config;\n\n return {\n grant_type: \"password\",\n username,\n password,\n client_id: clientId || DEFAULT_CLIENT_ID,\n };\n }\n\n private createClientCredentialsPayload(): TokenPayload {\n const { clientId, clientSecret } = this.config;\n\n return {\n grant_type: \"client_credentials\",\n client_id: clientId || DEFAULT_CLIENT_ID,\n client_secret: clientSecret,\n };\n }\n\n private createSearchParams(payload: Record<string, string | undefined>): URLSearchParams {\n return new URLSearchParams(\n Object.fromEntries(Object.entries(payload).filter(([_, v]) => v !== undefined)) as Record<\n string,\n string\n >,\n );\n }\n\n private validateConfigCredentials(config: KeycloakCredentialsConfig): void {\n if (!((config.clientId && config.clientSecret) || (config.username && config.password))) {\n throw new Error(\n \"Either client credentials (clientId, clientSecret) or \" +\n \"user credentials (username, password) must be provided\",\n );\n }\n }\n}\n","/**\n * Utility function to omit properties with undefined values from an object.\n * Helper during API response mapping to ensure clean data.\n */\nexport function omitUndefined<T extends Record<string, unknown>>(obj: T): T {\n return Object.fromEntries(Object.entries(obj).filter(([_, value]) => value !== undefined)) as T;\n}\n","import type { BaseModelApiResponse, BaseModelResponse } from \"../models\";\nimport { omitUndefined } from \"../utils/helpers\";\n\nexport class AssistantMapper {\n static mapBaseModelApiResponse(response: BaseModelApiResponse): BaseModelResponse {\n return omitUndefined({\n generated: response.generated,\n time_elapsed: response.timeElapsed,\n tokens_used: response.tokensUsed,\n thoughts: response.thoughts,\n task_id: response.taskId,\n });\n }\n}\n","import { AssistantMapper } from \"../mappers/assistant.mapper\";\nimport type {\n Assistant,\n AssistantBase,\n AssistantVersion,\n BaseModelApiResponse,\n BaseModelResponse,\n ToolKitDetails,\n AssistantCreateResponse,\n AssistantUpdateResponse,\n} from \"../models/assistant\";\nimport type { AnyJson, AuthConfig, PaginatedResponse } from \"../models/common\";\nimport { z } from \"zod\";\nimport {\n AssistantChatParamsSchema,\n type AssistantCreateParams,\n AssistantCreateParamsSchema,\n type AssistantListParams,\n AssistantListParamsSchema,\n type AssistantUpdateParams,\n AssistantUpdateParamsSchema,\n type AssistantChatParams,\n AssistantVersionsListParamsSchema,\n type AssistantVersionsListParams,\n} from \"../schemas/assistant\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\n// Union of supported response shapes for versions list endpoint to avoid `any`.\n// - Backend may return a raw array, or wrap in {data: [...]}, or {versions: [...]}.\nexport type VersionsListResponse =\n | AssistantVersion[]\n | { data: AssistantVersion[]; [key: string]: unknown }\n | { versions: AssistantVersion[]; [key: string]: unknown }\n | { items: AssistantVersion[]; [key: string]: unknown };\n\nexport class AssistantService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get list of available assistants.\n */\n async list(_params: AssistantListParams = {}): Promise<(Assistant | AssistantBase)[]> {\n const params = AssistantListParamsSchema.parse(_params);\n\n const response = await this.api.get<PaginatedResponse<Assistant | AssistantBase>>(\n \"/v1/assistants\",\n {\n ...params,\n ...(params.filters && { filters: JSON.stringify(params.filters) }),\n },\n );\n\n return response.data;\n }\n\n /**\n * Get list of available assistants with pagination metadata.\n */\n async listPaginated(_params: AssistantListParams = {}): Promise<PaginatedResponse<Assistant | AssistantBase>> {\n const params = AssistantListParamsSchema.parse(_params);\n\n const response = await this.api.get<PaginatedResponse<Assistant | AssistantBase>>(\n \"/v1/assistants\",\n {\n ...params,\n ...(params.filters && { filters: JSON.stringify(params.filters) }),\n },\n );\n\n return response;\n }\n\n /**\n * Get assistant by ID.\n */\n async get(assistantId: string): Promise<Assistant> {\n return this.api.get<Assistant>(`/v1/assistants/id/${assistantId}`);\n }\n\n /**\n * Get assistant by slug.\n */\n async getBySlug(slug: string): Promise<Assistant> {\n return this.api.get<Assistant>(`/v1/assistants/slug/${slug}`);\n }\n\n /**\n * Create a new assistant.\n * @returns AssistantCreateResponse with assistant_id and optional validation results\n */\n async create(_params: AssistantCreateParams): Promise<AssistantCreateResponse> {\n const params = AssistantCreateParamsSchema.parse(_params);\n return this.api.post<AssistantCreateResponse>(\"/v1/assistants\", params);\n }\n\n /**\n * Update an existing assistant.\n * @returns AssistantUpdateResponse with optional validation results\n */\n async update(\n assistantId: string,\n _params: AssistantUpdateParams,\n ): Promise<AssistantUpdateResponse> {\n const params = AssistantUpdateParamsSchema.parse(_params);\n return this.api.put<AssistantUpdateResponse>(`/v1/assistants/${assistantId}`, params);\n }\n\n /**\n * Get list of available tools.\n */\n async getTools(): Promise<ToolKitDetails[]> {\n return this.api.get<ToolKitDetails[]>(\"/v1/assistants/tools\");\n }\n\n /**\n * Delete an assistant by ID.\n */\n async delete(assistantId: string): Promise<AnyJson> {\n return this.api.delete(`/v1/assistants/${assistantId}`);\n }\n\n /**\n * Get list of prebuilt assistants.\n */\n async getPrebuilt(): Promise<Assistant[]> {\n return this.api.get<Assistant[]>(\"/v1/assistants/prebuilt\");\n }\n\n /**\n * Get prebuilt assistant by slug.\n */\n async getPrebuiltBySlug(slug: string): Promise<Assistant> {\n return this.api.get<Assistant>(`/v1/assistants/prebuilt/${slug}`);\n }\n\n /**\n * List assistant versions.\n */\n async listVersions(\n assistantId: string,\n _params: AssistantVersionsListParams = {},\n ): Promise<AssistantVersion[]> {\n const params = AssistantVersionsListParamsSchema.parse(_params);\n const response = await this.api.get<VersionsListResponse>(\n `/v1/assistants/${assistantId}/versions`,\n params,\n );\n // Support multiple backend response shapes: array, {data: [...]}, {versions: [...]}, {items: [...]}.\n if (Array.isArray(response)) {\n return response;\n }\n if (response && \"data\" in response && Array.isArray(response.data)) {\n return response.data;\n }\n if (\n response &&\n \"versions\" in response &&\n Array.isArray((response as { versions: unknown }).versions)\n ) {\n return (response as { versions: AssistantVersion[] }).versions;\n }\n if (response && \"items\" in response && Array.isArray((response as { items: unknown }).items)) {\n return (response as { items: AssistantVersion[] }).items;\n }\n return [];\n }\n\n /**\n * Get a specific assistant version by number.\n */\n async getVersion(assistantId: string, versionNumber: number): Promise<AssistantVersion> {\n return this.api.get<AssistantVersion>(\n `/v1/assistants/${assistantId}/versions/${versionNumber}`,\n );\n }\n\n /**\n * Send a chat request to an assistant.\n */\n async chat(\n assistantId: string,\n _params: AssistantChatParams,\n headers?: Record<string, string>,\n ): Promise<BaseModelResponse> {\n let zodSchema: z.ZodType | undefined = undefined;\n let params = { ..._params };\n\n if (params.output_schema && params.output_schema instanceof z.ZodType) {\n zodSchema = params.output_schema as z.ZodType;\n // Convert Zod schema to JSON schema\n params.output_schema = z.toJSONSchema(zodSchema);\n }\n\n params = AssistantChatParamsSchema.parse(params);\n\n const response = await this.api.post<BaseModelApiResponse>(\n `/v1/assistants/${assistantId}/model`,\n params,\n {\n responseType: params.stream ? \"stream\" : undefined,\n },\n headers,\n );\n\n const mapped = AssistantMapper.mapBaseModelApiResponse(response);\n\n if (!params.stream && zodSchema && mapped.generated) {\n mapped.generated = zodSchema.parse(mapped.generated);\n }\n\n return mapped;\n }\n\n /**\n * Send a chat request to an assistant by slug.\n */\n async chatBySlug(\n assistantSlug: string,\n _params: AssistantChatParams,\n headers?: Record<string, string>,\n ): Promise<BaseModelResponse> {\n let zodSchema: z.ZodType | undefined = undefined;\n let params = { ..._params };\n\n if (params.output_schema && params.output_schema instanceof z.ZodType) {\n zodSchema = params.output_schema as z.ZodType;\n params.output_schema = z.toJSONSchema(zodSchema);\n }\n\n params = AssistantChatParamsSchema.parse(params);\n\n const response = await this.api.post<BaseModelApiResponse>(\n `/v1/assistants/slug/${assistantSlug}/model`,\n params,\n {\n responseType: params.stream ? \"stream\" : undefined,\n },\n headers,\n );\n const mapped = AssistantMapper.mapBaseModelApiResponse(response);\n\n if (!params.stream && zodSchema && mapped.generated) {\n mapped.generated = zodSchema.parse(mapped.generated);\n }\n\n return mapped;\n }\n\n /**\n * Compare two assistant versions.\n */\n async compareVersions(\n assistantId: string,\n v1: number,\n v2: number,\n ): Promise<Record<string, unknown>> {\n return this.api.get<Record<string, unknown>>(\n `/v1/assistants/${assistantId}/versions/${v1}/compare/${v2}`,\n );\n }\n\n /**\n * Rollback assistant to a specific version. Creates a new version mirroring the target.\n */\n async rollbackToVersion(assistantId: string, versionNumber: number): Promise<AnyJson> {\n return this.api.post<AnyJson>(\n `/v1/assistants/${assistantId}/versions/${versionNumber}/rollback`,\n {},\n );\n }\n\n /**\n * Send a chat request to a specific assistant version.\n */\n async chatWithVersion(\n assistantId: string,\n versionNumber: number,\n _params: AssistantChatParams,\n ): Promise<BaseModelResponse> {\n let zodSchema: z.ZodType | undefined = undefined;\n let params = { ..._params };\n\n if (params.output_schema && params.output_schema instanceof z.ZodType) {\n zodSchema = params.output_schema as z.ZodType;\n params.output_schema = z.toJSONSchema(zodSchema);\n }\n\n params = AssistantChatParamsSchema.parse(params);\n\n // Use stable chat endpoint and pass version in body for broader backend compatibility\n const response = await this.api.post<BaseModelApiResponse>(\n `/v1/assistants/${assistantId}/model`,\n { ...params, version: versionNumber },\n {\n responseType: params.stream ? \"stream\" : undefined,\n },\n );\n\n const mapped = AssistantMapper.mapBaseModelApiResponse(response);\n\n if (!params.stream && zodSchema && mapped.generated) {\n mapped.generated = zodSchema.parse(mapped.generated);\n }\n\n return mapped;\n }\n}\n","import { z } from \"zod\";\n\nexport const AssistantListParamsSchema = z\n .object({\n minimal_response: z.boolean().prefault(true),\n scope: z.enum([\"visible_to_user\", \"marketplace\"]).prefault(\"visible_to_user\"),\n page: z.number().prefault(0),\n per_page: z.number().prefault(12),\n filters: z.record(z.string(), z.unknown()).optional(),\n })\n .readonly();\nexport type AssistantListParams = Partial<z.infer<typeof AssistantListParamsSchema>>;\n\nconst PromptVariableSchema = z.object({\n key: z.string(),\n description: z.string().optional(),\n default_value: z.string(),\n});\n\nexport const AssistantCreateParamsSchema = z\n .object({\n name: z.string(),\n description: z.string(),\n icon_url: z.string().optional(),\n system_prompt: z.string(),\n project: z.string(),\n context: z.array(\n z.object({\n context_type: z.enum([\"knowledge_base\", \"code\"]),\n name: z.string(),\n }),\n ),\n llm_model_type: z.string(),\n toolkits: z.array(\n z.object({\n toolkit: z.string(),\n tools: z.array(\n z.object({\n name: z.string(),\n label: z.string().optional(),\n settings_config: z.boolean(),\n user_description: z.string().optional(),\n settings: z.any().nullable().optional(),\n }),\n ),\n label: z.string(),\n settings_config: z.boolean(),\n is_external: z.boolean(),\n settings: z.any().optional(),\n }),\n ),\n conversation_starters: z.array(z.string()),\n shared: z.boolean().optional(),\n is_react: z.boolean().optional(),\n is_global: z.boolean().optional(),\n slug: z.string().optional(),\n temperature: z.number().optional(),\n top_p: z.number().optional(),\n mcp_servers: z.array(\n z.object({\n name: z.string(),\n description: z.string().optional(),\n enabled: z.boolean(),\n config: z\n .object({\n url: z.string().optional(),\n command: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), z.unknown()).optional(),\n auth_token: z.string().optional(),\n })\n .optional()\n .refine(\n (config) => {\n if (!config) {\n return true; // Allow undefined/null\n }\n const hasUrl = !!config.url;\n const hasCommand = !!config.command;\n return hasUrl !== hasCommand; // Either url or command must be present, but not both\n },\n {\n error: \"Either 'url' or 'command' must be provided in config, but not both\",\n },\n ),\n mcp_connect_url: z.string().optional(),\n tools_tokens_size_limit: z.number().optional(),\n command: z.string().optional(),\n arguments: z.string().optional(),\n settings: z.any().optional(),\n mcp_connect_auth_token: z.any().optional(),\n }),\n ),\n assistant_ids: z.array(z.string()),\n prompt_variables: z.array(PromptVariableSchema).optional().prefault([]),\n categories: z.array(z.string()).max(3).optional(),\n skip_integration_validation: z.boolean().optional().prefault(false),\n })\n .readonly();\n// In order to make sure that default values are applied correctly, we use z.input here\n// instead of z.infer which would give us the type after defaults are applied.\nexport type AssistantCreateParams = z.input<typeof AssistantCreateParamsSchema>;\n\nexport const AssistantUpdateParamsSchema = AssistantCreateParamsSchema;\nexport type AssistantUpdateParams = z.input<typeof AssistantUpdateParamsSchema>;\n\nexport const AssistantChatParamsSchema = z\n .object({\n conversation_id: z.string().optional(),\n text: z.string(),\n content_raw: z.string().optional(),\n file_names: z.array(z.string()).optional(),\n llm_model: z.string().optional(),\n history: z.union([\n z.array(\n z.object({\n role: z.enum([\"Assistant\", \"User\"]),\n message: z.string().optional(),\n }),\n ),\n z.string(),\n ]),\n history_index: z.number().optional(),\n stream: z.boolean().optional(),\n propagate_headers: z.boolean().optional(),\n custom_metadata: z.record(z.string(), z.unknown()).optional(),\n top_k: z.number().optional(),\n system_prompt: z.string().optional(),\n background_task: z.boolean().optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n mcp_server_single_usage: z.boolean().optional(),\n\n version: z.number().optional(),\n output_schema: z\n .union([z.custom((val) => val instanceof z.ZodType), z.record(z.string(), z.unknown())])\n .optional(),\n })\n .readonly();\nexport type AssistantChatParams = z.infer<typeof AssistantChatParamsSchema>;\n\nexport const AssistantVersionsListParamsSchema = z\n .object({\n page: z.number().optional(),\n per_page: z.number().optional(),\n })\n .readonly();\nexport type AssistantVersionsListParams = Partial<\n z.infer<typeof AssistantVersionsListParamsSchema>\n>;\n","import { Agent } from \"node:https\";\nimport axios from \"axios\";\nimport type { AxiosError, AxiosInstance, AxiosResponse } from \"axios/index\";\nimport type FormData from \"form-data\";\nimport { ApiError, NotFoundError } from \"../exceptions\";\nimport type { AuthConfig } from \"../models/common\";\n\nexport interface ApiResponse<T> {\n data: T;\n}\n\n/**\n * Convert cookies object to cookie string format.\n * Example: {key1: \"value1\", key2: \"value2\"} => \"key1=value1; key2=value2\"\n */\nexport function formatCookies(cookies: Record<string, string>): string {\n return Object.entries(cookies)\n .map(([key, value]) => `${key}=${value}`)\n .join(\"; \");\n}\n\nexport class ApiRequestHandler {\n private client: AxiosInstance;\n\n constructor(config: AuthConfig) {\n const { apiDomain, token, verifySSL = true, cookies = {} } = config;\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n };\n\n // Use Cookie header if cookies are provided, otherwise use Bearer token\n if (Object.keys(cookies).length > 0) {\n headers.Cookie = formatCookies(cookies);\n } else if (token) {\n headers.Authorization = `Bearer ${token}`;\n }\n\n this.client = axios.create({\n baseURL: apiDomain.replace(/\\/$/, \"\"), // Remove trailing slash\n validateStatus: (status: number) => status < 400,\n headers,\n httpsAgent: new Agent({\n rejectUnauthorized: verifySSL,\n }),\n });\n\n this.client.interceptors.response.use(\n (response: AxiosResponse) => response,\n (error: AxiosError) => this.processFailedResponse(error),\n );\n }\n\n private async request<T>(\n method: \"get\" | \"post\" | \"put\" | \"delete\",\n path: string,\n config: Record<string, unknown> = {},\n ): Promise<T> {\n const response = await this.client.request<T>({\n method,\n url: path,\n ...config,\n });\n return response.data;\n }\n\n /**\n * Merge extra headers into the request (used for X-* propagation)\n */\n private withHeaders(config: Record<string, unknown> = {}, extraHeaders?: Record<string, string>) {\n if (!extraHeaders || Object.keys(extraHeaders).length === 0) return config;\n const headers = (config.headers as Record<string, string> | undefined) ?? {};\n return { ...config, headers: { ...headers, ...extraHeaders } };\n }\n\n async get<T>(\n path: string,\n params?: Record<string, unknown>,\n config: Record<string, unknown> = {},\n extraHeaders?: Record<string, string>,\n ): Promise<T> {\n return this.request<T>(\"get\", path, this.withHeaders({ ...config, params }, extraHeaders));\n }\n\n async post<T>(\n path: string,\n data?: unknown,\n config: Record<string, unknown> = {},\n extraHeaders?: Record<string, string>,\n ): Promise<T> {\n return this.request<T>(\"post\", path, this.withHeaders({ ...config, data }, extraHeaders));\n }\n\n async put<T>(\n path: string,\n data?: unknown,\n config: Record<string, unknown> = {},\n extraHeaders?: Record<string, string>,\n ): Promise<T> {\n return this.request<T>(\"put\", path, this.withHeaders({ ...config, data }, extraHeaders));\n }\n\n async postMultipart<T>(\n url: string,\n formData: FormData,\n params?: Record<string, unknown>,\n ): Promise<T> {\n const response = await this.client.post<T>(url, formData, {\n headers: {\n \"Content-Type\": \"multipart/form-data\",\n },\n params,\n });\n return response.data;\n }\n\n async delete<T>(path: string, config: Record<string, unknown> = {}): Promise<T> {\n return this.request<T>(\"delete\", path, config);\n }\n\n async stream(\n path: string,\n data?: unknown,\n config: Record<string, unknown> = {},\n ): Promise<AxiosResponse> {\n return this.client.post(path, data, {\n ...config,\n responseType: \"stream\",\n });\n }\n\n private processFailedResponse(error: AxiosError): void {\n const response = error.response;\n const status = response?.status || 500;\n\n const data = (response?.data || {}) as {\n error?: { message?: string; detail?: string; help?: string; details?: string };\n };\n\n if (status === 404) {\n throw new NotFoundError(\"Resource\", \"unknown\");\n }\n\n if (status === 422) {\n // Validation error returns different structure (details instead of detail)\n const errorMessage = [\n data.error?.message,\n data.error?.help,\n JSON.stringify(data.error?.details ?? {}),\n ]\n .filter(Boolean)\n .join(\". \");\n throw new ApiError(errorMessage || \"Validation error\", status, data);\n }\n\n const errorMessage = [data.error?.message, data.error?.detail, data.error?.help]\n .filter(Boolean)\n .join(\". \");\n\n throw new ApiError(errorMessage, status, data);\n }\n}\n","import type { AnyJson } from \"../models/common\";\n\nexport class CodeMieError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"CodeMieError\";\n }\n}\n\nexport class ApiError extends CodeMieError {\n statusCode?: number;\n response?: AnyJson;\n\n constructor(message: string, statusCode?: number, response?: AnyJson) {\n super(message);\n this.name = \"ApiError\";\n this.statusCode = statusCode;\n this.response = response;\n }\n}\n\nexport class NotFoundError extends ApiError {\n constructor(resourceType: string, resourceId: string) {\n super(`${resourceType} with ${resourceId} not found`, 404);\n this.name = \"NotFoundError\";\n }\n}\n","import { z } from \"zod\";\n\nexport const ConversationCreateParamsSchema = z\n .object({\n initial_assistant_id: z.string().optional(),\n folder: z.string().optional(),\n mcp_server_single_usage: z.boolean().prefault(false).optional(),\n })\n .readonly();\n\nexport type ConversationCreateParams = z.infer<typeof ConversationCreateParamsSchema>;\n","import type { Conversation, ConversationDetails } from \"../models/conversation\";\nimport type { AnyJson, AuthConfig } from \"../models/common\";\nimport {\n ConversationCreateParamsSchema,\n type ConversationCreateParams,\n} from \"../schemas/conversation\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nexport class ConversationService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get list of all conversations for the current user.\n */\n async list(): Promise<Conversation[]> {\n return this.api.get<Conversation[]>(\"/v1/conversations\");\n }\n\n /**\n * Get list of all conversations for the current user that include the specified assistant.\n */\n async listByAssistantId(assistantId: string): Promise<Conversation[]> {\n const conversations = await this.list();\n return conversations.filter((conv) => conv.assistant_ids.includes(assistantId));\n }\n\n /**\n * Get details for a specific conversation by its ID.\n */\n async get(conversationId: string): Promise<ConversationDetails> {\n return this.api.get<ConversationDetails>(`/v1/conversations/${conversationId}`);\n }\n\n /**\n * Create a new conversation.\n */\n async create(_params: ConversationCreateParams = {}): Promise<AnyJson> {\n const params = ConversationCreateParamsSchema.parse(_params);\n return this.api.post(\"/v1/conversations\", params);\n }\n\n /**\n * Delete a specific conversation by its ID.\n */\n async delete(conversationId: string): Promise<AnyJson> {\n return this.api.delete(`/v1/conversations/${conversationId}`);\n }\n}\n","import FormData from \"form-data\";\nimport { DatasourceMapper } from \"../mappers/datasource.mapper\";\nimport type { AnyJson, PaginatedResponse, AuthConfig } from \"../models/common\";\nimport type {\n DataSource,\n DataSourceCreateParams,\n DataSourceListParams,\n DataSourceResponse,\n DataSourceTypeType,\n DataSourceUpdateParams,\n FileDataSourceCreateParams,\n} from \"../models/datasource\";\nimport { DataSourceType } from \"../models/datasource\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nconst DATA_SOURCE_TO_PATH_PARAM = {\n [DataSourceType.CODE]: \"CODE\",\n [DataSourceType.CONFLUENCE]: \"CONFLUENCE\",\n [DataSourceType.JIRA]: \"JIRA\",\n [DataSourceType.FILE]: \"FILE\",\n [DataSourceType.GOOGLE]: \"GOOGLE\",\n [DataSourceType.PROVIDER]: \"PROVIDER\",\n [DataSourceType.SUMMARY]: \"SUMMARY\",\n [DataSourceType.CHUNK_SUMMARY]: \"CHUNK_SUMMARY\",\n [DataSourceType.JSON]: \"JSON\",\n [DataSourceType.BEDROCK]: \"BEDROCK\",\n};\n\nexport class DatasourceService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Create a new datasource.\n */\n async create(params: DataSourceCreateParams): Promise<AnyJson> {\n const dto = DatasourceMapper.mapDatasourceCreateToDto(params);\n\n if (dto.type === DataSourceType.FILE) {\n return this.createFileDatasource(dto as unknown as FileDataSourceCreateParams);\n }\n\n return this.api.post(this.getCreateDatasourceUrl(dto.type, dto.project_name), dto);\n }\n\n /**\n * Create a file datasource.\n */\n private async createFileDatasource({\n files,\n ...datasource\n }: FileDataSourceCreateParams): Promise<AnyJson> {\n const formData = new FormData();\n\n for (const file of files) {\n formData.append(\"files\", Buffer.from(file.content), {\n filename: file.name,\n contentType: file.mime_type,\n });\n }\n\n return this.api.postMultipart(\n this.getCreateDatasourceUrl(datasource.type, datasource.project_name),\n formData,\n datasource,\n );\n }\n\n /**\n * Update an existing datasource.\n */\n async update(params: DataSourceUpdateParams): Promise<AnyJson> {\n this.validateUpdateReindexParams(params);\n\n const { full_reindex, skip_reindex, resume_indexing, incremental_reindex, ...data } = params;\n\n const endpoint =\n params.type === DataSourceType.CODE\n ? `/v1/application/${params.project_name}/index/${params.name}`\n : `/v1/index/knowledge_base/${this.getKnowledgeBaseParam(params.type)}`;\n\n // Extract reindex params\n const queryParams = {\n full_reindex,\n skip_reindex,\n resume_indexing,\n incremental_reindex,\n };\n\n const { type, ...dto } = DatasourceMapper.mapDatasourceUpdateToDto(data);\n\n return this.api.put(endpoint, dto, { params: queryParams });\n }\n\n /**\n * List datasources with pagination and filtering support.\n */\n async list(params: DataSourceListParams = {}): Promise<DataSource[]> {\n const queryParams: Record<string, number | string> = {\n page: params.page || 0,\n per_page: params.per_page || 10,\n sort_key: params.sort_key || \"update_date\",\n sort_order: params.sort_order || \"desc\",\n };\n\n if (params.datasource_types || params.projects || params.status || params.owner) {\n const filters: Record<string, number | string | string[]> = {};\n if (params.datasource_types) filters.index_type = params.datasource_types;\n if (params.projects) filters.project = params.projects;\n if (params.status) filters.status = params.status;\n if (params.owner) filters.created_by = params.owner;\n queryParams.filters = JSON.stringify(filters);\n }\n\n const response = await this.api.get<PaginatedResponse<DataSourceResponse>>(\n \"/v1/index\",\n queryParams,\n );\n\n return response.data.map(DatasourceMapper.mapDatasourceResponse);\n }\n\n /**\n * Get datasource by ID.\n */\n async get(datasourceId: string): Promise<DataSource> {\n const response = await this.api.get<DataSourceResponse>(`/v1/index/${datasourceId}`);\n return DatasourceMapper.mapDatasourceResponse(response);\n }\n\n /**\n * Delete a datasource by ID.\n */\n async delete(datasourceId: string): Promise<AnyJson> {\n return this.api.delete(`/v1/index/${datasourceId}`);\n }\n\n private getCreateDatasourceUrl(type: DataSourceTypeType, projectName: string): string {\n if (type === DataSourceType.CODE) {\n return `/v1/application/${projectName}/index`;\n }\n return `/v1/index/knowledge_base/${this.getKnowledgeBaseParam(type)}`;\n }\n\n private getKnowledgeBaseParam(type: DataSourceTypeType): string {\n return DATA_SOURCE_TO_PATH_PARAM[type].toLowerCase();\n }\n\n /**\n * Validates update parameters for reindexing.\n * @throws {Error} If the update parameters are invalid for the given datasource type.\n */\n private validateUpdateReindexParams(updateParams: DataSourceUpdateParams): void {\n if (updateParams.type === DataSourceType.CONFLUENCE && updateParams.incremental_reindex) {\n throw new Error(\"Confluence data sources only support full_reindex and resume_indexing\");\n }\n if (updateParams.type === DataSourceType.JIRA && updateParams.resume_indexing) {\n throw new Error(\"Jira data sources only support full_reindex and incremental_reindex\");\n }\n if (updateParams.type === DataSourceType.CODE && updateParams.incremental_reindex) {\n throw new Error(\"Code data sources do not support incremental_reindex\");\n }\n if (updateParams.type === DataSourceType.GOOGLE && updateParams.incremental_reindex) {\n throw new Error(\"Google data sources only support full_reindex\");\n }\n }\n}\n","/** Models for datasource service. */\nimport type { BaseUser, SortOrder, TokensUsage } from \"./common\";\n\n/** Code datasource type options */\nexport const CodeDataSourceType = {\n CODE: \"code\",\n SUMMARY: \"summary\",\n CHUNK_SUMMARY: \"chunk-summary\",\n} as const;\nexport type CodeDataSourceTypeType = (typeof CodeDataSourceType)[keyof typeof CodeDataSourceType];\n\n/** Datasource type options */\nexport const DataSourceType = {\n CODE: \"code\",\n CONFLUENCE: \"knowledge_base_confluence\",\n JIRA: \"knowledge_base_jira\",\n FILE: \"knowledge_base_file\",\n GOOGLE: \"llm_routing_google\",\n PROVIDER: \"provider\",\n SUMMARY: \"summary\",\n CHUNK_SUMMARY: \"chunk-summary\",\n JSON: \"knowledge_base_json\",\n BEDROCK: \"knowledge_base_bedrock\",\n} as const;\nexport type DataSourceTypeType = (typeof DataSourceType)[keyof typeof DataSourceType];\n\n/** Datasource status options */\nexport const DataSourceStatus = {\n COMPLETED: \"completed\",\n FAILED: \"failed\",\n FETCHING: \"fetching\",\n IN_PROGRESS: \"in_progress\",\n} as const;\nexport type DataSourceStatusType = (typeof DataSourceStatus)[keyof typeof DataSourceStatus];\n\n/** Base file model for file datasources */\nexport type File = Readonly<{\n /** File name */\n name: string;\n /** File content */\n content: string | Buffer<ArrayBuffer>;\n /** MIME type of the file */\n mime_type: string;\n}>;\n\n/** Confluence-specific configuration */\nexport interface Confluence {\n cql: string;\n include_restricted_content?: boolean;\n include_archived_content?: boolean;\n include_attachments?: boolean;\n include_comments?: boolean;\n keep_markdown_format?: boolean;\n keep_newlines?: boolean;\n max_pages?: number;\n pages_per_request?: number;\n}\n\n/** Jira-specific configuration */\nexport interface Jira {\n jql: string;\n}\n\n/** Google-specific configuration */\nexport interface Google {\n googleDoc: string;\n}\n\n/** File-specific configuration */\nexport interface Files {\n files: File[];\n}\n\n/** Code repository configuration */\nexport interface Code {\n branch: string;\n docsGeneration?: boolean;\n embeddingsModel?: string;\n filesFilter?: string;\n indexType: CodeDataSourceTypeType;\n link: string;\n projectSpaceVisible?: boolean;\n prompt?: string;\n settingId: string;\n summarizationModel?: string;\n}\n\n/** Base data source DTO */\nexport interface BaseDataSourceCreateDto {\n name: string;\n project_name: string;\n description: string;\n project_space_visible: boolean;\n setting_id: string | null;\n type: DataSourceTypeType;\n}\n\nexport interface ConfluenceDataSourceCreateDto extends BaseDataSourceCreateDto, Confluence {\n type: typeof DataSourceType.CONFLUENCE;\n}\nexport interface JiraDataSourceCreateDto extends BaseDataSourceCreateDto, Jira {\n type: typeof DataSourceType.JIRA;\n}\nexport interface GoogleDataSourceCreateDto extends BaseDataSourceCreateDto, Google {\n type: typeof DataSourceType.GOOGLE;\n}\nexport interface FileDataSourceCreateDto extends BaseDataSourceCreateDto, Files {\n type: typeof DataSourceType.FILE;\n}\nexport interface CodeDataSourceCreateDto\n // override to comply with keys in json\n extends Omit<BaseDataSourceCreateDto, \"setting_id\" | \"project_space_visible\">,\n Code {\n type: typeof DataSourceType.CODE;\n}\n\nexport type DataSourceCreateDto =\n | ConfluenceDataSourceCreateDto\n | JiraDataSourceCreateDto\n | GoogleDataSourceCreateDto\n | FileDataSourceCreateDto\n | CodeDataSourceCreateDto\n | BaseDataSourceCreateDto;\n\n/** Base data source update DTO */\nexport interface BaseDataSourceUpdateDto {\n name: string;\n project_name: string;\n description?: string;\n project_space_visible?: boolean;\n setting_id?: string | null;\n type: DataSourceTypeType;\n full_reindex?: boolean;\n skip_reindex?: boolean;\n resume_indexing?: boolean;\n incremental_reindex?: boolean;\n}\n\nexport interface ConfluenceDataSourceUpdateDto\n extends BaseDataSourceUpdateDto,\n Partial<Confluence> {\n type: typeof DataSourceType.CONFLUENCE;\n}\nexport interface JiraDataSourceUpdateDto extends BaseDataSourceUpdateDto, Partial<Jira> {\n type: typeof DataSourceType.JIRA;\n}\nexport interface GoogleDataSourceUpdateDto extends BaseDataSourceUpdateDto, Partial<Google> {\n type: typeof DataSourceType.GOOGLE;\n}\nexport interface FileDataSourceUpdateDto extends BaseDataSourceUpdateDto, Partial<Files> {\n type: typeof DataSourceType.FILE;\n}\nexport interface CodeDataSourceUpdateDto\n extends Omit<BaseDataSourceUpdateDto, \"setting_id\" | \"project_space_visible\">,\n Partial<Code> {\n type: typeof DataSourceType.CODE;\n}\n\nexport type DataSourceUpdateDto =\n | ConfluenceDataSourceUpdateDto\n | JiraDataSourceUpdateDto\n | GoogleDataSourceUpdateDto\n | FileDataSourceUpdateDto\n | CodeDataSourceUpdateDto\n | BaseDataSourceUpdateDto;\n\n/** Processing information for datasource */\nexport interface DataSourceProcessingInfoResponse {\n /** Total number of documents processed */\n total_documents?: number;\n /** Number of documents skipped */\n skipped_documents?: number;\n /** Total size in kilobytes */\n total_size_kb?: number;\n /** Average file size in bytes */\n average_file_size_bytes?: number;\n /** List of unique file extensions */\n unique_extensions?: string[];\n /** Filtered documents count or list */\n filtered_documents?: number | string[];\n /** Number of processed documents */\n documents_count_key?: number;\n}\n\n/** Processing information for datasource */\nexport interface DataSourceProcessingInfo {\n /** Total number of documents processed */\n total_documents_count?: number;\n /** Number of documents skipped */\n skipped_documents_count?: number;\n /** Total size in kilobytes */\n total_size_kb?: number;\n /** Average file size in bytes */\n average_file_size_bytes?: number;\n /** List of unique file extensions */\n unique_extensions?: string[];\n /** Filtered documents count or list */\n filtered_documents?: number | string[];\n /** Number of processed documents */\n processed_documents_count?: number;\n}\n\nexport type DataSourceResponse = BaseDataSourceResponse | CodeDataSourceResponse;\n\n/** Datasource response interface */\nexport interface BaseDataSourceResponse {\n /** Unique identifier */\n id: string;\n /** Project name */\n project_name: string;\n /** Datasource name */\n repo_name: string;\n /** Description */\n description?: string;\n /** Type of datasource */\n index_type: DataSourceTypeType;\n /** Embeddings model used */\n embeddings_model?: string;\n /** Current status */\n status: DataSourceStatusType;\n /** Setting ID reference */\n setting_id?: string;\n /** Creation date */\n date: string;\n /** Creator information */\n created_by: BaseUser;\n /** Whether shared with project */\n project_space_visible: boolean;\n /** Last update date */\n update_date: string;\n /** Error message if failed */\n text?: string;\n /** User abilities list */\n user_abilities: string[];\n /** Processing information */\n processing_info?: DataSourceProcessingInfoResponse;\n /** List of processed documents */\n processed_files?: string[];\n /** Token usage statistics */\n tokens_usage?: TokensUsage;\n /** Jira-specific configuration */\n jira?: Jira;\n /** Confluence-specific configuration */\n confluence?: Confluence;\n /** Google document link */\n google_doc_link?: string;\n}\n\nexport type CodeDataSourceResponse = BaseDataSourceResponse & {\n /** Repository URL */\n link: string;\n /** Branch name */\n branch: string;\n /** Type of index to create */\n index_type: CodeDataSourceTypeType;\n /** Files filter pattern */\n files_filter?: string;\n /** Embeddings model to use */\n embeddings_model?: string;\n /** Summarization model to use */\n summarization_model?: string;\n /** Custom summarization prompt */\n prompt?: string;\n /** Enable documentation generation */\n docs_generation?: boolean;\n};\n\n/** Datasource model */\nexport interface DataSource {\n /** Unique identifier */\n id: string;\n /** Project name */\n project_name: string;\n /** Datasource name */\n name: string;\n /** Description */\n description?: string;\n /** Type of datasource */\n type: DataSourceTypeType;\n /** Embeddings model used */\n embeddings_model?: string;\n /** Current status */\n status: DataSourceStatusType;\n /** Setting ID reference */\n setting_id?: string | null;\n /** Creation date */\n created_date: string;\n /** Creator information */\n created_by: BaseUser;\n /** Whether shared with project */\n shared_with_project: boolean;\n /** Last update date */\n update_date: string;\n /** Error message if failed */\n error_message?: string;\n /** User abilities list */\n user_abilities: string[];\n /** Processing information */\n processing_info?: DataSourceProcessingInfo;\n /** List of processed documents */\n processed_documents?: string[];\n /** Token usage statistics */\n tokens_usage?: TokensUsage;\n /** Code-specific configuration */\n code?: Partial<Code>;\n /** Jira-specific configuration */\n jira?: Jira;\n /** Confluence-specific configuration */\n confluence?: Confluence;\n /** Google document link */\n google_doc_link?: string;\n}\n\n/** DataSource fetch parameters */\nexport type DataSourceListParams = {\n page?: number;\n per_page?: number;\n sort_key?: \"date\" | \"update_date\";\n sort_order?: SortOrder;\n datasource_types?: DataSourceTypeType[];\n projects?: string[];\n owner?: string;\n status?: DataSourceStatusType;\n};\n\n// Datasources create and update parameters\nexport interface BaseConfluenceParams {\n /** Confluence Query Language string */\n cql: string;\n /** Include restricted content */\n include_restricted_content?: boolean;\n /** Include archived content */\n include_archived_content?: boolean;\n /** Include attachments */\n include_attachments?: boolean;\n /** Include comments */\n include_comments?: boolean;\n /** Keep markdown format */\n keep_markdown_format?: boolean;\n /** Keep newlines */\n keep_newlines?: boolean;\n /** Maximum pages to fetch */\n max_pages?: number;\n /** Pages per request */\n pages_per_request?: number;\n}\n\nexport interface BaseJiraParams {\n /** Jira Query Language string */\n jql: string;\n}\n\n/** File-specific configuration */\nexport interface BaseFileParams {\n /** List of files with their content and mime type */\n files: File[];\n}\n\n/** Google-specific configuration */\nexport interface BaseGoogleParams {\n /** Google document ID or URL */\n google_doc: string;\n}\n\n/** Code repository configuration */\nexport interface BaseCodeParams {\n /** Repository URL */\n link: string;\n /** Branch name */\n branch: string;\n /** Type of index to create */\n index_type: CodeDataSourceTypeType;\n /** Files filter pattern */\n files_filter?: string;\n /** Embeddings model to use */\n embeddings_model?: string;\n /** Summarization model to use */\n summarization_model?: string;\n /** Custom summarization prompt */\n prompt?: string;\n /** Enable documentation generation */\n docs_generation?: boolean;\n}\n\nexport interface BaseDataSourceCreateParams {\n /** Name of the datasource */\n name: string;\n /** Project name */\n project_name: string;\n /** Description of the datasource */\n description: string;\n /** Whether to share with project */\n shared_with_project: boolean;\n /** Setting ID reference */\n setting_id: string | null;\n /** Type of datasource */\n type: DataSourceTypeType;\n}\n\nexport interface ConfluenceDataSourceCreateParams\n extends BaseDataSourceCreateParams,\n BaseConfluenceParams {\n type: typeof DataSourceType.CONFLUENCE;\n}\nexport interface JiraDataSourceCreateParams extends BaseDataSourceCreateParams, BaseJiraParams {\n type: typeof DataSourceType.JIRA;\n}\nexport interface GoogleDataSourceCreateParams extends BaseDataSourceCreateParams, BaseGoogleParams {\n type: typeof DataSourceType.GOOGLE;\n}\nexport interface FileDataSourceCreateParams extends BaseDataSourceCreateParams, BaseFileParams {\n type: typeof DataSourceType.FILE;\n}\nexport interface CodeDataSourceCreateParams extends BaseDataSourceCreateParams, BaseCodeParams {\n type: typeof DataSourceType.CODE;\n}\nexport interface OtherDataSourceCreateParams extends BaseDataSourceCreateParams {\n type:\n | typeof DataSourceType.PROVIDER\n | typeof DataSourceType.SUMMARY\n | typeof DataSourceType.CHUNK_SUMMARY\n | typeof DataSourceType.JSON;\n}\n\n/** DataSource create parameters */\nexport type DataSourceCreateParams =\n | ConfluenceDataSourceCreateParams\n | JiraDataSourceCreateParams\n | GoogleDataSourceCreateParams\n | FileDataSourceCreateParams\n | CodeDataSourceCreateParams\n | OtherDataSourceCreateParams;\n\nexport interface BaseDataSourceUpdateParams {\n /** Type of datasource */\n type: DataSourceTypeType;\n /** Name of the datasource */\n name: string;\n /** Project name */\n project_name: string;\n /** Description of the datasource */\n description?: string;\n /** Whether to share with project */\n shared_with_project?: boolean;\n /** Setting ID reference */\n setting_id?: string | null;\n /** Perform full reindex */\n full_reindex?: boolean;\n /** Skip reindex operation */\n skip_reindex?: boolean;\n /** Resume interrupted indexing */\n resume_indexing?: boolean;\n /** Perform incremental reindex */\n incremental_reindex?: boolean;\n}\n\nexport interface ConfluenceDataSourceUpdateParams\n extends BaseDataSourceUpdateParams,\n Partial<BaseConfluenceParams> {\n type: typeof DataSourceType.CONFLUENCE;\n}\nexport interface JiraDataSourceUpdateParams\n extends BaseDataSourceUpdateParams,\n Partial<BaseJiraParams> {\n type: typeof DataSourceType.JIRA;\n}\nexport interface GoogleDataSourceUpdateParams\n extends BaseDataSourceUpdateParams,\n Partial<BaseGoogleParams> {\n type: typeof DataSourceType.GOOGLE;\n}\nexport interface FileDataSourceUpdateParams\n extends BaseDataSourceUpdateParams,\n Partial<BaseFileParams> {\n type: typeof DataSourceType.FILE;\n}\nexport interface CodeDataSourceUpdateParams\n extends BaseDataSourceUpdateParams,\n Partial<BaseCodeParams> {\n type: typeof DataSourceType.CODE;\n}\nexport interface OtherDataSourceUpdateParams extends BaseDataSourceUpdateParams {\n type:\n | typeof DataSourceType.PROVIDER\n | typeof DataSourceType.SUMMARY\n | typeof DataSourceType.CHUNK_SUMMARY\n | typeof DataSourceType.JSON;\n}\n\n/** DataSource update parameters */\nexport type DataSourceUpdateParams =\n | ConfluenceDataSourceUpdateParams\n | JiraDataSourceUpdateParams\n | GoogleDataSourceUpdateParams\n | FileDataSourceUpdateParams\n | CodeDataSourceUpdateParams\n | OtherDataSourceUpdateParams;\n","import type {\n CodeDataSourceResponse,\n CodeDataSourceCreateParams,\n CodeDataSourceUpdateParams,\n ConfluenceDataSourceCreateParams,\n ConfluenceDataSourceUpdateParams,\n DataSource,\n DataSourceCreateDto,\n DataSourceCreateParams,\n DataSourceProcessingInfo,\n DataSourceProcessingInfoResponse,\n DataSourceResponse,\n DataSourceUpdateDto,\n DataSourceUpdateParams,\n FileDataSourceCreateParams,\n FileDataSourceUpdateParams,\n GoogleDataSourceCreateParams,\n GoogleDataSourceUpdateParams,\n JiraDataSourceCreateParams,\n JiraDataSourceUpdateParams,\n Code,\n} from \"../models\";\nimport { DataSourceType } from \"../models/datasource\";\nimport { omitUndefined } from \"../utils/helpers\";\n\nexport class DatasourceMapper {\n /** Transforms API response into a client-friendly DataSource model, maintaining API-agnostic interface */\n static mapDatasourceResponse(response: DataSourceResponse): DataSource {\n return omitUndefined({\n ...DatasourceMapper.mapDataSourceResponseCommonFields(response),\n ...(response.index_type === DataSourceType.JIRA && {\n jira: response.jira,\n }),\n ...(response.index_type === DataSourceType.CONFLUENCE && {\n confluence: response.confluence,\n }),\n ...(response.index_type === DataSourceType.GOOGLE && {\n google_doc: response.google_doc_link,\n }),\n ...(response.index_type === DataSourceType.CODE && {\n code: DatasourceMapper.extractCodeDataSourceResponseFields(\n response as CodeDataSourceResponse,\n ),\n }),\n });\n }\n\n static mapDataSourceResponseCommonFields(response: DataSourceResponse) {\n return {\n id: response.id,\n created_by: response.created_by,\n created_date: response.date,\n description: response.description,\n embeddings_model: response.embeddings_model,\n error_message: response.text,\n name: response.repo_name,\n processed_documents: response.processed_files,\n processing_info: response.processing_info\n ? DatasourceMapper.mapDatasourceProcessingInfoResponse(response.processing_info)\n : undefined,\n project_name: response.project_name,\n setting_id: response.setting_id,\n shared_with_project: response.project_space_visible,\n status: response.status,\n tokens_usage: response.tokens_usage,\n type: response.index_type,\n update_date: response.update_date,\n user_abilities: response.user_abilities,\n };\n }\n\n static extractCodeDataSourceResponseFields(response: CodeDataSourceResponse): Partial<Code> {\n return omitUndefined({\n branch: response.branch,\n docsGeneration: response.docs_generation || false,\n embeddingsModel: response.embeddings_model,\n filesFilter: response.files_filter,\n indexType: response.index_type,\n link: response.link,\n projectSpaceVisible: response.project_space_visible || false,\n prompt: response.prompt,\n settingId: response.setting_id,\n summarizationModel: response.summarization_model,\n });\n }\n\n /** Converts processing metadata from API format to client model format with consistent property naming */\n static mapDatasourceProcessingInfoResponse(\n response: DataSourceProcessingInfoResponse,\n ): DataSourceProcessingInfo {\n return omitUndefined({\n total_documents_count: response.total_documents,\n skipped_documents_count: response.skipped_documents,\n total_size_kb: response.total_size_kb,\n average_file_size_bytes: response.average_file_size_bytes,\n unique_extensions: response.unique_extensions,\n filtered_documents: response.filtered_documents,\n processed_documents_count: response.documents_count_key,\n });\n }\n\n /** Transforms datasource creation parameters into DTO format, applying type-specific mappings based on datasource type */\n static mapDatasourceCreateToDto(create: DataSourceCreateParams): DataSourceCreateDto {\n return omitUndefined({\n ...DatasourceMapper.mapCommonDataSourceParams(create),\n ...(create.type === DataSourceType.CONFLUENCE &&\n DatasourceMapper.mapConfluenceDataSourceParams(create as ConfluenceDataSourceCreateParams)),\n ...(create.type === DataSourceType.JIRA &&\n DatasourceMapper.mapJiraDataSourceParams(create as JiraDataSourceCreateParams)),\n ...(create.type === DataSourceType.GOOGLE &&\n DatasourceMapper.mapGoogleDataSourceParams(create as GoogleDataSourceCreateParams)),\n ...(create.type === DataSourceType.FILE &&\n DatasourceMapper.mapFileDataSourceParams(create as FileDataSourceCreateParams)),\n ...(create.type === DataSourceType.CODE &&\n DatasourceMapper.mapCodeDataSourceParams(create as CodeDataSourceCreateParams)),\n });\n }\n\n /** Converts datasource update parameters to DTO format with conditional inclusion of type-specific properties */\n static mapDatasourceUpdateToDto(update: DataSourceUpdateParams): DataSourceUpdateDto {\n return omitUndefined({\n ...DatasourceMapper.mapCommonUpdateDataSourceParams(update),\n ...(update.type === DataSourceType.CONFLUENCE &&\n DatasourceMapper.mapConfluenceDataSourceParams(update as ConfluenceDataSourceUpdateParams)),\n ...(update.type === DataSourceType.JIRA &&\n DatasourceMapper.mapJiraDataSourceParams(update as JiraDataSourceUpdateParams)),\n ...(update.type === DataSourceType.GOOGLE &&\n DatasourceMapper.mapGoogleDataSourceParams(update as GoogleDataSourceUpdateParams)),\n ...(update.type === DataSourceType.FILE &&\n DatasourceMapper.mapFileDataSourceParams(update as FileDataSourceUpdateParams)),\n ...(update.type === DataSourceType.CODE &&\n DatasourceMapper.mapCodeDataSourceParams(update as CodeDataSourceUpdateParams)),\n });\n }\n\n /** Maps Confluence-specific configuration parameters for content filtering and pagination options */\n private static mapConfluenceDataSourceParams<\n T extends ConfluenceDataSourceCreateParams | ConfluenceDataSourceUpdateParams,\n >(params: T) {\n return {\n cql: params.cql,\n include_restricted_content: params.include_restricted_content,\n include_archived_content: params.include_archived_content,\n include_attachments: params.include_attachments,\n include_comments: params.include_comments,\n keep_markdown_format: params.keep_markdown_format,\n keep_newlines: params.keep_newlines,\n max_pages: params.max_pages,\n pages_per_request: params.pages_per_request,\n };\n }\n\n /** Maps Jira-specific parameters, transforming JQL (Jira Query Language) filter configuration */\n private static mapJiraDataSourceParams<\n T extends JiraDataSourceCreateParams | JiraDataSourceUpdateParams,\n >(params: T) {\n return {\n jql: params.jql,\n };\n }\n\n /** Maps Google Doc specific parameters with proper API naming conventions */\n private static mapGoogleDataSourceParams<\n T extends GoogleDataSourceCreateParams | GoogleDataSourceUpdateParams,\n >(params: T) {\n return {\n googleDoc: params.google_doc,\n };\n }\n\n /** Maps file upload datasource parameters, handling file reference collections */\n private static mapFileDataSourceParams<\n T extends FileDataSourceCreateParams | FileDataSourceUpdateParams,\n >(params: T) {\n return {\n files: params.files,\n };\n }\n\n /** Maps code repository specific parameters including indexing strategy and code processing settings */\n private static mapCodeDataSourceParams<\n T extends CodeDataSourceCreateParams | CodeDataSourceUpdateParams,\n >(params: T) {\n return {\n settingId: params.setting_id,\n projectSpaceVisible: params.shared_with_project || false,\n link: params.link,\n branch: params.branch,\n indexType: params.index_type,\n filesFilter: params.files_filter,\n embeddingsModel: params.embeddings_model,\n summarizationModel: params.summarization_model,\n prompt: params.prompt,\n docsGeneration: params.docs_generation || false,\n };\n }\n\n /** Maps general datasource parameters common across all datasource types with appropriate fallback values */\n private static mapCommonDataSourceParams(params: DataSourceCreateParams) {\n return {\n name: params.name,\n project_name: params.project_name,\n description: params.description,\n project_space_visible: params.shared_with_project || false,\n setting_id: params.setting_id || null,\n type: params.type,\n };\n }\n\n private static mapCommonUpdateDataSourceParams(params: DataSourceUpdateParams) {\n return omitUndefined({\n name: params.name,\n project_name: params.project_name,\n description: params.description,\n project_space_visible: params.shared_with_project || false,\n setting_id: params.setting_id || null,\n type: params.type,\n });\n }\n}\n","/** Models for integration-related data structures */\n\n/**\n * Credential types as constant object\n */\nexport const CredentialTypes = {\n JIRA: \"Jira\",\n CONFLUENCE: \"Confluence\",\n GIT: \"Git\",\n KUBERNETES: \"Kubernetes\",\n AWS: \"AWS\",\n GCP: \"GCP\",\n KEYCLOAK: \"Keycloak\",\n AZURE: \"Azure\",\n ELASTIC: \"Elastic\",\n OPENAPI: \"OpenAPI\",\n PLUGIN: \"Plugin\",\n FILESYSTEM: \"FileSystem\",\n SCHEDULER: \"Scheduler\",\n WEBHOOK: \"Webhook\",\n EMAIL: \"Email\",\n AZURE_DEVOPS: \"AzureDevOps\",\n SONAR: \"Sonar\",\n SQL: \"SQL\",\n TELEGRAM: \"Telegram\",\n ZEPHYR_CLOUD: \"ZephyrCloud\",\n ZEPHYR_SQUAD: \"ZephyrSquad\",\n SERVICE_NOW: \"ServiceNow\",\n DIAL: \"DIAL\",\n A2A: \"A2A\",\n MCP: \"MCP\",\n LITE_LLM: \"LiteLLM\",\n REPORT_PORTAL: \"ReportPortal\",\n} as const;\n\nexport type CredentialTypesType = (typeof CredentialTypes)[keyof typeof CredentialTypes];\n\n/**\n * Integration types as constant object\n */\nexport const IntegrationType = {\n USER: \"user\",\n PROJECT: \"project\",\n} as const;\n\nexport type IntegrationTypeType = (typeof IntegrationType)[keyof typeof IntegrationType];\n\n/**\n * Model for credential values\n */\nexport interface CredentialValues {\n /** Key for the credential value */\n key: string;\n /** Value of the credential (can be any type) */\n value: unknown;\n}\n\n/**\n * Model for settings configuration\n */\nexport interface Integration {\n /** Integration ID */\n id: string;\n /** Creation date */\n date?: string;\n /** Last update date */\n update_date?: string;\n /** User ID */\n user_id?: string;\n /** Project name */\n project_name: string;\n /** Integration alias */\n alias?: string;\n /** Whether this is the default integration */\n default?: boolean;\n /** Type of credential */\n credential_type: CredentialTypesType;\n /** List of credential values */\n credential_values: CredentialValues[];\n /** Type of integration */\n setting_type: IntegrationTypeType;\n}\n","import { z } from \"zod\";\nimport { CredentialTypes, IntegrationType, type IntegrationTypeType } from \"../models/integration\";\n\nexport const IntegrationListParamsSchema = z\n .object({\n setting_type: z\n .enum([IntegrationType.USER, IntegrationType.PROJECT])\n .prefault(IntegrationType.USER),\n page: z.number().prefault(0),\n per_page: z.number().prefault(10),\n filters: z.record(z.string(), z.unknown()).optional(),\n })\n .readonly();\nexport type IntegrationListParams = Partial<z.infer<typeof IntegrationListParamsSchema>>;\n\nexport const IntegrationGetParamsSchema = z\n .object({\n integration_id: z.string(),\n setting_type: z\n .enum([IntegrationType.USER, IntegrationType.PROJECT])\n .prefault(IntegrationType.USER),\n })\n .readonly();\nexport type IntegrationGetParams = z.infer<typeof IntegrationGetParamsSchema>;\n\nexport const IntegrationGetByAliasParamsSchema = z\n .object({\n alias: z.string(),\n setting_type: z\n .enum([IntegrationType.USER, IntegrationType.PROJECT])\n .prefault(IntegrationType.USER),\n })\n .readonly();\nexport type IntegrationGetByAliasParams = Omit<\n z.infer<typeof IntegrationGetByAliasParamsSchema>,\n \"setting_type\"\n> & {\n setting_type?: IntegrationTypeType;\n};\n\nconst CredentialValueSchema = z.object({\n key: z.string(),\n value: z.unknown(),\n});\n\nexport const IntegrationCreateParamsSchema = z\n .object({\n credential_type: z.enum(Object.values(CredentialTypes) as [string, ...string[]]),\n credential_values: z.array(CredentialValueSchema),\n project_name: z.string(),\n setting_type: z\n .enum([IntegrationType.USER, IntegrationType.PROJECT])\n .prefault(IntegrationType.USER),\n alias: z.string().optional(),\n default: z.boolean().optional().prefault(false),\n project: z.string().optional(),\n enabled: z.boolean().optional().prefault(true),\n external_id: z.string().optional(),\n })\n .readonly();\nexport type IntegrationCreateParams = Omit<\n z.infer<typeof IntegrationCreateParamsSchema>,\n \"default\" | \"enabled\"\n> & {\n default?: boolean;\n enabled?: boolean;\n};\n\nexport const IntegrationUpdateParamsSchema = IntegrationCreateParamsSchema;\nexport type IntegrationUpdateParams = Omit<\n z.infer<typeof IntegrationUpdateParamsSchema>,\n \"default\" | \"enabled\"\n> & {\n default?: boolean;\n enabled?: boolean;\n};\n","import { NotFoundError } from \"../exceptions\";\nimport type { AnyJson, PaginatedResponse, AuthConfig } from \"../models/common\";\nimport { type Integration, IntegrationType, type IntegrationTypeType } from \"../models/integration\";\nimport {\n IntegrationCreateParamsSchema,\n type IntegrationCreateParams,\n IntegrationGetByAliasParamsSchema,\n type IntegrationGetByAliasParams,\n IntegrationGetParamsSchema,\n type IntegrationGetParams,\n IntegrationListParamsSchema,\n type IntegrationListParams,\n IntegrationUpdateParamsSchema,\n type IntegrationUpdateParams,\n} from \"../schemas/integration\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nexport class IntegrationService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get base API path based on setting type.\n */\n private getBasePath(settingType: IntegrationTypeType): string {\n return `/v1/settings/${settingType === IntegrationType.USER ? \"user\" : \"project\"}`;\n }\n\n /**\n * Get list of available integrations.\n */\n async list(_params: IntegrationListParams = {}): Promise<Integration[]> {\n const params = IntegrationListParamsSchema.parse(_params);\n const settingType = params.setting_type;\n\n const queryParams = {\n page: params.page,\n per_page: params.per_page,\n ...(params.filters && { filters: JSON.stringify(params.filters) }),\n };\n\n const response = await this.api.get<PaginatedResponse<Integration>>(\n this.getBasePath(settingType),\n queryParams,\n );\n\n return response.data;\n }\n\n /**\n * Get integration by ID.\n */\n async get(_params: IntegrationGetParams): Promise<Integration> {\n const params = IntegrationGetParamsSchema.parse(_params);\n const settingType = params.setting_type;\n const integrationId = params.integration_id;\n\n const integrations = await this.list({\n per_page: 100,\n setting_type: settingType,\n });\n\n const integration = integrations.find((i) => i.id === integrationId);\n if (!integration) {\n throw new NotFoundError(\"Integration\", integrationId);\n }\n\n return integration;\n }\n\n /**\n * Get integration by alias.\n */\n async getByAlias(_params: IntegrationGetByAliasParams): Promise<Integration> {\n const params = IntegrationGetByAliasParamsSchema.parse(_params);\n const settingType = params.setting_type;\n const alias = params.alias;\n\n const integrations = await this.list({\n per_page: 100,\n setting_type: settingType,\n });\n\n const integration = integrations.find((i) => i.alias === alias);\n if (!integration) {\n throw new NotFoundError(\"Integration\", alias);\n }\n\n return integration;\n }\n\n /**\n * Create a new integration.\n */\n async create(_params: IntegrationCreateParams): Promise<AnyJson> {\n const params = IntegrationCreateParamsSchema.parse(_params);\n const settingType = params.setting_type;\n\n return this.api.post(this.getBasePath(settingType), {\n ...params,\n setting_type: settingType,\n default: false,\n });\n }\n\n /**\n * Update an existing integration.\n */\n async update(settingId: string, _params: IntegrationUpdateParams): Promise<AnyJson> {\n const params = IntegrationUpdateParamsSchema.parse(_params);\n const settingType = params.setting_type;\n\n return this.api.put(`${this.getBasePath(settingType)}/${settingId}`, {\n ...params,\n setting_type: settingType,\n default: false,\n });\n }\n\n /**\n * Delete an integration by ID.\n */\n async delete(\n settingId: string,\n settingType: IntegrationTypeType = IntegrationType.USER,\n ): Promise<AnyJson> {\n return this.api.delete(`${this.getBasePath(settingType)}/${settingId}`);\n }\n}\n","import type { AuthConfig } from \"../models/common\";\nimport type { LLMModel } from \"../models/llm\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nexport class LLMService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get list of available LLM models.\n */\n async list(): Promise<LLMModel[]> {\n return this.api.get<LLMModel[]>(\"/v1/llm_models\");\n }\n\n /**\n * Get list of available embeddings models.\n */\n async listEmbeddings(): Promise<LLMModel[]> {\n return this.api.get<LLMModel[]>(\"/v1/embeddings_models\");\n }\n}\n","import type { AuthConfig } from \"../models/common\";\nimport type { BackgroundTaskEntity } from \"../models/task\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nexport class TaskService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get a background task by ID.\n */\n async get(taskId: string): Promise<BackgroundTaskEntity> {\n return this.api.get(`/v1/tasks/${taskId}`);\n }\n}\n","import type { AboutUser, AboutUserResponse } from \"../models\";\nimport { omitUndefined } from \"../utils/helpers\";\n\nexport class UserMapper {\n static mapAboutUserResponse(response: AboutUserResponse): AboutUser {\n return omitUndefined({\n user_id: response.userId,\n name: response.name,\n username: response.username,\n is_admin: response.isAdmin,\n applications: response.applications,\n applications_admin: response.applicationsAdmin,\n picture: response.picture,\n knowledge_bases: response.knowledgeBases,\n });\n }\n}\n","import { UserMapper } from \"../mappers/user.mapper\";\nimport type { AuthConfig } from \"../models/common\";\nimport type { AboutUser, AboutUserResponse, UserData } from \"../models/user\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nexport class UserService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get current user profile.\n */\n async aboutMe(): Promise<AboutUser> {\n const response = await this.api.get<AboutUserResponse>(\"/v1/user\");\n return UserMapper.mapAboutUserResponse(response);\n }\n\n /**\n * Get user data and preferences.\n */\n async getData(): Promise<UserData> {\n return this.api.get(\"/v1/user/data\");\n }\n}\n","import type {\n Workflow,\n WorkflowExecution,\n WorkflowExecutionResponse,\n WorkflowResponse,\n} from \"../models\";\nimport { omitUndefined } from \"../utils/helpers\";\n\nexport class WorkflowMapper {\n static mapWorkflowResponse(response: WorkflowResponse): Workflow {\n return omitUndefined({\n id: response.id,\n project: response.project,\n name: response.name,\n description: response.description,\n yaml_config: response.yaml_config,\n mode: response.mode,\n shared: response.shared,\n icon_url: response.icon_url,\n created_date: response.date,\n update_date: response.update_date,\n created_by: response.created_by,\n });\n }\n\n static mapWorkflowExecutionResponse(response: WorkflowExecutionResponse): WorkflowExecution {\n return omitUndefined({\n id: response.id,\n execution_id: response.execution_id,\n workflow_id: response.workflow_id,\n overall_status: response.status,\n created_date: response.date,\n prompt: response.prompt,\n updated_date: response.updated_date,\n created_by: response.created_by,\n tokens_usage: response.tokens_usage,\n });\n }\n}\n","import { z } from \"zod\";\nimport { WorkflowMode } from \"../models/workflow\";\n\n/**\n * Workflow list parameters schema\n */\nexport const WorkflowListParamsSchema = z\n .object({\n page: z.number().prefault(0),\n per_page: z.number().prefault(10),\n projects: z.array(z.string()).optional(),\n })\n .readonly();\nexport type WorkflowListParams = Partial<z.infer<typeof WorkflowListParamsSchema>>;\n\n/**\n * Workflow create parameters schema\n */\nexport const WorkflowCreateParamsSchema = z\n .object({\n project: z.string(),\n name: z.string(),\n description: z.string().optional(),\n yaml_config: z.string(),\n mode: z.enum([WorkflowMode.SEQUENTIAL, WorkflowMode.AUTONOMOUS]),\n shared: z.boolean(),\n icon_url: z.string().optional(),\n })\n .readonly();\nexport type WorkflowCreateParams = z.infer<typeof WorkflowCreateParamsSchema>;\n\n/**\n * Workflow update parameters schema\n */\nexport const WorkflowUpdateParamsSchema = z\n .object({\n project: z.string(),\n name: z.string(),\n description: z.string().optional(),\n yaml_config: z.string(),\n mode: z.enum([WorkflowMode.SEQUENTIAL, WorkflowMode.AUTONOMOUS]).optional(),\n shared: z.boolean().optional(),\n icon_url: z.string().optional(),\n })\n .readonly();\nexport type WorkflowUpdateParams = z.infer<typeof WorkflowUpdateParamsSchema>;\n\n/**\n * Workflow execution list parameters schema\n */\nexport const WorkflowExecutionListParamsSchema = z\n .object({\n page: z.number().prefault(0),\n per_page: z.number().prefault(10),\n })\n .readonly();\nexport type WorkflowExecutionListParams = Partial<\n z.infer<typeof WorkflowExecutionListParamsSchema>\n>;\n\n/**\n * Workflow execution create parameters schema\n */\nexport const WorkflowExecutionCreateParamsSchema = z\n .object({\n user_input: z\n .union([\n z.string(),\n z.record(z.string(), z.unknown()),\n z.array(z.unknown()),\n z.number(),\n z.boolean(),\n ])\n .optional(),\n file_name: z.string().optional(),\n propagate_headers: z.boolean().optional(),\n })\n .readonly();\nexport type WorkflowExecutionCreateParams = z.infer<typeof WorkflowExecutionCreateParamsSchema>;\n\n/**\n * Workflow execution state list parameters schema\n */\nexport const WorkflowExecutionStateListParamsSchema = z\n .object({\n page: z.number().prefault(0),\n per_page: z.number().prefault(10),\n })\n .readonly();\nexport type WorkflowExecutionStateListParams = Partial<\n z.infer<typeof WorkflowExecutionStateListParamsSchema>\n>;\n","/** Models for workflow functionality */\nimport type { BaseUser, TokensUsage } from \"./common\";\n\n/** Available workflow modes */\nexport const WorkflowMode = {\n SEQUENTIAL: \"Sequential\",\n AUTONOMOUS: \"Autonomous\",\n} as const;\nexport type WorkflowModeType = (typeof WorkflowMode)[keyof typeof WorkflowMode];\n\n/** Workflow execution status */\nexport const ExecutionStatus = {\n IN_PROGRESS: \"In Progress\",\n NOT_STARTED: \"Not Started\",\n INTERRUPTED: \"Interrupted\",\n FAILED: \"Failed\",\n SUCCEEDED: \"Succeeded\",\n ABORTED: \"Aborted\",\n} as const;\nexport type ExecutionStatusType = (typeof ExecutionStatus)[keyof typeof ExecutionStatus];\n\n/** Workflow API response */\nexport interface WorkflowResponse {\n /** Unique identifier */\n id: string;\n /** Project name */\n project: string;\n /** Workflow name */\n name: string;\n /** Workflow description */\n description?: string;\n /** YAML configuration */\n yaml_config?: string;\n /** Workflow execution mode */\n mode: WorkflowModeType;\n /** Whether workflow is shared */\n shared: boolean;\n /** URL to workflow icon */\n icon_url?: string;\n /** Creation date */\n date: string;\n /** Last update date */\n update_date: string;\n /** Creator information */\n created_by: BaseUser;\n}\n\n/** Workflow model */\nexport interface Workflow {\n /** Unique identifier */\n id: string;\n /** Project name */\n project: string;\n /** Workflow name */\n name: string;\n /** Workflow description */\n description?: string;\n /** YAML configuration */\n yaml_config?: string;\n /** Workflow execution mode */\n mode: WorkflowModeType;\n /** Whether workflow is shared */\n shared: boolean;\n /** URL to workflow icon */\n icon_url?: string;\n /** Creation date */\n created_date: string;\n /** Last update date */\n update_date: string;\n /** Creator information */\n created_by: BaseUser;\n}\n\n/** Workflow execution API response */\nexport interface WorkflowExecutionResponse {\n /** Unique identifier */\n id: string;\n /** Execution identifier */\n execution_id: string;\n /** Associated workflow identifier */\n workflow_id: string;\n /** Execution status */\n status: ExecutionStatusType;\n /** Creation date */\n date: string;\n /** Execution prompt */\n prompt: string;\n /** Last update date */\n updated_date?: string;\n /** Creator information */\n created_by: BaseUser;\n /** Token usage statistics */\n tokens_usage?: TokensUsage;\n}\n\n/** Model representing a workflow execution */\nexport interface WorkflowExecution {\n /** Unique identifier */\n id: string;\n /** Execution identifier */\n execution_id: string;\n /** Associated workflow identifier */\n workflow_id: string;\n /** Execution status */\n overall_status: ExecutionStatusType;\n /** Creation date */\n created_date: string;\n /** Execution prompt */\n prompt: string;\n /** Last update date */\n updated_date?: string;\n /** Creator information */\n created_by: BaseUser;\n /** Token usage statistics */\n tokens_usage?: TokensUsage;\n}\n\n/** Model for workflow execution state thought */\nexport interface WorkflowExecutionStateThought {\n /** Unique identifier */\n id: string;\n /** Thought content */\n text: string;\n /** Creation timestamp */\n created_at: string;\n /** Parent thought identifier */\n parent_id?: string;\n}\n\n/** Model for workflow execution state */\nexport interface WorkflowExecutionState {\n /** Unique identifier */\n id: string;\n /** Execution identifier */\n execution_id: string;\n /** State name */\n name: string;\n /** Associated task */\n task?: string;\n /** State status */\n status: ExecutionStatusType;\n /** Start timestamp */\n started_at?: string;\n /** Completion timestamp */\n completed_at?: string;\n}\n\n/** Model for workflow execution state output */\nexport interface WorkflowExecutionStateOutput {\n /** Output content */\n output?: string;\n}\n","import type { PaginatedResponse } from \"../models/common\";\nimport type { WorkflowExecutionState, WorkflowExecutionStateOutput } from \"../models/workflow\";\nimport {\n WorkflowExecutionStateListParamsSchema,\n type WorkflowExecutionStateListParams,\n} from \"../schemas/workflow\";\nimport type { ApiRequestHandler } from \"../utils/http\";\n\nexport class WorkflowExecutionStateService {\n private api: ApiRequestHandler;\n private workflowId: string;\n private executionId: string;\n\n constructor(api: ApiRequestHandler, workflowId: string, executionId: string) {\n this.api = api;\n this.workflowId = workflowId;\n this.executionId = executionId;\n }\n\n /**\n * List states for the workflow execution with filtering and pagination support.\n */\n async list(_params: WorkflowExecutionStateListParams = {}): Promise<WorkflowExecutionState[]> {\n const params = WorkflowExecutionStateListParamsSchema.parse(_params);\n\n const queryParams = {\n page: params.page,\n per_page: params.per_page,\n };\n\n const response = await this.api.get<PaginatedResponse<WorkflowExecutionState>>(\n `/v1/workflows/${this.workflowId}/executions/${this.executionId}/states`,\n { params: queryParams },\n );\n\n return response.data;\n }\n\n /**\n * Get output for a specific execution state.\n */\n async getOutput(stateId: string): Promise<WorkflowExecutionStateOutput> {\n return this.api.get(\n `/v1/workflows/${this.workflowId}/executions/${this.executionId}/states/${stateId}/output`,\n );\n }\n}\n","import { WorkflowMapper } from \"../mappers/workflow.mapper\";\nimport type { AnyJson, PaginatedResponse } from \"../models/common\";\nimport type { WorkflowExecution, WorkflowExecutionResponse } from \"../models/workflow\";\nimport {\n WorkflowExecutionCreateParamsSchema,\n WorkflowExecutionListParamsSchema,\n type WorkflowExecutionListParams,\n} from \"../schemas/workflow\";\nimport type { ApiRequestHandler } from \"../utils/http\";\nimport { WorkflowExecutionStateService } from \"./workflow_execution_state\";\n\nexport class WorkflowExecutionService {\n private api: ApiRequestHandler;\n private workflowId: string;\n\n constructor(api: ApiRequestHandler, workflowId: string) {\n this.api = api;\n this.workflowId = workflowId;\n }\n\n /**\n * List executions for the workflow with filtering and pagination support.\n */\n async list(_params: WorkflowExecutionListParams = {}): Promise<WorkflowExecution[]> {\n const params = WorkflowExecutionListParamsSchema.parse(_params);\n\n const queryParams = {\n page: params.page,\n per_page: params.per_page,\n };\n\n const response = await this.api.get<PaginatedResponse<WorkflowExecutionResponse>>(\n `/v1/workflows/${this.workflowId}/executions`,\n { params: queryParams },\n );\n\n return response.data.map(WorkflowMapper.mapWorkflowExecutionResponse);\n }\n\n /**\n * Create a new workflow execution.\n */\n async create(\n userInput?: string | Record<string, unknown> | unknown[] | number | boolean,\n fileName?: string,\n propagateHeaders?: boolean,\n headers?: Record<string, string>,\n ): Promise<AnyJson> {\n const params = WorkflowExecutionCreateParamsSchema.parse({\n user_input: userInput,\n file_name: fileName,\n propagate_headers: propagateHeaders,\n });\n return this.api.post(`/v1/workflows/${this.workflowId}/executions`, params, {}, headers);\n }\n\n /**\n * Get workflow execution by ID.\n */\n async get(executionId: string): Promise<WorkflowExecution> {\n const response = await this.api.get<WorkflowExecutionResponse>(\n `/v1/workflows/${this.workflowId}/executions/${executionId}`,\n );\n return WorkflowMapper.mapWorkflowExecutionResponse(response);\n }\n\n /**\n * Get states service for a specific workflow execution.\n */\n states(executionId: string): WorkflowExecutionStateService {\n return new WorkflowExecutionStateService(this.api, this.workflowId, executionId);\n }\n\n /**\n * Delete all workflow executions.\n */\n async deleteAll(): Promise<AnyJson> {\n return this.api.delete(`/v1/workflows/${this.workflowId}/executions`);\n }\n\n /**\n * Abort a running workflow execution.\n */\n async abort(executionId: string): Promise<AnyJson> {\n return this.api.put(`/v1/workflows/${this.workflowId}/executions/${executionId}/abort`);\n }\n\n /**\n * Resume an interrupted workflow execution.\n */\n async resume(\n executionId: string,\n propagateHeaders?: boolean,\n headers?: Record<string, string>,\n ): Promise<AnyJson> {\n const config = { params: { propagate_headers: propagateHeaders } };\n // empty body per API; send {} with query param and optional headers\n return this.api.put(\n `/v1/workflows/${this.workflowId}/executions/${executionId}/resume`,\n {},\n config,\n headers,\n );\n }\n}\n","import { WorkflowMapper } from \"../mappers/workflow.mapper\";\nimport type { AnyJson, PaginatedResponse, AuthConfig } from \"../models/common\";\nimport type { Workflow, WorkflowResponse } from \"../models/workflow\";\nimport {\n WorkflowCreateParamsSchema,\n type WorkflowCreateParams,\n WorkflowListParamsSchema,\n type WorkflowListParams,\n WorkflowUpdateParamsSchema,\n type WorkflowUpdateParams,\n} from \"../schemas/workflow\";\nimport { ApiRequestHandler } from \"../utils/http\";\nimport { WorkflowExecutionService } from \"./workflow_execution\";\n\nexport class WorkflowService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get list of prebuilt workflows.\n */\n async getPrebuilt(): Promise<Workflow[]> {\n const response = await this.api.get<WorkflowResponse[]>(\"/v1/workflows/prebuilt\");\n return response.map(WorkflowMapper.mapWorkflowResponse);\n }\n\n /**\n * Create a new workflow.\n */\n async create(_params: WorkflowCreateParams): Promise<AnyJson> {\n const params = WorkflowCreateParamsSchema.parse(_params);\n return this.api.post(\"/v1/workflows\", params);\n }\n\n /**\n * Update an existing workflow.\n */\n async update(workflowId: string, _params: WorkflowUpdateParams): Promise<AnyJson> {\n const params = WorkflowUpdateParamsSchema.parse(_params);\n return this.api.put(`/v1/workflows/${workflowId}`, params);\n }\n\n /**\n * List workflows with filtering and pagination support.\n */\n async list(_params: WorkflowListParams = {}): Promise<Workflow[]> {\n const params = WorkflowListParamsSchema.parse(_params);\n\n const queryParams = {\n filters: JSON.stringify({\n page: params.page,\n per_page: params.per_page,\n ...(params.projects?.length ? { projects: params.projects } : {}),\n }),\n };\n\n const workflows = await this.api.get<PaginatedResponse<WorkflowResponse>>(\"/v1/workflows\", {\n params: queryParams,\n });\n\n return workflows.data.map(WorkflowMapper.mapWorkflowResponse);\n }\n\n /**\n * Get workflow by ID.\n */\n async get(workflowId: string): Promise<Workflow> {\n const response = await this.api.get<WorkflowResponse>(`/v1/workflows/id/${workflowId}`);\n return WorkflowMapper.mapWorkflowResponse(response);\n }\n\n /**\n * Delete a workflow by ID.\n */\n async delete(workflowId: string): Promise<AnyJson> {\n return this.api.delete(`/v1/workflows/${workflowId}`);\n }\n\n /**\n * Run a workflow by ID.\n */\n async run(\n workflowId: string,\n userInput?: string | Record<string, unknown> | unknown[] | number | boolean,\n fileName?: string,\n propagateHeaders?: boolean,\n headers?: Record<string, string>,\n ): Promise<AnyJson> {\n return this.executions(workflowId).create(userInput, fileName, propagateHeaders, headers);\n }\n\n /**\n * Get workflow execution service for the specified workflow.\n */\n executions(workflowId: string): WorkflowExecutionService {\n return new WorkflowExecutionService(this.api, workflowId);\n }\n}\n","import { KeycloakCredentials } from \"../auth/credentials\";\nimport type { AuthConfig } from \"../models/common\";\nimport { AssistantService } from \"../services/assistant\";\nimport { ConversationService } from \"../services/conversation\";\nimport { DatasourceService } from \"../services/datasource\";\nimport { IntegrationService } from \"../services/integration\";\nimport { LLMService } from \"../services/llm\";\nimport { TaskService } from \"../services/task\";\nimport { UserService } from \"../services/user\";\nimport { WorkflowService } from \"../services/workflow\";\n\nexport interface CodeMieClientConfig {\n auth_server_url?: string;\n auth_realm_name?: string;\n codemie_api_domain: string;\n auth_client_id?: string;\n auth_client_secret?: string;\n username?: string;\n password?: string;\n cookies?: Record<string, string>;\n verify_ssl?: boolean;\n}\n\nexport class CodeMieClient {\n private auth: KeycloakCredentials | null = null;\n private token: string | null = null;\n private cookies: Record<string, string>;\n private apiDomain: string;\n private verifySSL: boolean;\n private useCookieAuth: boolean;\n\n // Service instances\n private _assistants: AssistantService;\n private _conversations: ConversationService;\n private _llms: LLMService;\n private _integrations: IntegrationService;\n private _tasks: TaskService;\n private _users: UserService;\n private _datasources: DatasourceService;\n private _workflows: WorkflowService;\n\n constructor(config: CodeMieClientConfig) {\n const {\n auth_server_url,\n auth_realm_name,\n codemie_api_domain,\n auth_client_id,\n auth_client_secret,\n username,\n password,\n cookies,\n verify_ssl = true,\n } = config;\n\n this.apiDomain = codemie_api_domain.replace(/\\/$/, \"\");\n this.verifySSL = verify_ssl;\n this.cookies = cookies || {};\n this.useCookieAuth = !!cookies && Object.keys(cookies).length > 0;\n\n // Initialize token-based authentication only if not using cookie authentication\n if (!this.useCookieAuth) {\n // Validate required fields for token-based authentication\n if (!auth_server_url || !auth_realm_name) {\n throw new Error(\n \"auth_server_url and auth_realm_name are required when not using cookie authentication\"\n );\n }\n\n this.auth = new KeycloakCredentials({\n serverUrl: auth_server_url,\n realmName: auth_realm_name,\n clientId: auth_client_id,\n clientSecret: auth_client_secret,\n username: username,\n password: password,\n verifySSL: verify_ssl,\n });\n this.token = \"\"; // Will be set in initialize()\n }\n\n // Initialize services with shared auth config\n const authConfig: AuthConfig = {\n apiDomain: this.apiDomain,\n token: this.token,\n verifySSL: this.verifySSL,\n cookies: this.cookies,\n };\n\n this._assistants = new AssistantService(authConfig);\n this._conversations = new ConversationService(authConfig);\n this._llms = new LLMService(authConfig);\n this._integrations = new IntegrationService(authConfig);\n this._tasks = new TaskService(authConfig);\n this._users = new UserService(authConfig);\n this._datasources = new DatasourceService(authConfig);\n this._workflows = new WorkflowService(authConfig);\n }\n\n /**\n * Get the AssistantService instance.\n */\n get assistants(): AssistantService {\n return this._assistants;\n }\n\n /**\n * Get the ConversationService instance.\n */\n get conversations(): ConversationService {\n return this._conversations;\n }\n\n /**\n * Get the LLMService instance.\n */\n get llms(): LLMService {\n return this._llms;\n }\n\n /**\n * Get the IntegrationService instance.\n */\n get integrations(): IntegrationService {\n return this._integrations;\n }\n\n /**\n * Get the TaskService instance.\n */\n get tasks(): TaskService {\n return this._tasks;\n }\n\n /**\n * Get the UserService instance.\n */\n get users(): UserService {\n return this._users;\n }\n\n /**\n * Get the DatasourceService instance.\n */\n get datasources(): DatasourceService {\n return this._datasources;\n }\n\n /**\n * Get the WorkflowService instance.\n */\n get workflows(): WorkflowService {\n return this._workflows;\n }\n\n /**\n * Initialize the client by obtaining the initial token.\n * This should be called after creating the client instance.\n * When using cookie-based authentication, this is a no-op.\n */\n async initialize(): Promise<void> {\n // Skip initialization for cookie-based authentication\n if (this.useCookieAuth) {\n return;\n }\n\n if (!this.auth) {\n throw new Error(\"Authentication not configured\");\n }\n\n this.token = await this.auth.getToken();\n await this.refreshServices();\n }\n\n /**\n * Get the current access token or fetch a new one if not available.\n * Returns null when using cookie-based authentication.\n */\n async getToken(): Promise<string | null> {\n // Return null for cookie-based authentication\n if (this.useCookieAuth) {\n return null;\n }\n\n if (!this.auth) {\n throw new Error(\"Authentication not configured\");\n }\n\n if (!this.token) {\n this.token = await this.auth.getToken();\n await this.refreshServices();\n }\n return this.token;\n }\n\n /**\n * Force token refresh and update all services with the new token.\n * Throws an error when using cookie-based authentication.\n */\n async refreshToken(): Promise<string> {\n // Cookie-based authentication doesn't support token refresh\n if (this.useCookieAuth) {\n throw new Error(\"Token refresh is not supported with cookie-based authentication\");\n }\n\n if (!this.auth) {\n throw new Error(\"Authentication not configured\");\n }\n\n this.token = await this.auth.getToken();\n await this.refreshServices();\n return this.token;\n }\n\n /**\n * Reinitialize all services with the current token or cookies.\n */\n private async refreshServices(): Promise<void> {\n // For cookie-based auth, services are already initialized with cookies\n if (this.useCookieAuth) {\n return;\n }\n\n if (!this.token) {\n throw new Error(\"Token not available\");\n }\n\n const authConfig: AuthConfig = {\n apiDomain: this.apiDomain,\n token: this.token,\n verifySSL: this.verifySSL,\n cookies: this.cookies,\n };\n\n this._assistants = new AssistantService(authConfig);\n this._conversations = new ConversationService(authConfig);\n this._llms = new LLMService(authConfig);\n this._integrations = new IntegrationService(authConfig);\n this._tasks = new TaskService(authConfig);\n this._users = new UserService(authConfig);\n this._datasources = new DatasourceService(authConfig);\n this._workflows = new WorkflowService(authConfig);\n }\n}\n","/** Models for assistant-related data structures. */\n\nimport type { BaseUser } from \"./common\";\nimport type { Integration } from \"./integration\";\n\nexport enum ContextType {\n KNOWLEDGE_BASE = \"knowledge_base\",\n CODE = \"code\",\n}\n\nexport enum ChatRole {\n ASSISTANT = \"Assistant\",\n USER = \"User\",\n}\n\nexport interface ToolDetails {\n description?: string | null;\n label?: string;\n name: string;\n settings?: Integration | null;\n settings_config: boolean;\n user_description?: string;\n}\n\nexport interface ToolKitDetails {\n is_external: boolean;\n label: string;\n settings?: Integration;\n settings_config: boolean;\n toolkit: string;\n tools: ToolDetails[];\n}\n\nexport interface Context {\n context_type: ContextType;\n name: string;\n}\n\nexport interface PromptVariable {\n key: string;\n description?: string;\n default_value: string;\n}\n\nexport interface MCPServerConfig {\n command?: string;\n url?: string;\n args?: string[];\n env?: Record<string, unknown>;\n headers?: Record<string, string>;\n type?: string;\n auth_token?: string;\n}\n\nexport interface MCPServerDetails {\n name: string;\n description?: string;\n enabled: boolean;\n config?: MCPServerConfig;\n mcp_connect_url?: string;\n tools_tokens_size_limit?: number;\n command?: string;\n arguments?: string;\n settings?: Integration;\n mcp_connect_auth_token?: Integration;\n}\n\nexport interface SystemPromptHistory {\n system_prompt: string;\n date: string;\n created_by?: BaseUser;\n}\n\nexport interface AssistantCategory {\n id: string;\n name: string;\n description?: string;\n}\n\nexport interface AssistantBase {\n id: string;\n created_by?: BaseUser;\n description: string;\n icon_url?: string;\n name: string;\n}\n\nexport interface Assistant extends AssistantBase {\n assistant_ids: string[];\n categories?: AssistantCategory[];\n context: Context[];\n conversation_starters: string[];\n created_date?: string;\n creator: string;\n is_global: boolean;\n is_react: boolean;\n llm_model_type?: string;\n mcp_servers: MCPServerDetails[];\n nested_assistants: Partial<Assistant>[];\n project: string;\n prompt_variables?: PromptVariable[];\n shared: boolean;\n slug?: string;\n system_prompt: string;\n system_prompt_history: SystemPromptHistory[];\n temperature?: number;\n toolkits: ToolKitDetails[];\n top_p?: number;\n unique_users_count?: number;\n updated_date?: string;\n user_abilities?: unknown[];\n version_count?: number;\n}\n\nexport interface BaseModelApiResponse {\n generated: string;\n timeElapsed?: number;\n tokensUsed?: number;\n thoughts?: Record<string, unknown>[];\n taskId?: string;\n}\n\nexport interface BaseModelResponse {\n generated: string | object | unknown;\n time_elapsed?: number;\n tokens_used?: number;\n thoughts?: Record<string, unknown>[];\n task_id?: string;\n}\n\n// Assistant versioning models\nexport interface AssistantVersion {\n version_number: number;\n created_date: string;\n created_by?: BaseUser;\n change_notes?: string;\n description?: string;\n system_prompt: string;\n llm_model_type?: string;\n temperature?: number;\n top_p?: number;\n context: Context[];\n toolkits: ToolKitDetails[];\n mcp_servers: MCPServerDetails[];\n assistant_ids: string[];\n prompt_variables?: PromptVariable[];\n // allow future fields without breaking consumers\n [key: string]: unknown;\n}\n\n// Assistant validation models\nexport interface MissingIntegration {\n toolkit: string;\n tool: string;\n label: string;\n credential_type?: string;\n}\n\nexport interface MissingIntegrationsByCredentialType {\n credential_type: string;\n missing_tools: MissingIntegration[];\n assistant_id?: string;\n assistant_name?: string;\n icon_url?: string;\n}\n\nexport interface IntegrationValidationResult {\n has_missing_integrations: boolean;\n missing_by_credential_type: MissingIntegrationsByCredentialType[];\n sub_assistants_missing: MissingIntegrationsByCredentialType[];\n message?: string;\n}\n\nexport interface AssistantCreateResponse {\n message: string;\n assistant_id?: string;\n validation?: IntegrationValidationResult;\n}\n\nexport interface AssistantUpdateResponse {\n message: string;\n validation?: IntegrationValidationResult;\n}\n\n// Note: compareVersions returns a generic object; no strict SDK interface is defined\n","/** Models for LLM service. */\n\n/** LLM provider options as constant object */\nexport const LLMProvider = {\n AZURE_OPENAI: \"azure_openai\",\n AWS_BEDROCK: \"aws_bedrock\",\n GOOGLE_VERTEXAI: \"google_vertexai\",\n} as const;\n\nexport type LLMProviderType = (typeof LLMProvider)[keyof typeof LLMProvider];\n\n/** Cost configuration for LLM model */\nexport interface CostConfig {\n /** Cost per input token */\n input: number;\n /** Cost per output token */\n output: number;\n}\n\n/** Features supported by LLM model */\nexport interface LLMFeatures {\n /** Support for streaming responses */\n streaming: boolean;\n /** Support for tool usage */\n tools: boolean;\n /** Support for temperature parameter */\n temperature: boolean;\n /** Support for parallel tool calls */\n parallel_tool_calls: boolean;\n /** Support for system prompt */\n system_prompt: boolean;\n /** Support for max tokens parameter */\n max_tokens: boolean;\n}\n\n/** LLM model configuration. */\nexport interface LLMModel {\n /** Base name of the model */\n base_name: string;\n /** Deployment name */\n deployment_name: string;\n /** Display label */\n label?: string;\n /** Whether model supports multimodal inputs */\n multimodal?: boolean;\n /** Whether model supports react agent pattern */\n react_agent?: boolean;\n /** Whether the model is enabled */\n enabled: boolean;\n /** LLM provider */\n provider?: LLMProviderType;\n /** Whether this is the default model */\n default?: boolean;\n /** Cost configuration */\n cost?: CostConfig;\n /** Maximum output tokens */\n max_output_tokens?: number;\n /** Supported features */\n features: LLMFeatures;\n}\n","/** Models for task service. */\n\n/** Background task status constants */\nexport const BackgroundTaskStatus = {\n STARTED: \"STARTED\",\n COMPLETED: \"COMPLETED\",\n FAILED: \"FAILED\",\n} as const;\nexport type BackgroundTaskStatusType =\n (typeof BackgroundTaskStatus)[keyof typeof BackgroundTaskStatus];\n\n/** Model representing task user information */\nexport interface TaskUser {\n /** Unique identifier of the user */\n user_id: string;\n /** Username of the task owner */\n username: string;\n /** Display name of the task owner */\n name: string;\n}\n\n/** Model representing a background task */\nexport interface BackgroundTaskEntity {\n /** Unique identifier of the task */\n id: string;\n /** Task description or name */\n task: string;\n /** Information about the task owner */\n user: TaskUser;\n /** The final result or output of the task */\n final_output?: string;\n /** Current step or stage of the task */\n current_step?: string;\n /** Task status (STARTED, COMPLETED, or FAILED) */\n status: BackgroundTaskStatusType;\n /** Task creation timestamp */\n date: string;\n /** Last update timestamp */\n update_date: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,wBAAsB;AACtB,mBAAkB;AAGlB,IAAM,oBAAoB;AAEnB,IAAM,sBAAN,MAA0B;AAAA,EAI/B,YAAY,QAAmC;AAC7C,SAAK,0BAA0B,MAAM;AACrC,SAAK,SAAS;AAEd,SAAK,YAAY,IAAI,wBAAM;AAAA,MACzB,oBAAoB,OAAO;AAAA,IAC7B,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,WAA4B;AAChC,UAAM,EAAE,WAAW,UAAU,IAAI,KAAK;AACtC,UAAM,MAAM,GAAG,SAAS,WAAW,SAAS;AAE5C,UAAM,UACJ,KAAK,OAAO,YAAY,KAAK,OAAO,WAChC,KAAK,sCAAsC,IAC3C,KAAK,+BAA+B;AAE1C,UAAM,EAAE,KAAK,IAAI,MAAM,aAAAA,QAAM,KAAoB,KAAK,KAAK,mBAAmB,OAAO,GAAG;AAAA,MACtF,SAAS,EAAE,gBAAgB,oCAAoC;AAAA,MAC/D,YAAY,KAAK;AAAA,IACnB,CAAC;AAED,WAAO,KAAK;AAAA,EACd;AAAA,EAEQ,wCAAsD;AAC5D,UAAM,EAAE,UAAU,UAAU,SAAS,IAAI,KAAK;AAE9C,WAAO;AAAA,MACL,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,WAAW,YAAY;AAAA,IACzB;AAAA,EACF;AAAA,EAEQ,iCAA+C;AACrD,UAAM,EAAE,UAAU,aAAa,IAAI,KAA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;AAE7C,QAAI,KAAK,eAAe;AACtB;AAAA,IACF;AAEA,QAAI,CAAC,KAAK,OAAO;AACf,YAAM,IAAI,MAAM,qBAAqB;AAAA,IACvC;AAEA,UAAM,aAAyB;AAAA,MAC7B,WAAW,KAAK;AAAA,MAChB,OAAO,KAAK;AAAA,MACZ,WAAW,KAAK;AAAA,MAChB,SAAS,KAAK;AAAA,IAChB;AAEA,SAAK,cAAc,IAAI,iBAAiB,UAAU;AAClD,SAAK,iBAAiB,IAAI,oBAAoB,UAAU;AACxD,SAAK,QAAQ,IAAI,WAAW,UAAU;AACtC,SAAK,gBAAgB,IAAI,mBAAmB,UAAU;AACtD,SAAK,SAAS,IAAI,YAAY,UAAU;AACxC,SAAK,SAAS,IAAI,YAAY,UAAU;AACxC,SAAK,eAAe,IAAI,kBAAkB,UAAU;AACpD,SAAK,aAAa,IAAI,gBAAgB,UAAU;AAAA,EAClD;AACF;;;AC7OO,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,oBAAiB;AACjB,EAAAA,aAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAKL,IAAK,WAAL,kBAAKC,cAAL;AACL,EAAAA,UAAA,eAAY;AACZ,EAAAA,UAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;;;ACPL,IAAM,cAAc;AAAA,EACzB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,iBAAiB;AACnB;;;ACJO,IAAM,uBAAuB;AAAA,EAClC,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AACV;","names":["axios","import_zod","import_node_https","import_axios","axios","errorMessage","import_zod","FormData","import_zod","import_zod","ContextType","ChatRole"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/auth/credentials.ts","../src/utils/helpers.ts","../src/mappers/assistant.mapper.ts","../src/services/assistant.ts","../src/schemas/assistant.ts","../src/utils/http.ts","../src/exceptions/exceptions.ts","../src/schemas/conversation.ts","../src/services/conversation.ts","../src/services/datasource.ts","../src/models/datasource.ts","../src/mappers/datasource.mapper.ts","../src/models/integration.ts","../src/schemas/integration.ts","../src/services/integration.ts","../src/services/llm.ts","../src/services/task.ts","../src/mappers/user.mapper.ts","../src/services/user.ts","../src/mappers/workflow.mapper.ts","../src/schemas/workflow.ts","../src/models/workflow.ts","../src/services/workflow_execution_state.ts","../src/services/workflow_execution.ts","../src/services/workflow.ts","../src/client/client.ts","../src/models/assistant.ts","../src/models/errors.ts","../src/models/llm.ts","../src/models/task.ts"],"sourcesContent":["export * from \"./client\";\nexport * from \"./exceptions\";\nexport * from \"./models\";\nexport * from \"./schemas\";\nexport { formatCookies } from \"./utils/http\";\n","import { Agent } from \"node:https\";\nimport axios from \"axios\";\nimport type { KeycloakCredentialsConfig, TokenPayload, TokenResponse } from \"./types\";\n\nconst DEFAULT_CLIENT_ID = \"codemie-sdk\";\n\nexport class KeycloakCredentials {\n private config: KeycloakCredentialsConfig;\n private httpAgent: Agent;\n\n constructor(config: KeycloakCredentialsConfig) {\n this.validateConfigCredentials(config);\n this.config = config;\n\n this.httpAgent = new Agent({\n rejectUnauthorized: config.verifySSL,\n });\n }\n\n async getToken(): Promise<string> {\n const { serverUrl, realmName } = this.config;\n const url = `${serverUrl}/realms/${realmName}/protocol/openid-connect/token`;\n\n const payload =\n this.config.username && this.config.password\n ? this.createResourceOwnerCredentialsPayload()\n : this.createClientCredentialsPayload();\n\n const { data } = await axios.post<TokenResponse>(url, this.createSearchParams(payload), {\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n httpsAgent: this.httpAgent,\n });\n\n return data.access_token;\n }\n\n private createResourceOwnerCredentialsPayload(): TokenPayload {\n const { username, password, clientId } = this.config;\n\n return {\n grant_type: \"password\",\n username,\n password,\n client_id: clientId || DEFAULT_CLIENT_ID,\n };\n }\n\n private createClientCredentialsPayload(): TokenPayload {\n const { clientId, clientSecret } = this.config;\n\n return {\n grant_type: \"client_credentials\",\n client_id: clientId || DEFAULT_CLIENT_ID,\n client_secret: clientSecret,\n };\n }\n\n private createSearchParams(payload: Record<string, string | undefined>): URLSearchParams {\n return new URLSearchParams(\n Object.fromEntries(Object.entries(payload).filter(([_, v]) => v !== undefined)) as Record<\n string,\n string\n >,\n );\n }\n\n private validateConfigCredentials(config: KeycloakCredentialsConfig): void {\n if (!((config.clientId && config.clientSecret) || (config.username && config.password))) {\n throw new Error(\n \"Either client credentials (clientId, clientSecret) or \" +\n \"user credentials (username, password) must be provided\",\n );\n }\n }\n}\n","/**\n * Utility function to omit properties with undefined values from an object.\n * Helper during API response mapping to ensure clean data.\n */\nexport function omitUndefined<T extends Record<string, unknown>>(obj: T): T {\n return Object.fromEntries(Object.entries(obj).filter(([_, value]) => value !== undefined)) as T;\n}\n","import type { BaseModelApiResponse, BaseModelResponse } from \"../models\";\nimport { omitUndefined } from \"../utils/helpers\";\n\nexport class AssistantMapper {\n static mapBaseModelApiResponse(response: BaseModelApiResponse): BaseModelResponse {\n return omitUndefined({\n generated: response.generated,\n time_elapsed: response.timeElapsed,\n tokens_used: response.tokensUsed,\n thoughts: response.thoughts,\n task_id: response.taskId,\n });\n }\n}\n","import { AssistantMapper } from \"../mappers/assistant.mapper\";\nimport type {\n Assistant,\n AssistantBase,\n AssistantVersion,\n BaseModelApiResponse,\n BaseModelResponse,\n ToolKitDetails,\n AssistantCreateResponse,\n AssistantUpdateResponse,\n} from \"../models/assistant\";\nimport type { AnyJson, AuthConfig, PaginatedResponse } from \"../models/common\";\nimport { z } from \"zod\";\nimport {\n AssistantChatParamsSchema,\n type AssistantCreateParams,\n AssistantCreateParamsSchema,\n type AssistantListParams,\n AssistantListParamsSchema,\n type AssistantUpdateParams,\n AssistantUpdateParamsSchema,\n type AssistantChatParams,\n AssistantVersionsListParamsSchema,\n type AssistantVersionsListParams,\n} from \"../schemas/assistant\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\n// Union of supported response shapes for versions list endpoint to avoid `any`.\n// - Backend may return a raw array, or wrap in {data: [...]}, or {versions: [...]}.\nexport type VersionsListResponse =\n | AssistantVersion[]\n | { data: AssistantVersion[]; [key: string]: unknown }\n | { versions: AssistantVersion[]; [key: string]: unknown }\n | { items: AssistantVersion[]; [key: string]: unknown };\n\nexport class AssistantService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get list of available assistants.\n */\n async list(_params: AssistantListParams = {}): Promise<(Assistant | AssistantBase)[]> {\n const params = AssistantListParamsSchema.parse(_params);\n\n const response = await this.api.get<PaginatedResponse<Assistant | AssistantBase>>(\n \"/v1/assistants\",\n {\n ...params,\n ...(params.filters && { filters: JSON.stringify(params.filters) }),\n },\n );\n\n return response.data;\n }\n\n /**\n * Get list of available assistants with pagination metadata.\n */\n async listPaginated(_params: AssistantListParams = {}): Promise<PaginatedResponse<Assistant | AssistantBase>> {\n const params = AssistantListParamsSchema.parse(_params);\n\n const response = await this.api.get<PaginatedResponse<Assistant | AssistantBase>>(\n \"/v1/assistants\",\n {\n ...params,\n ...(params.filters && { filters: JSON.stringify(params.filters) }),\n },\n );\n\n return response;\n }\n\n /**\n * Get assistant by ID.\n */\n async get(assistantId: string): Promise<Assistant> {\n return this.api.get<Assistant>(`/v1/assistants/id/${assistantId}`);\n }\n\n /**\n * Get assistant by slug.\n */\n async getBySlug(slug: string): Promise<Assistant> {\n return this.api.get<Assistant>(`/v1/assistants/slug/${slug}`);\n }\n\n /**\n * Create a new assistant.\n * @returns AssistantCreateResponse with assistant_id and optional validation results\n */\n async create(_params: AssistantCreateParams): Promise<AssistantCreateResponse> {\n const params = AssistantCreateParamsSchema.parse(_params);\n return this.api.post<AssistantCreateResponse>(\"/v1/assistants\", params);\n }\n\n /**\n * Update an existing assistant.\n * @returns AssistantUpdateResponse with optional validation results\n */\n async update(\n assistantId: string,\n _params: AssistantUpdateParams,\n ): Promise<AssistantUpdateResponse> {\n const params = AssistantUpdateParamsSchema.parse(_params);\n return this.api.put<AssistantUpdateResponse>(`/v1/assistants/${assistantId}`, params);\n }\n\n /**\n * Get list of available tools.\n */\n async getTools(): Promise<ToolKitDetails[]> {\n return this.api.get<ToolKitDetails[]>(\"/v1/assistants/tools\");\n }\n\n /**\n * Delete an assistant by ID.\n */\n async delete(assistantId: string): Promise<AnyJson> {\n return this.api.delete(`/v1/assistants/${assistantId}`);\n }\n\n /**\n * Get list of prebuilt assistants.\n */\n async getPrebuilt(): Promise<Assistant[]> {\n return this.api.get<Assistant[]>(\"/v1/assistants/prebuilt\");\n }\n\n /**\n * Get prebuilt assistant by slug.\n */\n async getPrebuiltBySlug(slug: string): Promise<Assistant> {\n return this.api.get<Assistant>(`/v1/assistants/prebuilt/${slug}`);\n }\n\n /**\n * List assistant versions.\n */\n async listVersions(\n assistantId: string,\n _params: AssistantVersionsListParams = {},\n ): Promise<AssistantVersion[]> {\n const params = AssistantVersionsListParamsSchema.parse(_params);\n const response = await this.api.get<VersionsListResponse>(\n `/v1/assistants/${assistantId}/versions`,\n params,\n );\n // Support multiple backend response shapes: array, {data: [...]}, {versions: [...]}, {items: [...]}.\n if (Array.isArray(response)) {\n return response;\n }\n if (response && \"data\" in response && Array.isArray(response.data)) {\n return response.data;\n }\n if (\n response &&\n \"versions\" in response &&\n Array.isArray((response as { versions: unknown }).versions)\n ) {\n return (response as { versions: AssistantVersion[] }).versions;\n }\n if (response && \"items\" in response && Array.isArray((response as { items: unknown }).items)) {\n return (response as { items: AssistantVersion[] }).items;\n }\n return [];\n }\n\n /**\n * Get a specific assistant version by number.\n */\n async getVersion(assistantId: string, versionNumber: number): Promise<AssistantVersion> {\n return this.api.get<AssistantVersion>(\n `/v1/assistants/${assistantId}/versions/${versionNumber}`,\n );\n }\n\n /**\n * Send a chat request to an assistant.\n */\n async chat(\n assistantId: string,\n _params: AssistantChatParams,\n headers?: Record<string, string>,\n ): Promise<BaseModelResponse> {\n let zodSchema: z.ZodType | undefined = undefined;\n let params = { ..._params };\n\n if (params.output_schema && params.output_schema instanceof z.ZodType) {\n zodSchema = params.output_schema as z.ZodType;\n // Convert Zod schema to JSON schema\n params.output_schema = z.toJSONSchema(zodSchema);\n }\n\n params = AssistantChatParamsSchema.parse(params);\n\n const response = await this.api.post<BaseModelApiResponse>(\n `/v1/assistants/${assistantId}/model`,\n params,\n {\n responseType: params.stream ? \"stream\" : undefined,\n },\n headers,\n );\n\n const mapped = AssistantMapper.mapBaseModelApiResponse(response);\n\n if (!params.stream && zodSchema && mapped.generated) {\n mapped.generated = zodSchema.parse(mapped.generated);\n }\n\n return mapped;\n }\n\n /**\n * Send a chat request to an assistant by slug.\n */\n async chatBySlug(\n assistantSlug: string,\n _params: AssistantChatParams,\n headers?: Record<string, string>,\n ): Promise<BaseModelResponse> {\n let zodSchema: z.ZodType | undefined = undefined;\n let params = { ..._params };\n\n if (params.output_schema && params.output_schema instanceof z.ZodType) {\n zodSchema = params.output_schema as z.ZodType;\n params.output_schema = z.toJSONSchema(zodSchema);\n }\n\n params = AssistantChatParamsSchema.parse(params);\n\n const response = await this.api.post<BaseModelApiResponse>(\n `/v1/assistants/slug/${assistantSlug}/model`,\n params,\n {\n responseType: params.stream ? \"stream\" : undefined,\n },\n headers,\n );\n const mapped = AssistantMapper.mapBaseModelApiResponse(response);\n\n if (!params.stream && zodSchema && mapped.generated) {\n mapped.generated = zodSchema.parse(mapped.generated);\n }\n\n return mapped;\n }\n\n /**\n * Compare two assistant versions.\n */\n async compareVersions(\n assistantId: string,\n v1: number,\n v2: number,\n ): Promise<Record<string, unknown>> {\n return this.api.get<Record<string, unknown>>(\n `/v1/assistants/${assistantId}/versions/${v1}/compare/${v2}`,\n );\n }\n\n /**\n * Rollback assistant to a specific version. Creates a new version mirroring the target.\n */\n async rollbackToVersion(assistantId: string, versionNumber: number): Promise<AnyJson> {\n return this.api.post<AnyJson>(\n `/v1/assistants/${assistantId}/versions/${versionNumber}/rollback`,\n {},\n );\n }\n\n /**\n * Send a chat request to a specific assistant version.\n */\n async chatWithVersion(\n assistantId: string,\n versionNumber: number,\n _params: AssistantChatParams,\n ): Promise<BaseModelResponse> {\n let zodSchema: z.ZodType | undefined = undefined;\n let params = { ..._params };\n\n if (params.output_schema && params.output_schema instanceof z.ZodType) {\n zodSchema = params.output_schema as z.ZodType;\n params.output_schema = z.toJSONSchema(zodSchema);\n }\n\n params = AssistantChatParamsSchema.parse(params);\n\n // Use stable chat endpoint and pass version in body for broader backend compatibility\n const response = await this.api.post<BaseModelApiResponse>(\n `/v1/assistants/${assistantId}/model`,\n { ...params, version: versionNumber },\n {\n responseType: params.stream ? \"stream\" : undefined,\n },\n );\n\n const mapped = AssistantMapper.mapBaseModelApiResponse(response);\n\n if (!params.stream && zodSchema && mapped.generated) {\n mapped.generated = zodSchema.parse(mapped.generated);\n }\n\n return mapped;\n }\n}\n","import { z } from \"zod\";\n\nexport const AssistantListParamsSchema = z\n .object({\n minimal_response: z.boolean().prefault(true),\n scope: z.enum([\"visible_to_user\", \"marketplace\"]).prefault(\"visible_to_user\"),\n page: z.number().prefault(0),\n per_page: z.number().prefault(12),\n filters: z.record(z.string(), z.unknown()).optional(),\n })\n .readonly();\nexport type AssistantListParams = Partial<z.infer<typeof AssistantListParamsSchema>>;\n\nconst PromptVariableSchema = z.object({\n key: z.string(),\n description: z.string().optional(),\n default_value: z.string(),\n});\n\nexport const AssistantCreateParamsSchema = z\n .object({\n name: z.string(),\n description: z.string(),\n icon_url: z.string().optional(),\n system_prompt: z.string(),\n project: z.string(),\n context: z.array(\n z.object({\n context_type: z.enum([\"knowledge_base\", \"code\"]),\n name: z.string(),\n }),\n ),\n llm_model_type: z.string(),\n toolkits: z.array(\n z.object({\n toolkit: z.string(),\n tools: z.array(\n z.object({\n name: z.string(),\n label: z.string().optional(),\n settings_config: z.boolean(),\n user_description: z.string().optional(),\n settings: z.any().nullable().optional(),\n }),\n ),\n label: z.string(),\n settings_config: z.boolean(),\n is_external: z.boolean(),\n settings: z.any().optional(),\n }),\n ),\n conversation_starters: z.array(z.string()),\n shared: z.boolean().optional(),\n is_react: z.boolean().optional(),\n is_global: z.boolean().optional(),\n slug: z.string().optional(),\n temperature: z.number().optional(),\n top_p: z.number().optional(),\n mcp_servers: z.array(\n z.object({\n name: z.string(),\n description: z.string().optional(),\n enabled: z.boolean(),\n config: z\n .object({\n url: z.string().optional(),\n command: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), z.unknown()).optional(),\n auth_token: z.string().optional(),\n })\n .optional()\n .refine(\n (config) => {\n if (!config) {\n return true; // Allow undefined/null\n }\n const hasUrl = !!config.url;\n const hasCommand = !!config.command;\n return hasUrl !== hasCommand; // Either url or command must be present, but not both\n },\n {\n error: \"Either 'url' or 'command' must be provided in config, but not both\",\n },\n ),\n mcp_connect_url: z.string().optional(),\n tools_tokens_size_limit: z.number().optional(),\n command: z.string().optional(),\n arguments: z.string().optional(),\n settings: z.any().optional(),\n mcp_connect_auth_token: z.any().optional(),\n }),\n ),\n assistant_ids: z.array(z.string()),\n prompt_variables: z.array(PromptVariableSchema).optional().prefault([]),\n categories: z.array(z.string()).max(3).optional(),\n skip_integration_validation: z.boolean().optional().prefault(false),\n })\n .readonly();\n// In order to make sure that default values are applied correctly, we use z.input here\n// instead of z.infer which would give us the type after defaults are applied.\nexport type AssistantCreateParams = z.input<typeof AssistantCreateParamsSchema>;\n\nexport const AssistantUpdateParamsSchema = AssistantCreateParamsSchema;\nexport type AssistantUpdateParams = z.input<typeof AssistantUpdateParamsSchema>;\n\nexport const AssistantChatParamsSchema = z\n .object({\n conversation_id: z.string().optional(),\n text: z.string(),\n content_raw: z.string().optional(),\n file_names: z.array(z.string()).optional(),\n llm_model: z.string().optional(),\n history: z.union([\n z.array(\n z.object({\n role: z.enum([\"Assistant\", \"User\"]),\n message: z.string().optional(),\n }),\n ),\n z.string(),\n ]),\n history_index: z.number().optional(),\n stream: z.boolean().optional(),\n propagate_headers: z.boolean().optional(),\n custom_metadata: z.record(z.string(), z.unknown()).optional(),\n top_k: z.number().optional(),\n system_prompt: z.string().optional(),\n background_task: z.boolean().optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n mcp_server_single_usage: z.boolean().optional(),\n\n version: z.number().optional(),\n output_schema: z\n .union([z.custom((val) => val instanceof z.ZodType), z.record(z.string(), z.unknown())])\n .optional(),\n })\n .readonly();\nexport type AssistantChatParams = z.infer<typeof AssistantChatParamsSchema>;\n\nexport const AssistantVersionsListParamsSchema = z\n .object({\n page: z.number().optional(),\n per_page: z.number().optional(),\n })\n .readonly();\nexport type AssistantVersionsListParams = Partial<\n z.infer<typeof AssistantVersionsListParamsSchema>\n>;\n","import { Agent } from \"node:https\";\nimport axios from \"axios\";\nimport type { AxiosError, AxiosInstance, AxiosResponse } from \"axios/index\";\nimport type FormData from \"form-data\";\nimport { ApiError, NotFoundError } from \"../exceptions\";\nimport type { AuthConfig } from \"../models/common\";\n\nexport interface ApiResponse<T> {\n data: T;\n}\n\n/**\n * Convert cookies object to cookie string format.\n * Example: {key1: \"value1\", key2: \"value2\"} => \"key1=value1; key2=value2\"\n */\nexport function formatCookies(cookies: Record<string, string>): string {\n return Object.entries(cookies)\n .map(([key, value]) => `${key}=${value}`)\n .join(\"; \");\n}\n\nexport class ApiRequestHandler {\n private client: AxiosInstance;\n\n constructor(config: AuthConfig) {\n const { apiDomain, token, verifySSL = true, cookies = {} } = config;\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n };\n\n // Use Cookie header if cookies are provided, otherwise use Bearer token\n if (Object.keys(cookies).length > 0) {\n headers.Cookie = formatCookies(cookies);\n } else if (token) {\n headers.Authorization = `Bearer ${token}`;\n }\n\n this.client = axios.create({\n baseURL: apiDomain.replace(/\\/$/, \"\"), // Remove trailing slash\n validateStatus: (status: number) => status < 400,\n headers,\n httpsAgent: new Agent({\n rejectUnauthorized: verifySSL,\n }),\n });\n\n this.client.interceptors.response.use(\n (response: AxiosResponse) => response,\n (error: AxiosError) => this.processFailedResponse(error),\n );\n }\n\n private async request<T>(\n method: \"get\" | \"post\" | \"put\" | \"delete\",\n path: string,\n config: Record<string, unknown> = {},\n ): Promise<T> {\n const response = await this.client.request<T>({\n method,\n url: path,\n ...config,\n });\n return response.data;\n }\n\n /**\n * Merge extra headers into the request (used for X-* propagation)\n */\n private withHeaders(config: Record<string, unknown> = {}, extraHeaders?: Record<string, string>) {\n if (!extraHeaders || Object.keys(extraHeaders).length === 0) return config;\n const headers = (config.headers as Record<string, string> | undefined) ?? {};\n return { ...config, headers: { ...headers, ...extraHeaders } };\n }\n\n async get<T>(\n path: string,\n params?: Record<string, unknown>,\n config: Record<string, unknown> = {},\n extraHeaders?: Record<string, string>,\n ): Promise<T> {\n return this.request<T>(\"get\", path, this.withHeaders({ ...config, params }, extraHeaders));\n }\n\n async post<T>(\n path: string,\n data?: unknown,\n config: Record<string, unknown> = {},\n extraHeaders?: Record<string, string>,\n ): Promise<T> {\n return this.request<T>(\"post\", path, this.withHeaders({ ...config, data }, extraHeaders));\n }\n\n async put<T>(\n path: string,\n data?: unknown,\n config: Record<string, unknown> = {},\n extraHeaders?: Record<string, string>,\n ): Promise<T> {\n return this.request<T>(\"put\", path, this.withHeaders({ ...config, data }, extraHeaders));\n }\n\n async postMultipart<T>(\n url: string,\n formData: FormData,\n params?: Record<string, unknown>,\n ): Promise<T> {\n const response = await this.client.post<T>(url, formData, {\n headers: {\n \"Content-Type\": \"multipart/form-data\",\n },\n params,\n });\n return response.data;\n }\n\n async delete<T>(path: string, config: Record<string, unknown> = {}): Promise<T> {\n return this.request<T>(\"delete\", path, config);\n }\n\n async stream(\n path: string,\n data?: unknown,\n config: Record<string, unknown> = {},\n ): Promise<AxiosResponse> {\n return this.client.post(path, data, {\n ...config,\n responseType: \"stream\",\n });\n }\n\n private processFailedResponse(error: AxiosError): void {\n const response = error.response;\n const status = response?.status || 500;\n\n const data = (response?.data || {}) as {\n error?: { message?: string; detail?: string; help?: string; details?: string };\n };\n\n if (status === 404) {\n throw new NotFoundError(\"Resource\", \"unknown\");\n }\n\n if (status === 422) {\n // Validation error returns different structure (details instead of detail)\n const errorMessage = [\n data.error?.message,\n data.error?.help,\n JSON.stringify(data.error?.details ?? {}),\n ]\n .filter(Boolean)\n .join(\". \");\n throw new ApiError(errorMessage || \"Validation error\", status, data);\n }\n\n const errorMessage = [data.error?.message, data.error?.detail, data.error?.help]\n .filter(Boolean)\n .join(\". \");\n\n throw new ApiError(errorMessage, status, data);\n }\n}\n","import type { AnyJson } from \"../models/common\";\n\nexport class CodeMieError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"CodeMieError\";\n }\n}\n\nexport class ApiError extends CodeMieError {\n statusCode?: number;\n response?: AnyJson;\n\n constructor(message: string, statusCode?: number, response?: AnyJson) {\n super(message);\n this.name = \"ApiError\";\n this.statusCode = statusCode;\n this.response = response;\n }\n}\n\nexport class NotFoundError extends ApiError {\n constructor(resourceType: string, resourceId: string) {\n super(`${resourceType} with ${resourceId} not found`, 404);\n this.name = \"NotFoundError\";\n }\n}\n","import { z } from \"zod\";\n\nexport const ConversationCreateParamsSchema = z\n .object({\n initial_assistant_id: z.string().optional(),\n folder: z.string().optional(),\n mcp_server_single_usage: z.boolean().prefault(false).optional(),\n })\n .readonly();\n\nexport type ConversationCreateParams = z.infer<typeof ConversationCreateParamsSchema>;\n","import type { Conversation, ConversationDetails } from \"../models/conversation\";\nimport type { AnyJson, AuthConfig } from \"../models/common\";\nimport {\n ConversationCreateParamsSchema,\n type ConversationCreateParams,\n} from \"../schemas/conversation\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nexport class ConversationService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get list of all conversations for the current user.\n */\n async list(): Promise<Conversation[]> {\n return this.api.get<Conversation[]>(\"/v1/conversations\");\n }\n\n /**\n * Get list of all conversations for the current user that include the specified assistant.\n */\n async listByAssistantId(assistantId: string): Promise<Conversation[]> {\n const conversations = await this.list();\n return conversations.filter((conv) => conv.assistant_ids.includes(assistantId));\n }\n\n /**\n * Get details for a specific conversation by its ID.\n */\n async get(conversationId: string): Promise<ConversationDetails> {\n return this.api.get<ConversationDetails>(`/v1/conversations/${conversationId}`);\n }\n\n /**\n * Create a new conversation.\n */\n async create(_params: ConversationCreateParams = {}): Promise<AnyJson> {\n const params = ConversationCreateParamsSchema.parse(_params);\n return this.api.post(\"/v1/conversations\", params);\n }\n\n /**\n * Delete a specific conversation by its ID.\n */\n async delete(conversationId: string): Promise<AnyJson> {\n return this.api.delete(`/v1/conversations/${conversationId}`);\n }\n}\n","import FormData from \"form-data\";\nimport { DatasourceMapper } from \"../mappers/datasource.mapper\";\nimport type { AnyJson, PaginatedResponse, AuthConfig } from \"../models/common\";\nimport type {\n DataSource,\n DataSourceCreateParams,\n DataSourceListParams,\n DataSourceResponse,\n DataSourceTypeType,\n DataSourceUpdateParams,\n FileDataSourceCreateParams,\n} from \"../models/datasource\";\nimport { DataSourceType } from \"../models/datasource\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nconst DATA_SOURCE_TO_PATH_PARAM = {\n [DataSourceType.CODE]: \"CODE\",\n [DataSourceType.CONFLUENCE]: \"CONFLUENCE\",\n [DataSourceType.JIRA]: \"JIRA\",\n [DataSourceType.FILE]: \"FILE\",\n [DataSourceType.GOOGLE]: \"GOOGLE\",\n [DataSourceType.PROVIDER]: \"PROVIDER\",\n [DataSourceType.SUMMARY]: \"SUMMARY\",\n [DataSourceType.CHUNK_SUMMARY]: \"CHUNK_SUMMARY\",\n [DataSourceType.JSON]: \"JSON\",\n [DataSourceType.BEDROCK]: \"BEDROCK\",\n};\n\nexport class DatasourceService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Create a new datasource.\n */\n async create(params: DataSourceCreateParams): Promise<AnyJson> {\n const dto = DatasourceMapper.mapDatasourceCreateToDto(params);\n\n if (dto.type === DataSourceType.FILE) {\n return this.createFileDatasource(dto as unknown as FileDataSourceCreateParams);\n }\n\n return this.api.post(this.getCreateDatasourceUrl(dto.type, dto.project_name), dto);\n }\n\n /**\n * Create a file datasource.\n */\n private async createFileDatasource({\n files,\n ...datasource\n }: FileDataSourceCreateParams): Promise<AnyJson> {\n const formData = new FormData();\n\n for (const file of files) {\n formData.append(\"files\", Buffer.from(file.content), {\n filename: file.name,\n contentType: file.mime_type,\n });\n }\n\n return this.api.postMultipart(\n this.getCreateDatasourceUrl(datasource.type, datasource.project_name),\n formData,\n datasource,\n );\n }\n\n /**\n * Update an existing datasource.\n */\n async update(params: DataSourceUpdateParams): Promise<AnyJson> {\n this.validateUpdateReindexParams(params);\n\n const { full_reindex, skip_reindex, resume_indexing, incremental_reindex, ...data } = params;\n\n const endpoint =\n params.type === DataSourceType.CODE\n ? `/v1/application/${params.project_name}/index/${params.name}`\n : `/v1/index/knowledge_base/${this.getKnowledgeBaseParam(params.type)}`;\n\n // Extract reindex params\n const queryParams = {\n full_reindex,\n skip_reindex,\n resume_indexing,\n incremental_reindex,\n };\n\n const { type, ...dto } = DatasourceMapper.mapDatasourceUpdateToDto(data);\n\n return this.api.put(endpoint, dto, { params: queryParams });\n }\n\n /**\n * List datasources with pagination and filtering support.\n */\n async list(params: DataSourceListParams = {}): Promise<DataSource[]> {\n const queryParams: Record<string, number | string> = {\n page: params.page || 0,\n per_page: params.per_page || 10,\n sort_key: params.sort_key || \"update_date\",\n sort_order: params.sort_order || \"desc\",\n };\n\n if (params.datasource_types || params.projects || params.status || params.owner) {\n const filters: Record<string, number | string | string[]> = {};\n if (params.datasource_types) filters.index_type = params.datasource_types;\n if (params.projects) filters.project = params.projects;\n if (params.status) filters.status = params.status;\n if (params.owner) filters.created_by = params.owner;\n queryParams.filters = JSON.stringify(filters);\n }\n\n const response = await this.api.get<PaginatedResponse<DataSourceResponse>>(\n \"/v1/index\",\n queryParams,\n );\n\n return response.data.map(DatasourceMapper.mapDatasourceResponse);\n }\n\n /**\n * Get datasource by ID.\n */\n async get(datasourceId: string): Promise<DataSource> {\n const response = await this.api.get<DataSourceResponse>(`/v1/index/${datasourceId}`);\n return DatasourceMapper.mapDatasourceResponse(response);\n }\n\n /**\n * Delete a datasource by ID.\n */\n async delete(datasourceId: string): Promise<AnyJson> {\n return this.api.delete(`/v1/index/${datasourceId}`);\n }\n\n private getCreateDatasourceUrl(type: DataSourceTypeType, projectName: string): string {\n if (type === DataSourceType.CODE) {\n return `/v1/application/${projectName}/index`;\n }\n return `/v1/index/knowledge_base/${this.getKnowledgeBaseParam(type)}`;\n }\n\n private getKnowledgeBaseParam(type: DataSourceTypeType): string {\n return DATA_SOURCE_TO_PATH_PARAM[type].toLowerCase();\n }\n\n /**\n * Validates update parameters for reindexing.\n * @throws {Error} If the update parameters are invalid for the given datasource type.\n */\n private validateUpdateReindexParams(updateParams: DataSourceUpdateParams): void {\n if (updateParams.type === DataSourceType.CONFLUENCE && updateParams.incremental_reindex) {\n throw new Error(\"Confluence data sources only support full_reindex and resume_indexing\");\n }\n if (updateParams.type === DataSourceType.JIRA && updateParams.resume_indexing) {\n throw new Error(\"Jira data sources only support full_reindex and incremental_reindex\");\n }\n if (updateParams.type === DataSourceType.CODE && updateParams.incremental_reindex) {\n throw new Error(\"Code data sources do not support incremental_reindex\");\n }\n if (updateParams.type === DataSourceType.GOOGLE && updateParams.incremental_reindex) {\n throw new Error(\"Google data sources only support full_reindex\");\n }\n }\n}\n","/** Models for datasource service. */\nimport type { BaseUser, SortOrder, TokensUsage } from \"./common\";\n\n/** Code datasource type options */\nexport const CodeDataSourceType = {\n CODE: \"code\",\n SUMMARY: \"summary\",\n CHUNK_SUMMARY: \"chunk-summary\",\n} as const;\nexport type CodeDataSourceTypeType = (typeof CodeDataSourceType)[keyof typeof CodeDataSourceType];\n\n/** Datasource type options */\nexport const DataSourceType = {\n CODE: \"code\",\n CONFLUENCE: \"knowledge_base_confluence\",\n JIRA: \"knowledge_base_jira\",\n FILE: \"knowledge_base_file\",\n GOOGLE: \"llm_routing_google\",\n PROVIDER: \"provider\",\n SUMMARY: \"summary\",\n CHUNK_SUMMARY: \"chunk-summary\",\n JSON: \"knowledge_base_json\",\n BEDROCK: \"knowledge_base_bedrock\",\n} as const;\nexport type DataSourceTypeType = (typeof DataSourceType)[keyof typeof DataSourceType];\n\n/** Datasource status options */\nexport const DataSourceStatus = {\n COMPLETED: \"completed\",\n FAILED: \"failed\",\n FETCHING: \"fetching\",\n IN_PROGRESS: \"in_progress\",\n} as const;\nexport type DataSourceStatusType = (typeof DataSourceStatus)[keyof typeof DataSourceStatus];\n\n/** Base file model for file datasources */\nexport type File = Readonly<{\n /** File name */\n name: string;\n /** File content */\n content: string | Buffer<ArrayBuffer>;\n /** MIME type of the file */\n mime_type: string;\n}>;\n\n/** Confluence-specific configuration */\nexport interface Confluence {\n cql: string;\n include_restricted_content?: boolean;\n include_archived_content?: boolean;\n include_attachments?: boolean;\n include_comments?: boolean;\n keep_markdown_format?: boolean;\n keep_newlines?: boolean;\n max_pages?: number;\n pages_per_request?: number;\n}\n\n/** Jira-specific configuration */\nexport interface Jira {\n jql: string;\n}\n\n/** Google-specific configuration */\nexport interface Google {\n googleDoc: string;\n}\n\n/** File-specific configuration */\nexport interface Files {\n files: File[];\n}\n\n/** Code repository configuration */\nexport interface Code {\n branch: string;\n docsGeneration?: boolean;\n embeddingsModel?: string;\n filesFilter?: string;\n indexType: CodeDataSourceTypeType;\n link: string;\n projectSpaceVisible?: boolean;\n prompt?: string;\n settingId: string;\n summarizationModel?: string;\n}\n\n/** Base data source DTO */\nexport interface BaseDataSourceCreateDto {\n name: string;\n project_name: string;\n description: string;\n project_space_visible: boolean;\n setting_id: string | null;\n type: DataSourceTypeType;\n}\n\nexport interface ConfluenceDataSourceCreateDto extends BaseDataSourceCreateDto, Confluence {\n type: typeof DataSourceType.CONFLUENCE;\n}\nexport interface JiraDataSourceCreateDto extends BaseDataSourceCreateDto, Jira {\n type: typeof DataSourceType.JIRA;\n}\nexport interface GoogleDataSourceCreateDto extends BaseDataSourceCreateDto, Google {\n type: typeof DataSourceType.GOOGLE;\n}\nexport interface FileDataSourceCreateDto extends BaseDataSourceCreateDto, Files {\n type: typeof DataSourceType.FILE;\n}\nexport interface CodeDataSourceCreateDto\n // override to comply with keys in json\n extends Omit<BaseDataSourceCreateDto, \"setting_id\" | \"project_space_visible\">,\n Code {\n type: typeof DataSourceType.CODE;\n}\n\nexport type DataSourceCreateDto =\n | ConfluenceDataSourceCreateDto\n | JiraDataSourceCreateDto\n | GoogleDataSourceCreateDto\n | FileDataSourceCreateDto\n | CodeDataSourceCreateDto\n | BaseDataSourceCreateDto;\n\n/** Base data source update DTO */\nexport interface BaseDataSourceUpdateDto {\n name: string;\n project_name: string;\n description?: string;\n project_space_visible?: boolean;\n setting_id?: string | null;\n type: DataSourceTypeType;\n full_reindex?: boolean;\n skip_reindex?: boolean;\n resume_indexing?: boolean;\n incremental_reindex?: boolean;\n}\n\nexport interface ConfluenceDataSourceUpdateDto\n extends BaseDataSourceUpdateDto,\n Partial<Confluence> {\n type: typeof DataSourceType.CONFLUENCE;\n}\nexport interface JiraDataSourceUpdateDto extends BaseDataSourceUpdateDto, Partial<Jira> {\n type: typeof DataSourceType.JIRA;\n}\nexport interface GoogleDataSourceUpdateDto extends BaseDataSourceUpdateDto, Partial<Google> {\n type: typeof DataSourceType.GOOGLE;\n}\nexport interface FileDataSourceUpdateDto extends BaseDataSourceUpdateDto, Partial<Files> {\n type: typeof DataSourceType.FILE;\n}\nexport interface CodeDataSourceUpdateDto\n extends Omit<BaseDataSourceUpdateDto, \"setting_id\" | \"project_space_visible\">,\n Partial<Code> {\n type: typeof DataSourceType.CODE;\n}\n\nexport type DataSourceUpdateDto =\n | ConfluenceDataSourceUpdateDto\n | JiraDataSourceUpdateDto\n | GoogleDataSourceUpdateDto\n | FileDataSourceUpdateDto\n | CodeDataSourceUpdateDto\n | BaseDataSourceUpdateDto;\n\n/** Processing information for datasource */\nexport interface DataSourceProcessingInfoResponse {\n /** Total number of documents processed */\n total_documents?: number;\n /** Number of documents skipped */\n skipped_documents?: number;\n /** Total size in kilobytes */\n total_size_kb?: number;\n /** Average file size in bytes */\n average_file_size_bytes?: number;\n /** List of unique file extensions */\n unique_extensions?: string[];\n /** Filtered documents count or list */\n filtered_documents?: number | string[];\n /** Number of processed documents */\n documents_count_key?: number;\n}\n\n/** Processing information for datasource */\nexport interface DataSourceProcessingInfo {\n /** Total number of documents processed */\n total_documents_count?: number;\n /** Number of documents skipped */\n skipped_documents_count?: number;\n /** Total size in kilobytes */\n total_size_kb?: number;\n /** Average file size in bytes */\n average_file_size_bytes?: number;\n /** List of unique file extensions */\n unique_extensions?: string[];\n /** Filtered documents count or list */\n filtered_documents?: number | string[];\n /** Number of processed documents */\n processed_documents_count?: number;\n}\n\nexport type DataSourceResponse = BaseDataSourceResponse | CodeDataSourceResponse;\n\n/** Datasource response interface */\nexport interface BaseDataSourceResponse {\n /** Unique identifier */\n id: string;\n /** Project name */\n project_name: string;\n /** Datasource name */\n repo_name: string;\n /** Description */\n description?: string;\n /** Type of datasource */\n index_type: DataSourceTypeType;\n /** Embeddings model used */\n embeddings_model?: string;\n /** Current status */\n status: DataSourceStatusType;\n /** Setting ID reference */\n setting_id?: string;\n /** Creation date */\n date: string;\n /** Creator information */\n created_by: BaseUser;\n /** Whether shared with project */\n project_space_visible: boolean;\n /** Last update date */\n update_date: string;\n /** Error message if failed */\n text?: string;\n /** User abilities list */\n user_abilities: string[];\n /** Processing information */\n processing_info?: DataSourceProcessingInfoResponse;\n /** List of processed documents */\n processed_files?: string[];\n /** Token usage statistics */\n tokens_usage?: TokensUsage;\n /** Jira-specific configuration */\n jira?: Jira;\n /** Confluence-specific configuration */\n confluence?: Confluence;\n /** Google document link */\n google_doc_link?: string;\n}\n\nexport type CodeDataSourceResponse = BaseDataSourceResponse & {\n /** Repository URL */\n link: string;\n /** Branch name */\n branch: string;\n /** Type of index to create */\n index_type: CodeDataSourceTypeType;\n /** Files filter pattern */\n files_filter?: string;\n /** Embeddings model to use */\n embeddings_model?: string;\n /** Summarization model to use */\n summarization_model?: string;\n /** Custom summarization prompt */\n prompt?: string;\n /** Enable documentation generation */\n docs_generation?: boolean;\n};\n\n/** Datasource model */\nexport interface DataSource {\n /** Unique identifier */\n id: string;\n /** Project name */\n project_name: string;\n /** Datasource name */\n name: string;\n /** Description */\n description?: string;\n /** Type of datasource */\n type: DataSourceTypeType;\n /** Embeddings model used */\n embeddings_model?: string;\n /** Current status */\n status: DataSourceStatusType;\n /** Setting ID reference */\n setting_id?: string | null;\n /** Creation date */\n created_date: string;\n /** Creator information */\n created_by: BaseUser;\n /** Whether shared with project */\n shared_with_project: boolean;\n /** Last update date */\n update_date: string;\n /** Error message if failed */\n error_message?: string;\n /** User abilities list */\n user_abilities: string[];\n /** Processing information */\n processing_info?: DataSourceProcessingInfo;\n /** List of processed documents */\n processed_documents?: string[];\n /** Token usage statistics */\n tokens_usage?: TokensUsage;\n /** Code-specific configuration */\n code?: Partial<Code>;\n /** Jira-specific configuration */\n jira?: Jira;\n /** Confluence-specific configuration */\n confluence?: Confluence;\n /** Google document link */\n google_doc_link?: string;\n}\n\n/** DataSource fetch parameters */\nexport type DataSourceListParams = {\n page?: number;\n per_page?: number;\n sort_key?: \"date\" | \"update_date\";\n sort_order?: SortOrder;\n datasource_types?: DataSourceTypeType[];\n projects?: string[];\n owner?: string;\n status?: DataSourceStatusType;\n};\n\n// Datasources create and update parameters\nexport interface BaseConfluenceParams {\n /** Confluence Query Language string */\n cql: string;\n /** Include restricted content */\n include_restricted_content?: boolean;\n /** Include archived content */\n include_archived_content?: boolean;\n /** Include attachments */\n include_attachments?: boolean;\n /** Include comments */\n include_comments?: boolean;\n /** Keep markdown format */\n keep_markdown_format?: boolean;\n /** Keep newlines */\n keep_newlines?: boolean;\n /** Maximum pages to fetch */\n max_pages?: number;\n /** Pages per request */\n pages_per_request?: number;\n}\n\nexport interface BaseJiraParams {\n /** Jira Query Language string */\n jql: string;\n}\n\n/** File-specific configuration */\nexport interface BaseFileParams {\n /** List of files with their content and mime type */\n files: File[];\n}\n\n/** Google-specific configuration */\nexport interface BaseGoogleParams {\n /** Google document ID or URL */\n google_doc: string;\n}\n\n/** Code repository configuration */\nexport interface BaseCodeParams {\n /** Repository URL */\n link: string;\n /** Branch name */\n branch: string;\n /** Type of index to create */\n index_type: CodeDataSourceTypeType;\n /** Files filter pattern */\n files_filter?: string;\n /** Embeddings model to use */\n embeddings_model?: string;\n /** Summarization model to use */\n summarization_model?: string;\n /** Custom summarization prompt */\n prompt?: string;\n /** Enable documentation generation */\n docs_generation?: boolean;\n}\n\nexport interface BaseDataSourceCreateParams {\n /** Name of the datasource */\n name: string;\n /** Project name */\n project_name: string;\n /** Description of the datasource */\n description: string;\n /** Whether to share with project */\n shared_with_project: boolean;\n /** Setting ID reference */\n setting_id: string | null;\n /** Type of datasource */\n type: DataSourceTypeType;\n}\n\nexport interface ConfluenceDataSourceCreateParams\n extends BaseDataSourceCreateParams,\n BaseConfluenceParams {\n type: typeof DataSourceType.CONFLUENCE;\n}\nexport interface JiraDataSourceCreateParams extends BaseDataSourceCreateParams, BaseJiraParams {\n type: typeof DataSourceType.JIRA;\n}\nexport interface GoogleDataSourceCreateParams extends BaseDataSourceCreateParams, BaseGoogleParams {\n type: typeof DataSourceType.GOOGLE;\n}\nexport interface FileDataSourceCreateParams extends BaseDataSourceCreateParams, BaseFileParams {\n type: typeof DataSourceType.FILE;\n}\nexport interface CodeDataSourceCreateParams extends BaseDataSourceCreateParams, BaseCodeParams {\n type: typeof DataSourceType.CODE;\n}\nexport interface OtherDataSourceCreateParams extends BaseDataSourceCreateParams {\n type:\n | typeof DataSourceType.PROVIDER\n | typeof DataSourceType.SUMMARY\n | typeof DataSourceType.CHUNK_SUMMARY\n | typeof DataSourceType.JSON;\n}\n\n/** DataSource create parameters */\nexport type DataSourceCreateParams =\n | ConfluenceDataSourceCreateParams\n | JiraDataSourceCreateParams\n | GoogleDataSourceCreateParams\n | FileDataSourceCreateParams\n | CodeDataSourceCreateParams\n | OtherDataSourceCreateParams;\n\nexport interface BaseDataSourceUpdateParams {\n /** Type of datasource */\n type: DataSourceTypeType;\n /** Name of the datasource */\n name: string;\n /** Project name */\n project_name: string;\n /** Description of the datasource */\n description?: string;\n /** Whether to share with project */\n shared_with_project?: boolean;\n /** Setting ID reference */\n setting_id?: string | null;\n /** Perform full reindex */\n full_reindex?: boolean;\n /** Skip reindex operation */\n skip_reindex?: boolean;\n /** Resume interrupted indexing */\n resume_indexing?: boolean;\n /** Perform incremental reindex */\n incremental_reindex?: boolean;\n}\n\nexport interface ConfluenceDataSourceUpdateParams\n extends BaseDataSourceUpdateParams,\n Partial<BaseConfluenceParams> {\n type: typeof DataSourceType.CONFLUENCE;\n}\nexport interface JiraDataSourceUpdateParams\n extends BaseDataSourceUpdateParams,\n Partial<BaseJiraParams> {\n type: typeof DataSourceType.JIRA;\n}\nexport interface GoogleDataSourceUpdateParams\n extends BaseDataSourceUpdateParams,\n Partial<BaseGoogleParams> {\n type: typeof DataSourceType.GOOGLE;\n}\nexport interface FileDataSourceUpdateParams\n extends BaseDataSourceUpdateParams,\n Partial<BaseFileParams> {\n type: typeof DataSourceType.FILE;\n}\nexport interface CodeDataSourceUpdateParams\n extends BaseDataSourceUpdateParams,\n Partial<BaseCodeParams> {\n type: typeof DataSourceType.CODE;\n}\nexport interface OtherDataSourceUpdateParams extends BaseDataSourceUpdateParams {\n type:\n | typeof DataSourceType.PROVIDER\n | typeof DataSourceType.SUMMARY\n | typeof DataSourceType.CHUNK_SUMMARY\n | typeof DataSourceType.JSON;\n}\n\n/** DataSource update parameters */\nexport type DataSourceUpdateParams =\n | ConfluenceDataSourceUpdateParams\n | JiraDataSourceUpdateParams\n | GoogleDataSourceUpdateParams\n | FileDataSourceUpdateParams\n | CodeDataSourceUpdateParams\n | OtherDataSourceUpdateParams;\n","import type {\n CodeDataSourceResponse,\n CodeDataSourceCreateParams,\n CodeDataSourceUpdateParams,\n ConfluenceDataSourceCreateParams,\n ConfluenceDataSourceUpdateParams,\n DataSource,\n DataSourceCreateDto,\n DataSourceCreateParams,\n DataSourceProcessingInfo,\n DataSourceProcessingInfoResponse,\n DataSourceResponse,\n DataSourceUpdateDto,\n DataSourceUpdateParams,\n FileDataSourceCreateParams,\n FileDataSourceUpdateParams,\n GoogleDataSourceCreateParams,\n GoogleDataSourceUpdateParams,\n JiraDataSourceCreateParams,\n JiraDataSourceUpdateParams,\n Code,\n} from \"../models\";\nimport { DataSourceType } from \"../models/datasource\";\nimport { omitUndefined } from \"../utils/helpers\";\n\nexport class DatasourceMapper {\n /** Transforms API response into a client-friendly DataSource model, maintaining API-agnostic interface */\n static mapDatasourceResponse(response: DataSourceResponse): DataSource {\n return omitUndefined({\n ...DatasourceMapper.mapDataSourceResponseCommonFields(response),\n ...(response.index_type === DataSourceType.JIRA && {\n jira: response.jira,\n }),\n ...(response.index_type === DataSourceType.CONFLUENCE && {\n confluence: response.confluence,\n }),\n ...(response.index_type === DataSourceType.GOOGLE && {\n google_doc: response.google_doc_link,\n }),\n ...(response.index_type === DataSourceType.CODE && {\n code: DatasourceMapper.extractCodeDataSourceResponseFields(\n response as CodeDataSourceResponse,\n ),\n }),\n });\n }\n\n static mapDataSourceResponseCommonFields(response: DataSourceResponse) {\n return {\n id: response.id,\n created_by: response.created_by,\n created_date: response.date,\n description: response.description,\n embeddings_model: response.embeddings_model,\n error_message: response.text,\n name: response.repo_name,\n processed_documents: response.processed_files,\n processing_info: response.processing_info\n ? DatasourceMapper.mapDatasourceProcessingInfoResponse(response.processing_info)\n : undefined,\n project_name: response.project_name,\n setting_id: response.setting_id,\n shared_with_project: response.project_space_visible,\n status: response.status,\n tokens_usage: response.tokens_usage,\n type: response.index_type,\n update_date: response.update_date,\n user_abilities: response.user_abilities,\n };\n }\n\n static extractCodeDataSourceResponseFields(response: CodeDataSourceResponse): Partial<Code> {\n return omitUndefined({\n branch: response.branch,\n docsGeneration: response.docs_generation || false,\n embeddingsModel: response.embeddings_model,\n filesFilter: response.files_filter,\n indexType: response.index_type,\n link: response.link,\n projectSpaceVisible: response.project_space_visible || false,\n prompt: response.prompt,\n settingId: response.setting_id,\n summarizationModel: response.summarization_model,\n });\n }\n\n /** Converts processing metadata from API format to client model format with consistent property naming */\n static mapDatasourceProcessingInfoResponse(\n response: DataSourceProcessingInfoResponse,\n ): DataSourceProcessingInfo {\n return omitUndefined({\n total_documents_count: response.total_documents,\n skipped_documents_count: response.skipped_documents,\n total_size_kb: response.total_size_kb,\n average_file_size_bytes: response.average_file_size_bytes,\n unique_extensions: response.unique_extensions,\n filtered_documents: response.filtered_documents,\n processed_documents_count: response.documents_count_key,\n });\n }\n\n /** Transforms datasource creation parameters into DTO format, applying type-specific mappings based on datasource type */\n static mapDatasourceCreateToDto(create: DataSourceCreateParams): DataSourceCreateDto {\n return omitUndefined({\n ...DatasourceMapper.mapCommonDataSourceParams(create),\n ...(create.type === DataSourceType.CONFLUENCE &&\n DatasourceMapper.mapConfluenceDataSourceParams(create as ConfluenceDataSourceCreateParams)),\n ...(create.type === DataSourceType.JIRA &&\n DatasourceMapper.mapJiraDataSourceParams(create as JiraDataSourceCreateParams)),\n ...(create.type === DataSourceType.GOOGLE &&\n DatasourceMapper.mapGoogleDataSourceParams(create as GoogleDataSourceCreateParams)),\n ...(create.type === DataSourceType.FILE &&\n DatasourceMapper.mapFileDataSourceParams(create as FileDataSourceCreateParams)),\n ...(create.type === DataSourceType.CODE &&\n DatasourceMapper.mapCodeDataSourceParams(create as CodeDataSourceCreateParams)),\n });\n }\n\n /** Converts datasource update parameters to DTO format with conditional inclusion of type-specific properties */\n static mapDatasourceUpdateToDto(update: DataSourceUpdateParams): DataSourceUpdateDto {\n return omitUndefined({\n ...DatasourceMapper.mapCommonUpdateDataSourceParams(update),\n ...(update.type === DataSourceType.CONFLUENCE &&\n DatasourceMapper.mapConfluenceDataSourceParams(update as ConfluenceDataSourceUpdateParams)),\n ...(update.type === DataSourceType.JIRA &&\n DatasourceMapper.mapJiraDataSourceParams(update as JiraDataSourceUpdateParams)),\n ...(update.type === DataSourceType.GOOGLE &&\n DatasourceMapper.mapGoogleDataSourceParams(update as GoogleDataSourceUpdateParams)),\n ...(update.type === DataSourceType.FILE &&\n DatasourceMapper.mapFileDataSourceParams(update as FileDataSourceUpdateParams)),\n ...(update.type === DataSourceType.CODE &&\n DatasourceMapper.mapCodeDataSourceParams(update as CodeDataSourceUpdateParams)),\n });\n }\n\n /** Maps Confluence-specific configuration parameters for content filtering and pagination options */\n private static mapConfluenceDataSourceParams<\n T extends ConfluenceDataSourceCreateParams | ConfluenceDataSourceUpdateParams,\n >(params: T) {\n return {\n cql: params.cql,\n include_restricted_content: params.include_restricted_content,\n include_archived_content: params.include_archived_content,\n include_attachments: params.include_attachments,\n include_comments: params.include_comments,\n keep_markdown_format: params.keep_markdown_format,\n keep_newlines: params.keep_newlines,\n max_pages: params.max_pages,\n pages_per_request: params.pages_per_request,\n };\n }\n\n /** Maps Jira-specific parameters, transforming JQL (Jira Query Language) filter configuration */\n private static mapJiraDataSourceParams<\n T extends JiraDataSourceCreateParams | JiraDataSourceUpdateParams,\n >(params: T) {\n return {\n jql: params.jql,\n };\n }\n\n /** Maps Google Doc specific parameters with proper API naming conventions */\n private static mapGoogleDataSourceParams<\n T extends GoogleDataSourceCreateParams | GoogleDataSourceUpdateParams,\n >(params: T) {\n return {\n googleDoc: params.google_doc,\n };\n }\n\n /** Maps file upload datasource parameters, handling file reference collections */\n private static mapFileDataSourceParams<\n T extends FileDataSourceCreateParams | FileDataSourceUpdateParams,\n >(params: T) {\n return {\n files: params.files,\n };\n }\n\n /** Maps code repository specific parameters including indexing strategy and code processing settings */\n private static mapCodeDataSourceParams<\n T extends CodeDataSourceCreateParams | CodeDataSourceUpdateParams,\n >(params: T) {\n return {\n settingId: params.setting_id,\n projectSpaceVisible: params.shared_with_project || false,\n link: params.link,\n branch: params.branch,\n indexType: params.index_type,\n filesFilter: params.files_filter,\n embeddingsModel: params.embeddings_model,\n summarizationModel: params.summarization_model,\n prompt: params.prompt,\n docsGeneration: params.docs_generation || false,\n };\n }\n\n /** Maps general datasource parameters common across all datasource types with appropriate fallback values */\n private static mapCommonDataSourceParams(params: DataSourceCreateParams) {\n return {\n name: params.name,\n project_name: params.project_name,\n description: params.description,\n project_space_visible: params.shared_with_project || false,\n setting_id: params.setting_id || null,\n type: params.type,\n };\n }\n\n private static mapCommonUpdateDataSourceParams(params: DataSourceUpdateParams) {\n return omitUndefined({\n name: params.name,\n project_name: params.project_name,\n description: params.description,\n project_space_visible: params.shared_with_project || false,\n setting_id: params.setting_id || null,\n type: params.type,\n });\n }\n}\n","/** Models for integration-related data structures */\n\n/**\n * Credential types as constant object\n */\nexport const CredentialTypes = {\n JIRA: \"Jira\",\n CONFLUENCE: \"Confluence\",\n GIT: \"Git\",\n KUBERNETES: \"Kubernetes\",\n AWS: \"AWS\",\n GCP: \"GCP\",\n KEYCLOAK: \"Keycloak\",\n AZURE: \"Azure\",\n ELASTIC: \"Elastic\",\n OPENAPI: \"OpenAPI\",\n PLUGIN: \"Plugin\",\n FILESYSTEM: \"FileSystem\",\n SCHEDULER: \"Scheduler\",\n WEBHOOK: \"Webhook\",\n EMAIL: \"Email\",\n AZURE_DEVOPS: \"AzureDevOps\",\n SONAR: \"Sonar\",\n SQL: \"SQL\",\n TELEGRAM: \"Telegram\",\n ZEPHYR_CLOUD: \"ZephyrCloud\",\n ZEPHYR_SQUAD: \"ZephyrSquad\",\n SERVICE_NOW: \"ServiceNow\",\n DIAL: \"DIAL\",\n A2A: \"A2A\",\n MCP: \"MCP\",\n LITE_LLM: \"LiteLLM\",\n REPORT_PORTAL: \"ReportPortal\",\n} as const;\n\nexport type CredentialTypesType = (typeof CredentialTypes)[keyof typeof CredentialTypes];\n\n/**\n * Integration types as constant object\n */\nexport const IntegrationType = {\n USER: \"user\",\n PROJECT: \"project\",\n} as const;\n\nexport type IntegrationTypeType = (typeof IntegrationType)[keyof typeof IntegrationType];\n\n/**\n * Model for credential values\n */\nexport interface CredentialValues {\n /** Key for the credential value */\n key: string;\n /** Value of the credential (can be any type) */\n value: unknown;\n}\n\n/**\n * Model for settings configuration\n */\nexport interface Integration {\n /** Integration ID */\n id: string;\n /** Creation date */\n date?: string;\n /** Last update date */\n update_date?: string;\n /** User ID */\n user_id?: string;\n /** Project name */\n project_name: string;\n /** Integration alias */\n alias?: string;\n /** Whether this is the default integration */\n default?: boolean;\n /** Type of credential */\n credential_type: CredentialTypesType;\n /** List of credential values */\n credential_values: CredentialValues[];\n /** Type of integration */\n setting_type: IntegrationTypeType;\n}\n","import { z } from \"zod\";\nimport { CredentialTypes, IntegrationType, type IntegrationTypeType } from \"../models/integration\";\n\nexport const IntegrationListParamsSchema = z\n .object({\n setting_type: z\n .enum([IntegrationType.USER, IntegrationType.PROJECT])\n .prefault(IntegrationType.USER),\n page: z.number().prefault(0),\n per_page: z.number().prefault(10),\n filters: z.record(z.string(), z.unknown()).optional(),\n })\n .readonly();\nexport type IntegrationListParams = Partial<z.infer<typeof IntegrationListParamsSchema>>;\n\nexport const IntegrationGetParamsSchema = z\n .object({\n integration_id: z.string(),\n setting_type: z\n .enum([IntegrationType.USER, IntegrationType.PROJECT])\n .prefault(IntegrationType.USER),\n })\n .readonly();\nexport type IntegrationGetParams = z.infer<typeof IntegrationGetParamsSchema>;\n\nexport const IntegrationGetByAliasParamsSchema = z\n .object({\n alias: z.string(),\n setting_type: z\n .enum([IntegrationType.USER, IntegrationType.PROJECT])\n .prefault(IntegrationType.USER),\n })\n .readonly();\nexport type IntegrationGetByAliasParams = Omit<\n z.infer<typeof IntegrationGetByAliasParamsSchema>,\n \"setting_type\"\n> & {\n setting_type?: IntegrationTypeType;\n};\n\nconst CredentialValueSchema = z.object({\n key: z.string(),\n value: z.unknown(),\n});\n\nexport const IntegrationCreateParamsSchema = z\n .object({\n credential_type: z.enum(Object.values(CredentialTypes) as [string, ...string[]]),\n credential_values: z.array(CredentialValueSchema),\n project_name: z.string(),\n setting_type: z\n .enum([IntegrationType.USER, IntegrationType.PROJECT])\n .prefault(IntegrationType.USER),\n alias: z.string().optional(),\n default: z.boolean().optional().prefault(false),\n project: z.string().optional(),\n enabled: z.boolean().optional().prefault(true),\n external_id: z.string().optional(),\n })\n .readonly();\nexport type IntegrationCreateParams = Omit<\n z.infer<typeof IntegrationCreateParamsSchema>,\n \"default\" | \"enabled\"\n> & {\n default?: boolean;\n enabled?: boolean;\n};\n\nexport const IntegrationUpdateParamsSchema = IntegrationCreateParamsSchema;\nexport type IntegrationUpdateParams = Omit<\n z.infer<typeof IntegrationUpdateParamsSchema>,\n \"default\" | \"enabled\"\n> & {\n default?: boolean;\n enabled?: boolean;\n};\n","import { NotFoundError } from \"../exceptions\";\nimport type { AnyJson, PaginatedResponse, AuthConfig } from \"../models/common\";\nimport { type Integration, IntegrationType, type IntegrationTypeType } from \"../models/integration\";\nimport {\n IntegrationCreateParamsSchema,\n type IntegrationCreateParams,\n IntegrationGetByAliasParamsSchema,\n type IntegrationGetByAliasParams,\n IntegrationGetParamsSchema,\n type IntegrationGetParams,\n IntegrationListParamsSchema,\n type IntegrationListParams,\n IntegrationUpdateParamsSchema,\n type IntegrationUpdateParams,\n} from \"../schemas/integration\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nexport class IntegrationService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get base API path based on setting type.\n */\n private getBasePath(settingType: IntegrationTypeType): string {\n return `/v1/settings/${settingType === IntegrationType.USER ? \"user\" : \"project\"}`;\n }\n\n /**\n * Get list of available integrations.\n */\n async list(_params: IntegrationListParams = {}): Promise<Integration[]> {\n const params = IntegrationListParamsSchema.parse(_params);\n const settingType = params.setting_type;\n\n const queryParams = {\n page: params.page,\n per_page: params.per_page,\n ...(params.filters && { filters: JSON.stringify(params.filters) }),\n };\n\n const response = await this.api.get<PaginatedResponse<Integration>>(\n this.getBasePath(settingType),\n queryParams,\n );\n\n return response.data;\n }\n\n /**\n * Get integration by ID.\n */\n async get(_params: IntegrationGetParams): Promise<Integration> {\n const params = IntegrationGetParamsSchema.parse(_params);\n const settingType = params.setting_type;\n const integrationId = params.integration_id;\n\n const integrations = await this.list({\n per_page: 100,\n setting_type: settingType,\n });\n\n const integration = integrations.find((i) => i.id === integrationId);\n if (!integration) {\n throw new NotFoundError(\"Integration\", integrationId);\n }\n\n return integration;\n }\n\n /**\n * Get integration by alias.\n */\n async getByAlias(_params: IntegrationGetByAliasParams): Promise<Integration> {\n const params = IntegrationGetByAliasParamsSchema.parse(_params);\n const settingType = params.setting_type;\n const alias = params.alias;\n\n const integrations = await this.list({\n per_page: 100,\n setting_type: settingType,\n });\n\n const integration = integrations.find((i) => i.alias === alias);\n if (!integration) {\n throw new NotFoundError(\"Integration\", alias);\n }\n\n return integration;\n }\n\n /**\n * Create a new integration.\n */\n async create(_params: IntegrationCreateParams): Promise<AnyJson> {\n const params = IntegrationCreateParamsSchema.parse(_params);\n const settingType = params.setting_type;\n\n return this.api.post(this.getBasePath(settingType), {\n ...params,\n setting_type: settingType,\n default: false,\n });\n }\n\n /**\n * Update an existing integration.\n */\n async update(settingId: string, _params: IntegrationUpdateParams): Promise<AnyJson> {\n const params = IntegrationUpdateParamsSchema.parse(_params);\n const settingType = params.setting_type;\n\n return this.api.put(`${this.getBasePath(settingType)}/${settingId}`, {\n ...params,\n setting_type: settingType,\n default: false,\n });\n }\n\n /**\n * Delete an integration by ID.\n */\n async delete(\n settingId: string,\n settingType: IntegrationTypeType = IntegrationType.USER,\n ): Promise<AnyJson> {\n return this.api.delete(`${this.getBasePath(settingType)}/${settingId}`);\n }\n}\n","import type { AuthConfig } from \"../models/common\";\nimport type { LLMModel } from \"../models/llm\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nexport class LLMService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get list of available LLM models.\n */\n async list(): Promise<LLMModel[]> {\n return this.api.get<LLMModel[]>(\"/v1/llm_models\");\n }\n\n /**\n * Get list of available embeddings models.\n */\n async listEmbeddings(): Promise<LLMModel[]> {\n return this.api.get<LLMModel[]>(\"/v1/embeddings_models\");\n }\n}\n","import type { AuthConfig } from \"../models/common\";\nimport type { BackgroundTaskEntity } from \"../models/task\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nexport class TaskService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get a background task by ID.\n */\n async get(taskId: string): Promise<BackgroundTaskEntity> {\n return this.api.get(`/v1/tasks/${taskId}`);\n }\n}\n","import type { AboutUser, AboutUserResponse } from \"../models\";\nimport { omitUndefined } from \"../utils/helpers\";\n\nexport class UserMapper {\n static mapAboutUserResponse(response: AboutUserResponse): AboutUser {\n return omitUndefined({\n user_id: response.userId,\n name: response.name,\n username: response.username,\n is_admin: response.isAdmin,\n applications: response.applications,\n applications_admin: response.applicationsAdmin,\n picture: response.picture,\n knowledge_bases: response.knowledgeBases,\n });\n }\n}\n","import { UserMapper } from \"../mappers/user.mapper\";\nimport type { AuthConfig } from \"../models/common\";\nimport type { AboutUser, AboutUserResponse, UserData } from \"../models/user\";\nimport { ApiRequestHandler } from \"../utils/http\";\n\nexport class UserService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get current user profile.\n */\n async aboutMe(): Promise<AboutUser> {\n const response = await this.api.get<AboutUserResponse>(\"/v1/user\");\n return UserMapper.mapAboutUserResponse(response);\n }\n\n /**\n * Get user data and preferences.\n */\n async getData(): Promise<UserData> {\n return this.api.get(\"/v1/user/data\");\n }\n}\n","import type {\n Workflow,\n WorkflowExecution,\n WorkflowExecutionResponse,\n WorkflowResponse,\n} from \"../models\";\nimport { omitUndefined } from \"../utils/helpers\";\n\nexport class WorkflowMapper {\n static mapWorkflowResponse(response: WorkflowResponse): Workflow {\n return omitUndefined({\n id: response.id,\n project: response.project,\n name: response.name,\n description: response.description,\n yaml_config: response.yaml_config,\n mode: response.mode,\n shared: response.shared,\n icon_url: response.icon_url,\n created_date: response.date,\n update_date: response.update_date,\n created_by: response.created_by,\n });\n }\n\n static mapWorkflowExecutionResponse(response: WorkflowExecutionResponse): WorkflowExecution {\n return omitUndefined({\n id: response.id,\n execution_id: response.execution_id,\n workflow_id: response.workflow_id,\n overall_status: response.status,\n created_date: response.date,\n prompt: response.prompt,\n updated_date: response.updated_date,\n created_by: response.created_by,\n tokens_usage: response.tokens_usage,\n });\n }\n}\n","import { z } from \"zod\";\nimport { WorkflowMode } from \"../models/workflow\";\n\n/**\n * Workflow list parameters schema\n */\nexport const WorkflowListParamsSchema = z\n .object({\n page: z.number().prefault(0),\n per_page: z.number().prefault(10),\n projects: z.array(z.string()).optional(),\n })\n .readonly();\nexport type WorkflowListParams = Partial<z.infer<typeof WorkflowListParamsSchema>>;\n\n/**\n * Workflow create parameters schema\n */\nexport const WorkflowCreateParamsSchema = z\n .object({\n project: z.string(),\n name: z.string(),\n description: z.string().optional(),\n yaml_config: z.string(),\n mode: z.enum([WorkflowMode.SEQUENTIAL, WorkflowMode.AUTONOMOUS]),\n shared: z.boolean(),\n icon_url: z.string().optional(),\n })\n .readonly();\nexport type WorkflowCreateParams = z.infer<typeof WorkflowCreateParamsSchema>;\n\n/**\n * Workflow update parameters schema\n */\nexport const WorkflowUpdateParamsSchema = z\n .object({\n project: z.string(),\n name: z.string(),\n description: z.string().optional(),\n yaml_config: z.string(),\n mode: z.enum([WorkflowMode.SEQUENTIAL, WorkflowMode.AUTONOMOUS]).optional(),\n shared: z.boolean().optional(),\n icon_url: z.string().optional(),\n })\n .readonly();\nexport type WorkflowUpdateParams = z.infer<typeof WorkflowUpdateParamsSchema>;\n\n/**\n * Workflow execution list parameters schema\n */\nexport const WorkflowExecutionListParamsSchema = z\n .object({\n page: z.number().prefault(0),\n per_page: z.number().prefault(10),\n })\n .readonly();\nexport type WorkflowExecutionListParams = Partial<\n z.infer<typeof WorkflowExecutionListParamsSchema>\n>;\n\n/**\n * Workflow execution create parameters schema\n */\nexport const WorkflowExecutionCreateParamsSchema = z\n .object({\n user_input: z\n .union([\n z.string(),\n z.record(z.string(), z.unknown()),\n z.array(z.unknown()),\n z.number(),\n z.boolean(),\n ])\n .optional(),\n file_name: z.string().optional(),\n propagate_headers: z.boolean().optional(),\n })\n .readonly();\nexport type WorkflowExecutionCreateParams = z.infer<typeof WorkflowExecutionCreateParamsSchema>;\n\n/**\n * Workflow execution state list parameters schema\n */\nexport const WorkflowExecutionStateListParamsSchema = z\n .object({\n page: z.number().prefault(0),\n per_page: z.number().prefault(10),\n })\n .readonly();\nexport type WorkflowExecutionStateListParams = Partial<\n z.infer<typeof WorkflowExecutionStateListParamsSchema>\n>;\n","/** Models for workflow functionality */\nimport type { BaseUser, TokensUsage } from \"./common\";\n\n/** Available workflow modes */\nexport const WorkflowMode = {\n SEQUENTIAL: \"Sequential\",\n AUTONOMOUS: \"Autonomous\",\n} as const;\nexport type WorkflowModeType = (typeof WorkflowMode)[keyof typeof WorkflowMode];\n\n/** Workflow execution status */\nexport const ExecutionStatus = {\n IN_PROGRESS: \"In Progress\",\n NOT_STARTED: \"Not Started\",\n INTERRUPTED: \"Interrupted\",\n FAILED: \"Failed\",\n SUCCEEDED: \"Succeeded\",\n ABORTED: \"Aborted\",\n} as const;\nexport type ExecutionStatusType = (typeof ExecutionStatus)[keyof typeof ExecutionStatus];\n\n/** Workflow API response */\nexport interface WorkflowResponse {\n /** Unique identifier */\n id: string;\n /** Project name */\n project: string;\n /** Workflow name */\n name: string;\n /** Workflow description */\n description?: string;\n /** YAML configuration */\n yaml_config?: string;\n /** Workflow execution mode */\n mode: WorkflowModeType;\n /** Whether workflow is shared */\n shared: boolean;\n /** URL to workflow icon */\n icon_url?: string;\n /** Creation date */\n date: string;\n /** Last update date */\n update_date: string;\n /** Creator information */\n created_by: BaseUser;\n}\n\n/** Workflow model */\nexport interface Workflow {\n /** Unique identifier */\n id: string;\n /** Project name */\n project: string;\n /** Workflow name */\n name: string;\n /** Workflow description */\n description?: string;\n /** YAML configuration */\n yaml_config?: string;\n /** Workflow execution mode */\n mode: WorkflowModeType;\n /** Whether workflow is shared */\n shared: boolean;\n /** URL to workflow icon */\n icon_url?: string;\n /** Creation date */\n created_date: string;\n /** Last update date */\n update_date: string;\n /** Creator information */\n created_by: BaseUser;\n}\n\n/** Workflow execution API response */\nexport interface WorkflowExecutionResponse {\n /** Unique identifier */\n id: string;\n /** Execution identifier */\n execution_id: string;\n /** Associated workflow identifier */\n workflow_id: string;\n /** Execution status */\n status: ExecutionStatusType;\n /** Creation date */\n date: string;\n /** Execution prompt */\n prompt: string;\n /** Last update date */\n updated_date?: string;\n /** Creator information */\n created_by: BaseUser;\n /** Token usage statistics */\n tokens_usage?: TokensUsage;\n}\n\n/** Model representing a workflow execution */\nexport interface WorkflowExecution {\n /** Unique identifier */\n id: string;\n /** Execution identifier */\n execution_id: string;\n /** Associated workflow identifier */\n workflow_id: string;\n /** Execution status */\n overall_status: ExecutionStatusType;\n /** Creation date */\n created_date: string;\n /** Execution prompt */\n prompt: string;\n /** Last update date */\n updated_date?: string;\n /** Creator information */\n created_by: BaseUser;\n /** Token usage statistics */\n tokens_usage?: TokensUsage;\n}\n\n/** Model for workflow execution state thought */\nexport interface WorkflowExecutionStateThought {\n /** Unique identifier */\n id: string;\n /** Thought content */\n text: string;\n /** Creation timestamp */\n created_at: string;\n /** Parent thought identifier */\n parent_id?: string;\n}\n\n/** Model for workflow execution state */\nexport interface WorkflowExecutionState {\n /** Unique identifier */\n id: string;\n /** Execution identifier */\n execution_id: string;\n /** State name */\n name: string;\n /** Associated task */\n task?: string;\n /** State status */\n status: ExecutionStatusType;\n /** Start timestamp */\n started_at?: string;\n /** Completion timestamp */\n completed_at?: string;\n}\n\n/** Model for workflow execution state output */\nexport interface WorkflowExecutionStateOutput {\n /** Output content */\n output?: string;\n}\n","import type { PaginatedResponse } from \"../models/common\";\nimport type { WorkflowExecutionState, WorkflowExecutionStateOutput } from \"../models/workflow\";\nimport {\n WorkflowExecutionStateListParamsSchema,\n type WorkflowExecutionStateListParams,\n} from \"../schemas/workflow\";\nimport type { ApiRequestHandler } from \"../utils/http\";\n\nexport class WorkflowExecutionStateService {\n private api: ApiRequestHandler;\n private workflowId: string;\n private executionId: string;\n\n constructor(api: ApiRequestHandler, workflowId: string, executionId: string) {\n this.api = api;\n this.workflowId = workflowId;\n this.executionId = executionId;\n }\n\n /**\n * List states for the workflow execution with filtering and pagination support.\n */\n async list(_params: WorkflowExecutionStateListParams = {}): Promise<WorkflowExecutionState[]> {\n const params = WorkflowExecutionStateListParamsSchema.parse(_params);\n\n const queryParams = {\n page: params.page,\n per_page: params.per_page,\n };\n\n const response = await this.api.get<PaginatedResponse<WorkflowExecutionState>>(\n `/v1/workflows/${this.workflowId}/executions/${this.executionId}/states`,\n { params: queryParams },\n );\n\n return response.data;\n }\n\n /**\n * Get output for a specific execution state.\n */\n async getOutput(stateId: string): Promise<WorkflowExecutionStateOutput> {\n return this.api.get(\n `/v1/workflows/${this.workflowId}/executions/${this.executionId}/states/${stateId}/output`,\n );\n }\n}\n","import { WorkflowMapper } from \"../mappers/workflow.mapper\";\nimport type { AnyJson, PaginatedResponse } from \"../models/common\";\nimport type { WorkflowExecution, WorkflowExecutionResponse } from \"../models/workflow\";\nimport {\n WorkflowExecutionCreateParamsSchema,\n WorkflowExecutionListParamsSchema,\n type WorkflowExecutionListParams,\n} from \"../schemas/workflow\";\nimport type { ApiRequestHandler } from \"../utils/http\";\nimport { WorkflowExecutionStateService } from \"./workflow_execution_state\";\n\nexport class WorkflowExecutionService {\n private api: ApiRequestHandler;\n private workflowId: string;\n\n constructor(api: ApiRequestHandler, workflowId: string) {\n this.api = api;\n this.workflowId = workflowId;\n }\n\n /**\n * List executions for the workflow with filtering and pagination support.\n */\n async list(_params: WorkflowExecutionListParams = {}): Promise<WorkflowExecution[]> {\n const params = WorkflowExecutionListParamsSchema.parse(_params);\n\n const queryParams = {\n page: params.page,\n per_page: params.per_page,\n };\n\n const response = await this.api.get<PaginatedResponse<WorkflowExecutionResponse>>(\n `/v1/workflows/${this.workflowId}/executions`,\n { params: queryParams },\n );\n\n return response.data.map(WorkflowMapper.mapWorkflowExecutionResponse);\n }\n\n /**\n * Create a new workflow execution.\n */\n async create(\n userInput?: string | Record<string, unknown> | unknown[] | number | boolean,\n fileName?: string,\n propagateHeaders?: boolean,\n headers?: Record<string, string>,\n ): Promise<AnyJson> {\n const params = WorkflowExecutionCreateParamsSchema.parse({\n user_input: userInput,\n file_name: fileName,\n propagate_headers: propagateHeaders,\n });\n return this.api.post(`/v1/workflows/${this.workflowId}/executions`, params, {}, headers);\n }\n\n /**\n * Get workflow execution by ID.\n */\n async get(executionId: string): Promise<WorkflowExecution> {\n const response = await this.api.get<WorkflowExecutionResponse>(\n `/v1/workflows/${this.workflowId}/executions/${executionId}`,\n );\n return WorkflowMapper.mapWorkflowExecutionResponse(response);\n }\n\n /**\n * Get states service for a specific workflow execution.\n */\n states(executionId: string): WorkflowExecutionStateService {\n return new WorkflowExecutionStateService(this.api, this.workflowId, executionId);\n }\n\n /**\n * Delete all workflow executions.\n */\n async deleteAll(): Promise<AnyJson> {\n return this.api.delete(`/v1/workflows/${this.workflowId}/executions`);\n }\n\n /**\n * Abort a running workflow execution.\n */\n async abort(executionId: string): Promise<AnyJson> {\n return this.api.put(`/v1/workflows/${this.workflowId}/executions/${executionId}/abort`);\n }\n\n /**\n * Resume an interrupted workflow execution.\n */\n async resume(\n executionId: string,\n propagateHeaders?: boolean,\n headers?: Record<string, string>,\n ): Promise<AnyJson> {\n const config = { params: { propagate_headers: propagateHeaders } };\n // empty body per API; send {} with query param and optional headers\n return this.api.put(\n `/v1/workflows/${this.workflowId}/executions/${executionId}/resume`,\n {},\n config,\n headers,\n );\n }\n}\n","import { WorkflowMapper } from \"../mappers/workflow.mapper\";\nimport type { AnyJson, PaginatedResponse, AuthConfig } from \"../models/common\";\nimport type { Workflow, WorkflowResponse } from \"../models/workflow\";\nimport {\n WorkflowCreateParamsSchema,\n type WorkflowCreateParams,\n WorkflowListParamsSchema,\n type WorkflowListParams,\n WorkflowUpdateParamsSchema,\n type WorkflowUpdateParams,\n} from \"../schemas/workflow\";\nimport { ApiRequestHandler } from \"../utils/http\";\nimport { WorkflowExecutionService } from \"./workflow_execution\";\n\nexport class WorkflowService {\n private api: ApiRequestHandler;\n\n constructor(config: AuthConfig) {\n this.api = new ApiRequestHandler(config);\n }\n\n /**\n * Get list of prebuilt workflows.\n */\n async getPrebuilt(): Promise<Workflow[]> {\n const response = await this.api.get<WorkflowResponse[]>(\"/v1/workflows/prebuilt\");\n return response.map(WorkflowMapper.mapWorkflowResponse);\n }\n\n /**\n * Create a new workflow.\n */\n async create(_params: WorkflowCreateParams): Promise<AnyJson> {\n const params = WorkflowCreateParamsSchema.parse(_params);\n return this.api.post(\"/v1/workflows\", params);\n }\n\n /**\n * Update an existing workflow.\n */\n async update(workflowId: string, _params: WorkflowUpdateParams): Promise<AnyJson> {\n const params = WorkflowUpdateParamsSchema.parse(_params);\n return this.api.put(`/v1/workflows/${workflowId}`, params);\n }\n\n /**\n * List workflows with filtering and pagination support.\n */\n async list(_params: WorkflowListParams = {}): Promise<Workflow[]> {\n const params = WorkflowListParamsSchema.parse(_params);\n\n const queryParams = {\n filters: JSON.stringify({\n page: params.page,\n per_page: params.per_page,\n ...(params.projects?.length ? { projects: params.projects } : {}),\n }),\n };\n\n const workflows = await this.api.get<PaginatedResponse<WorkflowResponse>>(\"/v1/workflows\", {\n params: queryParams,\n });\n\n return workflows.data.map(WorkflowMapper.mapWorkflowResponse);\n }\n\n /**\n * Get workflow by ID.\n */\n async get(workflowId: string): Promise<Workflow> {\n const response = await this.api.get<WorkflowResponse>(`/v1/workflows/id/${workflowId}`);\n return WorkflowMapper.mapWorkflowResponse(response);\n }\n\n /**\n * Delete a workflow by ID.\n */\n async delete(workflowId: string): Promise<AnyJson> {\n return this.api.delete(`/v1/workflows/${workflowId}`);\n }\n\n /**\n * Run a workflow by ID.\n */\n async run(\n workflowId: string,\n userInput?: string | Record<string, unknown> | unknown[] | number | boolean,\n fileName?: string,\n propagateHeaders?: boolean,\n headers?: Record<string, string>,\n ): Promise<AnyJson> {\n return this.executions(workflowId).create(userInput, fileName, propagateHeaders, headers);\n }\n\n /**\n * Get workflow execution service for the specified workflow.\n */\n executions(workflowId: string): WorkflowExecutionService {\n return new WorkflowExecutionService(this.api, workflowId);\n }\n}\n","import { KeycloakCredentials } from \"../auth/credentials\";\nimport type { AuthConfig } from \"../models/common\";\nimport { AssistantService } from \"../services/assistant\";\nimport { ConversationService } from \"../services/conversation\";\nimport { DatasourceService } from \"../services/datasource\";\nimport { IntegrationService } from \"../services/integration\";\nimport { LLMService } from \"../services/llm\";\nimport { TaskService } from \"../services/task\";\nimport { UserService } from \"../services/user\";\nimport { WorkflowService } from \"../services/workflow\";\n\nexport interface CodeMieClientConfig {\n auth_server_url?: string;\n auth_realm_name?: string;\n codemie_api_domain: string;\n auth_client_id?: string;\n auth_client_secret?: string;\n username?: string;\n password?: string;\n cookies?: Record<string, string>;\n verify_ssl?: boolean;\n}\n\nexport class CodeMieClient {\n private auth: KeycloakCredentials | null = null;\n private token: string | null = null;\n private cookies: Record<string, string>;\n private apiDomain: string;\n private verifySSL: boolean;\n private useCookieAuth: boolean;\n\n // Service instances\n private _assistants: AssistantService;\n private _conversations: ConversationService;\n private _llms: LLMService;\n private _integrations: IntegrationService;\n private _tasks: TaskService;\n private _users: UserService;\n private _datasources: DatasourceService;\n private _workflows: WorkflowService;\n\n constructor(config: CodeMieClientConfig) {\n const {\n auth_server_url,\n auth_realm_name,\n codemie_api_domain,\n auth_client_id,\n auth_client_secret,\n username,\n password,\n cookies,\n verify_ssl = true,\n } = config;\n\n this.apiDomain = codemie_api_domain.replace(/\\/$/, \"\");\n this.verifySSL = verify_ssl;\n this.cookies = cookies || {};\n this.useCookieAuth = !!cookies && Object.keys(cookies).length > 0;\n\n // Initialize token-based authentication only if not using cookie authentication\n if (!this.useCookieAuth) {\n // Validate required fields for token-based authentication\n if (!auth_server_url || !auth_realm_name) {\n throw new Error(\n \"auth_server_url and auth_realm_name are required when not using cookie authentication\"\n );\n }\n\n this.auth = new KeycloakCredentials({\n serverUrl: auth_server_url,\n realmName: auth_realm_name,\n clientId: auth_client_id,\n clientSecret: auth_client_secret,\n username: username,\n password: password,\n verifySSL: verify_ssl,\n });\n this.token = \"\"; // Will be set in initialize()\n }\n\n // Initialize services with shared auth config\n const authConfig: AuthConfig = {\n apiDomain: this.apiDomain,\n token: this.token,\n verifySSL: this.verifySSL,\n cookies: this.cookies,\n };\n\n this._assistants = new AssistantService(authConfig);\n this._conversations = new ConversationService(authConfig);\n this._llms = new LLMService(authConfig);\n this._integrations = new IntegrationService(authConfig);\n this._tasks = new TaskService(authConfig);\n this._users = new UserService(authConfig);\n this._datasources = new DatasourceService(authConfig);\n this._workflows = new WorkflowService(authConfig);\n }\n\n /**\n * Get the AssistantService instance.\n */\n get assistants(): AssistantService {\n return this._assistants;\n }\n\n /**\n * Get the ConversationService instance.\n */\n get conversations(): ConversationService {\n return this._conversations;\n }\n\n /**\n * Get the LLMService instance.\n */\n get llms(): LLMService {\n return this._llms;\n }\n\n /**\n * Get the IntegrationService instance.\n */\n get integrations(): IntegrationService {\n return this._integrations;\n }\n\n /**\n * Get the TaskService instance.\n */\n get tasks(): TaskService {\n return this._tasks;\n }\n\n /**\n * Get the UserService instance.\n */\n get users(): UserService {\n return this._users;\n }\n\n /**\n * Get the DatasourceService instance.\n */\n get datasources(): DatasourceService {\n return this._datasources;\n }\n\n /**\n * Get the WorkflowService instance.\n */\n get workflows(): WorkflowService {\n return this._workflows;\n }\n\n /**\n * Initialize the client by obtaining the initial token.\n * This should be called after creating the client instance.\n * When using cookie-based authentication, this is a no-op.\n */\n async initialize(): Promise<void> {\n // Skip initialization for cookie-based authentication\n if (this.useCookieAuth) {\n return;\n }\n\n if (!this.auth) {\n throw new Error(\"Authentication not configured\");\n }\n\n this.token = await this.auth.getToken();\n await this.refreshServices();\n }\n\n /**\n * Get the current access token or fetch a new one if not available.\n * Returns null when using cookie-based authentication.\n */\n async getToken(): Promise<string | null> {\n // Return null for cookie-based authentication\n if (this.useCookieAuth) {\n return null;\n }\n\n if (!this.auth) {\n throw new Error(\"Authentication not configured\");\n }\n\n if (!this.token) {\n this.token = await this.auth.getToken();\n await this.refreshServices();\n }\n return this.token;\n }\n\n /**\n * Force token refresh and update all services with the new token.\n * Throws an error when using cookie-based authentication.\n */\n async refreshToken(): Promise<string> {\n // Cookie-based authentication doesn't support token refresh\n if (this.useCookieAuth) {\n throw new Error(\"Token refresh is not supported with cookie-based authentication\");\n }\n\n if (!this.auth) {\n throw new Error(\"Authentication not configured\");\n }\n\n this.token = await this.auth.getToken();\n await this.refreshServices();\n return this.token;\n }\n\n /**\n * Reinitialize all services with the current token or cookies.\n */\n private async refreshServices(): Promise<void> {\n // For cookie-based auth, services are already initialized with cookies\n if (this.useCookieAuth) {\n return;\n }\n\n if (!this.token) {\n throw new Error(\"Token not available\");\n }\n\n const authConfig: AuthConfig = {\n apiDomain: this.apiDomain,\n token: this.token,\n verifySSL: this.verifySSL,\n cookies: this.cookies,\n };\n\n this._assistants = new AssistantService(authConfig);\n this._conversations = new ConversationService(authConfig);\n this._llms = new LLMService(authConfig);\n this._integrations = new IntegrationService(authConfig);\n this._tasks = new TaskService(authConfig);\n this._users = new UserService(authConfig);\n this._datasources = new DatasourceService(authConfig);\n this._workflows = new WorkflowService(authConfig);\n }\n}\n","/** Models for assistant-related data structures. */\n\nimport type { BaseUser } from \"./common\";\nimport type { Integration } from \"./integration\";\nimport type { AgentErrorDetails, ToolErrorDetails } from \"./errors\";\n\nexport enum ContextType {\n KNOWLEDGE_BASE = \"knowledge_base\",\n CODE = \"code\",\n}\n\nexport enum ChatRole {\n ASSISTANT = \"Assistant\",\n USER = \"User\",\n}\n\nexport interface ToolDetails {\n description?: string | null;\n label?: string;\n name: string;\n settings?: Integration | null;\n settings_config: boolean;\n user_description?: string;\n}\n\nexport interface ToolKitDetails {\n is_external: boolean;\n label: string;\n settings?: Integration;\n settings_config: boolean;\n toolkit: string;\n tools: ToolDetails[];\n}\n\nexport interface Context {\n context_type: ContextType;\n name: string;\n}\n\nexport interface PromptVariable {\n key: string;\n description?: string;\n default_value: string;\n}\n\nexport interface MCPServerConfig {\n command?: string;\n url?: string;\n args?: string[];\n env?: Record<string, unknown>;\n headers?: Record<string, string>;\n type?: string;\n auth_token?: string;\n}\n\nexport interface MCPServerDetails {\n name: string;\n description?: string;\n enabled: boolean;\n config?: MCPServerConfig;\n mcp_connect_url?: string;\n tools_tokens_size_limit?: number;\n command?: string;\n arguments?: string;\n settings?: Integration;\n mcp_connect_auth_token?: Integration;\n}\n\nexport interface SystemPromptHistory {\n system_prompt: string;\n date: string;\n created_by?: BaseUser;\n}\n\nexport interface AssistantCategory {\n id: string;\n name: string;\n description?: string;\n}\n\nexport interface AssistantBase {\n id: string;\n created_by?: BaseUser;\n description: string;\n icon_url?: string;\n name: string;\n}\n\nexport interface Assistant extends AssistantBase {\n assistant_ids: string[];\n categories?: AssistantCategory[];\n context: Context[];\n conversation_starters: string[];\n created_date?: string;\n creator: string;\n is_global: boolean;\n is_react: boolean;\n llm_model_type?: string;\n mcp_servers: MCPServerDetails[];\n nested_assistants: Partial<Assistant>[];\n project: string;\n prompt_variables?: PromptVariable[];\n shared: boolean;\n slug?: string;\n system_prompt: string;\n system_prompt_history: SystemPromptHistory[];\n temperature?: number;\n toolkits: ToolKitDetails[];\n top_p?: number;\n unique_users_count?: number;\n updated_date?: string;\n user_abilities?: unknown[];\n version_count?: number;\n}\n\n/**\n * API response for assistant chat (camelCase format from API).\n *\n * Error fields expose agent and tool errors.\n */\nexport interface BaseModelApiResponse {\n generated: string;\n timeElapsed?: number;\n tokensUsed?: number;\n thoughts?: Record<string, unknown>[];\n taskId?: string;\n success?: boolean;\n agentError?: AgentErrorDetails;\n toolErrors?: ToolErrorDetails[];\n}\n\n/**\n * Client-facing response for assistant chat (snake_case format).\n *\n * Error fields expose agent and tool errors without breaking backward\n * compatibility (all error fields optional).\n */\nexport interface BaseModelResponse {\n generated: string | object | unknown;\n time_elapsed?: number;\n tokens_used?: number;\n thoughts?: Record<string, unknown>[];\n task_id?: string;\n success?: boolean;\n agent_error?: AgentErrorDetails;\n tool_errors?: ToolErrorDetails[];\n}\n\n// Assistant versioning models\nexport interface AssistantVersion {\n version_number: number;\n created_date: string;\n created_by?: BaseUser;\n change_notes?: string;\n description?: string;\n system_prompt: string;\n llm_model_type?: string;\n temperature?: number;\n top_p?: number;\n context: Context[];\n toolkits: ToolKitDetails[];\n mcp_servers: MCPServerDetails[];\n assistant_ids: string[];\n prompt_variables?: PromptVariable[];\n // allow future fields without breaking consumers\n [key: string]: unknown;\n}\n\n// Assistant validation models\nexport interface MissingIntegration {\n toolkit: string;\n tool: string;\n label: string;\n credential_type?: string;\n}\n\nexport interface MissingIntegrationsByCredentialType {\n credential_type: string;\n missing_tools: MissingIntegration[];\n assistant_id?: string;\n assistant_name?: string;\n icon_url?: string;\n}\n\nexport interface IntegrationValidationResult {\n has_missing_integrations: boolean;\n missing_by_credential_type: MissingIntegrationsByCredentialType[];\n sub_assistants_missing: MissingIntegrationsByCredentialType[];\n message?: string;\n}\n\nexport interface AssistantCreateResponse {\n message: string;\n assistant_id?: string;\n validation?: IntegrationValidationResult;\n}\n\nexport interface AssistantUpdateResponse {\n message: string;\n validation?: IntegrationValidationResult;\n}\n\n// Note: compareVersions returns a generic object; no strict SDK interface is defined\n","/**\n * Error models for structured error handling in CodeMie SDK responses.\n *\n * This module provides error classification and structured error details that match\n * the CodeMie API error response format, enabling proper error handling without\n * parsing error messages.\n */\n\n/**\n * High-level categorization of errors in the CodeMie system.\n *\n * Separates errors by their source to enable proper handling and debugging.\n */\nexport enum ErrorCategory {\n AGENT = \"agent\", // Agent-level errors (execution, callbacks, etc.)\n TOOL = \"tool\", // Tool execution errors (HTTP errors, timeouts, etc.)\n LLM = \"llm\", // LLM provider errors (rate limits, content policy, etc.)\n VALIDATION = \"validation\", // Input/output validation errors\n}\n\n/**\n * Specific error codes for detailed error classification.\n *\n * These codes enable clients to programmatically handle different error scenarios\n * without parsing error messages.\n */\nexport enum ErrorCode {\n // Agent errors - internal execution issues\n AGENT_TIMEOUT = \"agent_timeout\",\n AGENT_TOKEN_LIMIT = \"agent_token_limit\",\n AGENT_BUDGET_EXCEEDED = \"agent_budget_exceeded\",\n AGENT_CALLBACK_FAILURE = \"agent_callback_failure\",\n AGENT_NETWORK_ERROR = \"agent_network_error\",\n AGENT_CONFIGURATION_ERROR = \"agent_configuration_error\",\n AGENT_INTERNAL_ERROR = \"agent_internal_error\",\n\n // Tool errors - external service/integration errors\n TOOL_AUTHENTICATION = \"tool_authentication\", // 401 Unauthorized\n TOOL_AUTHORIZATION = \"tool_authorization\", // 403 Forbidden\n TOOL_NOT_FOUND = \"tool_not_found\", // 404 Not Found\n TOOL_CONFLICT = \"tool_conflict\", // 409 Conflict\n TOOL_RATE_LIMITED = \"tool_rate_limited\", // 429 Too Many Requests\n TOOL_SERVER_ERROR = \"tool_server_error\", // 5xx Server Error\n TOOL_TIMEOUT = \"tool_timeout\",\n TOOL_VALIDATION = \"tool_validation\", // Invalid tool input\n TOOL_NETWORK_ERROR = \"tool_network_error\",\n TOOL_EXECUTION_FAILED = \"tool_execution_failed\", // Generic tool failure\n\n // LLM errors - provider-specific errors\n LLM_CONTENT_POLICY = \"llm_content_policy\",\n LLM_CONTEXT_LENGTH = \"llm_context_length\",\n LLM_UNAVAILABLE = \"llm_unavailable\",\n LLM_RATE_LIMITED = \"llm_rate_limited\",\n LLM_INVALID_REQUEST = \"llm_invalid_request\",\n\n // Validation errors - input/output validation\n VALIDATION_INPUT = \"validation_input\",\n VALIDATION_OUTPUT = \"validation_output\",\n VALIDATION_SCHEMA = \"validation_schema\",\n}\n\n/**\n * Structured details for a tool execution error.\n *\n * Captures comprehensive information about tool failures to enable proper\n * debugging and error handling without relying on the LLM to interpret errors.\n */\nexport interface ToolErrorDetails {\n /** Name of the tool that encountered an error */\n tool_name: string;\n /** Unique identifier for the tool call */\n tool_call_id?: string;\n /** Classified error code for programmatic handling */\n error_code: ErrorCode;\n /** Human-readable error message */\n message: string;\n /** HTTP status code if applicable (401, 403, 404, 5xx, etc.) */\n http_status?: number;\n /** Additional error context (integration name, action, etc.) */\n details?: Record<string, unknown>;\n /** ISO 8601 timestamp of when error occurred */\n timestamp: string;\n}\n\n/**\n * Error verbosity level for API responses.\n *\n * Controls how much detail is included in tool error responses:\n * - Minimal: Only error code and message (for production clients)\n * - Standard: Adds HTTP status and tool_call_id (default, for debugging)\n * - Full: Includes all details including timestamp (for development)\n */\nexport enum ErrorDetailLevel {\n Minimal = \"minimal\",\n Standard = \"standard\",\n Full = \"full\",\n}\n\n/**\n * Structured details for an agent-level error.\n *\n * Captures agent execution failures that are not related to specific tools,\n * such as token limits, budget constraints, or internal errors.\n */\nexport interface AgentErrorDetails {\n /** Classified error code for programmatic handling */\n error_code: ErrorCode;\n /** Human-readable error message */\n message: string;\n /** Additional error context */\n details?: Record<string, unknown>;\n /** Full stacktrace for debugging (only in debug mode) */\n stacktrace?: string;\n}\n\n/**\n * Complete error response with separated agent and tool errors.\n *\n * This structure ensures that errors from different sources are clearly\n * distinguished and not absorbed by the LLM's response text.\n */\nexport interface ErrorResponse {\n /** High-level error category */\n category: ErrorCategory;\n /** Agent-level error details (if applicable) */\n agent_error?: AgentErrorDetails;\n /** Tool error details (multiple tools can fail) */\n tool_errors?: ToolErrorDetails[];\n /** Whether the error is recoverable */\n is_recoverable: boolean;\n}\n\n/**\n * Format tool error details to minimal format (code + message only).\n */\nexport function formatToolErrorMinimal(error: ToolErrorDetails): Record<string, unknown> {\n return {\n tool_name: error.tool_name,\n error_code: error.error_code,\n message: error.message,\n };\n}\n\n/**\n * Format tool error details to standard format (+ http_status, tool_call_id).\n */\nexport function formatToolErrorStandard(error: ToolErrorDetails): Record<string, unknown> {\n return {\n tool_name: error.tool_name,\n tool_call_id: error.tool_call_id,\n error_code: error.error_code,\n message: error.message,\n http_status: error.http_status,\n };\n}\n\n/**\n * Format tool error details to full format (all fields).\n */\nexport function formatToolErrorFull(error: ToolErrorDetails): Record<string, unknown> {\n return { ...error };\n}\n\n/**\n * Format tool error details based on verbosity level.\n */\nexport function formatToolErrorForLevel(\n error: ToolErrorDetails,\n level: ErrorDetailLevel,\n): Record<string, unknown> {\n switch (level) {\n case ErrorDetailLevel.Minimal:\n return formatToolErrorMinimal(error);\n case ErrorDetailLevel.Standard:\n return formatToolErrorStandard(error);\n case ErrorDetailLevel.Full:\n return formatToolErrorFull(error);\n }\n}\n\n/**\n * HTTP status code to error code mapping.\n */\nexport const HTTP_STATUS_TO_ERROR_CODE: Record<number, ErrorCode> = {\n // Client errors (4xx)\n 401: ErrorCode.TOOL_AUTHENTICATION,\n 403: ErrorCode.TOOL_AUTHORIZATION,\n 404: ErrorCode.TOOL_NOT_FOUND,\n 409: ErrorCode.TOOL_CONFLICT,\n 429: ErrorCode.TOOL_RATE_LIMITED,\n // Server errors (5xx)\n 500: ErrorCode.TOOL_SERVER_ERROR,\n 501: ErrorCode.TOOL_SERVER_ERROR,\n 502: ErrorCode.TOOL_SERVER_ERROR,\n 503: ErrorCode.TOOL_SERVER_ERROR,\n 504: ErrorCode.TOOL_SERVER_ERROR,\n 505: ErrorCode.TOOL_SERVER_ERROR,\n 506: ErrorCode.TOOL_SERVER_ERROR,\n 507: ErrorCode.TOOL_SERVER_ERROR,\n 508: ErrorCode.TOOL_SERVER_ERROR,\n 509: ErrorCode.TOOL_SERVER_ERROR,\n 510: ErrorCode.TOOL_SERVER_ERROR,\n 511: ErrorCode.TOOL_SERVER_ERROR,\n};\n\n/**\n * Error message keywords to error code mapping.\n */\nexport const ERROR_MESSAGE_PATTERNS: Record<string, ErrorCode> = {\n timeout: ErrorCode.TOOL_TIMEOUT,\n network: ErrorCode.TOOL_NETWORK_ERROR,\n connection: ErrorCode.TOOL_NETWORK_ERROR,\n validation: ErrorCode.TOOL_VALIDATION,\n invalid: ErrorCode.TOOL_VALIDATION,\n};\n\n/**\n * Classify error based on HTTP status code only.\n *\n * Uses dictionary mapping for efficient lookup of common HTTP status codes.\n * This is the primary classification method - message-based classification is only\n * used as a fallback when status code classification yields a generic result.\n */\nfunction classifyByHttpStatus(statusCode: number): ErrorCode {\n // Try direct lookup first\n if (statusCode in HTTP_STATUS_TO_ERROR_CODE) {\n return HTTP_STATUS_TO_ERROR_CODE[statusCode];\n }\n\n // Fallback for any 5xx not in the dict\n if (statusCode >= 500 && statusCode < 600) {\n return ErrorCode.TOOL_SERVER_ERROR;\n }\n\n // Default for unknown status codes\n return ErrorCode.TOOL_EXECUTION_FAILED;\n}\n\n/**\n * Classify error based on error message content.\n *\n * Checks for keywords in the error message to determine error type.\n */\nfunction classifyByMessage(errorMessage: string): ErrorCode {\n const errorLower = errorMessage.toLowerCase();\n\n // Check each pattern\n for (const [keyword, errorCode] of Object.entries(ERROR_MESSAGE_PATTERNS)) {\n if (errorLower.includes(keyword)) {\n return errorCode;\n }\n }\n\n // Default for unrecognized error messages\n return ErrorCode.TOOL_EXECUTION_FAILED;\n}\n\n/**\n * Classify HTTP status codes into appropriate ErrorCode values.\n *\n * Uses a two-stage classification approach:\n * 1. Primary: Classification by HTTP status code using dictionary mapping\n * 2. Fallback: If status yields generic result, analyze error message content\n */\nexport function classifyHttpError(statusCode: number, errorMessage = \"\"): ErrorCode {\n // First, try classification by HTTP status\n let errorCode = classifyByHttpStatus(statusCode);\n\n // If we got a generic error and have a message, try message-based classification\n if (errorCode === ErrorCode.TOOL_EXECUTION_FAILED && errorMessage) {\n errorCode = classifyByMessage(errorMessage);\n }\n\n return errorCode;\n}\n\n/**\n * Determine if an error is recoverable (can be retried).\n */\nexport function isRecoverableError(errorCode: ErrorCode): boolean {\n const recoverableErrors = new Set([\n ErrorCode.TOOL_TIMEOUT,\n ErrorCode.TOOL_RATE_LIMITED,\n ErrorCode.TOOL_SERVER_ERROR,\n ErrorCode.TOOL_NETWORK_ERROR,\n ErrorCode.AGENT_NETWORK_ERROR,\n ErrorCode.LLM_RATE_LIMITED,\n ErrorCode.LLM_UNAVAILABLE,\n ]);\n return recoverableErrors.has(errorCode);\n}","/** Models for LLM service. */\n\n/** LLM provider options as constant object */\nexport const LLMProvider = {\n AZURE_OPENAI: \"azure_openai\",\n AWS_BEDROCK: \"aws_bedrock\",\n GOOGLE_VERTEXAI: \"google_vertexai\",\n} as const;\n\nexport type LLMProviderType = (typeof LLMProvider)[keyof typeof LLMProvider];\n\n/** Cost configuration for LLM model */\nexport interface CostConfig {\n /** Cost per input token */\n input: number;\n /** Cost per output token */\n output: number;\n}\n\n/** Features supported by LLM model */\nexport interface LLMFeatures {\n /** Support for streaming responses */\n streaming: boolean;\n /** Support for tool usage */\n tools: boolean;\n /** Support for temperature parameter */\n temperature: boolean;\n /** Support for parallel tool calls */\n parallel_tool_calls: boolean;\n /** Support for system prompt */\n system_prompt: boolean;\n /** Support for max tokens parameter */\n max_tokens: boolean;\n}\n\n/** LLM model configuration. */\nexport interface LLMModel {\n /** Base name of the model */\n base_name: string;\n /** Deployment name */\n deployment_name: string;\n /** Display label */\n label?: string;\n /** Whether model supports multimodal inputs */\n multimodal?: boolean;\n /** Whether model supports react agent pattern */\n react_agent?: boolean;\n /** Whether the model is enabled */\n enabled: boolean;\n /** LLM provider */\n provider?: LLMProviderType;\n /** Whether this is the default model */\n default?: boolean;\n /** Cost configuration */\n cost?: CostConfig;\n /** Maximum output tokens */\n max_output_tokens?: number;\n /** Supported features */\n features: LLMFeatures;\n}\n","/** Models for task service. */\n\n/** Background task status constants */\nexport const BackgroundTaskStatus = {\n STARTED: \"STARTED\",\n COMPLETED: \"COMPLETED\",\n FAILED: \"FAILED\",\n} as const;\nexport type BackgroundTaskStatusType =\n (typeof BackgroundTaskStatus)[keyof typeof BackgroundTaskStatus];\n\n/** Model representing task user information */\nexport interface TaskUser {\n /** Unique identifier of the user */\n user_id: string;\n /** Username of the task owner */\n username: string;\n /** Display name of the task owner */\n name: string;\n}\n\n/** Model representing a background task */\nexport interface BackgroundTaskEntity {\n /** Unique identifier of the task */\n id: string;\n /** Task description or name */\n task: string;\n /** Information about the task owner */\n user: TaskUser;\n /** The final result or output of the task */\n final_output?: string;\n /** Current step or stage of the task */\n current_step?: string;\n /** Task status (STARTED, COMPLETED, or FAILED) */\n status: BackgroundTaskStatusType;\n /** Task creation timestamp */\n date: string;\n /** Last update timestamp */\n update_date: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,wBAAsB;AACtB,mBAAkB;AAGlB,IAAM,oBAAoB;AAEnB,IAAM,sBAAN,MAA0B;AAAA,EAI/B,YAAY,QAAmC;AAC7C,SAAK,0BAA0B,MAAM;AACrC,SAAK,SAAS;AAEd,SAAK,YAAY,IAAI,wBAAM;AAAA,MACzB,oBAAoB,OAAO;AAAA,IAC7B,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,WAA4B;AAChC,UAAM,EAAE,WAAW,UAAU,IAAI,KAAK;AACtC,UAAM,MAAM,GAAG,SAAS,WAAW,SAAS;AAE5C,UAAM,UACJ,KAAK,OAAO,YAAY,KAAK,OAAO,WAChC,KAAK,sCAAsC,IAC3C,KAAK,+BAA+B;AAE1C,UAAM,EAAE,KAAK,IAAI,MAAM,aAAAA,QAAM,KAAoB,KAAK,KAAK,mBAAmB,OAAO,GAAG;AAAA,MACtF,SAAS,EAAE,gB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O;AACT;AAKO,SAAS,mBAAmB,WAA+B;AAChE,QAAM,oBAAoB,oBAAI,IAAI;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,SAAO,kBAAkB,IAAI,SAAS;AACxC;;;AC/RO,IAAM,cAAc;AAAA,EACzB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,iBAAiB;AACnB;;;ACJO,IAAM,uBAAuB;AAAA,EAClC,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AACV;","names":["axios","import_zod","import_node_https","import_axios","axios","errorMessage","import_zod","FormData","import_zod","import_zod","ContextType","ChatRole","ErrorCategory","ErrorCode","ErrorDetailLevel"]}
|