@lightdash-tools/common 0.8.0 → 0.11.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.
- package/dist/audit.d.ts +29 -8
- package/dist/audit.js +53 -9
- package/dist/audit.test.js +51 -24
- package/dist/env.d.ts +1 -1
- package/dist/env.js +2 -2
- package/dist/operations/ai-agents.js +108 -40
- package/dist/operations/cli-content.js +6 -8
- package/dist/operations/client-coverage.d.ts +7 -0
- package/dist/operations/client-coverage.js +13 -4
- package/dist/operations/content-developer.js +19 -5
- package/dist/operations/content-governance.js +1 -1
- package/dist/operations/content-reader.js +19 -4
- package/dist/operations/data-analyst.d.ts +5 -0
- package/dist/operations/data-analyst.js +23 -0
- package/dist/operations/index.d.ts +2 -1
- package/dist/operations/index.js +4 -1
- package/dist/operations/organization-audit.js +1 -1
- package/dist/operations/registry.d.ts +5 -5
- package/dist/operations/registry.js +35 -9
- package/dist/operations/registry.test.js +23 -45
- package/dist/operations/semantic-layer.js +8 -7
- package/dist/operations/types.d.ts +10 -6
- package/dist/operations/types.js +23 -14
- package/dist/operations/types.test.js +14 -5
- package/dist/operations/users.js +3 -5
- package/dist/safety.d.ts +3 -2
- package/dist/safety.js +11 -3
- package/dist/safety.test.js +29 -6
- package/package.json +1 -1
- package/src/audit.test.ts +70 -30
- package/src/audit.ts +78 -11
- package/src/env.ts +1 -1
- package/src/operations/ai-agents.ts +113 -41
- package/src/operations/cli-content.ts +7 -10
- package/src/operations/client-coverage.ts +14 -5
- package/src/operations/content-developer.ts +23 -7
- package/src/operations/content-governance.ts +3 -3
- package/src/operations/content-reader.ts +23 -7
- package/src/operations/data-analyst.ts +27 -0
- package/src/operations/index.ts +3 -1
- package/src/operations/organization-audit.ts +2 -2
- package/src/operations/registry.test.ts +31 -52
- package/src/operations/registry.ts +42 -12
- package/src/operations/semantic-layer.ts +9 -8
- package/src/operations/types.test.ts +34 -6
- package/src/operations/types.ts +41 -31
- package/src/operations/users.ts +4 -7
- package/src/safety.test.ts +32 -6
- package/src/safety.ts +15 -4
package/src/audit.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Structured audit logger for Lightdash tool invocations (MCP and CLI).
|
|
3
3
|
*
|
|
4
|
-
* Each operation is recorded as a single NDJSON line
|
|
5
|
-
*
|
|
6
|
-
* and optional OAuth attribution fields (tokenHash, subject) when available.
|
|
4
|
+
* Each operation is recorded as a single NDJSON line. On stderr the line is pure JSON
|
|
5
|
+
* (Cloud Logging–parseable); text prefixes prevent jsonPayload parsing on Cloud Run.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
* - If LIGHTDASH_TOOLS_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.
|
|
7
|
+
* If LIGHTDASH_TOOLS_AUDIT_LOG is a file path, entries are appended there; otherwise stderr.
|
|
11
8
|
*/
|
|
12
9
|
|
|
13
10
|
import { randomUUID } from 'node:crypto';
|
|
14
11
|
import { createWriteStream, type WriteStream } from 'node:fs';
|
|
15
12
|
|
|
13
|
+
import type { ProfileId } from './operations/types';
|
|
14
|
+
|
|
16
15
|
export type AuditStatus =
|
|
17
16
|
| 'blocked'
|
|
18
17
|
| 'confirmation_cancelled'
|
|
@@ -26,21 +25,41 @@ export type AuditStatus =
|
|
|
26
25
|
| 'resource_changed'
|
|
27
26
|
| 'success';
|
|
28
27
|
|
|
28
|
+
/** Cloud Logging LogSeverity-compatible strings for structured stderr JSON. */
|
|
29
|
+
export type AuditSeverity = 'ERROR' | 'INFO' | 'NOTICE' | 'WARNING';
|
|
30
|
+
|
|
29
31
|
export type AuditLogEntry = {
|
|
32
|
+
/** Stable filter key for Cloud Logging (`jsonPayload.channel="audit"`). */
|
|
33
|
+
channel: 'audit';
|
|
34
|
+
severity: AuditSeverity;
|
|
35
|
+
message: string;
|
|
30
36
|
timestamp: string;
|
|
37
|
+
/** Process-lifetime instance id (not the MCP client session). */
|
|
31
38
|
sessionId: string;
|
|
32
|
-
/** MCP tool name or CLI command name. */
|
|
33
39
|
tool: string;
|
|
34
|
-
/** Project UUIDs involved in the call, if any (covers both projectUuid and projectUuids[]). */
|
|
35
40
|
projectUuids?: string[];
|
|
36
41
|
/** SHA-256 hash of the OAuth bearer token (never the raw token). */
|
|
37
42
|
tokenHash?: string;
|
|
38
43
|
/** Lightdash user UUID when the call runs under OAuth bearer auth. */
|
|
39
44
|
subject?: string;
|
|
45
|
+
clientSessionId?: string;
|
|
46
|
+
profileId?: ProfileId;
|
|
40
47
|
status: AuditStatus;
|
|
41
48
|
durationMs: number;
|
|
42
49
|
};
|
|
43
50
|
|
|
51
|
+
export type BuildAuditLogEntryInput = {
|
|
52
|
+
tool: string;
|
|
53
|
+
status: AuditStatus;
|
|
54
|
+
/** Epoch ms when the operation started (`durationMs = now - startMs`). */
|
|
55
|
+
startMs: number;
|
|
56
|
+
projectUuids?: string[];
|
|
57
|
+
tokenHash?: string;
|
|
58
|
+
subject?: string;
|
|
59
|
+
clientSessionId?: string;
|
|
60
|
+
profileId?: ProfileId;
|
|
61
|
+
};
|
|
62
|
+
|
|
44
63
|
/** Unique ID for the current process lifetime. Generated once at module load. */
|
|
45
64
|
const SESSION_ID = randomUUID();
|
|
46
65
|
|
|
@@ -50,19 +69,67 @@ export function getSessionId(): string {
|
|
|
50
69
|
return SESSION_ID;
|
|
51
70
|
}
|
|
52
71
|
|
|
72
|
+
/** Map audit status to Cloud Logging severity. */
|
|
73
|
+
export function auditSeverityForStatus(status: AuditStatus): AuditSeverity {
|
|
74
|
+
switch (status) {
|
|
75
|
+
case 'success':
|
|
76
|
+
return 'INFO';
|
|
77
|
+
case 'deletion_succeeded':
|
|
78
|
+
case 'promotion_succeeded':
|
|
79
|
+
return 'NOTICE';
|
|
80
|
+
case 'blocked':
|
|
81
|
+
case 'confirmation_cancelled':
|
|
82
|
+
case 'confirmation_declined':
|
|
83
|
+
case 'confirmation_requested':
|
|
84
|
+
case 'resource_changed':
|
|
85
|
+
return 'WARNING';
|
|
86
|
+
case 'deletion_failed':
|
|
87
|
+
case 'error':
|
|
88
|
+
case 'promotion_failed':
|
|
89
|
+
return 'ERROR';
|
|
90
|
+
default: {
|
|
91
|
+
const _exhaustive: never = status;
|
|
92
|
+
return _exhaustive;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Assemble a full audit entry (shared by CLI and MCP). */
|
|
98
|
+
export function buildAuditLogEntry(input: BuildAuditLogEntryInput): AuditLogEntry {
|
|
99
|
+
const projectUuids =
|
|
100
|
+
input.projectUuids && input.projectUuids.length > 0 ? input.projectUuids : undefined;
|
|
101
|
+
return {
|
|
102
|
+
channel: 'audit',
|
|
103
|
+
severity: auditSeverityForStatus(input.status),
|
|
104
|
+
message: `${input.tool} ${input.status}`,
|
|
105
|
+
timestamp: new Date().toISOString(),
|
|
106
|
+
sessionId: SESSION_ID,
|
|
107
|
+
tool: input.tool,
|
|
108
|
+
projectUuids,
|
|
109
|
+
tokenHash: input.tokenHash,
|
|
110
|
+
subject: input.subject,
|
|
111
|
+
clientSessionId: input.clientSessionId,
|
|
112
|
+
profileId: input.profileId,
|
|
113
|
+
status: input.status,
|
|
114
|
+
durationMs: Date.now() - input.startMs,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
53
118
|
/**
|
|
54
119
|
* Initialise the audit log. Call once at process startup.
|
|
55
120
|
* If filePath is provided, entries are appended to that file; otherwise stderr is used.
|
|
121
|
+
* Startup banners go to stdout so they do not mix with structured audit JSON on stderr.
|
|
56
122
|
*/
|
|
57
123
|
export function initAuditLog(filePath?: string): void {
|
|
58
124
|
if (filePath) {
|
|
59
125
|
_writeStream = createWriteStream(filePath, { flags: 'a' });
|
|
60
126
|
_writeStream.on('error', (err) => {
|
|
127
|
+
// Diagnostic only — not an audit row.
|
|
61
128
|
console.error('[audit] Failed to write to audit log file:', err);
|
|
62
129
|
});
|
|
63
|
-
console.
|
|
130
|
+
console.log(`[audit] Writing to file: ${filePath} (session: ${SESSION_ID})`);
|
|
64
131
|
} else {
|
|
65
|
-
console.
|
|
132
|
+
console.log(`[audit] Writing to stderr (session: ${SESSION_ID})`);
|
|
66
133
|
}
|
|
67
134
|
}
|
|
68
135
|
|
|
@@ -72,7 +139,7 @@ export function logAuditEntry(entry: AuditLogEntry): void {
|
|
|
72
139
|
if (_writeStream) {
|
|
73
140
|
_writeStream.write(line);
|
|
74
141
|
} else {
|
|
75
|
-
process.stderr.write(
|
|
142
|
+
process.stderr.write(line);
|
|
76
143
|
}
|
|
77
144
|
}
|
|
78
145
|
|
package/src/env.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export const ENV_LIGHTDASH_TOOLS_DRY_RUN = 'LIGHTDASH_TOOLS_DRY_RUN';
|
|
8
8
|
export const ENV_LIGHTDASH_TOOLS_AUDIT_LOG = 'LIGHTDASH_TOOLS_AUDIT_LOG';
|
|
9
9
|
export const ENV_LIGHTDASH_TOOLS_SAFETY_MODE = 'LIGHTDASH_TOOLS_SAFETY_MODE';
|
|
10
|
-
export const
|
|
10
|
+
export const ENV_LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS = 'LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS';
|
|
11
11
|
|
|
12
12
|
/** MCP HTTP server env vars (`LIGHTDASH_TOOLS_MCP_*` / `LIGHTDASH_TOOLS_OAUTH_*` per ADR-0009). */
|
|
13
13
|
/** @deprecated Removed — auth is credential-inferred (ADR-0007). Kept for migration error messages. */
|
|
@@ -12,17 +12,14 @@ import {
|
|
|
12
12
|
|
|
13
13
|
import { defineOperation } from './types';
|
|
14
14
|
|
|
15
|
-
import type {
|
|
15
|
+
import type { OperationDescriptor, ProfileId, SafetyImpact } from './types';
|
|
16
16
|
|
|
17
17
|
const IMPACT_READ: SafetyImpact = 'read';
|
|
18
18
|
const IMPACT_WRITE_NONDESTRUCTIVE: SafetyImpact = 'write-nondestructive';
|
|
19
19
|
const IMPACT_WRITE_DESTRUCTIVE: SafetyImpact = 'write-destructive';
|
|
20
20
|
const IMPACT_EXTERNAL: SafetyImpact = 'external-side-effect';
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
const PROFILE_DISCOVERY: CapabilityProfile = 'discovery-readonly';
|
|
24
|
-
const PROFILE_CONVERSATIONS: CapabilityProfile = 'conversations';
|
|
25
|
-
const PROFILE_EVALUATIONS: CapabilityProfile = 'evaluations';
|
|
22
|
+
const PROFILE_AI_AGENT_OPS: ProfileId = 'ai-agent-ops';
|
|
26
23
|
|
|
27
24
|
const API_V1 = '/api/v1';
|
|
28
25
|
const PROJECT_AGENTS_PATH = `${API_V1}/projects/{projectUuid}/aiAgents`;
|
|
@@ -40,7 +37,7 @@ const adminListAgents = defineOperation({
|
|
|
40
37
|
taskSupport: { exposed: false, taskEligible: false },
|
|
41
38
|
},
|
|
42
39
|
cli: { commandPath: 'ai-agents list' },
|
|
43
|
-
profiles: [
|
|
40
|
+
profiles: [],
|
|
44
41
|
});
|
|
45
42
|
|
|
46
43
|
const adminListThreads = defineOperation({
|
|
@@ -55,7 +52,7 @@ const adminListThreads = defineOperation({
|
|
|
55
52
|
taskSupport: { exposed: false, taskEligible: false },
|
|
56
53
|
},
|
|
57
54
|
cli: { commandPath: 'ai-agents threads' },
|
|
58
|
-
profiles: [
|
|
55
|
+
profiles: [],
|
|
59
56
|
});
|
|
60
57
|
|
|
61
58
|
const adminSettingsGet = defineOperation({
|
|
@@ -70,7 +67,7 @@ const adminSettingsGet = defineOperation({
|
|
|
70
67
|
taskSupport: { exposed: false, taskEligible: false },
|
|
71
68
|
},
|
|
72
69
|
cli: { commandPath: 'ai-agents settings get' },
|
|
73
|
-
profiles: [
|
|
70
|
+
profiles: [],
|
|
74
71
|
});
|
|
75
72
|
|
|
76
73
|
const adminSettingsUpdate = defineOperation({
|
|
@@ -85,7 +82,7 @@ const adminSettingsUpdate = defineOperation({
|
|
|
85
82
|
taskSupport: { exposed: false, taskEligible: false },
|
|
86
83
|
},
|
|
87
84
|
cli: { commandPath: 'ai-agents settings update' },
|
|
88
|
-
profiles: [
|
|
85
|
+
profiles: [],
|
|
89
86
|
});
|
|
90
87
|
|
|
91
88
|
const projectAgentsList = defineOperation({
|
|
@@ -97,10 +94,10 @@ const projectAgentsList = defineOperation({
|
|
|
97
94
|
mcp: {
|
|
98
95
|
toolName: 'list_project_agents',
|
|
99
96
|
annotations: READ_ONLY_DEFAULT,
|
|
100
|
-
taskSupport: { exposed:
|
|
97
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
101
98
|
},
|
|
102
99
|
cli: { commandPath: 'agents list' },
|
|
103
|
-
profiles: [
|
|
100
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
104
101
|
});
|
|
105
102
|
|
|
106
103
|
const projectAgentsGet = defineOperation({
|
|
@@ -112,10 +109,10 @@ const projectAgentsGet = defineOperation({
|
|
|
112
109
|
mcp: {
|
|
113
110
|
toolName: 'get_project_agent',
|
|
114
111
|
annotations: READ_ONLY_DEFAULT,
|
|
115
|
-
taskSupport: { exposed:
|
|
112
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
116
113
|
},
|
|
117
114
|
cli: { commandPath: 'agents get' },
|
|
118
|
-
profiles: [
|
|
115
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
119
116
|
});
|
|
120
117
|
|
|
121
118
|
const projectAgentsCreate = defineOperation({
|
|
@@ -130,7 +127,7 @@ const projectAgentsCreate = defineOperation({
|
|
|
130
127
|
taskSupport: { exposed: false, taskEligible: false },
|
|
131
128
|
},
|
|
132
129
|
cli: { commandPath: 'agents create' },
|
|
133
|
-
profiles: [
|
|
130
|
+
profiles: [],
|
|
134
131
|
});
|
|
135
132
|
|
|
136
133
|
const projectAgentsUpdate = defineOperation({
|
|
@@ -145,7 +142,7 @@ const projectAgentsUpdate = defineOperation({
|
|
|
145
142
|
taskSupport: { exposed: false, taskEligible: false },
|
|
146
143
|
},
|
|
147
144
|
cli: { commandPath: 'agents update' },
|
|
148
|
-
profiles: [
|
|
145
|
+
profiles: [],
|
|
149
146
|
});
|
|
150
147
|
|
|
151
148
|
const projectAgentsDelete = defineOperation({
|
|
@@ -160,7 +157,7 @@ const projectAgentsDelete = defineOperation({
|
|
|
160
157
|
taskSupport: { exposed: false, taskEligible: false },
|
|
161
158
|
},
|
|
162
159
|
cli: { commandPath: 'agents delete' },
|
|
163
|
-
profiles: [
|
|
160
|
+
profiles: [],
|
|
164
161
|
});
|
|
165
162
|
|
|
166
163
|
const PROJECT_AGENT_THREADS_PATH = `${PROJECT_AGENT_PATH}/threads`;
|
|
@@ -177,10 +174,10 @@ const threadsList = defineOperation({
|
|
|
177
174
|
mcp: {
|
|
178
175
|
toolName: 'list_agent_threads',
|
|
179
176
|
annotations: READ_ONLY_DEFAULT,
|
|
180
|
-
taskSupport: { exposed:
|
|
177
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
181
178
|
},
|
|
182
179
|
cli: { commandPath: 'agents threads list' },
|
|
183
|
-
profiles: [
|
|
180
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
184
181
|
});
|
|
185
182
|
|
|
186
183
|
const PROJECT_AGENT_THREAD_PATH = `${PROJECT_AGENT_THREADS_PATH}/{threadUuid}`;
|
|
@@ -197,10 +194,10 @@ const threadsGet = defineOperation({
|
|
|
197
194
|
mcp: {
|
|
198
195
|
toolName: 'get_agent_thread',
|
|
199
196
|
annotations: READ_ONLY_DEFAULT,
|
|
200
|
-
taskSupport: { exposed:
|
|
197
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
201
198
|
},
|
|
202
199
|
cli: { commandPath: 'agents threads get' },
|
|
203
|
-
profiles: [
|
|
200
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
204
201
|
});
|
|
205
202
|
|
|
206
203
|
const PROJECT_AGENT_THREAD_MESSAGES_PATH = `${PROJECT_AGENT_THREAD_PATH}/messages`;
|
|
@@ -239,7 +236,7 @@ const threadsStart = defineOperation({
|
|
|
239
236
|
taskSupport: { exposed: false, taskEligible: true },
|
|
240
237
|
},
|
|
241
238
|
cli: { commandPath: 'agents threads start' },
|
|
242
|
-
profiles: [
|
|
239
|
+
profiles: [],
|
|
243
240
|
});
|
|
244
241
|
|
|
245
242
|
const threadsContinue = defineOperation({
|
|
@@ -269,7 +266,7 @@ const threadsContinue = defineOperation({
|
|
|
269
266
|
taskSupport: { exposed: false, taskEligible: true },
|
|
270
267
|
},
|
|
271
268
|
cli: { commandPath: 'agents threads continue' },
|
|
272
|
-
profiles: [
|
|
269
|
+
profiles: [],
|
|
273
270
|
});
|
|
274
271
|
|
|
275
272
|
const PROJECT_AGENT_EVALUATIONS_PATH = `${PROJECT_AGENT_PATH}/evaluations`;
|
|
@@ -286,10 +283,10 @@ const evaluationsList = defineOperation({
|
|
|
286
283
|
mcp: {
|
|
287
284
|
toolName: 'list_agent_evaluations',
|
|
288
285
|
annotations: READ_ONLY_DEFAULT,
|
|
289
|
-
taskSupport: { exposed:
|
|
286
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
290
287
|
},
|
|
291
288
|
cli: { commandPath: 'agents evals list' },
|
|
292
|
-
profiles: [
|
|
289
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
293
290
|
});
|
|
294
291
|
|
|
295
292
|
const PROJECT_AGENT_EVALUATION_PATH = `${PROJECT_AGENT_EVALUATIONS_PATH}/{evalUuid}`;
|
|
@@ -306,10 +303,10 @@ const evaluationsGet = defineOperation({
|
|
|
306
303
|
mcp: {
|
|
307
304
|
toolName: 'get_agent_evaluation',
|
|
308
305
|
annotations: READ_ONLY_DEFAULT,
|
|
309
|
-
taskSupport: { exposed:
|
|
306
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
310
307
|
},
|
|
311
308
|
cli: { commandPath: 'agents evals get' },
|
|
312
|
-
profiles: [
|
|
309
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
313
310
|
});
|
|
314
311
|
|
|
315
312
|
const evaluationsCreate = defineOperation({
|
|
@@ -324,10 +321,10 @@ const evaluationsCreate = defineOperation({
|
|
|
324
321
|
mcp: {
|
|
325
322
|
toolName: 'create_agent_evaluation',
|
|
326
323
|
annotations: WRITE_NONDESTRUCTIVE,
|
|
327
|
-
taskSupport: { exposed:
|
|
324
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
328
325
|
},
|
|
329
326
|
cli: { commandPath: 'agents evals create' },
|
|
330
|
-
profiles: [
|
|
327
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
331
328
|
});
|
|
332
329
|
|
|
333
330
|
const evaluationsUpdate = defineOperation({
|
|
@@ -342,10 +339,10 @@ const evaluationsUpdate = defineOperation({
|
|
|
342
339
|
mcp: {
|
|
343
340
|
toolName: 'update_agent_evaluation',
|
|
344
341
|
annotations: WRITE_NONDESTRUCTIVE,
|
|
345
|
-
taskSupport: { exposed:
|
|
342
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
346
343
|
},
|
|
347
344
|
cli: { commandPath: 'agents evals update' },
|
|
348
|
-
profiles: [
|
|
345
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
349
346
|
});
|
|
350
347
|
|
|
351
348
|
const evaluationsAppend = defineOperation({
|
|
@@ -360,10 +357,10 @@ const evaluationsAppend = defineOperation({
|
|
|
360
357
|
mcp: {
|
|
361
358
|
toolName: 'append_agent_evaluation_prompts',
|
|
362
359
|
annotations: WRITE_NONDESTRUCTIVE,
|
|
363
|
-
taskSupport: { exposed:
|
|
360
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
364
361
|
},
|
|
365
362
|
cli: { commandPath: 'agents evals append' },
|
|
366
|
-
profiles: [
|
|
363
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
367
364
|
});
|
|
368
365
|
|
|
369
366
|
const evaluationsDelete = defineOperation({
|
|
@@ -378,10 +375,10 @@ const evaluationsDelete = defineOperation({
|
|
|
378
375
|
mcp: {
|
|
379
376
|
toolName: 'delete_agent_evaluation',
|
|
380
377
|
annotations: WRITE_DESTRUCTIVE,
|
|
381
|
-
taskSupport: { exposed:
|
|
378
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
382
379
|
},
|
|
383
380
|
cli: { commandPath: 'agents evals delete' },
|
|
384
|
-
profiles: [
|
|
381
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
385
382
|
});
|
|
386
383
|
|
|
387
384
|
const evaluationsRun = defineOperation({
|
|
@@ -396,10 +393,10 @@ const evaluationsRun = defineOperation({
|
|
|
396
393
|
mcp: {
|
|
397
394
|
toolName: 'run_agent_evaluation',
|
|
398
395
|
annotations: WRITE_OPEN_WORLD,
|
|
399
|
-
taskSupport: { exposed:
|
|
396
|
+
taskSupport: { exposed: true, taskEligible: true },
|
|
400
397
|
},
|
|
401
398
|
cli: { commandPath: 'agents evals run' },
|
|
402
|
-
profiles: [
|
|
399
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
403
400
|
});
|
|
404
401
|
|
|
405
402
|
const PROJECT_AGENT_EVALUATION_RUNS_PATH = `${PROJECT_AGENT_EVALUATION_PATH}/runs`;
|
|
@@ -416,10 +413,10 @@ const evaluationsRunsList = defineOperation({
|
|
|
416
413
|
mcp: {
|
|
417
414
|
toolName: 'list_agent_evaluation_runs',
|
|
418
415
|
annotations: READ_ONLY_DEFAULT,
|
|
419
|
-
taskSupport: { exposed:
|
|
416
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
420
417
|
},
|
|
421
418
|
cli: { commandPath: 'agents evals runs' },
|
|
422
|
-
profiles: [
|
|
419
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
423
420
|
});
|
|
424
421
|
|
|
425
422
|
const evaluationsRunResultsGet = defineOperation({
|
|
@@ -432,12 +429,83 @@ const evaluationsRunResultsGet = defineOperation({
|
|
|
432
429
|
authorization: { safetyImpact: IMPACT_READ },
|
|
433
430
|
sensitivity: 'none',
|
|
434
431
|
mcp: {
|
|
435
|
-
toolName: '
|
|
432
|
+
toolName: 'get_agent_eval_run_results',
|
|
436
433
|
annotations: READ_ONLY_DEFAULT,
|
|
437
|
-
taskSupport: { exposed:
|
|
434
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
438
435
|
},
|
|
439
436
|
cli: { commandPath: 'agents evals run-results' },
|
|
440
|
-
profiles: [
|
|
437
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
const evaluateAgentReadiness = defineOperation({
|
|
441
|
+
id: 'ai-agents.project.agents.evaluate-readiness',
|
|
442
|
+
summary: 'Evaluate release readiness score for an agent (not an evaluation-suite run)',
|
|
443
|
+
http: {
|
|
444
|
+
method: 'POST',
|
|
445
|
+
path: `${PROJECT_AGENT_PATH}/evaluateReadiness`,
|
|
446
|
+
},
|
|
447
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
448
|
+
sensitivity: 'none',
|
|
449
|
+
mcp: {
|
|
450
|
+
toolName: 'evaluate_agent_readiness',
|
|
451
|
+
annotations: READ_ONLY_DEFAULT,
|
|
452
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
453
|
+
},
|
|
454
|
+
cli: { commandPath: 'agents readiness evaluate' },
|
|
455
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
const getAgentSuggestions = defineOperation({
|
|
459
|
+
id: 'ai-agents.project.agents.suggestions',
|
|
460
|
+
summary: 'List suggestion chips for an agent',
|
|
461
|
+
http: {
|
|
462
|
+
method: 'GET',
|
|
463
|
+
path: `${PROJECT_AGENT_PATH}/suggestions`,
|
|
464
|
+
},
|
|
465
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
466
|
+
sensitivity: 'none',
|
|
467
|
+
mcp: {
|
|
468
|
+
toolName: 'get_agent_suggestions',
|
|
469
|
+
annotations: READ_ONLY_DEFAULT,
|
|
470
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
471
|
+
},
|
|
472
|
+
cli: { commandPath: 'agents suggestions' },
|
|
473
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
const getAgentModels = defineOperation({
|
|
477
|
+
id: 'ai-agents.project.agents.models',
|
|
478
|
+
summary: 'List available AI model options for an agent',
|
|
479
|
+
http: {
|
|
480
|
+
method: 'GET',
|
|
481
|
+
path: `${PROJECT_AGENT_PATH}/models`,
|
|
482
|
+
},
|
|
483
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
484
|
+
sensitivity: 'none',
|
|
485
|
+
mcp: {
|
|
486
|
+
toolName: 'get_agent_models',
|
|
487
|
+
annotations: READ_ONLY_DEFAULT,
|
|
488
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
489
|
+
},
|
|
490
|
+
cli: { commandPath: 'agents models' },
|
|
491
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
const getExploreAccessSummary = defineOperation({
|
|
495
|
+
id: 'ai-agents.project.explore-access-summary',
|
|
496
|
+
summary: 'Summarize explore access for tag-filtered explores',
|
|
497
|
+
http: {
|
|
498
|
+
method: 'POST',
|
|
499
|
+
path: `${PROJECT_AGENTS_PATH}/explore-access-summary`,
|
|
500
|
+
},
|
|
501
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
502
|
+
sensitivity: 'none',
|
|
503
|
+
mcp: {
|
|
504
|
+
toolName: 'get_explore_access_summary',
|
|
505
|
+
annotations: READ_ONLY_DEFAULT,
|
|
506
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
507
|
+
},
|
|
508
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
441
509
|
});
|
|
442
510
|
|
|
443
511
|
/** All registered P0 AI agent operations. */
|
|
@@ -451,6 +519,10 @@ export const AI_AGENT_OPERATIONS: readonly OperationDescriptor[] = [
|
|
|
451
519
|
projectAgentsCreate,
|
|
452
520
|
projectAgentsUpdate,
|
|
453
521
|
projectAgentsDelete,
|
|
522
|
+
evaluateAgentReadiness,
|
|
523
|
+
getAgentSuggestions,
|
|
524
|
+
getAgentModels,
|
|
525
|
+
getExploreAccessSummary,
|
|
454
526
|
threadsList,
|
|
455
527
|
threadsGet,
|
|
456
528
|
threadsStart,
|
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { defineOperation } from './types';
|
|
6
6
|
|
|
7
|
-
import type {
|
|
8
|
-
|
|
9
|
-
const PROFILE_DISCOVERY: CapabilityProfile = 'discovery-readonly';
|
|
10
|
-
const PROFILE_CORE: CapabilityProfile = 'core-lifecycle';
|
|
7
|
+
import type { OperationDescriptor } from './types';
|
|
11
8
|
|
|
12
9
|
const chartsList = defineOperation({
|
|
13
10
|
id: 'cli.charts.list',
|
|
@@ -16,7 +13,7 @@ const chartsList = defineOperation({
|
|
|
16
13
|
authorization: { safetyImpact: 'read' },
|
|
17
14
|
sensitivity: 'none',
|
|
18
15
|
cli: { commandPath: 'projects charts list' },
|
|
19
|
-
profiles: [
|
|
16
|
+
profiles: [],
|
|
20
17
|
});
|
|
21
18
|
|
|
22
19
|
const chartsCodeList = defineOperation({
|
|
@@ -26,7 +23,7 @@ const chartsCodeList = defineOperation({
|
|
|
26
23
|
authorization: { safetyImpact: 'read' },
|
|
27
24
|
sensitivity: 'none',
|
|
28
25
|
cli: { commandPath: 'projects charts code list' },
|
|
29
|
-
profiles: [
|
|
26
|
+
profiles: [],
|
|
30
27
|
});
|
|
31
28
|
|
|
32
29
|
const chartsCodeUpsert = defineOperation({
|
|
@@ -36,7 +33,7 @@ const chartsCodeUpsert = defineOperation({
|
|
|
36
33
|
authorization: { safetyImpact: 'write-nondestructive' },
|
|
37
34
|
sensitivity: 'none',
|
|
38
35
|
cli: { commandPath: 'projects charts code upsert' },
|
|
39
|
-
profiles: [
|
|
36
|
+
profiles: [],
|
|
40
37
|
});
|
|
41
38
|
|
|
42
39
|
const dashboardsList = defineOperation({
|
|
@@ -46,7 +43,7 @@ const dashboardsList = defineOperation({
|
|
|
46
43
|
authorization: { safetyImpact: 'read' },
|
|
47
44
|
sensitivity: 'none',
|
|
48
45
|
cli: { commandPath: 'projects dashboards list' },
|
|
49
|
-
profiles: [
|
|
46
|
+
profiles: [],
|
|
50
47
|
});
|
|
51
48
|
|
|
52
49
|
const validateRun = defineOperation({
|
|
@@ -56,7 +53,7 @@ const validateRun = defineOperation({
|
|
|
56
53
|
authorization: { safetyImpact: 'write-nondestructive' },
|
|
57
54
|
sensitivity: 'none',
|
|
58
55
|
cli: { commandPath: 'projects validate run' },
|
|
59
|
-
profiles: [
|
|
56
|
+
profiles: [],
|
|
60
57
|
});
|
|
61
58
|
|
|
62
59
|
const validateResults = defineOperation({
|
|
@@ -66,7 +63,7 @@ const validateResults = defineOperation({
|
|
|
66
63
|
authorization: { safetyImpact: 'read' },
|
|
67
64
|
sensitivity: 'none',
|
|
68
65
|
cli: { commandPath: 'projects validate results' },
|
|
69
|
-
profiles: [
|
|
66
|
+
profiles: [],
|
|
70
67
|
});
|
|
71
68
|
|
|
72
69
|
export const CLI_CONTENT_OPERATIONS: readonly OperationDescriptor[] = [
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export type ClientMethodRef = string;
|
|
8
8
|
|
|
9
9
|
const CLIENT_CHARTS_UPSERT_AS_CODE = 'v1.charts.upsertChartAsCode';
|
|
10
|
+
const CLIENT_CHARTS_GET_AS_CODE = 'v1.charts.getChartsAsCode';
|
|
10
11
|
const CLIENT_DASHBOARDS_V2_UPDATE = 'v2.dashboards.updateDashboard';
|
|
11
12
|
const CLIENT_CONTENT_SEARCH = 'v2.content.searchContent';
|
|
12
13
|
const LEDGER_PREVIEW = 'ledger:preview';
|
|
@@ -27,6 +28,10 @@ export const OPERATION_CLIENT_METHOD_MAP = {
|
|
|
27
28
|
'ai-agents.project.agents.create': 'v1.aiAgents.createAgent',
|
|
28
29
|
'ai-agents.project.agents.update': 'v1.aiAgents.updateAgent',
|
|
29
30
|
'ai-agents.project.agents.delete': 'v1.aiAgents.deleteAgent',
|
|
31
|
+
'ai-agents.project.agents.evaluate-readiness': 'v1.aiAgents.evaluateAgentReadiness',
|
|
32
|
+
'ai-agents.project.agents.suggestions': 'v1.aiAgents.getAgentSuggestions',
|
|
33
|
+
'ai-agents.project.agents.models': 'v1.aiAgents.getAgentModelOptions',
|
|
34
|
+
'ai-agents.project.explore-access-summary': 'v1.aiAgents.getExploreAccessSummary',
|
|
30
35
|
'ai-agents.project.threads.list': 'v1.aiAgents.listAgentThreads',
|
|
31
36
|
'ai-agents.project.threads.get': 'v1.aiAgents.getAgentThread',
|
|
32
37
|
'ai-agents.project.threads.start': 'v1.aiAgents.startConversation',
|
|
@@ -88,14 +93,19 @@ export const OPERATION_CLIENT_METHOD_MAP = {
|
|
|
88
93
|
'content-reader.parameters.get': 'v2.parameters.getParameters',
|
|
89
94
|
'content-reader.content.explain': 'composed:v2.charts.getSavedChart+v2.dashboards.getDashboard',
|
|
90
95
|
'content-reader.charts.run': 'v2.query.runChartQuery',
|
|
96
|
+
'content-reader.charts.export-image': 'composed:v1.charts.exportChartImagePng',
|
|
91
97
|
'content-reader.dashboards.run-tile': 'v2.query.runDashboardChartQuery',
|
|
92
98
|
'content-reader.query.result.get': 'v2.query.getAsyncQueryResults',
|
|
93
99
|
'content-reader.query.cancel': 'v2.query.cancelAsyncQuery',
|
|
94
100
|
|
|
101
|
+
// data-analyst
|
|
102
|
+
'data-analyst.query.metric-query.run': 'v2.query.runMetricQuery',
|
|
103
|
+
|
|
95
104
|
// content-developer
|
|
96
105
|
'content-developer.preview.chart': 'composed:v2.charts.getSavedChart',
|
|
97
106
|
'content-developer.preview.dashboard': 'composed:v2.dashboards.getDashboard',
|
|
98
107
|
'content-developer.preview.content-move': LEDGER_PREVIEW,
|
|
108
|
+
'content-developer.charts.get-as-code': CLIENT_CHARTS_GET_AS_CODE,
|
|
99
109
|
'content-developer.charts.validate': 'v1.validation.validateChart',
|
|
100
110
|
'content-developer.dashboards.validate': 'v1.validation.validateDashboard',
|
|
101
111
|
'content-developer.preview.confirm': LEDGER_PREVIEW,
|
|
@@ -105,8 +115,7 @@ export const OPERATION_CLIENT_METHOD_MAP = {
|
|
|
105
115
|
'composed:v2.dashboards.getDashboard+v1.dashboards.getDashboardHistory+v1.dashboards.getDashboardVersion',
|
|
106
116
|
'content-developer.charts.create': CLIENT_CHARTS_UPSERT_AS_CODE,
|
|
107
117
|
'content-developer.charts.update': CLIENT_CHARTS_UPSERT_AS_CODE,
|
|
108
|
-
'content-developer.charts.duplicate':
|
|
109
|
-
'composed:v1.charts.getChartsAsCode+v1.charts.upsertChartAsCode',
|
|
118
|
+
'content-developer.charts.duplicate': `composed:${CLIENT_CHARTS_GET_AS_CODE}+${CLIENT_CHARTS_UPSERT_AS_CODE}`,
|
|
110
119
|
'content-developer.dashboards.create': 'v1.dashboards.createDashboard',
|
|
111
120
|
'content-developer.dashboards.update': CLIENT_DASHBOARDS_V2_UPDATE,
|
|
112
121
|
'content-developer.dashboards.duplicate': 'v1.dashboards.createDashboard',
|
|
@@ -126,9 +135,9 @@ export const OPERATION_CLIENT_METHOD_MAP = {
|
|
|
126
135
|
'content-governance.content.permanent-delete': 'v2.content.permanentlyDeleteContent',
|
|
127
136
|
|
|
128
137
|
// cli content
|
|
129
|
-
'cli.charts.list':
|
|
130
|
-
'cli.charts.code.list':
|
|
131
|
-
'cli.charts.code.upsert':
|
|
138
|
+
'cli.charts.list': CLIENT_CHARTS_GET_AS_CODE,
|
|
139
|
+
'cli.charts.code.list': CLIENT_CHARTS_GET_AS_CODE,
|
|
140
|
+
'cli.charts.code.upsert': CLIENT_CHARTS_UPSERT_AS_CODE,
|
|
132
141
|
'cli.dashboards.list': 'v1.dashboards.listDashboards',
|
|
133
142
|
'cli.projects.validate.run': 'v1.validation.validateProject',
|
|
134
143
|
'cli.projects.validate.results': 'v2.validation.listValidationResults',
|