@lightdash-tools/common 0.2.6 → 0.3.2
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/README.md +2 -0
- package/dist/audit.d.ts +29 -0
- package/dist/audit.js +49 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/safety.d.ts +24 -0
- package/dist/safety.js +92 -0
- package/dist/safety.test.js +54 -0
- package/dist/types/lightdash-api.d.ts +1 -1
- package/dist/types/v1/ai-agents.d.ts +61 -5
- package/dist/types/v1/ai-agents.js +3 -0
- package/dist/types/v1/index.d.ts +18 -0
- package/dist/types/v1/lightdash-api.d.ts +40 -0
- package/package.json +1 -1
- package/src/audit.ts +61 -0
- package/src/index.ts +3 -0
- package/src/safety.test.ts +72 -0
- package/src/safety.ts +87 -0
- package/src/types/lightdash-api.ts +19 -0
- package/src/types/v1/ai-agents.ts +79 -5
- package/src/types/v1/index.ts +22 -0
- package/src/types/v1/lightdash-api.ts +52 -1
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ Models are split into domain-specific files for better maintainability:
|
|
|
22
22
|
- `types/v1/charts.ts` - Charts domain models
|
|
23
23
|
- `types/v1/dashboards.ts` - Dashboards domain models
|
|
24
24
|
- `types/v1/spaces.ts` - Spaces domain models
|
|
25
|
+
- `types/v1/space-access.ts` - Space Access domain models
|
|
26
|
+
- `types/v1/explores.ts` - Explores domain models
|
|
25
27
|
- `types/v1/metrics.ts` - Metrics domain models
|
|
26
28
|
- `types/v1/schedulers.ts` - Schedulers domain models
|
|
27
29
|
- `types/v1/tags.ts` - Tags domain models
|
package/dist/audit.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured audit logger for Lightdash tool invocations (MCP and CLI).
|
|
3
|
+
*
|
|
4
|
+
* Each operation is recorded as a single NDJSON line containing:
|
|
5
|
+
* timestamp, sessionId, tool/command name, projectUuids (if present), status, and durationMs.
|
|
6
|
+
*
|
|
7
|
+
* Output destination:
|
|
8
|
+
* - If LIGHTDASH_AUDIT_LOG is set to a file path, entries are appended to that file.
|
|
9
|
+
* - Otherwise entries are written to stderr with an "[audit]" prefix.
|
|
10
|
+
*/
|
|
11
|
+
export type AuditStatus = 'success' | 'error' | 'blocked';
|
|
12
|
+
export type AuditLogEntry = {
|
|
13
|
+
timestamp: string;
|
|
14
|
+
sessionId: string;
|
|
15
|
+
/** MCP tool name or CLI command name. */
|
|
16
|
+
tool: string;
|
|
17
|
+
/** Project UUIDs involved in the call, if any (covers both projectUuid and projectUuids[]). */
|
|
18
|
+
projectUuids?: string[];
|
|
19
|
+
status: AuditStatus;
|
|
20
|
+
durationMs: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function getSessionId(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Initialise the audit log. Call once at process startup.
|
|
25
|
+
* If filePath is provided, entries are appended to that file; otherwise stderr is used.
|
|
26
|
+
*/
|
|
27
|
+
export declare function initAuditLog(filePath?: string): void;
|
|
28
|
+
/** Append one NDJSON entry to the configured output. */
|
|
29
|
+
export declare function logAuditEntry(entry: AuditLogEntry): void;
|
package/dist/audit.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Structured audit logger for Lightdash tool invocations (MCP and CLI).
|
|
4
|
+
*
|
|
5
|
+
* Each operation is recorded as a single NDJSON line containing:
|
|
6
|
+
* timestamp, sessionId, tool/command name, projectUuids (if present), status, and durationMs.
|
|
7
|
+
*
|
|
8
|
+
* Output destination:
|
|
9
|
+
* - If LIGHTDASH_AUDIT_LOG is set to a file path, entries are appended to that file.
|
|
10
|
+
* - Otherwise entries are written to stderr with an "[audit]" prefix.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.getSessionId = getSessionId;
|
|
14
|
+
exports.initAuditLog = initAuditLog;
|
|
15
|
+
exports.logAuditEntry = logAuditEntry;
|
|
16
|
+
const node_fs_1 = require("node:fs");
|
|
17
|
+
const node_crypto_1 = require("node:crypto");
|
|
18
|
+
/** Unique ID for the current process lifetime. Generated once at module load. */
|
|
19
|
+
const SESSION_ID = (0, node_crypto_1.randomUUID)();
|
|
20
|
+
let _writeStream;
|
|
21
|
+
function getSessionId() {
|
|
22
|
+
return SESSION_ID;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Initialise the audit log. Call once at process startup.
|
|
26
|
+
* If filePath is provided, entries are appended to that file; otherwise stderr is used.
|
|
27
|
+
*/
|
|
28
|
+
function initAuditLog(filePath) {
|
|
29
|
+
if (filePath) {
|
|
30
|
+
_writeStream = (0, node_fs_1.createWriteStream)(filePath, { flags: 'a' });
|
|
31
|
+
_writeStream.on('error', (err) => {
|
|
32
|
+
console.error('[audit] Failed to write to audit log file:', err);
|
|
33
|
+
});
|
|
34
|
+
console.error(`[audit] Writing to file: ${filePath} (session: ${SESSION_ID})`);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.error(`[audit] Writing to stderr (session: ${SESSION_ID})`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Append one NDJSON entry to the configured output. */
|
|
41
|
+
function logAuditEntry(entry) {
|
|
42
|
+
const line = `${JSON.stringify(entry)}\n`;
|
|
43
|
+
if (_writeStream) {
|
|
44
|
+
_writeStream.write(line);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
process.stderr.write(`[audit] ${line}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare function greet(name: string): string;
|
|
2
2
|
export * from './safety';
|
|
3
|
+
export * from './audit';
|
|
3
4
|
export * from './types/lightdash-api';
|
|
4
5
|
export type { LightdashApi } from './types/lightdash-api';
|
|
5
6
|
export type { paths, components, operations } from './types/generated/openapi-types';
|
package/dist/index.js
CHANGED
|
@@ -20,5 +20,7 @@ function greet(name) {
|
|
|
20
20
|
}
|
|
21
21
|
// Export safety logic
|
|
22
22
|
__exportStar(require("./safety"), exports);
|
|
23
|
+
// Export audit logger (shared by MCP and CLI)
|
|
24
|
+
__exportStar(require("./audit"), exports);
|
|
23
25
|
// Export Lightdash API models
|
|
24
26
|
__exportStar(require("./types/lightdash-api"), exports);
|
package/dist/safety.d.ts
CHANGED
|
@@ -31,3 +31,27 @@ export declare function isAllowed(mode: SafetyMode | string, annotations: ToolAn
|
|
|
31
31
|
* Resolves safety mode from environment variable.
|
|
32
32
|
*/
|
|
33
33
|
export declare function getSafetyModeFromEnv(): SafetyMode;
|
|
34
|
+
/**
|
|
35
|
+
* Parses allowed project UUIDs from the LIGHTDASH_TOOLS_ALLOWED_PROJECTS environment
|
|
36
|
+
* variable (comma-separated). Returns an empty array when the variable is unset, meaning
|
|
37
|
+
* all projects are allowed.
|
|
38
|
+
*
|
|
39
|
+
* Note: CLI/MCP flags (--allowed-projects) always take priority over this env var.
|
|
40
|
+
*/
|
|
41
|
+
export declare function getAllowedProjectUuidsFromEnv(): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Returns true if a single projectUuid is permitted by the allowlist.
|
|
44
|
+
* An empty allowlist means all projects are allowed.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isProjectAllowed(allowedUuids: readonly string[], projectUuid: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Returns true when every UUID in projectUuids is permitted by the allowlist.
|
|
49
|
+
* An empty allowlist means all projects are allowed.
|
|
50
|
+
* An empty projectUuids array is trivially allowed.
|
|
51
|
+
*/
|
|
52
|
+
export declare function areAllProjectsAllowed(allowedUuids: readonly string[], projectUuids: readonly string[]): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Extracts all project UUIDs from tool or command arguments.
|
|
55
|
+
* Handles both MCP-style objects and CLI-style argument arrays.
|
|
56
|
+
*/
|
|
57
|
+
export declare function extractProjectUuids(args: unknown): string[];
|
package/dist/safety.js
CHANGED
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WRITE_DESTRUCTIVE = exports.WRITE_IDEMPOTENT = exports.READ_ONLY_DEFAULT = exports.SafetyMode = void 0;
|
|
4
4
|
exports.isAllowed = isAllowed;
|
|
5
5
|
exports.getSafetyModeFromEnv = getSafetyModeFromEnv;
|
|
6
|
+
exports.getAllowedProjectUuidsFromEnv = getAllowedProjectUuidsFromEnv;
|
|
7
|
+
exports.isProjectAllowed = isProjectAllowed;
|
|
8
|
+
exports.areAllProjectsAllowed = areAllProjectsAllowed;
|
|
9
|
+
exports.extractProjectUuids = extractProjectUuids;
|
|
6
10
|
/**
|
|
7
11
|
* Hierarchical safety modes for Lightdash AI tools and CLI.
|
|
8
12
|
*/
|
|
@@ -58,3 +62,91 @@ function getSafetyModeFromEnv() {
|
|
|
58
62
|
}
|
|
59
63
|
return SafetyMode.READ_ONLY;
|
|
60
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Parses allowed project UUIDs from the LIGHTDASH_TOOLS_ALLOWED_PROJECTS environment
|
|
67
|
+
* variable (comma-separated). Returns an empty array when the variable is unset, meaning
|
|
68
|
+
* all projects are allowed.
|
|
69
|
+
*
|
|
70
|
+
* Note: CLI/MCP flags (--allowed-projects) always take priority over this env var.
|
|
71
|
+
*/
|
|
72
|
+
function getAllowedProjectUuidsFromEnv() {
|
|
73
|
+
var _a;
|
|
74
|
+
const raw = (_a = process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS) !== null && _a !== void 0 ? _a : '';
|
|
75
|
+
return raw
|
|
76
|
+
.split(',')
|
|
77
|
+
.map((s) => s.trim())
|
|
78
|
+
.filter(Boolean);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Returns true if a single projectUuid is permitted by the allowlist.
|
|
82
|
+
* An empty allowlist means all projects are allowed.
|
|
83
|
+
*/
|
|
84
|
+
function isProjectAllowed(allowedUuids, projectUuid) {
|
|
85
|
+
if (allowedUuids.length === 0)
|
|
86
|
+
return true;
|
|
87
|
+
return allowedUuids.includes(projectUuid);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns true when every UUID in projectUuids is permitted by the allowlist.
|
|
91
|
+
* An empty allowlist means all projects are allowed.
|
|
92
|
+
* An empty projectUuids array is trivially allowed.
|
|
93
|
+
*/
|
|
94
|
+
function areAllProjectsAllowed(allowedUuids, projectUuids) {
|
|
95
|
+
if (allowedUuids.length === 0)
|
|
96
|
+
return true;
|
|
97
|
+
return projectUuids.every((uuid) => allowedUuids.includes(uuid));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Extracts all project UUIDs from tool or command arguments.
|
|
101
|
+
* Handles both MCP-style objects and CLI-style argument arrays.
|
|
102
|
+
*/
|
|
103
|
+
function extractProjectUuids(args) {
|
|
104
|
+
if (args === null || args === undefined)
|
|
105
|
+
return [];
|
|
106
|
+
const uuids = [];
|
|
107
|
+
if (Array.isArray(args)) {
|
|
108
|
+
// CLI: positional arguments + options object
|
|
109
|
+
for (const arg of args) {
|
|
110
|
+
if (typeof arg === 'string' && /^[0-9a-f-]{36}$/i.test(arg)) {
|
|
111
|
+
// Looks like a UUID positional arg
|
|
112
|
+
uuids.push(arg);
|
|
113
|
+
}
|
|
114
|
+
else if (typeof arg === 'object' && arg !== null) {
|
|
115
|
+
// Looks like options object or nested args
|
|
116
|
+
const a = arg;
|
|
117
|
+
// Check various naming conventions used across CLI and MCP
|
|
118
|
+
const keys = ['projects', 'project', 'projectUuid', 'projectUuids'];
|
|
119
|
+
for (const key of keys) {
|
|
120
|
+
const val = a[key];
|
|
121
|
+
if (typeof val === 'string') {
|
|
122
|
+
uuids.push(val);
|
|
123
|
+
}
|
|
124
|
+
else if (Array.isArray(val)) {
|
|
125
|
+
for (const item of val) {
|
|
126
|
+
if (typeof item === 'string')
|
|
127
|
+
uuids.push(item);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (typeof args === 'object') {
|
|
135
|
+
// MCP or single options object
|
|
136
|
+
const a = args;
|
|
137
|
+
const keys = ['project', 'projectUuid', 'projectUuids'];
|
|
138
|
+
for (const key of keys) {
|
|
139
|
+
const val = a[key];
|
|
140
|
+
if (typeof val === 'string') {
|
|
141
|
+
uuids.push(val);
|
|
142
|
+
}
|
|
143
|
+
else if (Array.isArray(val)) {
|
|
144
|
+
for (const item of val) {
|
|
145
|
+
if (typeof item === 'string')
|
|
146
|
+
uuids.push(item);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return [...new Set(uuids)].filter((u) => u.length > 0);
|
|
152
|
+
}
|
package/dist/safety.test.js
CHANGED
|
@@ -42,4 +42,58 @@ const safety_1 = require("./safety");
|
|
|
42
42
|
(0, vitest_1.expect)((0, safety_1.getSafetyModeFromEnv)()).toBe(safety_1.SafetyMode.READ_ONLY);
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
|
+
(0, vitest_1.describe)('getAllowedProjectUuidsFromEnv', () => {
|
|
46
|
+
const originalEnv = process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
47
|
+
(0, vitest_1.afterEach)(() => {
|
|
48
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = originalEnv;
|
|
49
|
+
});
|
|
50
|
+
(0, vitest_1.it)('should return empty array when env is not set', () => {
|
|
51
|
+
delete process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
52
|
+
(0, vitest_1.expect)((0, safety_1.getAllowedProjectUuidsFromEnv)()).toEqual([]);
|
|
53
|
+
});
|
|
54
|
+
(0, vitest_1.it)('should parse a single UUID', () => {
|
|
55
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = 'uuid-a';
|
|
56
|
+
(0, vitest_1.expect)((0, safety_1.getAllowedProjectUuidsFromEnv)()).toEqual(['uuid-a']);
|
|
57
|
+
});
|
|
58
|
+
(0, vitest_1.it)('should parse comma-separated UUIDs', () => {
|
|
59
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = 'uuid-a,uuid-b,uuid-c';
|
|
60
|
+
(0, vitest_1.expect)((0, safety_1.getAllowedProjectUuidsFromEnv)()).toEqual(['uuid-a', 'uuid-b', 'uuid-c']);
|
|
61
|
+
});
|
|
62
|
+
(0, vitest_1.it)('should trim whitespace around UUIDs', () => {
|
|
63
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = ' uuid-a , uuid-b ';
|
|
64
|
+
(0, vitest_1.expect)((0, safety_1.getAllowedProjectUuidsFromEnv)()).toEqual(['uuid-a', 'uuid-b']);
|
|
65
|
+
});
|
|
66
|
+
(0, vitest_1.it)('should filter out empty entries', () => {
|
|
67
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = 'uuid-a,,uuid-b';
|
|
68
|
+
(0, vitest_1.expect)((0, safety_1.getAllowedProjectUuidsFromEnv)()).toEqual(['uuid-a', 'uuid-b']);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
(0, vitest_1.describe)('isProjectAllowed', () => {
|
|
72
|
+
(0, vitest_1.it)('should allow all projects when allowlist is empty', () => {
|
|
73
|
+
(0, vitest_1.expect)((0, safety_1.isProjectAllowed)([], 'any-uuid')).toBe(true);
|
|
74
|
+
});
|
|
75
|
+
(0, vitest_1.it)('should allow a project that is in the allowlist', () => {
|
|
76
|
+
(0, vitest_1.expect)((0, safety_1.isProjectAllowed)(['uuid-a', 'uuid-b'], 'uuid-a')).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
(0, vitest_1.it)('should deny a project that is not in the allowlist', () => {
|
|
79
|
+
(0, vitest_1.expect)((0, safety_1.isProjectAllowed)(['uuid-a', 'uuid-b'], 'uuid-c')).toBe(false);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
(0, vitest_1.describe)('areAllProjectsAllowed', () => {
|
|
83
|
+
(0, vitest_1.it)('should allow everything when allowlist is empty', () => {
|
|
84
|
+
(0, vitest_1.expect)((0, safety_1.areAllProjectsAllowed)([], ['uuid-a', 'uuid-b'])).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
(0, vitest_1.it)('should allow an empty projectUuids array (trivially)', () => {
|
|
87
|
+
(0, vitest_1.expect)((0, safety_1.areAllProjectsAllowed)(['uuid-a'], [])).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
(0, vitest_1.it)('should allow when all UUIDs are in the allowlist', () => {
|
|
90
|
+
(0, vitest_1.expect)((0, safety_1.areAllProjectsAllowed)(['uuid-a', 'uuid-b'], ['uuid-a', 'uuid-b'])).toBe(true);
|
|
91
|
+
});
|
|
92
|
+
(0, vitest_1.it)('should deny when any UUID is not in the allowlist', () => {
|
|
93
|
+
(0, vitest_1.expect)((0, safety_1.areAllProjectsAllowed)(['uuid-a', 'uuid-b'], ['uuid-a', 'uuid-c'])).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
(0, vitest_1.it)('should deny when all UUIDs are outside the allowlist', () => {
|
|
96
|
+
(0, vitest_1.expect)((0, safety_1.areAllProjectsAllowed)(['uuid-a'], ['uuid-b', 'uuid-c'])).toBe(false);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
45
99
|
});
|
|
@@ -25,4 +25,4 @@ export declare namespace LightdashApi {
|
|
|
25
25
|
export import V1 = V1Api.V1;
|
|
26
26
|
export import V2 = V2Api;
|
|
27
27
|
}
|
|
28
|
-
export type { Project, OrganizationProject, Organization, SpaceQuery, ChartAsCodeListResults, ChartAsCodeUpsertResults, UpsertChartAsCodeBody, DashboardBasicDetailsWithTileTypes, SpaceSummary, Space, CreateSpace, UpdateSpace, AddSpaceUserAccess, AddSpaceGroupAccess, SpaceMemberRole, ProjectMemberProfile, ProjectMemberRole, CreateProjectMember, UpdateProjectMember, ProjectGroupAccess, CreateProjectGroupAccessBody, UpdateProjectGroupAccess, MetricQueryRequest, CompileQueryRequest, ExecuteAsyncMetricQueryRequestParams, ExecuteAsyncSqlQueryRequestParams, ExecuteAsyncSavedChartRequestParams, ExecuteAsyncDashboardChartRequestParams, ExecuteAsyncUnderlyingDataRequestParams, RunQueryResults, CompiledQueryResults, ExecuteAsyncMetricQueryResults, ExecuteAsyncDashboardChartResults, ExecuteAsyncSqlQueryResults, AiAgentSummary, AiAgentAdminSortField, AiAgentsAdminThreadsResult, GetAiOrganizationSettingsResult, UpdateAiOrganizationSettings, UpdateAiOrganizationSettingsResult, GetAdminThreadsParams, ApiExploresResults, ApiExploreResults, } from './v1/lightdash-api';
|
|
28
|
+
export type { Project, OrganizationProject, Organization, SpaceQuery, ChartAsCodeListResults, ChartAsCodeUpsertResults, UpsertChartAsCodeBody, DashboardBasicDetailsWithTileTypes, SpaceSummary, Space, CreateSpace, UpdateSpace, AddSpaceUserAccess, AddSpaceGroupAccess, SpaceMemberRole, ProjectMemberProfile, ProjectMemberRole, CreateProjectMember, UpdateProjectMember, ProjectGroupAccess, CreateProjectGroupAccessBody, UpdateProjectGroupAccess, MetricQueryRequest, CompileQueryRequest, ExecuteAsyncMetricQueryRequestParams, ExecuteAsyncSqlQueryRequestParams, ExecuteAsyncSavedChartRequestParams, ExecuteAsyncDashboardChartRequestParams, ExecuteAsyncUnderlyingDataRequestParams, RunQueryResults, CompiledQueryResults, ExecuteAsyncMetricQueryResults, ExecuteAsyncDashboardChartResults, ExecuteAsyncSqlQueryResults, AiAgentSummary, AiAgentAdminSortField, AiAgentsAdminThreadsResult, GetAiOrganizationSettingsResult, UpdateAiOrganizationSettings, UpdateAiOrganizationSettingsResult, GetAdminThreadsParams, AiAgent, CreateAiAgent, UpdateAiAgent, AiAgentThreadSummary, AiAgentThread, CreateAgentThreadBody, GenerateAgentThreadBody, GenerateAgentThreadResult, CreateEvaluationPrompt, CreateEvaluationBody, CreateEvaluationResult, UpdateEvaluationBody, AppendEvaluationBody, AiAgentEvaluationSummary, AiAgentEvaluation, AiAgentEvaluationRunSummary, AiAgentEvaluationRunsListResponse, AiAgentEvaluationRun, AiAgentEvaluationRunResult, ApiExploresResults, ApiExploreResults, } from './v1/lightdash-api';
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AI agents domain models.
|
|
3
3
|
* Extracted from OpenAPI specification for better maintainability.
|
|
4
|
+
*
|
|
5
|
+
* Admin endpoints: /api/v1/aiAgents/admin/...
|
|
6
|
+
* Project-scoped endpoints: /api/v1/projects/{projectUuid}/aiAgents/...
|
|
4
7
|
*/
|
|
5
8
|
import type { components } from '../generated/openapi-types';
|
|
6
9
|
export declare namespace AiAgents {
|
|
7
|
-
/** Summary of an AI agent
|
|
10
|
+
/** Summary of an AI agent returned by the admin list endpoint. */
|
|
8
11
|
type AiAgentSummary = components['schemas']['AiAgentSummary'];
|
|
9
|
-
/** Sort field for admin thread list. */
|
|
12
|
+
/** Sort field for the admin thread list. */
|
|
10
13
|
type AiAgentAdminSortField = components['schemas']['AiAgentAdminSortField'];
|
|
11
14
|
/** Paginated result for admin threads (API response results). */
|
|
12
15
|
type AdminThreadsResult = components['schemas']['ApiAiAgentAdminConversationsResponse']['results'];
|
|
13
|
-
/** Query params for listing admin threads (
|
|
16
|
+
/** Query params for listing admin threads (GET /aiAgents/admin/threads). */
|
|
14
17
|
interface GetAdminThreadsParams {
|
|
15
18
|
page?: number;
|
|
16
19
|
pageSize?: number;
|
|
@@ -25,14 +28,67 @@ export declare namespace AiAgents {
|
|
|
25
28
|
sortField?: components['schemas']['AiAgentAdminSortField'];
|
|
26
29
|
sortDirection?: 'asc' | 'desc';
|
|
27
30
|
}
|
|
28
|
-
/** AI organization settings
|
|
31
|
+
/** AI organization settings returned by GET /aiAgents/admin/settings. */
|
|
29
32
|
type AiOrganizationSettings = components['schemas']['AiOrganizationSettings'];
|
|
30
33
|
/** Computed AI org settings (included in get response). */
|
|
31
34
|
type ComputedAiOrganizationSettings = components['schemas']['ComputedAiOrganizationSettings'];
|
|
32
35
|
/** Get AI org settings response results (settings + computed). */
|
|
33
36
|
type GetAiOrganizationSettingsResult = components['schemas']['ApiAiOrganizationSettingsResponse']['results'];
|
|
34
|
-
/** Update AI org settings request body. */
|
|
37
|
+
/** Update AI org settings request body (PATCH /aiAgents/admin/settings). */
|
|
35
38
|
type UpdateAiOrganizationSettings = components['schemas']['UpdateAiOrganizationSettings'];
|
|
36
39
|
/** Update AI org settings response results. */
|
|
37
40
|
type UpdateAiOrganizationSettingsResult = components['schemas']['ApiUpdateAiOrganizationSettingsResponse']['results'];
|
|
41
|
+
/** Full AI agent object returned by GET /projects/{projectUuid}/aiAgents/{agentUuid}. */
|
|
42
|
+
type AiAgent = components['schemas']['AiAgent'];
|
|
43
|
+
/** Request body for creating an agent (POST /projects/{projectUuid}/aiAgents). */
|
|
44
|
+
type CreateAiAgent = components['schemas']['ApiCreateAiAgent'];
|
|
45
|
+
/** Request body for updating an agent (PATCH /projects/{projectUuid}/aiAgents/{agentUuid}). */
|
|
46
|
+
type UpdateAiAgent = components['schemas']['ApiUpdateAiAgent'];
|
|
47
|
+
/** Thread summary (no messages) returned by list and create operations. */
|
|
48
|
+
type AiAgentThreadSummary = components['schemas']['AiAgentThreadSummary'];
|
|
49
|
+
/** Full thread including messages, returned by GET …/threads/{threadUuid}. */
|
|
50
|
+
type AiAgentThread = components['schemas']['AiAgentThread'];
|
|
51
|
+
/**
|
|
52
|
+
* Request body for creating a new thread
|
|
53
|
+
* (POST /projects/{projectUuid}/aiAgents/{agentUuid}/threads).
|
|
54
|
+
* Include `prompt` to trigger immediate generation.
|
|
55
|
+
*/
|
|
56
|
+
type CreateAgentThreadBody = components['schemas']['ApiAiAgentThreadCreateRequest'];
|
|
57
|
+
/**
|
|
58
|
+
* Request body for generating/continuing a thread response
|
|
59
|
+
* (POST …/threads/{threadUuid}/generate).
|
|
60
|
+
*/
|
|
61
|
+
type GenerateAgentThreadBody = components['schemas']['ApiAiAgentThreadMessageCreateRequest'];
|
|
62
|
+
/** Response returned by the generate endpoint. */
|
|
63
|
+
type GenerateAgentThreadResult = components['schemas']['ApiAiAgentThreadGenerateResponse']['results'];
|
|
64
|
+
/** A prompt used in an evaluation (string prompt or reference to existing thread message). */
|
|
65
|
+
type CreateEvaluationPrompt = components['schemas']['CreateEvaluationPrompt'];
|
|
66
|
+
/** Request body for creating an evaluation
|
|
67
|
+
* (POST /projects/{projectUuid}/aiAgents/{agentUuid}/evaluations). */
|
|
68
|
+
type CreateEvaluationBody = components['schemas']['ApiCreateEvaluationRequest'];
|
|
69
|
+
/** Evaluation UUID returned after creating an evaluation. */
|
|
70
|
+
type CreateEvaluationResult = components['schemas']['ApiCreateEvaluationResponse']['results'];
|
|
71
|
+
/** Request body for updating an evaluation. */
|
|
72
|
+
type UpdateEvaluationBody = components['schemas']['ApiUpdateEvaluationRequest'];
|
|
73
|
+
/** Request body for appending prompts to an existing evaluation. */
|
|
74
|
+
type AppendEvaluationBody = components['schemas']['ApiAppendEvaluationRequest'];
|
|
75
|
+
/** Summary of an evaluation (used in list responses). */
|
|
76
|
+
type AiAgentEvaluationSummary = components['schemas']['AiAgentEvaluationSummary'];
|
|
77
|
+
/** Full evaluation including its prompts. */
|
|
78
|
+
type AiAgentEvaluation = components['schemas']['AiAgentEvaluation'];
|
|
79
|
+
/** Summary of a single evaluation run. */
|
|
80
|
+
type AiAgentEvaluationRunSummary = components['schemas']['AiAgentEvaluationRunSummary'];
|
|
81
|
+
/**
|
|
82
|
+
* Paginated list response for evaluation runs.
|
|
83
|
+
* Shape: `{ results: { data: { runs: AiAgentEvaluationRunSummary[] }, pagination? }, status }`.
|
|
84
|
+
*/
|
|
85
|
+
type AiAgentEvaluationRunsListResponse = components['schemas']['ApiAiAgentEvaluationRunSummaryListResponse']['results'];
|
|
86
|
+
/** Full evaluation run including per-prompt results. */
|
|
87
|
+
type AiAgentEvaluationRun = components['schemas']['AiAgentEvaluationRun'];
|
|
88
|
+
/** Individual result entry within a run (prompt + response + assessment). */
|
|
89
|
+
type AiAgentEvaluationRunResult = components['schemas']['AiAgentEvaluationRunResult'];
|
|
90
|
+
/** Assessment (human or LLM-judge) for a single run result. */
|
|
91
|
+
type AiEvalRunResultAssessment = components['schemas']['AiEvalRunResultAssessment'];
|
|
92
|
+
/** Assessment type: human or llm. */
|
|
93
|
+
type AssessmentType = components['schemas']['AssessmentType'];
|
|
38
94
|
}
|
|
@@ -2,5 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* AI agents domain models.
|
|
4
4
|
* Extracted from OpenAPI specification for better maintainability.
|
|
5
|
+
*
|
|
6
|
+
* Admin endpoints: /api/v1/aiAgents/admin/...
|
|
7
|
+
* Project-scoped endpoints: /api/v1/projects/{projectUuid}/aiAgents/...
|
|
5
8
|
*/
|
|
6
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/types/v1/index.d.ts
CHANGED
|
@@ -89,5 +89,23 @@ export declare namespace V1 {
|
|
|
89
89
|
type GetAiOrganizationSettingsResult = A.GetAiOrganizationSettingsResult;
|
|
90
90
|
type UpdateAiOrganizationSettings = A.UpdateAiOrganizationSettings;
|
|
91
91
|
type UpdateAiOrganizationSettingsResult = A.UpdateAiOrganizationSettingsResult;
|
|
92
|
+
type AiAgent = A.AiAgent;
|
|
93
|
+
type CreateAiAgent = A.CreateAiAgent;
|
|
94
|
+
type UpdateAiAgent = A.UpdateAiAgent;
|
|
95
|
+
type AiAgentThreadSummary = A.AiAgentThreadSummary;
|
|
96
|
+
type AiAgentThread = A.AiAgentThread;
|
|
97
|
+
type CreateAgentThreadBody = A.CreateAgentThreadBody;
|
|
98
|
+
type GenerateAgentThreadBody = A.GenerateAgentThreadBody;
|
|
99
|
+
type GenerateAgentThreadResult = A.GenerateAgentThreadResult;
|
|
100
|
+
type CreateEvaluationPrompt = A.CreateEvaluationPrompt;
|
|
101
|
+
type CreateEvaluationBody = A.CreateEvaluationBody;
|
|
102
|
+
type CreateEvaluationResult = A.CreateEvaluationResult;
|
|
103
|
+
type UpdateEvaluationBody = A.UpdateEvaluationBody;
|
|
104
|
+
type AppendEvaluationBody = A.AppendEvaluationBody;
|
|
105
|
+
type AiAgentEvaluationSummary = A.AiAgentEvaluationSummary;
|
|
106
|
+
type AiAgentEvaluation = A.AiAgentEvaluation;
|
|
107
|
+
type AiAgentEvaluationRunSummary = A.AiAgentEvaluationRunSummary;
|
|
108
|
+
type AiAgentEvaluationRun = A.AiAgentEvaluationRun;
|
|
109
|
+
type AiAgentEvaluationRunResult = A.AiAgentEvaluationRunResult;
|
|
92
110
|
}
|
|
93
111
|
}
|
|
@@ -125,6 +125,27 @@ export declare namespace LightdashApi {
|
|
|
125
125
|
type GetAiOrganizationSettingsResult = components['schemas']['ApiAiOrganizationSettingsResponse']['results'];
|
|
126
126
|
type UpdateAiOrganizationSettings = components['schemas']['UpdateAiOrganizationSettings'];
|
|
127
127
|
type UpdateAiOrganizationSettingsResult = components['schemas']['ApiUpdateAiOrganizationSettingsResponse']['results'];
|
|
128
|
+
type AiAgent = components['schemas']['AiAgent'];
|
|
129
|
+
type CreateAiAgent = components['schemas']['ApiCreateAiAgent'];
|
|
130
|
+
type UpdateAiAgent = components['schemas']['ApiUpdateAiAgent'];
|
|
131
|
+
type AiAgentThreadSummary = components['schemas']['AiAgentThreadSummary'];
|
|
132
|
+
type AiAgentThread = components['schemas']['AiAgentThread'];
|
|
133
|
+
type CreateAgentThreadBody = components['schemas']['ApiAiAgentThreadCreateRequest'];
|
|
134
|
+
type GenerateAgentThreadBody = components['schemas']['ApiAiAgentThreadMessageCreateRequest'];
|
|
135
|
+
type GenerateAgentThreadResult = components['schemas']['ApiAiAgentThreadGenerateResponse']['results'];
|
|
136
|
+
type CreateEvaluationPrompt = components['schemas']['CreateEvaluationPrompt'];
|
|
137
|
+
type CreateEvaluationBody = components['schemas']['ApiCreateEvaluationRequest'];
|
|
138
|
+
type CreateEvaluationResult = components['schemas']['ApiCreateEvaluationResponse']['results'];
|
|
139
|
+
type UpdateEvaluationBody = components['schemas']['ApiUpdateEvaluationRequest'];
|
|
140
|
+
type AppendEvaluationBody = components['schemas']['ApiAppendEvaluationRequest'];
|
|
141
|
+
type AiAgentEvaluationSummary = components['schemas']['AiAgentEvaluationSummary'];
|
|
142
|
+
type AiAgentEvaluation = components['schemas']['AiAgentEvaluation'];
|
|
143
|
+
type AiAgentEvaluationRunSummary = components['schemas']['AiAgentEvaluationRunSummary'];
|
|
144
|
+
type AiAgentEvaluationRunsListResponse = components['schemas']['ApiAiAgentEvaluationRunSummaryListResponse'];
|
|
145
|
+
type AiAgentEvaluationRun = components['schemas']['AiAgentEvaluationRun'];
|
|
146
|
+
type AiAgentEvaluationRunResult = components['schemas']['AiAgentEvaluationRunResult'];
|
|
147
|
+
type AiEvalRunResultAssessment = components['schemas']['AiEvalRunResultAssessment'];
|
|
148
|
+
type AssessmentType = components['schemas']['AssessmentType'];
|
|
128
149
|
}
|
|
129
150
|
namespace Explores {
|
|
130
151
|
type ApiExploresResults = components['schemas']['ApiExploresResults'];
|
|
@@ -207,5 +228,24 @@ export type GetAiOrganizationSettingsResult = AiAgents.GetAiOrganizationSettings
|
|
|
207
228
|
export type UpdateAiOrganizationSettings = AiAgents.UpdateAiOrganizationSettings;
|
|
208
229
|
export type UpdateAiOrganizationSettingsResult = AiAgents.UpdateAiOrganizationSettingsResult;
|
|
209
230
|
export type GetAdminThreadsParams = AiAgents.GetAdminThreadsParams;
|
|
231
|
+
export type AiAgent = AiAgents.AiAgent;
|
|
232
|
+
export type CreateAiAgent = AiAgents.CreateAiAgent;
|
|
233
|
+
export type UpdateAiAgent = AiAgents.UpdateAiAgent;
|
|
234
|
+
export type AiAgentThreadSummary = AiAgents.AiAgentThreadSummary;
|
|
235
|
+
export type AiAgentThread = AiAgents.AiAgentThread;
|
|
236
|
+
export type CreateAgentThreadBody = AiAgents.CreateAgentThreadBody;
|
|
237
|
+
export type GenerateAgentThreadBody = AiAgents.GenerateAgentThreadBody;
|
|
238
|
+
export type GenerateAgentThreadResult = AiAgents.GenerateAgentThreadResult;
|
|
239
|
+
export type CreateEvaluationPrompt = AiAgents.CreateEvaluationPrompt;
|
|
240
|
+
export type CreateEvaluationBody = AiAgents.CreateEvaluationBody;
|
|
241
|
+
export type CreateEvaluationResult = AiAgents.CreateEvaluationResult;
|
|
242
|
+
export type UpdateEvaluationBody = AiAgents.UpdateEvaluationBody;
|
|
243
|
+
export type AppendEvaluationBody = AiAgents.AppendEvaluationBody;
|
|
244
|
+
export type AiAgentEvaluationSummary = AiAgents.AiAgentEvaluationSummary;
|
|
245
|
+
export type AiAgentEvaluation = AiAgents.AiAgentEvaluation;
|
|
246
|
+
export type AiAgentEvaluationRunSummary = AiAgents.AiAgentEvaluationRunSummary;
|
|
247
|
+
export type AiAgentEvaluationRunsListResponse = AiAgents.AiAgentEvaluationRunsListResponse;
|
|
248
|
+
export type AiAgentEvaluationRun = AiAgents.AiAgentEvaluationRun;
|
|
249
|
+
export type AiAgentEvaluationRunResult = AiAgents.AiAgentEvaluationRunResult;
|
|
210
250
|
export type ApiExploresResults = Explores.ApiExploresResults;
|
|
211
251
|
export type ApiExploreResults = Explores.ApiExploreResults;
|
package/package.json
CHANGED
package/src/audit.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured audit logger for Lightdash tool invocations (MCP and CLI).
|
|
3
|
+
*
|
|
4
|
+
* Each operation is recorded as a single NDJSON line containing:
|
|
5
|
+
* timestamp, sessionId, tool/command name, projectUuids (if present), status, and durationMs.
|
|
6
|
+
*
|
|
7
|
+
* Output destination:
|
|
8
|
+
* - If LIGHTDASH_AUDIT_LOG is set to a file path, entries are appended to that file.
|
|
9
|
+
* - Otherwise entries are written to stderr with an "[audit]" prefix.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { createWriteStream, type WriteStream } from 'node:fs';
|
|
13
|
+
import { randomUUID } from 'node:crypto';
|
|
14
|
+
|
|
15
|
+
export type AuditStatus = 'success' | 'error' | 'blocked';
|
|
16
|
+
|
|
17
|
+
export type AuditLogEntry = {
|
|
18
|
+
timestamp: string;
|
|
19
|
+
sessionId: string;
|
|
20
|
+
/** MCP tool name or CLI command name. */
|
|
21
|
+
tool: string;
|
|
22
|
+
/** Project UUIDs involved in the call, if any (covers both projectUuid and projectUuids[]). */
|
|
23
|
+
projectUuids?: string[];
|
|
24
|
+
status: AuditStatus;
|
|
25
|
+
durationMs: number;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** Unique ID for the current process lifetime. Generated once at module load. */
|
|
29
|
+
const SESSION_ID = randomUUID();
|
|
30
|
+
|
|
31
|
+
let _writeStream: WriteStream | undefined;
|
|
32
|
+
|
|
33
|
+
export function getSessionId(): string {
|
|
34
|
+
return SESSION_ID;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Initialise the audit log. Call once at process startup.
|
|
39
|
+
* If filePath is provided, entries are appended to that file; otherwise stderr is used.
|
|
40
|
+
*/
|
|
41
|
+
export function initAuditLog(filePath?: string): void {
|
|
42
|
+
if (filePath) {
|
|
43
|
+
_writeStream = createWriteStream(filePath, { flags: 'a' });
|
|
44
|
+
_writeStream.on('error', (err) => {
|
|
45
|
+
console.error('[audit] Failed to write to audit log file:', err);
|
|
46
|
+
});
|
|
47
|
+
console.error(`[audit] Writing to file: ${filePath} (session: ${SESSION_ID})`);
|
|
48
|
+
} else {
|
|
49
|
+
console.error(`[audit] Writing to stderr (session: ${SESSION_ID})`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Append one NDJSON entry to the configured output. */
|
|
54
|
+
export function logAuditEntry(entry: AuditLogEntry): void {
|
|
55
|
+
const line = `${JSON.stringify(entry)}\n`;
|
|
56
|
+
if (_writeStream) {
|
|
57
|
+
_writeStream.write(line);
|
|
58
|
+
} else {
|
|
59
|
+
process.stderr.write(`[audit] ${line}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,9 @@ export function greet(name: string): string {
|
|
|
5
5
|
// Export safety logic
|
|
6
6
|
export * from './safety';
|
|
7
7
|
|
|
8
|
+
// Export audit logger (shared by MCP and CLI)
|
|
9
|
+
export * from './audit';
|
|
10
|
+
|
|
8
11
|
// Export Lightdash API models
|
|
9
12
|
export * from './types/lightdash-api';
|
|
10
13
|
export type { LightdashApi } from './types/lightdash-api';
|
package/src/safety.test.ts
CHANGED
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
SafetyMode,
|
|
4
4
|
isAllowed,
|
|
5
5
|
getSafetyModeFromEnv,
|
|
6
|
+
getAllowedProjectUuidsFromEnv,
|
|
7
|
+
isProjectAllowed,
|
|
8
|
+
areAllProjectsAllowed,
|
|
6
9
|
READ_ONLY_DEFAULT,
|
|
7
10
|
WRITE_IDEMPOTENT,
|
|
8
11
|
WRITE_DESTRUCTIVE,
|
|
@@ -57,4 +60,73 @@ describe('Safety Logic', () => {
|
|
|
57
60
|
expect(getSafetyModeFromEnv()).toBe(SafetyMode.READ_ONLY);
|
|
58
61
|
});
|
|
59
62
|
});
|
|
63
|
+
|
|
64
|
+
describe('getAllowedProjectUuidsFromEnv', () => {
|
|
65
|
+
const originalEnv = process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
66
|
+
|
|
67
|
+
afterEach(() => {
|
|
68
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = originalEnv;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should return empty array when env is not set', () => {
|
|
72
|
+
delete process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
73
|
+
expect(getAllowedProjectUuidsFromEnv()).toEqual([]);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should parse a single UUID', () => {
|
|
77
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = 'uuid-a';
|
|
78
|
+
expect(getAllowedProjectUuidsFromEnv()).toEqual(['uuid-a']);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('should parse comma-separated UUIDs', () => {
|
|
82
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = 'uuid-a,uuid-b,uuid-c';
|
|
83
|
+
expect(getAllowedProjectUuidsFromEnv()).toEqual(['uuid-a', 'uuid-b', 'uuid-c']);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should trim whitespace around UUIDs', () => {
|
|
87
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = ' uuid-a , uuid-b ';
|
|
88
|
+
expect(getAllowedProjectUuidsFromEnv()).toEqual(['uuid-a', 'uuid-b']);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('should filter out empty entries', () => {
|
|
92
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = 'uuid-a,,uuid-b';
|
|
93
|
+
expect(getAllowedProjectUuidsFromEnv()).toEqual(['uuid-a', 'uuid-b']);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
describe('isProjectAllowed', () => {
|
|
98
|
+
it('should allow all projects when allowlist is empty', () => {
|
|
99
|
+
expect(isProjectAllowed([], 'any-uuid')).toBe(true);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should allow a project that is in the allowlist', () => {
|
|
103
|
+
expect(isProjectAllowed(['uuid-a', 'uuid-b'], 'uuid-a')).toBe(true);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('should deny a project that is not in the allowlist', () => {
|
|
107
|
+
expect(isProjectAllowed(['uuid-a', 'uuid-b'], 'uuid-c')).toBe(false);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe('areAllProjectsAllowed', () => {
|
|
112
|
+
it('should allow everything when allowlist is empty', () => {
|
|
113
|
+
expect(areAllProjectsAllowed([], ['uuid-a', 'uuid-b'])).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should allow an empty projectUuids array (trivially)', () => {
|
|
117
|
+
expect(areAllProjectsAllowed(['uuid-a'], [])).toBe(true);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('should allow when all UUIDs are in the allowlist', () => {
|
|
121
|
+
expect(areAllProjectsAllowed(['uuid-a', 'uuid-b'], ['uuid-a', 'uuid-b'])).toBe(true);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('should deny when any UUID is not in the allowlist', () => {
|
|
125
|
+
expect(areAllProjectsAllowed(['uuid-a', 'uuid-b'], ['uuid-a', 'uuid-c'])).toBe(false);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('should deny when all UUIDs are outside the allowlist', () => {
|
|
129
|
+
expect(areAllProjectsAllowed(['uuid-a'], ['uuid-b', 'uuid-c'])).toBe(false);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
60
132
|
});
|
package/src/safety.ts
CHANGED
|
@@ -69,3 +69,90 @@ export function getSafetyModeFromEnv(): SafetyMode {
|
|
|
69
69
|
}
|
|
70
70
|
return SafetyMode.READ_ONLY;
|
|
71
71
|
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Parses allowed project UUIDs from the LIGHTDASH_TOOLS_ALLOWED_PROJECTS environment
|
|
75
|
+
* variable (comma-separated). Returns an empty array when the variable is unset, meaning
|
|
76
|
+
* all projects are allowed.
|
|
77
|
+
*
|
|
78
|
+
* Note: CLI/MCP flags (--allowed-projects) always take priority over this env var.
|
|
79
|
+
*/
|
|
80
|
+
export function getAllowedProjectUuidsFromEnv(): string[] {
|
|
81
|
+
const raw = process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS ?? '';
|
|
82
|
+
return raw
|
|
83
|
+
.split(',')
|
|
84
|
+
.map((s) => s.trim())
|
|
85
|
+
.filter(Boolean);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Returns true if a single projectUuid is permitted by the allowlist.
|
|
90
|
+
* An empty allowlist means all projects are allowed.
|
|
91
|
+
*/
|
|
92
|
+
export function isProjectAllowed(allowedUuids: readonly string[], projectUuid: string): boolean {
|
|
93
|
+
if (allowedUuids.length === 0) return true;
|
|
94
|
+
return allowedUuids.includes(projectUuid);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns true when every UUID in projectUuids is permitted by the allowlist.
|
|
99
|
+
* An empty allowlist means all projects are allowed.
|
|
100
|
+
* An empty projectUuids array is trivially allowed.
|
|
101
|
+
*/
|
|
102
|
+
export function areAllProjectsAllowed(
|
|
103
|
+
allowedUuids: readonly string[],
|
|
104
|
+
projectUuids: readonly string[],
|
|
105
|
+
): boolean {
|
|
106
|
+
if (allowedUuids.length === 0) return true;
|
|
107
|
+
return projectUuids.every((uuid) => allowedUuids.includes(uuid));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Extracts all project UUIDs from tool or command arguments.
|
|
112
|
+
* Handles both MCP-style objects and CLI-style argument arrays.
|
|
113
|
+
*/
|
|
114
|
+
export function extractProjectUuids(args: unknown): string[] {
|
|
115
|
+
if (args === null || args === undefined) return [];
|
|
116
|
+
const uuids: string[] = [];
|
|
117
|
+
|
|
118
|
+
if (Array.isArray(args)) {
|
|
119
|
+
// CLI: positional arguments + options object
|
|
120
|
+
for (const arg of args) {
|
|
121
|
+
if (typeof arg === 'string' && /^[0-9a-f-]{36}$/i.test(arg)) {
|
|
122
|
+
// Looks like a UUID positional arg
|
|
123
|
+
uuids.push(arg);
|
|
124
|
+
} else if (typeof arg === 'object' && arg !== null) {
|
|
125
|
+
// Looks like options object or nested args
|
|
126
|
+
const a = arg as Record<string, unknown>;
|
|
127
|
+
// Check various naming conventions used across CLI and MCP
|
|
128
|
+
const keys = ['projects', 'project', 'projectUuid', 'projectUuids'];
|
|
129
|
+
for (const key of keys) {
|
|
130
|
+
const val = a[key];
|
|
131
|
+
if (typeof val === 'string') {
|
|
132
|
+
uuids.push(val);
|
|
133
|
+
} else if (Array.isArray(val)) {
|
|
134
|
+
for (const item of val) {
|
|
135
|
+
if (typeof item === 'string') uuids.push(item);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
} else if (typeof args === 'object') {
|
|
142
|
+
// MCP or single options object
|
|
143
|
+
const a = args as Record<string, unknown>;
|
|
144
|
+
const keys = ['project', 'projectUuid', 'projectUuids'];
|
|
145
|
+
for (const key of keys) {
|
|
146
|
+
const val = a[key];
|
|
147
|
+
if (typeof val === 'string') {
|
|
148
|
+
uuids.push(val);
|
|
149
|
+
} else if (Array.isArray(val)) {
|
|
150
|
+
for (const item of val) {
|
|
151
|
+
if (typeof item === 'string') uuids.push(item);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return [...new Set(uuids)].filter((u) => u.length > 0);
|
|
158
|
+
}
|
|
@@ -75,6 +75,25 @@ export type {
|
|
|
75
75
|
UpdateAiOrganizationSettings,
|
|
76
76
|
UpdateAiOrganizationSettingsResult,
|
|
77
77
|
GetAdminThreadsParams,
|
|
78
|
+
AiAgent,
|
|
79
|
+
CreateAiAgent,
|
|
80
|
+
UpdateAiAgent,
|
|
81
|
+
AiAgentThreadSummary,
|
|
82
|
+
AiAgentThread,
|
|
83
|
+
CreateAgentThreadBody,
|
|
84
|
+
GenerateAgentThreadBody,
|
|
85
|
+
GenerateAgentThreadResult,
|
|
86
|
+
CreateEvaluationPrompt,
|
|
87
|
+
CreateEvaluationBody,
|
|
88
|
+
CreateEvaluationResult,
|
|
89
|
+
UpdateEvaluationBody,
|
|
90
|
+
AppendEvaluationBody,
|
|
91
|
+
AiAgentEvaluationSummary,
|
|
92
|
+
AiAgentEvaluation,
|
|
93
|
+
AiAgentEvaluationRunSummary,
|
|
94
|
+
AiAgentEvaluationRunsListResponse,
|
|
95
|
+
AiAgentEvaluationRun,
|
|
96
|
+
AiAgentEvaluationRunResult,
|
|
78
97
|
ApiExploresResults,
|
|
79
98
|
ApiExploreResults,
|
|
80
99
|
} from './v1/lightdash-api';
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AI agents domain models.
|
|
3
3
|
* Extracted from OpenAPI specification for better maintainability.
|
|
4
|
+
*
|
|
5
|
+
* Admin endpoints: /api/v1/aiAgents/admin/...
|
|
6
|
+
* Project-scoped endpoints: /api/v1/projects/{projectUuid}/aiAgents/...
|
|
4
7
|
*/
|
|
5
8
|
|
|
6
9
|
import type { components } from '../generated/openapi-types';
|
|
7
10
|
|
|
8
11
|
export namespace AiAgents {
|
|
9
|
-
|
|
12
|
+
// ─── Admin types ────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
/** Summary of an AI agent returned by the admin list endpoint. */
|
|
10
15
|
export type AiAgentSummary = components['schemas']['AiAgentSummary'];
|
|
11
|
-
/** Sort field for admin thread list. */
|
|
16
|
+
/** Sort field for the admin thread list. */
|
|
12
17
|
export type AiAgentAdminSortField = components['schemas']['AiAgentAdminSortField'];
|
|
13
18
|
/** Paginated result for admin threads (API response results). */
|
|
14
19
|
export type AdminThreadsResult =
|
|
15
20
|
components['schemas']['ApiAiAgentAdminConversationsResponse']['results'];
|
|
16
|
-
/** Query params for listing admin threads (
|
|
21
|
+
/** Query params for listing admin threads (GET /aiAgents/admin/threads). */
|
|
17
22
|
export interface GetAdminThreadsParams {
|
|
18
23
|
page?: number;
|
|
19
24
|
pageSize?: number;
|
|
@@ -28,7 +33,7 @@ export namespace AiAgents {
|
|
|
28
33
|
sortField?: components['schemas']['AiAgentAdminSortField'];
|
|
29
34
|
sortDirection?: 'asc' | 'desc';
|
|
30
35
|
}
|
|
31
|
-
/** AI organization settings
|
|
36
|
+
/** AI organization settings returned by GET /aiAgents/admin/settings. */
|
|
32
37
|
export type AiOrganizationSettings = components['schemas']['AiOrganizationSettings'];
|
|
33
38
|
/** Computed AI org settings (included in get response). */
|
|
34
39
|
export type ComputedAiOrganizationSettings =
|
|
@@ -36,9 +41,78 @@ export namespace AiAgents {
|
|
|
36
41
|
/** Get AI org settings response results (settings + computed). */
|
|
37
42
|
export type GetAiOrganizationSettingsResult =
|
|
38
43
|
components['schemas']['ApiAiOrganizationSettingsResponse']['results'];
|
|
39
|
-
/** Update AI org settings request body. */
|
|
44
|
+
/** Update AI org settings request body (PATCH /aiAgents/admin/settings). */
|
|
40
45
|
export type UpdateAiOrganizationSettings = components['schemas']['UpdateAiOrganizationSettings'];
|
|
41
46
|
/** Update AI org settings response results. */
|
|
42
47
|
export type UpdateAiOrganizationSettingsResult =
|
|
43
48
|
components['schemas']['ApiUpdateAiOrganizationSettingsResponse']['results'];
|
|
49
|
+
|
|
50
|
+
// ─── Project-scoped agent CRUD ───────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
/** Full AI agent object returned by GET /projects/{projectUuid}/aiAgents/{agentUuid}. */
|
|
53
|
+
export type AiAgent = components['schemas']['AiAgent'];
|
|
54
|
+
/** Request body for creating an agent (POST /projects/{projectUuid}/aiAgents). */
|
|
55
|
+
export type CreateAiAgent = components['schemas']['ApiCreateAiAgent'];
|
|
56
|
+
/** Request body for updating an agent (PATCH /projects/{projectUuid}/aiAgents/{agentUuid}). */
|
|
57
|
+
export type UpdateAiAgent = components['schemas']['ApiUpdateAiAgent'];
|
|
58
|
+
|
|
59
|
+
// ─── Thread management ───────────────────────────────────────────────────────
|
|
60
|
+
|
|
61
|
+
/** Thread summary (no messages) returned by list and create operations. */
|
|
62
|
+
export type AiAgentThreadSummary = components['schemas']['AiAgentThreadSummary'];
|
|
63
|
+
/** Full thread including messages, returned by GET …/threads/{threadUuid}. */
|
|
64
|
+
export type AiAgentThread = components['schemas']['AiAgentThread'];
|
|
65
|
+
/**
|
|
66
|
+
* Request body for creating a new thread
|
|
67
|
+
* (POST /projects/{projectUuid}/aiAgents/{agentUuid}/threads).
|
|
68
|
+
* Include `prompt` to trigger immediate generation.
|
|
69
|
+
*/
|
|
70
|
+
export type CreateAgentThreadBody = components['schemas']['ApiAiAgentThreadCreateRequest'];
|
|
71
|
+
/**
|
|
72
|
+
* Request body for generating/continuing a thread response
|
|
73
|
+
* (POST …/threads/{threadUuid}/generate).
|
|
74
|
+
*/
|
|
75
|
+
export type GenerateAgentThreadBody =
|
|
76
|
+
components['schemas']['ApiAiAgentThreadMessageCreateRequest'];
|
|
77
|
+
/** Response returned by the generate endpoint. */
|
|
78
|
+
export type GenerateAgentThreadResult =
|
|
79
|
+
components['schemas']['ApiAiAgentThreadGenerateResponse']['results'];
|
|
80
|
+
|
|
81
|
+
// ─── Evaluations ────────────────────────────────────────────────────────────
|
|
82
|
+
|
|
83
|
+
/** A prompt used in an evaluation (string prompt or reference to existing thread message). */
|
|
84
|
+
export type CreateEvaluationPrompt = components['schemas']['CreateEvaluationPrompt'];
|
|
85
|
+
/** Request body for creating an evaluation
|
|
86
|
+
* (POST /projects/{projectUuid}/aiAgents/{agentUuid}/evaluations). */
|
|
87
|
+
export type CreateEvaluationBody = components['schemas']['ApiCreateEvaluationRequest'];
|
|
88
|
+
/** Evaluation UUID returned after creating an evaluation. */
|
|
89
|
+
export type CreateEvaluationResult =
|
|
90
|
+
components['schemas']['ApiCreateEvaluationResponse']['results'];
|
|
91
|
+
/** Request body for updating an evaluation. */
|
|
92
|
+
export type UpdateEvaluationBody = components['schemas']['ApiUpdateEvaluationRequest'];
|
|
93
|
+
/** Request body for appending prompts to an existing evaluation. */
|
|
94
|
+
export type AppendEvaluationBody = components['schemas']['ApiAppendEvaluationRequest'];
|
|
95
|
+
/** Summary of an evaluation (used in list responses). */
|
|
96
|
+
export type AiAgentEvaluationSummary = components['schemas']['AiAgentEvaluationSummary'];
|
|
97
|
+
/** Full evaluation including its prompts. */
|
|
98
|
+
export type AiAgentEvaluation = components['schemas']['AiAgentEvaluation'];
|
|
99
|
+
|
|
100
|
+
// ─── Evaluation runs ─────────────────────────────────────────────────────────
|
|
101
|
+
|
|
102
|
+
/** Summary of a single evaluation run. */
|
|
103
|
+
export type AiAgentEvaluationRunSummary = components['schemas']['AiAgentEvaluationRunSummary'];
|
|
104
|
+
/**
|
|
105
|
+
* Paginated list response for evaluation runs.
|
|
106
|
+
* Shape: `{ results: { data: { runs: AiAgentEvaluationRunSummary[] }, pagination? }, status }`.
|
|
107
|
+
*/
|
|
108
|
+
export type AiAgentEvaluationRunsListResponse =
|
|
109
|
+
components['schemas']['ApiAiAgentEvaluationRunSummaryListResponse']['results'];
|
|
110
|
+
/** Full evaluation run including per-prompt results. */
|
|
111
|
+
export type AiAgentEvaluationRun = components['schemas']['AiAgentEvaluationRun'];
|
|
112
|
+
/** Individual result entry within a run (prompt + response + assessment). */
|
|
113
|
+
export type AiAgentEvaluationRunResult = components['schemas']['AiAgentEvaluationRunResult'];
|
|
114
|
+
/** Assessment (human or LLM-judge) for a single run result. */
|
|
115
|
+
export type AiEvalRunResultAssessment = components['schemas']['AiEvalRunResultAssessment'];
|
|
116
|
+
/** Assessment type: human or llm. */
|
|
117
|
+
export type AssessmentType = components['schemas']['AssessmentType'];
|
|
44
118
|
}
|
package/src/types/v1/index.ts
CHANGED
|
@@ -95,11 +95,33 @@ export namespace V1 {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
export namespace AiAgents {
|
|
98
|
+
// Admin
|
|
98
99
|
export type AiAgentSummary = A.AiAgentSummary;
|
|
99
100
|
export type AiAgentAdminSortField = A.AiAgentAdminSortField;
|
|
100
101
|
export type AdminThreadsResult = A.AdminThreadsResult;
|
|
101
102
|
export type GetAiOrganizationSettingsResult = A.GetAiOrganizationSettingsResult;
|
|
102
103
|
export type UpdateAiOrganizationSettings = A.UpdateAiOrganizationSettings;
|
|
103
104
|
export type UpdateAiOrganizationSettingsResult = A.UpdateAiOrganizationSettingsResult;
|
|
105
|
+
// Agent CRUD
|
|
106
|
+
export type AiAgent = A.AiAgent;
|
|
107
|
+
export type CreateAiAgent = A.CreateAiAgent;
|
|
108
|
+
export type UpdateAiAgent = A.UpdateAiAgent;
|
|
109
|
+
// Threads
|
|
110
|
+
export type AiAgentThreadSummary = A.AiAgentThreadSummary;
|
|
111
|
+
export type AiAgentThread = A.AiAgentThread;
|
|
112
|
+
export type CreateAgentThreadBody = A.CreateAgentThreadBody;
|
|
113
|
+
export type GenerateAgentThreadBody = A.GenerateAgentThreadBody;
|
|
114
|
+
export type GenerateAgentThreadResult = A.GenerateAgentThreadResult;
|
|
115
|
+
// Evaluations
|
|
116
|
+
export type CreateEvaluationPrompt = A.CreateEvaluationPrompt;
|
|
117
|
+
export type CreateEvaluationBody = A.CreateEvaluationBody;
|
|
118
|
+
export type CreateEvaluationResult = A.CreateEvaluationResult;
|
|
119
|
+
export type UpdateEvaluationBody = A.UpdateEvaluationBody;
|
|
120
|
+
export type AppendEvaluationBody = A.AppendEvaluationBody;
|
|
121
|
+
export type AiAgentEvaluationSummary = A.AiAgentEvaluationSummary;
|
|
122
|
+
export type AiAgentEvaluation = A.AiAgentEvaluation;
|
|
123
|
+
export type AiAgentEvaluationRunSummary = A.AiAgentEvaluationRunSummary;
|
|
124
|
+
export type AiAgentEvaluationRun = A.AiAgentEvaluationRun;
|
|
125
|
+
export type AiAgentEvaluationRunResult = A.AiAgentEvaluationRunResult;
|
|
104
126
|
}
|
|
105
127
|
}
|
|
@@ -172,6 +172,7 @@ export namespace LightdashApi {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
export namespace AiAgents {
|
|
175
|
+
// Admin
|
|
175
176
|
export type AiAgentSummary = components['schemas']['AiAgentSummary'];
|
|
176
177
|
export type AiAgentAdminSortField = components['schemas']['AiAgentAdminSortField'];
|
|
177
178
|
export type AdminThreadsResult =
|
|
@@ -182,6 +183,35 @@ export namespace LightdashApi {
|
|
|
182
183
|
components['schemas']['UpdateAiOrganizationSettings'];
|
|
183
184
|
export type UpdateAiOrganizationSettingsResult =
|
|
184
185
|
components['schemas']['ApiUpdateAiOrganizationSettingsResponse']['results'];
|
|
186
|
+
// Agent CRUD
|
|
187
|
+
export type AiAgent = components['schemas']['AiAgent'];
|
|
188
|
+
export type CreateAiAgent = components['schemas']['ApiCreateAiAgent'];
|
|
189
|
+
export type UpdateAiAgent = components['schemas']['ApiUpdateAiAgent'];
|
|
190
|
+
// Threads
|
|
191
|
+
export type AiAgentThreadSummary = components['schemas']['AiAgentThreadSummary'];
|
|
192
|
+
export type AiAgentThread = components['schemas']['AiAgentThread'];
|
|
193
|
+
export type CreateAgentThreadBody = components['schemas']['ApiAiAgentThreadCreateRequest'];
|
|
194
|
+
export type GenerateAgentThreadBody =
|
|
195
|
+
components['schemas']['ApiAiAgentThreadMessageCreateRequest'];
|
|
196
|
+
export type GenerateAgentThreadResult =
|
|
197
|
+
components['schemas']['ApiAiAgentThreadGenerateResponse']['results'];
|
|
198
|
+
// Evaluations
|
|
199
|
+
export type CreateEvaluationPrompt = components['schemas']['CreateEvaluationPrompt'];
|
|
200
|
+
export type CreateEvaluationBody = components['schemas']['ApiCreateEvaluationRequest'];
|
|
201
|
+
export type CreateEvaluationResult =
|
|
202
|
+
components['schemas']['ApiCreateEvaluationResponse']['results'];
|
|
203
|
+
export type UpdateEvaluationBody = components['schemas']['ApiUpdateEvaluationRequest'];
|
|
204
|
+
export type AppendEvaluationBody = components['schemas']['ApiAppendEvaluationRequest'];
|
|
205
|
+
export type AiAgentEvaluationSummary = components['schemas']['AiAgentEvaluationSummary'];
|
|
206
|
+
export type AiAgentEvaluation = components['schemas']['AiAgentEvaluation'];
|
|
207
|
+
// Evaluation runs
|
|
208
|
+
export type AiAgentEvaluationRunSummary = components['schemas']['AiAgentEvaluationRunSummary'];
|
|
209
|
+
export type AiAgentEvaluationRunsListResponse =
|
|
210
|
+
components['schemas']['ApiAiAgentEvaluationRunSummaryListResponse'];
|
|
211
|
+
export type AiAgentEvaluationRun = components['schemas']['AiAgentEvaluationRun'];
|
|
212
|
+
export type AiAgentEvaluationRunResult = components['schemas']['AiAgentEvaluationRunResult'];
|
|
213
|
+
export type AiEvalRunResultAssessment = components['schemas']['AiEvalRunResultAssessment'];
|
|
214
|
+
export type AssessmentType = components['schemas']['AssessmentType'];
|
|
185
215
|
}
|
|
186
216
|
|
|
187
217
|
export namespace Explores {
|
|
@@ -273,7 +303,7 @@ export type ExecuteAsyncMetricQueryResults = Queries.Responses.ExecuteAsyncMetri
|
|
|
273
303
|
export type ExecuteAsyncDashboardChartResults = Queries.Responses.ExecuteAsyncDashboardChartResults;
|
|
274
304
|
export type ExecuteAsyncSqlQueryResults = Queries.Responses.ExecuteAsyncSqlQueryResults;
|
|
275
305
|
|
|
276
|
-
// AI agents (flat exports)
|
|
306
|
+
// AI agents (flat exports) — admin
|
|
277
307
|
export type AiAgentSummary = AiAgents.AiAgentSummary;
|
|
278
308
|
export type AiAgentAdminSortField = AiAgents.AiAgentAdminSortField;
|
|
279
309
|
export type AiAgentsAdminThreadsResult = AiAgents.AdminThreadsResult;
|
|
@@ -281,6 +311,27 @@ export type GetAiOrganizationSettingsResult = AiAgents.GetAiOrganizationSettings
|
|
|
281
311
|
export type UpdateAiOrganizationSettings = AiAgents.UpdateAiOrganizationSettings;
|
|
282
312
|
export type UpdateAiOrganizationSettingsResult = AiAgents.UpdateAiOrganizationSettingsResult;
|
|
283
313
|
export type GetAdminThreadsParams = AiAgents.GetAdminThreadsParams;
|
|
314
|
+
// AI agents (flat exports) — project-scoped
|
|
315
|
+
export type AiAgent = AiAgents.AiAgent;
|
|
316
|
+
export type CreateAiAgent = AiAgents.CreateAiAgent;
|
|
317
|
+
export type UpdateAiAgent = AiAgents.UpdateAiAgent;
|
|
318
|
+
export type AiAgentThreadSummary = AiAgents.AiAgentThreadSummary;
|
|
319
|
+
export type AiAgentThread = AiAgents.AiAgentThread;
|
|
320
|
+
export type CreateAgentThreadBody = AiAgents.CreateAgentThreadBody;
|
|
321
|
+
export type GenerateAgentThreadBody = AiAgents.GenerateAgentThreadBody;
|
|
322
|
+
export type GenerateAgentThreadResult = AiAgents.GenerateAgentThreadResult;
|
|
323
|
+
// AI agents (flat exports) — evaluations
|
|
324
|
+
export type CreateEvaluationPrompt = AiAgents.CreateEvaluationPrompt;
|
|
325
|
+
export type CreateEvaluationBody = AiAgents.CreateEvaluationBody;
|
|
326
|
+
export type CreateEvaluationResult = AiAgents.CreateEvaluationResult;
|
|
327
|
+
export type UpdateEvaluationBody = AiAgents.UpdateEvaluationBody;
|
|
328
|
+
export type AppendEvaluationBody = AiAgents.AppendEvaluationBody;
|
|
329
|
+
export type AiAgentEvaluationSummary = AiAgents.AiAgentEvaluationSummary;
|
|
330
|
+
export type AiAgentEvaluation = AiAgents.AiAgentEvaluation;
|
|
331
|
+
export type AiAgentEvaluationRunSummary = AiAgents.AiAgentEvaluationRunSummary;
|
|
332
|
+
export type AiAgentEvaluationRunsListResponse = AiAgents.AiAgentEvaluationRunsListResponse;
|
|
333
|
+
export type AiAgentEvaluationRun = AiAgents.AiAgentEvaluationRun;
|
|
334
|
+
export type AiAgentEvaluationRunResult = AiAgents.AiAgentEvaluationRunResult;
|
|
284
335
|
|
|
285
336
|
// Explores (flat exports)
|
|
286
337
|
export type ApiExploresResults = Explores.ApiExploresResults;
|