@lightdash-tools/common 0.8.0 → 0.9.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 +28 -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 +99 -27
- package/dist/operations/client-coverage.d.ts +6 -0
- package/dist/operations/client-coverage.js +11 -4
- package/dist/operations/content-developer.js +16 -2
- package/dist/operations/content-reader.js +16 -2
- package/dist/operations/registry.test.js +1 -0
- package/dist/operations/types.d.ts +1 -1
- package/dist/operations/types.js +1 -0
- 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 +76 -11
- package/src/env.ts +1 -1
- package/src/operations/ai-agents.ts +103 -27
- package/src/operations/client-coverage.ts +11 -5
- package/src/operations/content-developer.ts +18 -2
- package/src/operations/content-reader.ts +17 -2
- package/src/operations/registry.test.ts +1 -0
- package/src/operations/types.ts +2 -0
- package/src/safety.test.ts +32 -6
- package/src/safety.ts +15 -4
|
@@ -23,6 +23,7 @@ const PROFILE_CORE_LIFECYCLE: CapabilityProfile = 'core-lifecycle';
|
|
|
23
23
|
const PROFILE_DISCOVERY: CapabilityProfile = 'discovery-readonly';
|
|
24
24
|
const PROFILE_CONVERSATIONS: CapabilityProfile = 'conversations';
|
|
25
25
|
const PROFILE_EVALUATIONS: CapabilityProfile = 'evaluations';
|
|
26
|
+
const PROFILE_AI_AGENT_OPS: CapabilityProfile = 'ai-agent-ops';
|
|
26
27
|
|
|
27
28
|
const API_V1 = '/api/v1';
|
|
28
29
|
const PROJECT_AGENTS_PATH = `${API_V1}/projects/{projectUuid}/aiAgents`;
|
|
@@ -97,10 +98,10 @@ const projectAgentsList = defineOperation({
|
|
|
97
98
|
mcp: {
|
|
98
99
|
toolName: 'list_project_agents',
|
|
99
100
|
annotations: READ_ONLY_DEFAULT,
|
|
100
|
-
taskSupport: { exposed:
|
|
101
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
101
102
|
},
|
|
102
103
|
cli: { commandPath: 'agents list' },
|
|
103
|
-
profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
|
|
104
|
+
profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
104
105
|
});
|
|
105
106
|
|
|
106
107
|
const projectAgentsGet = defineOperation({
|
|
@@ -112,10 +113,10 @@ const projectAgentsGet = defineOperation({
|
|
|
112
113
|
mcp: {
|
|
113
114
|
toolName: 'get_project_agent',
|
|
114
115
|
annotations: READ_ONLY_DEFAULT,
|
|
115
|
-
taskSupport: { exposed:
|
|
116
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
116
117
|
},
|
|
117
118
|
cli: { commandPath: 'agents get' },
|
|
118
|
-
profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
|
|
119
|
+
profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
119
120
|
});
|
|
120
121
|
|
|
121
122
|
const projectAgentsCreate = defineOperation({
|
|
@@ -177,10 +178,10 @@ const threadsList = defineOperation({
|
|
|
177
178
|
mcp: {
|
|
178
179
|
toolName: 'list_agent_threads',
|
|
179
180
|
annotations: READ_ONLY_DEFAULT,
|
|
180
|
-
taskSupport: { exposed:
|
|
181
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
181
182
|
},
|
|
182
183
|
cli: { commandPath: 'agents threads list' },
|
|
183
|
-
profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY],
|
|
184
|
+
profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
184
185
|
});
|
|
185
186
|
|
|
186
187
|
const PROJECT_AGENT_THREAD_PATH = `${PROJECT_AGENT_THREADS_PATH}/{threadUuid}`;
|
|
@@ -197,10 +198,10 @@ const threadsGet = defineOperation({
|
|
|
197
198
|
mcp: {
|
|
198
199
|
toolName: 'get_agent_thread',
|
|
199
200
|
annotations: READ_ONLY_DEFAULT,
|
|
200
|
-
taskSupport: { exposed:
|
|
201
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
201
202
|
},
|
|
202
203
|
cli: { commandPath: 'agents threads get' },
|
|
203
|
-
profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY],
|
|
204
|
+
profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
204
205
|
});
|
|
205
206
|
|
|
206
207
|
const PROJECT_AGENT_THREAD_MESSAGES_PATH = `${PROJECT_AGENT_THREAD_PATH}/messages`;
|
|
@@ -286,10 +287,10 @@ const evaluationsList = defineOperation({
|
|
|
286
287
|
mcp: {
|
|
287
288
|
toolName: 'list_agent_evaluations',
|
|
288
289
|
annotations: READ_ONLY_DEFAULT,
|
|
289
|
-
taskSupport: { exposed:
|
|
290
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
290
291
|
},
|
|
291
292
|
cli: { commandPath: 'agents evals list' },
|
|
292
|
-
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
293
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
293
294
|
});
|
|
294
295
|
|
|
295
296
|
const PROJECT_AGENT_EVALUATION_PATH = `${PROJECT_AGENT_EVALUATIONS_PATH}/{evalUuid}`;
|
|
@@ -306,10 +307,10 @@ const evaluationsGet = defineOperation({
|
|
|
306
307
|
mcp: {
|
|
307
308
|
toolName: 'get_agent_evaluation',
|
|
308
309
|
annotations: READ_ONLY_DEFAULT,
|
|
309
|
-
taskSupport: { exposed:
|
|
310
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
310
311
|
},
|
|
311
312
|
cli: { commandPath: 'agents evals get' },
|
|
312
|
-
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
313
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
313
314
|
});
|
|
314
315
|
|
|
315
316
|
const evaluationsCreate = defineOperation({
|
|
@@ -324,10 +325,10 @@ const evaluationsCreate = defineOperation({
|
|
|
324
325
|
mcp: {
|
|
325
326
|
toolName: 'create_agent_evaluation',
|
|
326
327
|
annotations: WRITE_NONDESTRUCTIVE,
|
|
327
|
-
taskSupport: { exposed:
|
|
328
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
328
329
|
},
|
|
329
330
|
cli: { commandPath: 'agents evals create' },
|
|
330
|
-
profiles: [PROFILE_EVALUATIONS],
|
|
331
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
|
|
331
332
|
});
|
|
332
333
|
|
|
333
334
|
const evaluationsUpdate = defineOperation({
|
|
@@ -342,10 +343,10 @@ const evaluationsUpdate = defineOperation({
|
|
|
342
343
|
mcp: {
|
|
343
344
|
toolName: 'update_agent_evaluation',
|
|
344
345
|
annotations: WRITE_NONDESTRUCTIVE,
|
|
345
|
-
taskSupport: { exposed:
|
|
346
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
346
347
|
},
|
|
347
348
|
cli: { commandPath: 'agents evals update' },
|
|
348
|
-
profiles: [PROFILE_EVALUATIONS],
|
|
349
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
|
|
349
350
|
});
|
|
350
351
|
|
|
351
352
|
const evaluationsAppend = defineOperation({
|
|
@@ -360,10 +361,10 @@ const evaluationsAppend = defineOperation({
|
|
|
360
361
|
mcp: {
|
|
361
362
|
toolName: 'append_agent_evaluation_prompts',
|
|
362
363
|
annotations: WRITE_NONDESTRUCTIVE,
|
|
363
|
-
taskSupport: { exposed:
|
|
364
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
364
365
|
},
|
|
365
366
|
cli: { commandPath: 'agents evals append' },
|
|
366
|
-
profiles: [PROFILE_EVALUATIONS],
|
|
367
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
|
|
367
368
|
});
|
|
368
369
|
|
|
369
370
|
const evaluationsDelete = defineOperation({
|
|
@@ -378,10 +379,10 @@ const evaluationsDelete = defineOperation({
|
|
|
378
379
|
mcp: {
|
|
379
380
|
toolName: 'delete_agent_evaluation',
|
|
380
381
|
annotations: WRITE_DESTRUCTIVE,
|
|
381
|
-
taskSupport: { exposed:
|
|
382
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
382
383
|
},
|
|
383
384
|
cli: { commandPath: 'agents evals delete' },
|
|
384
|
-
profiles: [PROFILE_EVALUATIONS],
|
|
385
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
|
|
385
386
|
});
|
|
386
387
|
|
|
387
388
|
const evaluationsRun = defineOperation({
|
|
@@ -396,10 +397,10 @@ const evaluationsRun = defineOperation({
|
|
|
396
397
|
mcp: {
|
|
397
398
|
toolName: 'run_agent_evaluation',
|
|
398
399
|
annotations: WRITE_OPEN_WORLD,
|
|
399
|
-
taskSupport: { exposed:
|
|
400
|
+
taskSupport: { exposed: true, taskEligible: true },
|
|
400
401
|
},
|
|
401
402
|
cli: { commandPath: 'agents evals run' },
|
|
402
|
-
profiles: [PROFILE_EVALUATIONS],
|
|
403
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
|
|
403
404
|
});
|
|
404
405
|
|
|
405
406
|
const PROJECT_AGENT_EVALUATION_RUNS_PATH = `${PROJECT_AGENT_EVALUATION_PATH}/runs`;
|
|
@@ -416,10 +417,10 @@ const evaluationsRunsList = defineOperation({
|
|
|
416
417
|
mcp: {
|
|
417
418
|
toolName: 'list_agent_evaluation_runs',
|
|
418
419
|
annotations: READ_ONLY_DEFAULT,
|
|
419
|
-
taskSupport: { exposed:
|
|
420
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
420
421
|
},
|
|
421
422
|
cli: { commandPath: 'agents evals runs' },
|
|
422
|
-
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
423
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
423
424
|
});
|
|
424
425
|
|
|
425
426
|
const evaluationsRunResultsGet = defineOperation({
|
|
@@ -432,12 +433,83 @@ const evaluationsRunResultsGet = defineOperation({
|
|
|
432
433
|
authorization: { safetyImpact: IMPACT_READ },
|
|
433
434
|
sensitivity: 'none',
|
|
434
435
|
mcp: {
|
|
435
|
-
toolName: '
|
|
436
|
+
toolName: 'get_agent_eval_run_results',
|
|
436
437
|
annotations: READ_ONLY_DEFAULT,
|
|
437
|
-
taskSupport: { exposed:
|
|
438
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
438
439
|
},
|
|
439
440
|
cli: { commandPath: 'agents evals run-results' },
|
|
440
|
-
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
441
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
const evaluateAgentReadiness = defineOperation({
|
|
445
|
+
id: 'ai-agents.project.agents.evaluate-readiness',
|
|
446
|
+
summary: 'Evaluate release readiness score for an agent (not an evaluation-suite run)',
|
|
447
|
+
http: {
|
|
448
|
+
method: 'POST',
|
|
449
|
+
path: `${PROJECT_AGENT_PATH}/evaluateReadiness`,
|
|
450
|
+
},
|
|
451
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
452
|
+
sensitivity: 'none',
|
|
453
|
+
mcp: {
|
|
454
|
+
toolName: 'evaluate_agent_readiness',
|
|
455
|
+
annotations: READ_ONLY_DEFAULT,
|
|
456
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
457
|
+
},
|
|
458
|
+
cli: { commandPath: 'agents readiness evaluate' },
|
|
459
|
+
profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
const getAgentSuggestions = defineOperation({
|
|
463
|
+
id: 'ai-agents.project.agents.suggestions',
|
|
464
|
+
summary: 'List suggestion chips for an agent',
|
|
465
|
+
http: {
|
|
466
|
+
method: 'GET',
|
|
467
|
+
path: `${PROJECT_AGENT_PATH}/suggestions`,
|
|
468
|
+
},
|
|
469
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
470
|
+
sensitivity: 'none',
|
|
471
|
+
mcp: {
|
|
472
|
+
toolName: 'get_agent_suggestions',
|
|
473
|
+
annotations: READ_ONLY_DEFAULT,
|
|
474
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
475
|
+
},
|
|
476
|
+
cli: { commandPath: 'agents suggestions' },
|
|
477
|
+
profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
const getAgentModels = defineOperation({
|
|
481
|
+
id: 'ai-agents.project.agents.models',
|
|
482
|
+
summary: 'List available AI model options for an agent',
|
|
483
|
+
http: {
|
|
484
|
+
method: 'GET',
|
|
485
|
+
path: `${PROJECT_AGENT_PATH}/models`,
|
|
486
|
+
},
|
|
487
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
488
|
+
sensitivity: 'none',
|
|
489
|
+
mcp: {
|
|
490
|
+
toolName: 'get_agent_models',
|
|
491
|
+
annotations: READ_ONLY_DEFAULT,
|
|
492
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
493
|
+
},
|
|
494
|
+
cli: { commandPath: 'agents models' },
|
|
495
|
+
profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
const getExploreAccessSummary = defineOperation({
|
|
499
|
+
id: 'ai-agents.project.explore-access-summary',
|
|
500
|
+
summary: 'Summarize explore access for tag-filtered explores',
|
|
501
|
+
http: {
|
|
502
|
+
method: 'POST',
|
|
503
|
+
path: `${PROJECT_AGENTS_PATH}/explore-access-summary`,
|
|
504
|
+
},
|
|
505
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
506
|
+
sensitivity: 'none',
|
|
507
|
+
mcp: {
|
|
508
|
+
toolName: 'get_explore_access_summary',
|
|
509
|
+
annotations: READ_ONLY_DEFAULT,
|
|
510
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
511
|
+
},
|
|
512
|
+
profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
|
|
441
513
|
});
|
|
442
514
|
|
|
443
515
|
/** All registered P0 AI agent operations. */
|
|
@@ -451,6 +523,10 @@ export const AI_AGENT_OPERATIONS: readonly OperationDescriptor[] = [
|
|
|
451
523
|
projectAgentsCreate,
|
|
452
524
|
projectAgentsUpdate,
|
|
453
525
|
projectAgentsDelete,
|
|
526
|
+
evaluateAgentReadiness,
|
|
527
|
+
getAgentSuggestions,
|
|
528
|
+
getAgentModels,
|
|
529
|
+
getExploreAccessSummary,
|
|
454
530
|
threadsList,
|
|
455
531
|
threadsGet,
|
|
456
532
|
threadsStart,
|
|
@@ -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,6 +93,7 @@ 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',
|
|
@@ -96,6 +102,7 @@ export const OPERATION_CLIENT_METHOD_MAP = {
|
|
|
96
102
|
'content-developer.preview.chart': 'composed:v2.charts.getSavedChart',
|
|
97
103
|
'content-developer.preview.dashboard': 'composed:v2.dashboards.getDashboard',
|
|
98
104
|
'content-developer.preview.content-move': LEDGER_PREVIEW,
|
|
105
|
+
'content-developer.charts.get-as-code': CLIENT_CHARTS_GET_AS_CODE,
|
|
99
106
|
'content-developer.charts.validate': 'v1.validation.validateChart',
|
|
100
107
|
'content-developer.dashboards.validate': 'v1.validation.validateDashboard',
|
|
101
108
|
'content-developer.preview.confirm': LEDGER_PREVIEW,
|
|
@@ -105,8 +112,7 @@ export const OPERATION_CLIENT_METHOD_MAP = {
|
|
|
105
112
|
'composed:v2.dashboards.getDashboard+v1.dashboards.getDashboardHistory+v1.dashboards.getDashboardVersion',
|
|
106
113
|
'content-developer.charts.create': CLIENT_CHARTS_UPSERT_AS_CODE,
|
|
107
114
|
'content-developer.charts.update': CLIENT_CHARTS_UPSERT_AS_CODE,
|
|
108
|
-
'content-developer.charts.duplicate':
|
|
109
|
-
'composed:v1.charts.getChartsAsCode+v1.charts.upsertChartAsCode',
|
|
115
|
+
'content-developer.charts.duplicate': `composed:${CLIENT_CHARTS_GET_AS_CODE}+${CLIENT_CHARTS_UPSERT_AS_CODE}`,
|
|
110
116
|
'content-developer.dashboards.create': 'v1.dashboards.createDashboard',
|
|
111
117
|
'content-developer.dashboards.update': CLIENT_DASHBOARDS_V2_UPDATE,
|
|
112
118
|
'content-developer.dashboards.duplicate': 'v1.dashboards.createDashboard',
|
|
@@ -126,9 +132,9 @@ export const OPERATION_CLIENT_METHOD_MAP = {
|
|
|
126
132
|
'content-governance.content.permanent-delete': 'v2.content.permanentlyDeleteContent',
|
|
127
133
|
|
|
128
134
|
// cli content
|
|
129
|
-
'cli.charts.list':
|
|
130
|
-
'cli.charts.code.list':
|
|
131
|
-
'cli.charts.code.upsert':
|
|
135
|
+
'cli.charts.list': CLIENT_CHARTS_GET_AS_CODE,
|
|
136
|
+
'cli.charts.code.list': CLIENT_CHARTS_GET_AS_CODE,
|
|
137
|
+
'cli.charts.code.upsert': CLIENT_CHARTS_UPSERT_AS_CODE,
|
|
132
138
|
'cli.dashboards.list': 'v1.dashboards.listDashboards',
|
|
133
139
|
'cli.projects.validate.run': 'v1.validation.validateProject',
|
|
134
140
|
'cli.projects.validate.results': 'v2.validation.listValidationResults',
|
|
@@ -16,7 +16,7 @@ const API_V1 = '/api/v1';
|
|
|
16
16
|
const API_V2 = '/api/v2';
|
|
17
17
|
const WRITE_NONDESTRUCTIVE_IMPACT: SafetyImpact = 'write-nondestructive';
|
|
18
18
|
const PREVIEW_DIFF_SUMMARY =
|
|
19
|
-
'Compute an in-memory diff and issue
|
|
19
|
+
'Compute an in-memory diff and issue an HMAC-signed previewToken (no upstream preview API)';
|
|
20
20
|
const TILE_READ_SUMMARY = 'Read the current tile array (no per-tile REST route exists)';
|
|
21
21
|
|
|
22
22
|
const op_preview_chart_changes = defineOperation({
|
|
@@ -77,7 +77,7 @@ const op_preview_dashboard_changes = defineOperation({
|
|
|
77
77
|
const op_preview_content_move = defineOperation({
|
|
78
78
|
id: 'content-developer.preview.content-move',
|
|
79
79
|
summary:
|
|
80
|
-
'Preview a bulk content move into an existing space (
|
|
80
|
+
'Preview a bulk content move into an existing space (issues an HMAC-signed previewToken)',
|
|
81
81
|
http: { method: 'GET', path: `${API_V2}/content` },
|
|
82
82
|
authorization: { safetyImpact: 'read' },
|
|
83
83
|
sensitivity: 'none',
|
|
@@ -96,6 +96,21 @@ const op_preview_content_move = defineOperation({
|
|
|
96
96
|
profiles: [PROFILE_CONTENT_DEVELOPER],
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
+
const op_get_chart_as_code = defineOperation({
|
|
100
|
+
id: 'content-developer.charts.get-as-code',
|
|
101
|
+
summary:
|
|
102
|
+
'Get a chart in as-code (upsert) shape for cloning chartConfig/metricQuery before dashboard-scoped create',
|
|
103
|
+
http: { method: 'GET', path: `${API_V1}/projects/{projectUuid}/code/charts` },
|
|
104
|
+
authorization: { safetyImpact: 'read' },
|
|
105
|
+
sensitivity: 'none',
|
|
106
|
+
mcp: {
|
|
107
|
+
toolName: 'get_chart_as_code',
|
|
108
|
+
annotations: READ_ONLY_DEFAULT,
|
|
109
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
110
|
+
},
|
|
111
|
+
profiles: [PROFILE_CONTENT_DEVELOPER],
|
|
112
|
+
});
|
|
113
|
+
|
|
99
114
|
const op_validate_chart = defineOperation({
|
|
100
115
|
id: 'content-developer.charts.validate',
|
|
101
116
|
summary: "Validate a saved chart's fields against its underlying explore",
|
|
@@ -464,6 +479,7 @@ export const CONTENT_DEVELOPER_OPERATIONS: readonly OperationDescriptor[] = [
|
|
|
464
479
|
op_preview_chart_changes,
|
|
465
480
|
op_preview_dashboard_changes,
|
|
466
481
|
op_preview_content_move,
|
|
482
|
+
op_get_chart_as_code,
|
|
467
483
|
op_validate_chart,
|
|
468
484
|
op_validate_dashboard,
|
|
469
485
|
op_confirm_preview,
|
|
@@ -139,6 +139,20 @@ const op_run_chart = defineOperation({
|
|
|
139
139
|
profiles: [PROFILE_CONTENT_READER],
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
+
const op_export_chart_image = defineOperation({
|
|
143
|
+
id: 'content-reader.charts.export-image',
|
|
144
|
+
summary: 'Export a saved chart as a PNG image snapshot',
|
|
145
|
+
http: { method: 'POST', path: '/api/v1/saved/{chartUuid}/export' },
|
|
146
|
+
authorization: { safetyImpact: 'read' },
|
|
147
|
+
sensitivity: 'none',
|
|
148
|
+
mcp: {
|
|
149
|
+
toolName: 'export_chart_image',
|
|
150
|
+
annotations: READ_ONLY_TRANSIENT,
|
|
151
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
152
|
+
},
|
|
153
|
+
profiles: [PROFILE_CONTENT_READER],
|
|
154
|
+
});
|
|
155
|
+
|
|
142
156
|
const op_run_dashboard_tile = defineOperation({
|
|
143
157
|
id: 'content-reader.dashboards.run-tile',
|
|
144
158
|
summary: 'Execute a dashboard tile with bounded results',
|
|
@@ -155,7 +169,7 @@ const op_run_dashboard_tile = defineOperation({
|
|
|
155
169
|
|
|
156
170
|
const op_get_query_result = defineOperation({
|
|
157
171
|
id: 'content-reader.query.result.get',
|
|
158
|
-
summary: 'Get or poll a
|
|
172
|
+
summary: 'Get or poll a query result by queryUuid',
|
|
159
173
|
http: { method: 'GET', path: '/api/v2/projects/{projectUuid}/query/{queryUuid}' },
|
|
160
174
|
authorization: { safetyImpact: 'read' },
|
|
161
175
|
sensitivity: 'none',
|
|
@@ -169,7 +183,7 @@ const op_get_query_result = defineOperation({
|
|
|
169
183
|
|
|
170
184
|
const op_cancel_query = defineOperation({
|
|
171
185
|
id: 'content-reader.query.cancel',
|
|
172
|
-
summary: 'Cancel a running
|
|
186
|
+
summary: 'Cancel a running query by queryUuid',
|
|
173
187
|
http: { method: 'POST', path: '/api/v2/projects/{projectUuid}/query/{queryUuid}/cancel' },
|
|
174
188
|
authorization: { safetyImpact: 'read' },
|
|
175
189
|
sensitivity: 'none',
|
|
@@ -191,6 +205,7 @@ export const CONTENT_READER_OPERATIONS: readonly OperationDescriptor[] = [
|
|
|
191
205
|
op_get_project_parameters,
|
|
192
206
|
op_explain_content,
|
|
193
207
|
op_run_chart,
|
|
208
|
+
op_export_chart_image,
|
|
194
209
|
op_run_dashboard_tile,
|
|
195
210
|
op_get_query_result,
|
|
196
211
|
op_cancel_query,
|
package/src/operations/types.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type HttpMethod = 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';
|
|
|
17
17
|
* Capability profiles group operations for selective exposure (CLI profiles, MCP subsets).
|
|
18
18
|
*/
|
|
19
19
|
export type CapabilityProfile =
|
|
20
|
+
| 'ai-agent-ops'
|
|
20
21
|
| 'content-developer'
|
|
21
22
|
| 'content-governance'
|
|
22
23
|
| 'content-reader'
|
|
@@ -107,6 +108,7 @@ export type OperationDefinitionInput = Omit<
|
|
|
107
108
|
};
|
|
108
109
|
|
|
109
110
|
const VALID_PROFILES = new Set<CapabilityProfile>([
|
|
111
|
+
'ai-agent-ops',
|
|
110
112
|
'content-developer',
|
|
111
113
|
'content-governance',
|
|
112
114
|
'content-reader',
|
package/src/safety.test.ts
CHANGED
|
@@ -213,36 +213,62 @@ describe('Safety Logic', () => {
|
|
|
213
213
|
});
|
|
214
214
|
|
|
215
215
|
describe('getAllowedProjectUuidsFromEnv', () => {
|
|
216
|
-
const originalEnv = process.env.
|
|
216
|
+
const originalEnv = process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS;
|
|
217
|
+
const originalLegacy = process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
217
218
|
|
|
218
219
|
afterEach(() => {
|
|
219
|
-
|
|
220
|
+
if (originalEnv === undefined) {
|
|
221
|
+
delete process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS;
|
|
222
|
+
} else {
|
|
223
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS = originalEnv;
|
|
224
|
+
}
|
|
225
|
+
if (originalLegacy === undefined) {
|
|
226
|
+
delete process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
227
|
+
} else {
|
|
228
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = originalLegacy;
|
|
229
|
+
}
|
|
220
230
|
});
|
|
221
231
|
|
|
222
232
|
it('should return empty array when env is not set', () => {
|
|
233
|
+
delete process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS;
|
|
223
234
|
delete process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
224
235
|
expect(getAllowedProjectUuidsFromEnv()).toEqual([]);
|
|
225
236
|
});
|
|
226
237
|
|
|
227
238
|
it('should parse a single UUID', () => {
|
|
228
|
-
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS
|
|
239
|
+
delete process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
240
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS = 'uuid-a';
|
|
229
241
|
expect(getAllowedProjectUuidsFromEnv()).toEqual(['uuid-a']);
|
|
230
242
|
});
|
|
231
243
|
|
|
232
244
|
it('should parse comma-separated UUIDs', () => {
|
|
233
|
-
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS
|
|
245
|
+
delete process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
246
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS = 'uuid-a,uuid-b,uuid-c';
|
|
234
247
|
expect(getAllowedProjectUuidsFromEnv()).toEqual(['uuid-a', 'uuid-b', 'uuid-c']);
|
|
235
248
|
});
|
|
236
249
|
|
|
237
250
|
it('should trim whitespace around UUIDs', () => {
|
|
238
|
-
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS
|
|
251
|
+
delete process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
252
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS = ' uuid-a , uuid-b ';
|
|
239
253
|
expect(getAllowedProjectUuidsFromEnv()).toEqual(['uuid-a', 'uuid-b']);
|
|
240
254
|
});
|
|
241
255
|
|
|
242
256
|
it('should filter out empty entries', () => {
|
|
243
|
-
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS
|
|
257
|
+
delete process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
258
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS = 'uuid-a,,uuid-b';
|
|
244
259
|
expect(getAllowedProjectUuidsFromEnv()).toEqual(['uuid-a', 'uuid-b']);
|
|
245
260
|
});
|
|
261
|
+
|
|
262
|
+
it('should reject removed LIGHTDASH_TOOLS_ALLOWED_PROJECTS', () => {
|
|
263
|
+
delete process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS;
|
|
264
|
+
process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS = 'uuid-a';
|
|
265
|
+
expect(() => getAllowedProjectUuidsFromEnv()).toThrow(
|
|
266
|
+
/LIGHTDASH_TOOLS_ALLOWED_PROJECTS is no longer supported/,
|
|
267
|
+
);
|
|
268
|
+
expect(() => getAllowedProjectUuidsFromEnv()).toThrow(
|
|
269
|
+
/LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS/,
|
|
270
|
+
);
|
|
271
|
+
});
|
|
246
272
|
});
|
|
247
273
|
|
|
248
274
|
describe('isProjectAllowed', () => {
|
package/src/safety.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { extractProjectUuidsFromToolArgs } from './agentops/extract-yaml-project';
|
|
2
|
-
import {
|
|
2
|
+
import { ENV_LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS, ENV_LIGHTDASH_TOOLS_SAFETY_MODE } from './env';
|
|
3
|
+
|
|
4
|
+
/** Removed allowlist env — fail closed if still set. */
|
|
5
|
+
const ENV_ALLOWED_PROJECTS_REMOVED = 'LIGHTDASH_TOOLS_ALLOWED_PROJECTS';
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* Semantic impact classification for operations (RFC Phase 0).
|
|
@@ -150,14 +153,22 @@ export function getSafetyModeFromEnv(): SafetyMode {
|
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
/**
|
|
153
|
-
* Parses allowed project UUIDs from the
|
|
156
|
+
* Parses allowed project UUIDs from the LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS environment
|
|
154
157
|
* variable (comma-separated). Returns an empty array when the variable is unset, meaning
|
|
155
158
|
* all projects are allowed.
|
|
156
159
|
*
|
|
157
|
-
*
|
|
160
|
+
* Throws if the removed name LIGHTDASH_TOOLS_ALLOWED_PROJECTS is still set.
|
|
161
|
+
* Note: CLI `--projects` takes priority over this env var.
|
|
158
162
|
*/
|
|
159
163
|
export function getAllowedProjectUuidsFromEnv(): string[] {
|
|
160
|
-
const
|
|
164
|
+
const legacy = process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECTS;
|
|
165
|
+
if (legacy !== undefined && legacy.trim() !== '') {
|
|
166
|
+
throw new Error(
|
|
167
|
+
`${ENV_ALLOWED_PROJECTS_REMOVED} is no longer supported. ` +
|
|
168
|
+
`Use ${ENV_LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS} instead.`,
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
const raw = process.env.LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS ?? '';
|
|
161
172
|
return raw
|
|
162
173
|
.split(',')
|
|
163
174
|
.map((s) => s.trim())
|