@lightdash-tools/client 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/README.md +2 -2
  2. package/dist/agentops/apply-agent-change.d.ts +3 -0
  3. package/dist/agentops/apply-agent-change.js +63 -0
  4. package/dist/agentops/apply-bundle-diff.d.ts +13 -0
  5. package/dist/agentops/apply-bundle-diff.js +44 -0
  6. package/dist/agentops/apply-bundle-diff.test.d.ts +1 -0
  7. package/dist/agentops/apply-bundle-diff.test.js +397 -0
  8. package/dist/agentops/apply-context.d.ts +14 -0
  9. package/dist/agentops/apply-context.js +6 -0
  10. package/dist/agentops/apply-evaluation-change.d.ts +3 -0
  11. package/dist/agentops/apply-evaluation-change.js +78 -0
  12. package/dist/agentops/fetch-bundle-state.d.ts +6 -0
  13. package/dist/agentops/fetch-bundle-state.js +20 -0
  14. package/dist/agentops/fetch-bundle-state.test.d.ts +1 -0
  15. package/dist/agentops/fetch-bundle-state.test.js +44 -0
  16. package/dist/agentops/index.d.ts +3 -0
  17. package/dist/agentops/index.js +9 -0
  18. package/dist/agentops/resolve-evaluation-run.d.ts +15 -0
  19. package/dist/agentops/resolve-evaluation-run.js +48 -0
  20. package/dist/api/v1/ai-agents/admin.d.ts +16 -0
  21. package/dist/api/v1/ai-agents/admin.js +29 -0
  22. package/dist/api/v1/ai-agents/agents.d.ts +18 -0
  23. package/dist/api/v1/ai-agents/agents.js +31 -0
  24. package/dist/api/v1/ai-agents/artifacts.d.ts +26 -0
  25. package/dist/api/v1/ai-agents/artifacts.js +41 -0
  26. package/dist/api/v1/ai-agents/artifacts.test.d.ts +1 -0
  27. package/dist/api/v1/ai-agents/artifacts.test.js +69 -0
  28. package/dist/api/v1/ai-agents/discovery.d.ts +28 -0
  29. package/dist/api/v1/ai-agents/discovery.js +46 -0
  30. package/dist/api/v1/ai-agents/discovery.test.d.ts +1 -0
  31. package/dist/api/v1/ai-agents/discovery.test.js +90 -0
  32. package/dist/api/v1/ai-agents/evaluations.d.ts +39 -0
  33. package/dist/api/v1/ai-agents/evaluations.js +70 -0
  34. package/dist/api/v1/ai-agents/facade.d.ts +79 -0
  35. package/dist/api/v1/ai-agents/facade.js +193 -0
  36. package/dist/api/v1/ai-agents/feedback.d.ts +10 -0
  37. package/dist/api/v1/ai-agents/feedback.js +15 -0
  38. package/dist/api/v1/ai-agents/feedback.test.d.ts +1 -0
  39. package/dist/api/v1/ai-agents/feedback.test.js +23 -0
  40. package/dist/api/v1/ai-agents/index.d.ts +1 -0
  41. package/dist/api/v1/ai-agents/index.js +5 -0
  42. package/dist/api/v1/ai-agents/mcp-servers.d.ts +20 -0
  43. package/dist/api/v1/ai-agents/mcp-servers.js +35 -0
  44. package/dist/api/v1/ai-agents/mcp-servers.test.d.ts +1 -0
  45. package/dist/api/v1/ai-agents/mcp-servers.test.js +66 -0
  46. package/dist/api/v1/ai-agents/request-options.d.ts +12 -0
  47. package/dist/api/v1/ai-agents/request-options.js +20 -0
  48. package/dist/api/v1/ai-agents/sql-approval.d.ts +10 -0
  49. package/dist/api/v1/ai-agents/sql-approval.js +15 -0
  50. package/dist/api/v1/ai-agents/sql-approval.test.d.ts +1 -0
  51. package/dist/api/v1/ai-agents/sql-approval.test.js +25 -0
  52. package/dist/api/v1/ai-agents/threads.d.ts +56 -0
  53. package/dist/api/v1/ai-agents/threads.js +97 -0
  54. package/dist/api/v1/ai-agents/threads.test.d.ts +1 -0
  55. package/dist/api/v1/ai-agents/threads.test.js +39 -0
  56. package/dist/api/v1/ai-agents.test.js +172 -89
  57. package/dist/api/v1/analytics.d.ts +10 -0
  58. package/dist/api/v1/analytics.js +14 -0
  59. package/dist/api/v1/analytics.test.d.ts +4 -0
  60. package/dist/api/v1/analytics.test.js +27 -0
  61. package/dist/api/v1/charts.d.ts +5 -2
  62. package/dist/api/v1/charts.js +18 -30
  63. package/dist/api/v1/charts.test.js +19 -28
  64. package/dist/api/v1/dashboards.d.ts +11 -2
  65. package/dist/api/v1/dashboards.js +19 -14
  66. package/dist/api/v1/dashboards.test.js +54 -12
  67. package/dist/api/v1/explores.d.ts +4 -2
  68. package/dist/api/v1/explores.js +20 -29
  69. package/dist/api/v1/explores.test.js +31 -21
  70. package/dist/api/v1/groups.d.ts +1 -1
  71. package/dist/api/v1/groups.js +25 -51
  72. package/dist/api/v1/groups.test.js +15 -24
  73. package/dist/api/v1/metrics.d.ts +2 -2
  74. package/dist/api/v1/metrics.js +4 -17
  75. package/dist/api/v1/metrics.test.js +6 -15
  76. package/dist/api/v1/organizations.d.ts +1 -1
  77. package/dist/api/v1/organizations.js +2 -13
  78. package/dist/api/v1/organizations.test.js +3 -12
  79. package/dist/api/v1/project-access.d.ts +1 -1
  80. package/dist/api/v1/project-access.js +18 -45
  81. package/dist/api/v1/project-access.test.js +27 -36
  82. package/dist/api/v1/projects.d.ts +1 -1
  83. package/dist/api/v1/projects.js +6 -21
  84. package/dist/api/v1/projects.test.js +9 -18
  85. package/dist/api/v1/query.d.ts +5 -2
  86. package/dist/api/v1/query.js +8 -18
  87. package/dist/api/v1/query.test.js +6 -15
  88. package/dist/api/v1/schedulers.d.ts +2 -2
  89. package/dist/api/v1/schedulers.js +4 -17
  90. package/dist/api/v1/schedulers.test.js +6 -15
  91. package/dist/api/v1/spaces.d.ts +1 -1
  92. package/dist/api/v1/spaces.js +18 -45
  93. package/dist/api/v1/spaces.test.js +27 -36
  94. package/dist/api/v1/tags.d.ts +1 -1
  95. package/dist/api/v1/tags.js +4 -17
  96. package/dist/api/v1/tags.test.js +6 -15
  97. package/dist/api/v1/users.d.ts +3 -1
  98. package/dist/api/v1/users.js +22 -39
  99. package/dist/api/v1/users.test.js +44 -30
  100. package/dist/api/v1/validation.d.ts +5 -2
  101. package/dist/api/v1/validation.js +8 -18
  102. package/dist/api/v1/validation.test.js +6 -15
  103. package/dist/api/v2/content.d.ts +2 -2
  104. package/dist/api/v2/content.js +3 -14
  105. package/dist/api/v2/content.test.js +3 -12
  106. package/dist/api/v2/dashboards.d.ts +10 -0
  107. package/dist/api/v2/dashboards.js +14 -0
  108. package/dist/api/v2/dashboards.test.d.ts +4 -0
  109. package/dist/api/v2/dashboards.test.js +27 -0
  110. package/dist/api/v2/organization-roles.d.ts +1 -1
  111. package/dist/api/v2/organization-roles.js +21 -50
  112. package/dist/api/v2/organization-roles.test.js +33 -42
  113. package/dist/api/v2/project-role-assignments.d.ts +1 -1
  114. package/dist/api/v2/project-role-assignments.js +12 -33
  115. package/dist/api/v2/project-role-assignments.test.js +18 -27
  116. package/dist/api/v2/query.d.ts +1 -1
  117. package/dist/api/v2/query.js +10 -29
  118. package/dist/api/v2/query.test.js +15 -24
  119. package/dist/api/v2/validation.d.ts +28 -0
  120. package/dist/api/v2/validation.js +23 -0
  121. package/dist/client.d.ts +20 -14
  122. package/dist/client.js +22 -16
  123. package/dist/config.d.ts +35 -10
  124. package/dist/http/axios-client.d.ts +4 -4
  125. package/dist/http/http-client.d.ts +3 -3
  126. package/dist/http/http-client.js +19 -40
  127. package/dist/http/interceptors.d.ts +3 -3
  128. package/dist/http/interceptors.js +16 -3
  129. package/dist/http/rate-limiter.js +2 -13
  130. package/dist/http/rate-limiter.test.js +15 -24
  131. package/dist/index.d.ts +7 -2
  132. package/dist/index.js +12 -1
  133. package/dist/index.test.js +13 -5
  134. package/dist/pagination/fetch-all-pages.js +18 -29
  135. package/dist/pagination/fetch-all-pages.test.js +15 -24
  136. package/dist/types/api.d.ts +1 -1
  137. package/dist/utils/env.d.ts +11 -2
  138. package/dist/utils/env.js +41 -8
  139. package/dist/utils/env.test.js +14 -4
  140. package/dist/utils/logger.js +5 -4
  141. package/dist/utils/retry.js +17 -28
  142. package/dist/utils/retry.test.js +9 -18
  143. package/dist/utils/secret-string.test.d.ts +1 -0
  144. package/dist/utils/secret-string.test.js +25 -0
  145. package/package.json +12 -4
  146. package/src/agentops/apply-agent-change.ts +82 -0
  147. package/src/agentops/apply-bundle-diff.test.ts +453 -0
  148. package/src/agentops/apply-bundle-diff.ts +63 -0
  149. package/src/agentops/apply-context.ts +23 -0
  150. package/src/agentops/apply-evaluation-change.ts +125 -0
  151. package/src/agentops/fetch-bundle-state.test.ts +51 -0
  152. package/src/agentops/fetch-bundle-state.ts +33 -0
  153. package/src/agentops/index.ts +11 -0
  154. package/src/agentops/resolve-evaluation-run.ts +94 -0
  155. package/src/api/v1/ai-agents/admin.ts +41 -0
  156. package/src/api/v1/ai-agents/agents.ts +40 -0
  157. package/src/api/v1/ai-agents/artifacts.test.ts +84 -0
  158. package/src/api/v1/ai-agents/artifacts.ts +92 -0
  159. package/src/api/v1/ai-agents/discovery.test.ts +102 -0
  160. package/src/api/v1/ai-agents/discovery.ts +79 -0
  161. package/src/api/v1/ai-agents/evaluations.ts +152 -0
  162. package/src/api/v1/ai-agents/facade.ts +489 -0
  163. package/src/api/v1/ai-agents/feedback.test.ts +30 -0
  164. package/src/api/v1/ai-agents/feedback.ts +24 -0
  165. package/src/api/v1/ai-agents/index.ts +1 -0
  166. package/src/api/v1/ai-agents/mcp-servers.test.ts +81 -0
  167. package/src/api/v1/ai-agents/mcp-servers.ts +67 -0
  168. package/src/api/v1/ai-agents/request-options.ts +32 -0
  169. package/src/api/v1/ai-agents/sql-approval.test.ts +32 -0
  170. package/src/api/v1/ai-agents/sql-approval.ts +24 -0
  171. package/src/api/v1/ai-agents/threads.test.ts +55 -0
  172. package/src/api/v1/ai-agents/threads.ts +216 -0
  173. package/src/api/v1/ai-agents.test.ts +189 -13
  174. package/src/api/v1/analytics.test.ts +32 -0
  175. package/src/api/v1/analytics.ts +16 -0
  176. package/src/api/v1/charts.test.ts +8 -6
  177. package/src/api/v1/charts.ts +8 -4
  178. package/src/api/v1/dashboards.test.ts +57 -0
  179. package/src/api/v1/dashboards.ts +41 -2
  180. package/src/api/v1/explores.test.ts +22 -0
  181. package/src/api/v1/explores.ts +13 -2
  182. package/src/api/v1/groups.test.ts +2 -0
  183. package/src/api/v1/groups.ts +9 -7
  184. package/src/api/v1/metrics.test.ts +2 -0
  185. package/src/api/v1/metrics.ts +3 -2
  186. package/src/api/v1/organizations.test.ts +2 -0
  187. package/src/api/v1/organizations.ts +2 -1
  188. package/src/api/v1/project-access.test.ts +3 -1
  189. package/src/api/v1/project-access.ts +2 -1
  190. package/src/api/v1/projects.test.ts +2 -0
  191. package/src/api/v1/projects.ts +2 -1
  192. package/src/api/v1/query.test.ts +2 -0
  193. package/src/api/v1/query.ts +6 -2
  194. package/src/api/v1/schedulers.test.ts +2 -0
  195. package/src/api/v1/schedulers.ts +3 -2
  196. package/src/api/v1/spaces.test.ts +2 -0
  197. package/src/api/v1/spaces.ts +2 -1
  198. package/src/api/v1/tags.test.ts +2 -0
  199. package/src/api/v1/tags.ts +2 -1
  200. package/src/api/v1/users.test.ts +26 -0
  201. package/src/api/v1/users.ts +8 -2
  202. package/src/api/v1/validation.test.ts +2 -0
  203. package/src/api/v1/validation.ts +6 -2
  204. package/src/api/v2/content.test.ts +2 -0
  205. package/src/api/v2/content.ts +3 -2
  206. package/src/api/v2/dashboards.test.ts +32 -0
  207. package/src/api/v2/dashboards.ts +18 -0
  208. package/src/api/v2/organization-roles.test.ts +2 -0
  209. package/src/api/v2/organization-roles.ts +2 -1
  210. package/src/api/v2/project-role-assignments.test.ts +2 -0
  211. package/src/api/v2/project-role-assignments.ts +2 -1
  212. package/src/api/v2/query.test.ts +2 -0
  213. package/src/api/v2/query.ts +2 -1
  214. package/src/api/v2/validation.ts +48 -0
  215. package/src/client.test.ts +1 -0
  216. package/src/client.ts +27 -17
  217. package/src/config.ts +38 -10
  218. package/src/errors.test.ts +1 -0
  219. package/src/http/axios-client.ts +8 -5
  220. package/src/http/http-client.ts +8 -6
  221. package/src/http/interceptors.ts +23 -10
  222. package/src/http/rate-limiter.test.ts +1 -0
  223. package/src/http/rate-limiter.ts +3 -1
  224. package/src/index.test.ts +16 -7
  225. package/src/index.ts +16 -1
  226. package/src/pagination/fetch-all-pages.test.ts +2 -0
  227. package/src/types/api.ts +1 -1
  228. package/src/utils/env.test.ts +16 -4
  229. package/src/utils/env.ts +61 -10
  230. package/src/utils/logger.ts +6 -4
  231. package/src/utils/retry.test.ts +1 -0
  232. package/src/utils/retry.ts +2 -1
  233. package/src/utils/secret-string.test.ts +27 -0
  234. package/tsconfig.json +4 -2
  235. package/dist/api/v1/ai-agents.d.ts +0 -63
  236. package/dist/api/v1/ai-agents.js +0 -173
  237. package/src/api/v1/ai-agents.ts +0 -252
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /**
3
+ * Project-scoped AI agent evaluation client.
4
+ * Endpoints: /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluations/...
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AiAgentsEvaluationsClient = void 0;
8
+ const fetch_all_pages_1 = require("../../../pagination/fetch-all-pages");
9
+ const base_client_1 = require("../../base-client");
10
+ class AiAgentsEvaluationsClient extends base_client_1.BaseApiClient {
11
+ /** List all evaluations for an agent (GET …/{agentUuid}/evaluations). */
12
+ async listEvaluations(projectUuid, agentUuid) {
13
+ return this.http.get(`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations`);
14
+ }
15
+ /** Create a new evaluation (POST …/{agentUuid}/evaluations). */
16
+ async createEvaluation(projectUuid, agentUuid, body) {
17
+ return this.http.post(`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations`, body);
18
+ }
19
+ /** Get a full evaluation with prompts (GET …/evaluations/{evalUuid}). */
20
+ async getEvaluation(projectUuid, agentUuid, evalUuid) {
21
+ return this.http.get(`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}`);
22
+ }
23
+ /** Update an evaluation's title, description, or prompts (PATCH …/evaluations/{evalUuid}). */
24
+ async updateEvaluation(projectUuid, agentUuid, evalUuid, body) {
25
+ return this.http.patch(`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}`, body);
26
+ }
27
+ /** Append additional prompts to an existing evaluation (POST …/evaluations/{evalUuid}/append). */
28
+ async appendToEvaluation(projectUuid, agentUuid, evalUuid, body) {
29
+ return this.http.post(`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}/append`, body);
30
+ }
31
+ /** Delete an evaluation (DELETE …/evaluations/{evalUuid}). */
32
+ async deleteEvaluation(projectUuid, agentUuid, evalUuid) {
33
+ await this.http.delete(`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}`);
34
+ }
35
+ /**
36
+ * Trigger a new evaluation run (POST …/evaluations/{evalUuid}/run).
37
+ * Returns a run summary with the new runUuid and initial status.
38
+ */
39
+ async runEvaluation(projectUuid, agentUuid, evalUuid) {
40
+ return this.http.post(`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}/run`, {});
41
+ }
42
+ /** List runs for an evaluation with pagination (GET …/evaluations/{evalUuid}/runs). */
43
+ async listEvaluationRuns(projectUuid, agentUuid, evalUuid, params) {
44
+ return this.http.get(`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}/runs`, { params });
45
+ }
46
+ /**
47
+ * List all runs for an evaluation, returning only the runs array.
48
+ * Convenience wrapper around {@link listEvaluationRuns} for backward compatibility.
49
+ */
50
+ async listAllEvaluationRuns(projectUuid, agentUuid, evalUuid, options) {
51
+ return (0, fetch_all_pages_1.fetchAllPages)({
52
+ fetchPage: async (page, pageSize) => {
53
+ const response = await this.listEvaluationRuns(projectUuid, agentUuid, evalUuid, {
54
+ page,
55
+ pageSize,
56
+ });
57
+ return {
58
+ data: response.data.runs,
59
+ pagination: response.pagination ? Object.assign(Object.assign({}, response.pagination), { page, pageSize }) : undefined,
60
+ };
61
+ },
62
+ pageSize: options === null || options === void 0 ? void 0 : options.pageSize,
63
+ });
64
+ }
65
+ /** Get detailed results of a specific run (GET …/evaluations/{evalUuid}/runs/{runUuid}). */
66
+ async getEvaluationRunResults(projectUuid, agentUuid, evalUuid, runUuid) {
67
+ return this.http.get(`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}/runs/${runUuid}`);
68
+ }
69
+ }
70
+ exports.AiAgentsEvaluationsClient = AiAgentsEvaluationsClient;
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Facade for the AI agents API client.
3
+ * Delegates to domain-specific clients while preserving the monolithic public API.
4
+ */
5
+ import { BaseApiClient } from '../../base-client';
6
+ import { type StartConversationThreadBody } from './threads';
7
+ import type { RequestOptions } from './request-options';
8
+ import type { HttpClient } from '../../../http/http-client';
9
+ import type { AgentSuggestions, AiAgent, AiAgentEvaluation, AiAgentEvaluationRun, AiAgentEvaluationRunSummary, AiAgentEvaluationRunsListResponse, AiAgentEvaluationSummary, AiAgentExploreAccessSummary, AiAgentMcpServerTool, AiAgentsAdminThreadsResult, AiAgentSummary, AiAgentThread, AiAgentThreadMessageVizQuery, AiAgentThreadSummary, AiAgentUserPreferences, AiAgentVerifiedArtifactsListResult, AiAgentVerifiedQuestion, AiArtifact, AiMcpServer, AiMcpServerTool, AiModelOption, AppendEvaluationBody, CloneThreadBody, CreateAgentThreadBody, CreateAgentThreadMessageResult, CreateAiAgent, CreateEvaluationBody, CreateEvaluationResult, CreateProjectMcpServerBody, ExploreAccessSummaryBody, GenerateAgentThreadBody, GenerateAgentThreadResult, GenerateThreadTitleResult, GetAdminThreadsParams, GetAgentSuggestionsParams, GetAiOrganizationSettingsResult, ListVerifiedArtifactsParams, ReadinessScore, SubmitSqlApprovalBody, SubmitSqlApprovalResult, UpdateAiAgent, UpdateAiOrganizationSettings, UpdateAiOrganizationSettingsResult, UpdateAgentMcpServerToolsBody, UpdateEvaluationBody, UpdateMessageFeedbackBody } from '@lightdash-tools/common';
10
+ export declare class AiAgentsClient extends BaseApiClient {
11
+ private readonly admin;
12
+ private readonly agents;
13
+ private readonly artifacts;
14
+ private readonly discovery;
15
+ private readonly threads;
16
+ private readonly evaluations;
17
+ private readonly feedback;
18
+ private readonly mcpServers;
19
+ private readonly sqlApproval;
20
+ constructor(http: HttpClient);
21
+ getAdminThreads(params?: GetAdminThreadsParams): Promise<AiAgentsAdminThreadsResult>;
22
+ listAdminAgents(): Promise<AiAgentSummary[]>;
23
+ getAiOrganizationSettings(): Promise<GetAiOrganizationSettingsResult>;
24
+ updateAiOrganizationSettings(body: UpdateAiOrganizationSettings): Promise<UpdateAiOrganizationSettingsResult>;
25
+ listAgents(projectUuid: string): Promise<AiAgentSummary[]>;
26
+ getAgent(projectUuid: string, agentUuid: string): Promise<AiAgent>;
27
+ createAgent(projectUuid: string, body: CreateAiAgent): Promise<AiAgent>;
28
+ updateAgent(projectUuid: string, agentUuid: string, body: UpdateAiAgent): Promise<AiAgent>;
29
+ deleteAgent(projectUuid: string, agentUuid: string): Promise<void>;
30
+ getAgentModelOptions(projectUuid: string, agentUuid: string): Promise<AiModelOption[]>;
31
+ getAgentSuggestions(projectUuid: string, agentUuid: string, params?: GetAgentSuggestionsParams): Promise<AgentSuggestions>;
32
+ evaluateAgentReadiness(projectUuid: string, agentUuid: string): Promise<ReadinessScore>;
33
+ getExploreAccessSummary(projectUuid: string, agentUuid: string, body?: ExploreAccessSummaryBody): Promise<AiAgentExploreAccessSummary[]>;
34
+ getUserAgentPreferences(projectUuid: string): Promise<AiAgentUserPreferences | null>;
35
+ setUserAgentPreferences(projectUuid: string, body: AiAgentUserPreferences): Promise<void>;
36
+ deleteUserAgentPreferences(projectUuid: string): Promise<void>;
37
+ listAgentThreads(projectUuid: string, agentUuid: string): Promise<AiAgentThreadSummary[]>;
38
+ createAgentThread(projectUuid: string, agentUuid: string, body?: CreateAgentThreadBody, options?: RequestOptions): Promise<AiAgentThreadSummary>;
39
+ getAgentThread(projectUuid: string, agentUuid: string, threadUuid: string, options?: RequestOptions): Promise<AiAgentThread>;
40
+ createAgentThreadMessage(projectUuid: string, agentUuid: string, threadUuid: string, body: GenerateAgentThreadBody, options?: RequestOptions): Promise<CreateAgentThreadMessageResult>;
41
+ generateAgentThreadResponse(projectUuid: string, agentUuid: string, threadUuid: string, options?: RequestOptions): Promise<GenerateAgentThreadResult>;
42
+ generateAgentThreadResponse(projectUuid: string, agentUuid: string, threadUuid: string, body: GenerateAgentThreadBody, options?: RequestOptions): Promise<GenerateAgentThreadResult>;
43
+ startConversation(projectUuid: string, agentUuid: string, body: GenerateAgentThreadBody, options?: RequestOptions & {
44
+ threadBody?: StartConversationThreadBody;
45
+ }): Promise<{
46
+ thread: AiAgentThreadSummary;
47
+ result: GenerateAgentThreadResult;
48
+ }>;
49
+ continueConversation(projectUuid: string, agentUuid: string, threadUuid: string, body: GenerateAgentThreadBody, options?: RequestOptions): Promise<GenerateAgentThreadResult>;
50
+ generateThreadTitle(projectUuid: string, agentUuid: string, threadUuid: string, options?: RequestOptions): Promise<GenerateThreadTitleResult>;
51
+ cloneThread(projectUuid: string, agentUuid: string, threadUuid: string, body?: CloneThreadBody): Promise<AiAgentThreadSummary>;
52
+ listVerifiedArtifacts(projectUuid: string, agentUuid: string, params?: ListVerifiedArtifactsParams): Promise<AiAgentVerifiedArtifactsListResult>;
53
+ listVerifiedQuestions(projectUuid: string, agentUuid: string): Promise<AiAgentVerifiedQuestion[]>;
54
+ getArtifact(projectUuid: string, agentUuid: string, artifactUuid: string): Promise<AiArtifact>;
55
+ getArtifactVersion(projectUuid: string, agentUuid: string, artifactUuid: string, versionUuid: string): Promise<AiArtifact>;
56
+ getArtifactVersionVizQuery(projectUuid: string, agentUuid: string, artifactUuid: string, versionUuid: string): Promise<AiAgentThreadMessageVizQuery>;
57
+ getDashboardArtifactChartVizQuery(projectUuid: string, agentUuid: string, artifactUuid: string, versionUuid: string, chartIndex: number): Promise<AiAgentThreadMessageVizQuery>;
58
+ updateMessageFeedback(projectUuid: string, agentUuid: string, threadUuid: string, messageUuid: string, body: UpdateMessageFeedbackBody): Promise<void>;
59
+ listProjectMcpServers(projectUuid: string): Promise<AiMcpServer[]>;
60
+ createProjectMcpServer(projectUuid: string, body: CreateProjectMcpServerBody): Promise<AiMcpServer>;
61
+ listMcpServerTools(projectUuid: string, mcpServerUuid: string): Promise<AiMcpServerTool[]>;
62
+ refreshMcpServerTools(projectUuid: string, mcpServerUuid: string): Promise<AiMcpServerTool[]>;
63
+ listAgentMcpServers(projectUuid: string, agentUuid: string): Promise<AiMcpServer[]>;
64
+ updateAgentMcpServerTools(projectUuid: string, agentUuid: string, mcpServerUuid: string, body: UpdateAgentMcpServerToolsBody): Promise<AiAgentMcpServerTool[]>;
65
+ submitSqlApproval(projectUuid: string, agentUuid: string, threadUuid: string, toolCallId: string, body: SubmitSqlApprovalBody): Promise<SubmitSqlApprovalResult>;
66
+ listEvaluations(projectUuid: string, agentUuid: string): Promise<AiAgentEvaluationSummary[]>;
67
+ createEvaluation(projectUuid: string, agentUuid: string, body: CreateEvaluationBody): Promise<CreateEvaluationResult>;
68
+ getEvaluation(projectUuid: string, agentUuid: string, evalUuid: string): Promise<AiAgentEvaluation>;
69
+ updateEvaluation(projectUuid: string, agentUuid: string, evalUuid: string, body: UpdateEvaluationBody): Promise<AiAgentEvaluation>;
70
+ appendToEvaluation(projectUuid: string, agentUuid: string, evalUuid: string, body: AppendEvaluationBody): Promise<AiAgentEvaluation>;
71
+ deleteEvaluation(projectUuid: string, agentUuid: string, evalUuid: string): Promise<void>;
72
+ runEvaluation(projectUuid: string, agentUuid: string, evalUuid: string): Promise<AiAgentEvaluationRunSummary>;
73
+ listEvaluationRuns(projectUuid: string, agentUuid: string, evalUuid: string, params?: {
74
+ page?: number;
75
+ pageSize?: number;
76
+ }): Promise<AiAgentEvaluationRunsListResponse>;
77
+ listAllEvaluationRuns(projectUuid: string, agentUuid: string, evalUuid: string): Promise<AiAgentEvaluationRunSummary[]>;
78
+ getEvaluationRunResults(projectUuid: string, agentUuid: string, evalUuid: string, runUuid: string): Promise<AiAgentEvaluationRun>;
79
+ }
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ /**
3
+ * Facade for the AI agents API client.
4
+ * Delegates to domain-specific clients while preserving the monolithic public API.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AiAgentsClient = void 0;
8
+ const base_client_1 = require("../../base-client");
9
+ const admin_1 = require("./admin");
10
+ const agents_1 = require("./agents");
11
+ const artifacts_1 = require("./artifacts");
12
+ const discovery_1 = require("./discovery");
13
+ const evaluations_1 = require("./evaluations");
14
+ const feedback_1 = require("./feedback");
15
+ const mcp_servers_1 = require("./mcp-servers");
16
+ const sql_approval_1 = require("./sql-approval");
17
+ const threads_1 = require("./threads");
18
+ class AiAgentsClient extends base_client_1.BaseApiClient {
19
+ constructor(http) {
20
+ super(http);
21
+ this.admin = new admin_1.AiAgentsAdminClient(http);
22
+ this.agents = new agents_1.AiAgentsProjectClient(http);
23
+ this.artifacts = new artifacts_1.AiAgentsArtifactsClient(http);
24
+ this.discovery = new discovery_1.AiAgentsDiscoveryClient(http);
25
+ this.threads = new threads_1.AiAgentsThreadsClient(http);
26
+ this.evaluations = new evaluations_1.AiAgentsEvaluationsClient(http);
27
+ this.feedback = new feedback_1.AiAgentsFeedbackClient(http);
28
+ this.mcpServers = new mcp_servers_1.AiAgentsMcpServersClient(http);
29
+ this.sqlApproval = new sql_approval_1.AiAgentsSqlApprovalClient(http);
30
+ }
31
+ // ─── Admin ───────────────────────────────────────────────────────────────────
32
+ getAdminThreads(params) {
33
+ return this.admin.getAdminThreads(params);
34
+ }
35
+ listAdminAgents() {
36
+ return this.admin.listAdminAgents();
37
+ }
38
+ getAiOrganizationSettings() {
39
+ return this.admin.getAiOrganizationSettings();
40
+ }
41
+ updateAiOrganizationSettings(body) {
42
+ return this.admin.updateAiOrganizationSettings(body);
43
+ }
44
+ // ─── Project-scoped: agent CRUD ──────────────────────────────────────────────
45
+ listAgents(projectUuid) {
46
+ return this.agents.listAgents(projectUuid);
47
+ }
48
+ getAgent(projectUuid, agentUuid) {
49
+ return this.agents.getAgent(projectUuid, agentUuid);
50
+ }
51
+ createAgent(projectUuid, body) {
52
+ return this.agents.createAgent(projectUuid, body);
53
+ }
54
+ updateAgent(projectUuid, agentUuid, body) {
55
+ return this.agents.updateAgent(projectUuid, agentUuid, body);
56
+ }
57
+ deleteAgent(projectUuid, agentUuid) {
58
+ return this.agents.deleteAgent(projectUuid, agentUuid);
59
+ }
60
+ // ─── Discovery & preferences ─────────────────────────────────────────────────
61
+ getAgentModelOptions(projectUuid, agentUuid) {
62
+ return this.discovery.getAgentModelOptions(projectUuid, agentUuid);
63
+ }
64
+ getAgentSuggestions(projectUuid, agentUuid, params) {
65
+ return this.discovery.getAgentSuggestions(projectUuid, agentUuid, params);
66
+ }
67
+ evaluateAgentReadiness(projectUuid, agentUuid) {
68
+ return this.discovery.evaluateAgentReadiness(projectUuid, agentUuid);
69
+ }
70
+ getExploreAccessSummary(projectUuid, agentUuid, body) {
71
+ return this.discovery.getExploreAccessSummary(projectUuid, agentUuid, body);
72
+ }
73
+ getUserAgentPreferences(projectUuid) {
74
+ return this.discovery.getUserAgentPreferences(projectUuid);
75
+ }
76
+ setUserAgentPreferences(projectUuid, body) {
77
+ return this.discovery.setUserAgentPreferences(projectUuid, body);
78
+ }
79
+ deleteUserAgentPreferences(projectUuid) {
80
+ return this.discovery.deleteUserAgentPreferences(projectUuid);
81
+ }
82
+ // ─── Project-scoped: threads ─────────────────────────────────────────────────
83
+ listAgentThreads(projectUuid, agentUuid) {
84
+ return this.threads.listAgentThreads(projectUuid, agentUuid);
85
+ }
86
+ createAgentThread(projectUuid, agentUuid, body, options) {
87
+ return this.threads.createAgentThread(projectUuid, agentUuid, body, options);
88
+ }
89
+ getAgentThread(projectUuid, agentUuid, threadUuid, options) {
90
+ return this.threads.getAgentThread(projectUuid, agentUuid, threadUuid, options);
91
+ }
92
+ createAgentThreadMessage(projectUuid, agentUuid, threadUuid, body, options) {
93
+ return this.threads.createAgentThreadMessage(projectUuid, agentUuid, threadUuid, body, options);
94
+ }
95
+ generateAgentThreadResponse(projectUuid, agentUuid, threadUuid, bodyOrOptions, maybeOptions) {
96
+ if (bodyOrOptions !== undefined &&
97
+ typeof bodyOrOptions === 'object' &&
98
+ 'prompt' in bodyOrOptions) {
99
+ return this.threads.generateAgentThreadResponse(projectUuid, agentUuid, threadUuid, bodyOrOptions, maybeOptions);
100
+ }
101
+ return this.threads.generateAgentThreadResponse(projectUuid, agentUuid, threadUuid, bodyOrOptions);
102
+ }
103
+ startConversation(projectUuid, agentUuid, body, options) {
104
+ return this.threads.startConversation(projectUuid, agentUuid, body, options);
105
+ }
106
+ continueConversation(projectUuid, agentUuid, threadUuid, body, options) {
107
+ return this.threads.continueConversation(projectUuid, agentUuid, threadUuid, body, options);
108
+ }
109
+ generateThreadTitle(projectUuid, agentUuid, threadUuid, options) {
110
+ return this.threads.generateThreadTitle(projectUuid, agentUuid, threadUuid, options);
111
+ }
112
+ cloneThread(projectUuid, agentUuid, threadUuid, body) {
113
+ return this.threads.cloneThread(projectUuid, agentUuid, threadUuid, body);
114
+ }
115
+ // ─── Artifacts ───────────────────────────────────────────────────────────────
116
+ listVerifiedArtifacts(projectUuid, agentUuid, params) {
117
+ return this.artifacts.listVerifiedArtifacts(projectUuid, agentUuid, params);
118
+ }
119
+ listVerifiedQuestions(projectUuid, agentUuid) {
120
+ return this.artifacts.listVerifiedQuestions(projectUuid, agentUuid);
121
+ }
122
+ getArtifact(projectUuid, agentUuid, artifactUuid) {
123
+ return this.artifacts.getArtifact(projectUuid, agentUuid, artifactUuid);
124
+ }
125
+ getArtifactVersion(projectUuid, agentUuid, artifactUuid, versionUuid) {
126
+ return this.artifacts.getArtifactVersion(projectUuid, agentUuid, artifactUuid, versionUuid);
127
+ }
128
+ getArtifactVersionVizQuery(projectUuid, agentUuid, artifactUuid, versionUuid) {
129
+ return this.artifacts.getArtifactVersionVizQuery(projectUuid, agentUuid, artifactUuid, versionUuid);
130
+ }
131
+ getDashboardArtifactChartVizQuery(projectUuid, agentUuid, artifactUuid, versionUuid, chartIndex) {
132
+ return this.artifacts.getDashboardArtifactChartVizQuery(projectUuid, agentUuid, artifactUuid, versionUuid, chartIndex);
133
+ }
134
+ // ─── Message feedback ────────────────────────────────────────────────────────
135
+ updateMessageFeedback(projectUuid, agentUuid, threadUuid, messageUuid, body) {
136
+ return this.feedback.updateMessageFeedback(projectUuid, agentUuid, threadUuid, messageUuid, body);
137
+ }
138
+ // ─── MCP servers (EE-guarded upstream) ───────────────────────────────────────
139
+ listProjectMcpServers(projectUuid) {
140
+ return this.mcpServers.listProjectMcpServers(projectUuid);
141
+ }
142
+ createProjectMcpServer(projectUuid, body) {
143
+ return this.mcpServers.createProjectMcpServer(projectUuid, body);
144
+ }
145
+ listMcpServerTools(projectUuid, mcpServerUuid) {
146
+ return this.mcpServers.listMcpServerTools(projectUuid, mcpServerUuid);
147
+ }
148
+ refreshMcpServerTools(projectUuid, mcpServerUuid) {
149
+ return this.mcpServers.refreshMcpServerTools(projectUuid, mcpServerUuid);
150
+ }
151
+ listAgentMcpServers(projectUuid, agentUuid) {
152
+ return this.mcpServers.listAgentMcpServers(projectUuid, agentUuid);
153
+ }
154
+ updateAgentMcpServerTools(projectUuid, agentUuid, mcpServerUuid, body) {
155
+ return this.mcpServers.updateAgentMcpServerTools(projectUuid, agentUuid, mcpServerUuid, body);
156
+ }
157
+ // ─── SQL approval ────────────────────────────────────────────────────────────
158
+ submitSqlApproval(projectUuid, agentUuid, threadUuid, toolCallId, body) {
159
+ return this.sqlApproval.submitSqlApproval(projectUuid, agentUuid, threadUuid, toolCallId, body);
160
+ }
161
+ // ─── Project-scoped: evaluations ─────────────────────────────────────────────
162
+ listEvaluations(projectUuid, agentUuid) {
163
+ return this.evaluations.listEvaluations(projectUuid, agentUuid);
164
+ }
165
+ createEvaluation(projectUuid, agentUuid, body) {
166
+ return this.evaluations.createEvaluation(projectUuid, agentUuid, body);
167
+ }
168
+ getEvaluation(projectUuid, agentUuid, evalUuid) {
169
+ return this.evaluations.getEvaluation(projectUuid, agentUuid, evalUuid);
170
+ }
171
+ updateEvaluation(projectUuid, agentUuid, evalUuid, body) {
172
+ return this.evaluations.updateEvaluation(projectUuid, agentUuid, evalUuid, body);
173
+ }
174
+ appendToEvaluation(projectUuid, agentUuid, evalUuid, body) {
175
+ return this.evaluations.appendToEvaluation(projectUuid, agentUuid, evalUuid, body);
176
+ }
177
+ deleteEvaluation(projectUuid, agentUuid, evalUuid) {
178
+ return this.evaluations.deleteEvaluation(projectUuid, agentUuid, evalUuid);
179
+ }
180
+ runEvaluation(projectUuid, agentUuid, evalUuid) {
181
+ return this.evaluations.runEvaluation(projectUuid, agentUuid, evalUuid);
182
+ }
183
+ listEvaluationRuns(projectUuid, agentUuid, evalUuid, params) {
184
+ return this.evaluations.listEvaluationRuns(projectUuid, agentUuid, evalUuid, params);
185
+ }
186
+ listAllEvaluationRuns(projectUuid, agentUuid, evalUuid) {
187
+ return this.evaluations.listAllEvaluationRuns(projectUuid, agentUuid, evalUuid);
188
+ }
189
+ getEvaluationRunResults(projectUuid, agentUuid, evalUuid, runUuid) {
190
+ return this.evaluations.getEvaluationRunResults(projectUuid, agentUuid, evalUuid, runUuid);
191
+ }
192
+ }
193
+ exports.AiAgentsClient = AiAgentsClient;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * AI agent message feedback client.
3
+ * Endpoints: …/threads/{threadUuid}/messages/{messageUuid}/feedback
4
+ */
5
+ import { BaseApiClient } from '../../base-client';
6
+ import type { UpdateMessageFeedbackBody } from '@lightdash-tools/common';
7
+ export declare class AiAgentsFeedbackClient extends BaseApiClient {
8
+ /** Update human feedback on an assistant message (PATCH …/messages/{messageUuid}/feedback). */
9
+ updateMessageFeedback(projectUuid: string, agentUuid: string, threadUuid: string, messageUuid: string, body: UpdateMessageFeedbackBody): Promise<void>;
10
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * AI agent message feedback client.
4
+ * Endpoints: …/threads/{threadUuid}/messages/{messageUuid}/feedback
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AiAgentsFeedbackClient = void 0;
8
+ const base_client_1 = require("../../base-client");
9
+ class AiAgentsFeedbackClient extends base_client_1.BaseApiClient {
10
+ /** Update human feedback on an assistant message (PATCH …/messages/{messageUuid}/feedback). */
11
+ async updateMessageFeedback(projectUuid, agentUuid, threadUuid, messageUuid, body) {
12
+ await this.http.patch(`/projects/${projectUuid}/aiAgents/${agentUuid}/threads/${threadUuid}/messages/${messageUuid}/feedback`, body);
13
+ }
14
+ }
15
+ exports.AiAgentsFeedbackClient = AiAgentsFeedbackClient;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const feedback_1 = require("./feedback");
5
+ (0, vitest_1.describe)('AiAgentsFeedbackClient', () => {
6
+ let mockHttp;
7
+ (0, vitest_1.beforeEach)(() => {
8
+ mockHttp = {
9
+ get: vitest_1.vi.fn(),
10
+ post: vitest_1.vi.fn(),
11
+ put: vitest_1.vi.fn(),
12
+ patch: vitest_1.vi.fn(),
13
+ delete: vitest_1.vi.fn(),
14
+ };
15
+ });
16
+ (0, vitest_1.it)('updateMessageFeedback should call PATCH …/messages/{messageUuid}/feedback', async () => {
17
+ const client = new feedback_1.AiAgentsFeedbackClient(mockHttp);
18
+ const body = { humanScore: 5, humanFeedback: 'Great answer' };
19
+ vitest_1.vi.mocked(mockHttp.patch).mockResolvedValue(undefined);
20
+ await client.updateMessageFeedback('proj1', 'a1', 't1', 'm1', body);
21
+ (0, vitest_1.expect)(mockHttp.patch).toHaveBeenCalledWith('/projects/proj1/aiAgents/a1/threads/t1/messages/m1/feedback', body);
22
+ });
23
+ });
@@ -0,0 +1 @@
1
+ export { AiAgentsClient } from './facade';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AiAgentsClient = void 0;
4
+ var facade_1 = require("./facade");
5
+ Object.defineProperty(exports, "AiAgentsClient", { enumerable: true, get: function () { return facade_1.AiAgentsClient; } });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * AI agent MCP server client (EE-guarded upstream).
3
+ * Endpoints: /api/v1/projects/{projectUuid}/aiAgents/mcpServers/...
4
+ */
5
+ import { BaseApiClient } from '../../base-client';
6
+ import type { AiAgentMcpServerTool, AiMcpServer, AiMcpServerTool, CreateProjectMcpServerBody, UpdateAgentMcpServerToolsBody } from '@lightdash-tools/common';
7
+ export declare class AiAgentsMcpServersClient extends BaseApiClient {
8
+ /** List MCP servers configured for a project (GET …/mcpServers). */
9
+ listProjectMcpServers(projectUuid: string): Promise<AiMcpServer[]>;
10
+ /** Create a project MCP server (POST …/mcpServers). */
11
+ createProjectMcpServer(projectUuid: string, body: CreateProjectMcpServerBody): Promise<AiMcpServer>;
12
+ /** List tools exposed by a project MCP server (GET …/mcpServers/{mcpServerUuid}/tools). */
13
+ listMcpServerTools(projectUuid: string, mcpServerUuid: string): Promise<AiMcpServerTool[]>;
14
+ /** Refresh tools from the remote MCP server (POST …/tools/refresh). */
15
+ refreshMcpServerTools(projectUuid: string, mcpServerUuid: string): Promise<AiMcpServerTool[]>;
16
+ /** List MCP servers linked to an agent (GET …/{agentUuid}/mcpServers). */
17
+ listAgentMcpServers(projectUuid: string, agentUuid: string): Promise<AiMcpServer[]>;
18
+ /** Update per-agent tool enablement (PATCH …/{agentUuid}/mcpServers/{mcpServerUuid}/tools). */
19
+ updateAgentMcpServerTools(projectUuid: string, agentUuid: string, mcpServerUuid: string, body: UpdateAgentMcpServerToolsBody): Promise<AiAgentMcpServerTool[]>;
20
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * AI agent MCP server client (EE-guarded upstream).
4
+ * Endpoints: /api/v1/projects/{projectUuid}/aiAgents/mcpServers/...
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AiAgentsMcpServersClient = void 0;
8
+ const base_client_1 = require("../../base-client");
9
+ class AiAgentsMcpServersClient extends base_client_1.BaseApiClient {
10
+ /** List MCP servers configured for a project (GET …/mcpServers). */
11
+ async listProjectMcpServers(projectUuid) {
12
+ return this.http.get(`/projects/${projectUuid}/aiAgents/mcpServers`);
13
+ }
14
+ /** Create a project MCP server (POST …/mcpServers). */
15
+ async createProjectMcpServer(projectUuid, body) {
16
+ return this.http.post(`/projects/${projectUuid}/aiAgents/mcpServers`, body);
17
+ }
18
+ /** List tools exposed by a project MCP server (GET …/mcpServers/{mcpServerUuid}/tools). */
19
+ async listMcpServerTools(projectUuid, mcpServerUuid) {
20
+ return this.http.get(`/projects/${projectUuid}/aiAgents/mcpServers/${mcpServerUuid}/tools`);
21
+ }
22
+ /** Refresh tools from the remote MCP server (POST …/tools/refresh). */
23
+ async refreshMcpServerTools(projectUuid, mcpServerUuid) {
24
+ return this.http.post(`/projects/${projectUuid}/aiAgents/mcpServers/${mcpServerUuid}/tools/refresh`, {});
25
+ }
26
+ /** List MCP servers linked to an agent (GET …/{agentUuid}/mcpServers). */
27
+ async listAgentMcpServers(projectUuid, agentUuid) {
28
+ return this.http.get(`/projects/${projectUuid}/aiAgents/${agentUuid}/mcpServers`);
29
+ }
30
+ /** Update per-agent tool enablement (PATCH …/{agentUuid}/mcpServers/{mcpServerUuid}/tools). */
31
+ async updateAgentMcpServerTools(projectUuid, agentUuid, mcpServerUuid, body) {
32
+ return this.http.patch(`/projects/${projectUuid}/aiAgents/${agentUuid}/mcpServers/${mcpServerUuid}/tools`, body);
33
+ }
34
+ }
35
+ exports.AiAgentsMcpServersClient = AiAgentsMcpServersClient;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const mcp_servers_1 = require("./mcp-servers");
5
+ (0, vitest_1.describe)('AiAgentsMcpServersClient', () => {
6
+ let mockHttp;
7
+ (0, vitest_1.beforeEach)(() => {
8
+ mockHttp = {
9
+ get: vitest_1.vi.fn(),
10
+ post: vitest_1.vi.fn(),
11
+ put: vitest_1.vi.fn(),
12
+ patch: vitest_1.vi.fn(),
13
+ delete: vitest_1.vi.fn(),
14
+ };
15
+ });
16
+ (0, vitest_1.it)('listProjectMcpServers should call GET …/mcpServers', async () => {
17
+ const client = new mcp_servers_1.AiAgentsMcpServersClient(mockHttp);
18
+ const servers = [{ uuid: 'mcp1', name: 'GitHub' }];
19
+ vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(servers);
20
+ const result = await client.listProjectMcpServers('proj1');
21
+ (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/proj1/aiAgents/mcpServers');
22
+ (0, vitest_1.expect)(result).toEqual(servers);
23
+ });
24
+ (0, vitest_1.it)('createProjectMcpServer should call POST …/mcpServers', async () => {
25
+ const client = new mcp_servers_1.AiAgentsMcpServersClient(mockHttp);
26
+ const body = { name: 'Custom', url: 'https://mcp.example.com', authType: 'none' };
27
+ const created = Object.assign({ uuid: 'mcp2' }, body);
28
+ vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(created);
29
+ const result = await client.createProjectMcpServer('proj1', body);
30
+ (0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/proj1/aiAgents/mcpServers', body);
31
+ (0, vitest_1.expect)(result).toEqual(created);
32
+ });
33
+ (0, vitest_1.it)('listMcpServerTools should call GET …/mcpServers/{mcpServerUuid}/tools', async () => {
34
+ const client = new mcp_servers_1.AiAgentsMcpServersClient(mockHttp);
35
+ const tools = [{ uuid: 'tool1', toolName: 'search' }];
36
+ vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(tools);
37
+ const result = await client.listMcpServerTools('proj1', 'mcp1');
38
+ (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/proj1/aiAgents/mcpServers/mcp1/tools');
39
+ (0, vitest_1.expect)(result).toEqual(tools);
40
+ });
41
+ (0, vitest_1.it)('refreshMcpServerTools should call POST …/tools/refresh', async () => {
42
+ const client = new mcp_servers_1.AiAgentsMcpServersClient(mockHttp);
43
+ const tools = [{ uuid: 'tool1', toolName: 'search' }];
44
+ vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(tools);
45
+ const result = await client.refreshMcpServerTools('proj1', 'mcp1');
46
+ (0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/proj1/aiAgents/mcpServers/mcp1/tools/refresh', {});
47
+ (0, vitest_1.expect)(result).toEqual(tools);
48
+ });
49
+ (0, vitest_1.it)('listAgentMcpServers should call GET …/{agentUuid}/mcpServers', async () => {
50
+ const client = new mcp_servers_1.AiAgentsMcpServersClient(mockHttp);
51
+ const servers = [{ uuid: 'mcp1', name: 'GitHub' }];
52
+ vitest_1.vi.mocked(mockHttp.get).mockResolvedValue(servers);
53
+ const result = await client.listAgentMcpServers('proj1', 'a1');
54
+ (0, vitest_1.expect)(mockHttp.get).toHaveBeenCalledWith('/projects/proj1/aiAgents/a1/mcpServers');
55
+ (0, vitest_1.expect)(result).toEqual(servers);
56
+ });
57
+ (0, vitest_1.it)('updateAgentMcpServerTools should call PATCH …/{agentUuid}/mcpServers/{mcpServerUuid}/tools', async () => {
58
+ const client = new mcp_servers_1.AiAgentsMcpServersClient(mockHttp);
59
+ const body = { toolSettings: [{ toolName: 'search', enabled: true }] };
60
+ const tools = [{ uuid: 'tool1', toolName: 'search', enabled: true }];
61
+ vitest_1.vi.mocked(mockHttp.patch).mockResolvedValue(tools);
62
+ const result = await client.updateAgentMcpServerTools('proj1', 'a1', 'mcp1', body);
63
+ (0, vitest_1.expect)(mockHttp.patch).toHaveBeenCalledWith('/projects/proj1/aiAgents/a1/mcpServers/mcp1/tools', body);
64
+ (0, vitest_1.expect)(result).toEqual(tools);
65
+ });
66
+ });
@@ -0,0 +1,12 @@
1
+ import type { AxiosRequestConfig } from 'axios';
2
+ /** Per-request overrides for AI agent thread operations. */
3
+ export interface RequestOptions {
4
+ /** AbortSignal for request cancellation. */
5
+ signal?: AbortSignal;
6
+ /** Request timeout in milliseconds. */
7
+ timeoutMs?: number;
8
+ /** Optional correlation ID sent as `X-Request-Id`. */
9
+ requestId?: string;
10
+ }
11
+ /** Maps {@link RequestOptions} to Axios request config. */
12
+ export declare function toAxiosConfig(options?: RequestOptions): AxiosRequestConfig | undefined;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toAxiosConfig = toAxiosConfig;
4
+ /** Maps {@link RequestOptions} to Axios request config. */
5
+ function toAxiosConfig(options) {
6
+ if (!options) {
7
+ return undefined;
8
+ }
9
+ const config = {};
10
+ if (options.signal !== undefined) {
11
+ config.signal = options.signal;
12
+ }
13
+ if (options.timeoutMs !== undefined) {
14
+ config.timeout = options.timeoutMs;
15
+ }
16
+ if (options.requestId !== undefined) {
17
+ config.headers = { 'X-Request-Id': options.requestId };
18
+ }
19
+ return Object.keys(config).length > 0 ? config : undefined;
20
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * AI agent SQL approval client.
3
+ * Endpoints: …/threads/{threadUuid}/tool-calls/{toolCallId}/sql-approval
4
+ */
5
+ import { BaseApiClient } from '../../base-client';
6
+ import type { SubmitSqlApprovalBody, SubmitSqlApprovalResult } from '@lightdash-tools/common';
7
+ export declare class AiAgentsSqlApprovalClient extends BaseApiClient {
8
+ /** Submit an approval decision for a pending SQL tool call (POST …/sql-approval). */
9
+ submitSqlApproval(projectUuid: string, agentUuid: string, threadUuid: string, toolCallId: string, body: SubmitSqlApprovalBody): Promise<SubmitSqlApprovalResult>;
10
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * AI agent SQL approval client.
4
+ * Endpoints: …/threads/{threadUuid}/tool-calls/{toolCallId}/sql-approval
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AiAgentsSqlApprovalClient = void 0;
8
+ const base_client_1 = require("../../base-client");
9
+ class AiAgentsSqlApprovalClient extends base_client_1.BaseApiClient {
10
+ /** Submit an approval decision for a pending SQL tool call (POST …/sql-approval). */
11
+ async submitSqlApproval(projectUuid, agentUuid, threadUuid, toolCallId, body) {
12
+ return this.http.post(`/projects/${projectUuid}/aiAgents/${agentUuid}/threads/${threadUuid}/tool-calls/${toolCallId}/sql-approval`, body);
13
+ }
14
+ }
15
+ exports.AiAgentsSqlApprovalClient = AiAgentsSqlApprovalClient;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const sql_approval_1 = require("./sql-approval");
5
+ (0, vitest_1.describe)('AiAgentsSqlApprovalClient', () => {
6
+ let mockHttp;
7
+ (0, vitest_1.beforeEach)(() => {
8
+ mockHttp = {
9
+ get: vitest_1.vi.fn(),
10
+ post: vitest_1.vi.fn(),
11
+ put: vitest_1.vi.fn(),
12
+ patch: vitest_1.vi.fn(),
13
+ delete: vitest_1.vi.fn(),
14
+ };
15
+ });
16
+ (0, vitest_1.it)('submitSqlApproval should call POST …/tool-calls/{toolCallId}/sql-approval', async () => {
17
+ const client = new sql_approval_1.AiAgentsSqlApprovalClient(mockHttp);
18
+ const body = { decision: 'approved' };
19
+ const result = { decision: 'approved' };
20
+ vitest_1.vi.mocked(mockHttp.post).mockResolvedValue(result);
21
+ const response = await client.submitSqlApproval('proj1', 'a1', 't1', 'call-1', body);
22
+ (0, vitest_1.expect)(mockHttp.post).toHaveBeenCalledWith('/projects/proj1/aiAgents/a1/threads/t1/tool-calls/call-1/sql-approval', body);
23
+ (0, vitest_1.expect)(response).toEqual(result);
24
+ });
25
+ });