@lightdash-tools/common 0.9.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 +3 -2
- package/dist/audit.js +1 -1
- package/dist/audit.test.js +4 -4
- package/dist/operations/ai-agents.js +26 -30
- package/dist/operations/cli-content.js +6 -8
- package/dist/operations/client-coverage.d.ts +1 -0
- package/dist/operations/client-coverage.js +2 -0
- package/dist/operations/content-developer.js +3 -3
- package/dist/operations/content-governance.js +1 -1
- package/dist/operations/content-reader.js +3 -2
- 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 -46
- package/dist/operations/semantic-layer.js +8 -7
- package/dist/operations/types.d.ts +10 -6
- package/dist/operations/types.js +22 -14
- package/dist/operations/types.test.js +14 -5
- package/dist/operations/users.js +3 -5
- package/package.json +1 -1
- package/src/audit.test.ts +4 -4
- package/src/audit.ts +5 -3
- package/src/operations/ai-agents.ts +28 -32
- package/src/operations/cli-content.ts +7 -10
- package/src/operations/client-coverage.ts +3 -0
- package/src/operations/content-developer.ts +5 -5
- package/src/operations/content-governance.ts +3 -3
- package/src/operations/content-reader.ts +6 -5
- 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 -53
- 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 -33
- package/src/operations/users.ts +4 -7
|
@@ -12,18 +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';
|
|
26
|
-
const PROFILE_AI_AGENT_OPS: CapabilityProfile = 'ai-agent-ops';
|
|
22
|
+
const PROFILE_AI_AGENT_OPS: ProfileId = 'ai-agent-ops';
|
|
27
23
|
|
|
28
24
|
const API_V1 = '/api/v1';
|
|
29
25
|
const PROJECT_AGENTS_PATH = `${API_V1}/projects/{projectUuid}/aiAgents`;
|
|
@@ -41,7 +37,7 @@ const adminListAgents = defineOperation({
|
|
|
41
37
|
taskSupport: { exposed: false, taskEligible: false },
|
|
42
38
|
},
|
|
43
39
|
cli: { commandPath: 'ai-agents list' },
|
|
44
|
-
profiles: [
|
|
40
|
+
profiles: [],
|
|
45
41
|
});
|
|
46
42
|
|
|
47
43
|
const adminListThreads = defineOperation({
|
|
@@ -56,7 +52,7 @@ const adminListThreads = defineOperation({
|
|
|
56
52
|
taskSupport: { exposed: false, taskEligible: false },
|
|
57
53
|
},
|
|
58
54
|
cli: { commandPath: 'ai-agents threads' },
|
|
59
|
-
profiles: [
|
|
55
|
+
profiles: [],
|
|
60
56
|
});
|
|
61
57
|
|
|
62
58
|
const adminSettingsGet = defineOperation({
|
|
@@ -71,7 +67,7 @@ const adminSettingsGet = defineOperation({
|
|
|
71
67
|
taskSupport: { exposed: false, taskEligible: false },
|
|
72
68
|
},
|
|
73
69
|
cli: { commandPath: 'ai-agents settings get' },
|
|
74
|
-
profiles: [
|
|
70
|
+
profiles: [],
|
|
75
71
|
});
|
|
76
72
|
|
|
77
73
|
const adminSettingsUpdate = defineOperation({
|
|
@@ -86,7 +82,7 @@ const adminSettingsUpdate = defineOperation({
|
|
|
86
82
|
taskSupport: { exposed: false, taskEligible: false },
|
|
87
83
|
},
|
|
88
84
|
cli: { commandPath: 'ai-agents settings update' },
|
|
89
|
-
profiles: [
|
|
85
|
+
profiles: [],
|
|
90
86
|
});
|
|
91
87
|
|
|
92
88
|
const projectAgentsList = defineOperation({
|
|
@@ -101,7 +97,7 @@ const projectAgentsList = defineOperation({
|
|
|
101
97
|
taskSupport: { exposed: true, taskEligible: false },
|
|
102
98
|
},
|
|
103
99
|
cli: { commandPath: 'agents list' },
|
|
104
|
-
profiles: [
|
|
100
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
105
101
|
});
|
|
106
102
|
|
|
107
103
|
const projectAgentsGet = defineOperation({
|
|
@@ -116,7 +112,7 @@ const projectAgentsGet = defineOperation({
|
|
|
116
112
|
taskSupport: { exposed: true, taskEligible: false },
|
|
117
113
|
},
|
|
118
114
|
cli: { commandPath: 'agents get' },
|
|
119
|
-
profiles: [
|
|
115
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
120
116
|
});
|
|
121
117
|
|
|
122
118
|
const projectAgentsCreate = defineOperation({
|
|
@@ -131,7 +127,7 @@ const projectAgentsCreate = defineOperation({
|
|
|
131
127
|
taskSupport: { exposed: false, taskEligible: false },
|
|
132
128
|
},
|
|
133
129
|
cli: { commandPath: 'agents create' },
|
|
134
|
-
profiles: [
|
|
130
|
+
profiles: [],
|
|
135
131
|
});
|
|
136
132
|
|
|
137
133
|
const projectAgentsUpdate = defineOperation({
|
|
@@ -146,7 +142,7 @@ const projectAgentsUpdate = defineOperation({
|
|
|
146
142
|
taskSupport: { exposed: false, taskEligible: false },
|
|
147
143
|
},
|
|
148
144
|
cli: { commandPath: 'agents update' },
|
|
149
|
-
profiles: [
|
|
145
|
+
profiles: [],
|
|
150
146
|
});
|
|
151
147
|
|
|
152
148
|
const projectAgentsDelete = defineOperation({
|
|
@@ -161,7 +157,7 @@ const projectAgentsDelete = defineOperation({
|
|
|
161
157
|
taskSupport: { exposed: false, taskEligible: false },
|
|
162
158
|
},
|
|
163
159
|
cli: { commandPath: 'agents delete' },
|
|
164
|
-
profiles: [
|
|
160
|
+
profiles: [],
|
|
165
161
|
});
|
|
166
162
|
|
|
167
163
|
const PROJECT_AGENT_THREADS_PATH = `${PROJECT_AGENT_PATH}/threads`;
|
|
@@ -181,7 +177,7 @@ const threadsList = defineOperation({
|
|
|
181
177
|
taskSupport: { exposed: true, taskEligible: false },
|
|
182
178
|
},
|
|
183
179
|
cli: { commandPath: 'agents threads list' },
|
|
184
|
-
profiles: [
|
|
180
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
185
181
|
});
|
|
186
182
|
|
|
187
183
|
const PROJECT_AGENT_THREAD_PATH = `${PROJECT_AGENT_THREADS_PATH}/{threadUuid}`;
|
|
@@ -201,7 +197,7 @@ const threadsGet = defineOperation({
|
|
|
201
197
|
taskSupport: { exposed: true, taskEligible: false },
|
|
202
198
|
},
|
|
203
199
|
cli: { commandPath: 'agents threads get' },
|
|
204
|
-
profiles: [
|
|
200
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
205
201
|
});
|
|
206
202
|
|
|
207
203
|
const PROJECT_AGENT_THREAD_MESSAGES_PATH = `${PROJECT_AGENT_THREAD_PATH}/messages`;
|
|
@@ -240,7 +236,7 @@ const threadsStart = defineOperation({
|
|
|
240
236
|
taskSupport: { exposed: false, taskEligible: true },
|
|
241
237
|
},
|
|
242
238
|
cli: { commandPath: 'agents threads start' },
|
|
243
|
-
profiles: [
|
|
239
|
+
profiles: [],
|
|
244
240
|
});
|
|
245
241
|
|
|
246
242
|
const threadsContinue = defineOperation({
|
|
@@ -270,7 +266,7 @@ const threadsContinue = defineOperation({
|
|
|
270
266
|
taskSupport: { exposed: false, taskEligible: true },
|
|
271
267
|
},
|
|
272
268
|
cli: { commandPath: 'agents threads continue' },
|
|
273
|
-
profiles: [
|
|
269
|
+
profiles: [],
|
|
274
270
|
});
|
|
275
271
|
|
|
276
272
|
const PROJECT_AGENT_EVALUATIONS_PATH = `${PROJECT_AGENT_PATH}/evaluations`;
|
|
@@ -290,7 +286,7 @@ const evaluationsList = defineOperation({
|
|
|
290
286
|
taskSupport: { exposed: true, taskEligible: false },
|
|
291
287
|
},
|
|
292
288
|
cli: { commandPath: 'agents evals list' },
|
|
293
|
-
profiles: [
|
|
289
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
294
290
|
});
|
|
295
291
|
|
|
296
292
|
const PROJECT_AGENT_EVALUATION_PATH = `${PROJECT_AGENT_EVALUATIONS_PATH}/{evalUuid}`;
|
|
@@ -310,7 +306,7 @@ const evaluationsGet = defineOperation({
|
|
|
310
306
|
taskSupport: { exposed: true, taskEligible: false },
|
|
311
307
|
},
|
|
312
308
|
cli: { commandPath: 'agents evals get' },
|
|
313
|
-
profiles: [
|
|
309
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
314
310
|
});
|
|
315
311
|
|
|
316
312
|
const evaluationsCreate = defineOperation({
|
|
@@ -328,7 +324,7 @@ const evaluationsCreate = defineOperation({
|
|
|
328
324
|
taskSupport: { exposed: true, taskEligible: false },
|
|
329
325
|
},
|
|
330
326
|
cli: { commandPath: 'agents evals create' },
|
|
331
|
-
profiles: [
|
|
327
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
332
328
|
});
|
|
333
329
|
|
|
334
330
|
const evaluationsUpdate = defineOperation({
|
|
@@ -346,7 +342,7 @@ const evaluationsUpdate = defineOperation({
|
|
|
346
342
|
taskSupport: { exposed: true, taskEligible: false },
|
|
347
343
|
},
|
|
348
344
|
cli: { commandPath: 'agents evals update' },
|
|
349
|
-
profiles: [
|
|
345
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
350
346
|
});
|
|
351
347
|
|
|
352
348
|
const evaluationsAppend = defineOperation({
|
|
@@ -364,7 +360,7 @@ const evaluationsAppend = defineOperation({
|
|
|
364
360
|
taskSupport: { exposed: true, taskEligible: false },
|
|
365
361
|
},
|
|
366
362
|
cli: { commandPath: 'agents evals append' },
|
|
367
|
-
profiles: [
|
|
363
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
368
364
|
});
|
|
369
365
|
|
|
370
366
|
const evaluationsDelete = defineOperation({
|
|
@@ -382,7 +378,7 @@ const evaluationsDelete = defineOperation({
|
|
|
382
378
|
taskSupport: { exposed: true, taskEligible: false },
|
|
383
379
|
},
|
|
384
380
|
cli: { commandPath: 'agents evals delete' },
|
|
385
|
-
profiles: [
|
|
381
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
386
382
|
});
|
|
387
383
|
|
|
388
384
|
const evaluationsRun = defineOperation({
|
|
@@ -400,7 +396,7 @@ const evaluationsRun = defineOperation({
|
|
|
400
396
|
taskSupport: { exposed: true, taskEligible: true },
|
|
401
397
|
},
|
|
402
398
|
cli: { commandPath: 'agents evals run' },
|
|
403
|
-
profiles: [
|
|
399
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
404
400
|
});
|
|
405
401
|
|
|
406
402
|
const PROJECT_AGENT_EVALUATION_RUNS_PATH = `${PROJECT_AGENT_EVALUATION_PATH}/runs`;
|
|
@@ -420,7 +416,7 @@ const evaluationsRunsList = defineOperation({
|
|
|
420
416
|
taskSupport: { exposed: true, taskEligible: false },
|
|
421
417
|
},
|
|
422
418
|
cli: { commandPath: 'agents evals runs' },
|
|
423
|
-
profiles: [
|
|
419
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
424
420
|
});
|
|
425
421
|
|
|
426
422
|
const evaluationsRunResultsGet = defineOperation({
|
|
@@ -438,7 +434,7 @@ const evaluationsRunResultsGet = defineOperation({
|
|
|
438
434
|
taskSupport: { exposed: true, taskEligible: false },
|
|
439
435
|
},
|
|
440
436
|
cli: { commandPath: 'agents evals run-results' },
|
|
441
|
-
profiles: [
|
|
437
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
442
438
|
});
|
|
443
439
|
|
|
444
440
|
const evaluateAgentReadiness = defineOperation({
|
|
@@ -456,7 +452,7 @@ const evaluateAgentReadiness = defineOperation({
|
|
|
456
452
|
taskSupport: { exposed: true, taskEligible: false },
|
|
457
453
|
},
|
|
458
454
|
cli: { commandPath: 'agents readiness evaluate' },
|
|
459
|
-
profiles: [
|
|
455
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
460
456
|
});
|
|
461
457
|
|
|
462
458
|
const getAgentSuggestions = defineOperation({
|
|
@@ -474,7 +470,7 @@ const getAgentSuggestions = defineOperation({
|
|
|
474
470
|
taskSupport: { exposed: true, taskEligible: false },
|
|
475
471
|
},
|
|
476
472
|
cli: { commandPath: 'agents suggestions' },
|
|
477
|
-
profiles: [
|
|
473
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
478
474
|
});
|
|
479
475
|
|
|
480
476
|
const getAgentModels = defineOperation({
|
|
@@ -492,7 +488,7 @@ const getAgentModels = defineOperation({
|
|
|
492
488
|
taskSupport: { exposed: true, taskEligible: false },
|
|
493
489
|
},
|
|
494
490
|
cli: { commandPath: 'agents models' },
|
|
495
|
-
profiles: [
|
|
491
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
496
492
|
});
|
|
497
493
|
|
|
498
494
|
const getExploreAccessSummary = defineOperation({
|
|
@@ -509,7 +505,7 @@ const getExploreAccessSummary = defineOperation({
|
|
|
509
505
|
annotations: READ_ONLY_DEFAULT,
|
|
510
506
|
taskSupport: { exposed: true, taskEligible: false },
|
|
511
507
|
},
|
|
512
|
-
profiles: [
|
|
508
|
+
profiles: [PROFILE_AI_AGENT_OPS],
|
|
513
509
|
});
|
|
514
510
|
|
|
515
511
|
/** All registered P0 AI agent operations. */
|
|
@@ -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[] = [
|
|
@@ -98,6 +98,9 @@ export const OPERATION_CLIENT_METHOD_MAP = {
|
|
|
98
98
|
'content-reader.query.result.get': 'v2.query.getAsyncQueryResults',
|
|
99
99
|
'content-reader.query.cancel': 'v2.query.cancelAsyncQuery',
|
|
100
100
|
|
|
101
|
+
// data-analyst
|
|
102
|
+
'data-analyst.query.metric-query.run': 'v2.query.runMetricQuery',
|
|
103
|
+
|
|
101
104
|
// content-developer
|
|
102
105
|
'content-developer.preview.chart': 'composed:v2.charts.getSavedChart',
|
|
103
106
|
'content-developer.preview.dashboard': 'composed:v2.dashboards.getDashboard',
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* Hybrid authoring surface: chart as-code upsert, dashboard REST create/update,
|
|
4
4
|
* MCP-composed tile layout, and bulk content move into existing spaces.
|
|
5
5
|
* Space create/update are client-only (spaces managed out-of-band, e.g. Terraform).
|
|
6
|
-
* Preview -> validate -> apply is enforced by the
|
|
6
|
+
* Preview -> validate -> apply is enforced by the profile policy layer, not here.
|
|
7
7
|
*/
|
|
8
8
|
import { READ_ONLY_DEFAULT, WRITE_IDEMPOTENT, WRITE_NONDESTRUCTIVE } from '../safety';
|
|
9
9
|
|
|
10
10
|
import { defineOperation } from './types';
|
|
11
11
|
|
|
12
|
-
import type {
|
|
12
|
+
import type { ProfileId, OperationDescriptor, SafetyImpact } from './types';
|
|
13
13
|
|
|
14
|
-
const PROFILE_CONTENT_DEVELOPER:
|
|
14
|
+
const PROFILE_CONTENT_DEVELOPER: ProfileId = 'content-developer';
|
|
15
15
|
const API_V1 = '/api/v1';
|
|
16
16
|
const API_V2 = '/api/v2';
|
|
17
17
|
const WRITE_NONDESTRUCTIVE_IMPACT: SafetyImpact = 'write-nondestructive';
|
|
@@ -446,7 +446,7 @@ const op_create_space = defineOperation({
|
|
|
446
446
|
sensitivity: 'none',
|
|
447
447
|
agentExposure: 'client-only',
|
|
448
448
|
bannedMcpToolName: 'create_space',
|
|
449
|
-
profiles: [
|
|
449
|
+
profiles: [],
|
|
450
450
|
});
|
|
451
451
|
|
|
452
452
|
const op_update_space = defineOperation({
|
|
@@ -458,7 +458,7 @@ const op_update_space = defineOperation({
|
|
|
458
458
|
sensitivity: 'none',
|
|
459
459
|
agentExposure: 'client-only',
|
|
460
460
|
bannedMcpToolName: 'update_space',
|
|
461
|
-
profiles: [
|
|
461
|
+
profiles: [],
|
|
462
462
|
});
|
|
463
463
|
|
|
464
464
|
const op_move_content = defineOperation({
|
|
@@ -8,11 +8,11 @@ import { READ_ONLY_DEFAULT, WRITE_DESTRUCTIVE } from '../safety';
|
|
|
8
8
|
|
|
9
9
|
import { defineOperation } from './types';
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type { ProfileId, OperationDescriptor, SafetyImpact } from './types';
|
|
12
12
|
|
|
13
13
|
const IMPACT_READ: SafetyImpact = 'read';
|
|
14
14
|
const IMPACT_WRITE_DESTRUCTIVE: SafetyImpact = 'write-destructive';
|
|
15
|
-
const PROFILE_CONTENT_GOVERNANCE:
|
|
15
|
+
const PROFILE_CONTENT_GOVERNANCE: ProfileId = 'content-governance';
|
|
16
16
|
|
|
17
17
|
const API_V1 = '/api/v1';
|
|
18
18
|
const API_V2 = '/api/v2';
|
|
@@ -98,7 +98,7 @@ const op_permanent_purge = defineOperation({
|
|
|
98
98
|
sensitivity: 'none',
|
|
99
99
|
agentExposure: 'client-only',
|
|
100
100
|
bannedMcpToolName: 'permanent_delete_content',
|
|
101
|
-
profiles: [
|
|
101
|
+
profiles: [],
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
export const CONTENT_GOVERNANCE_OPERATIONS: readonly OperationDescriptor[] = [
|
|
@@ -5,10 +5,11 @@ import { READ_ONLY_DEFAULT, READ_ONLY_TRANSIENT } from '../safety';
|
|
|
5
5
|
|
|
6
6
|
import { defineOperation } from './types';
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { ProfileId, OperationDescriptor } from './types';
|
|
9
9
|
|
|
10
|
-
const PROFILE_CONTENT_READER:
|
|
11
|
-
const PROFILE_CONTENT_DEVELOPER:
|
|
10
|
+
const PROFILE_CONTENT_READER: ProfileId = 'content-reader';
|
|
11
|
+
const PROFILE_CONTENT_DEVELOPER: ProfileId = 'content-developer';
|
|
12
|
+
const PROFILE_DATA_ANALYST: ProfileId = 'data-analyst';
|
|
12
13
|
|
|
13
14
|
const op_search_content = defineOperation({
|
|
14
15
|
id: 'content-reader.content.search',
|
|
@@ -178,7 +179,7 @@ const op_get_query_result = defineOperation({
|
|
|
178
179
|
annotations: READ_ONLY_DEFAULT,
|
|
179
180
|
taskSupport: { exposed: true, taskEligible: false },
|
|
180
181
|
},
|
|
181
|
-
profiles: [PROFILE_CONTENT_READER],
|
|
182
|
+
profiles: [PROFILE_CONTENT_READER, PROFILE_DATA_ANALYST],
|
|
182
183
|
});
|
|
183
184
|
|
|
184
185
|
const op_cancel_query = defineOperation({
|
|
@@ -192,7 +193,7 @@ const op_cancel_query = defineOperation({
|
|
|
192
193
|
annotations: READ_ONLY_TRANSIENT,
|
|
193
194
|
taskSupport: { exposed: true, taskEligible: false },
|
|
194
195
|
},
|
|
195
|
-
profiles: [PROFILE_CONTENT_READER],
|
|
196
|
+
profiles: [PROFILE_CONTENT_READER, PROFILE_DATA_ANALYST],
|
|
196
197
|
});
|
|
197
198
|
|
|
198
199
|
export const CONTENT_READER_OPERATIONS: readonly OperationDescriptor[] = [
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data-analyst operations in the shared operation catalog (ADR-0020).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { READ_ONLY_TRANSIENT } from '../safety';
|
|
6
|
+
|
|
7
|
+
import { defineOperation } from './types';
|
|
8
|
+
|
|
9
|
+
import type { ProfileId, OperationDescriptor } from './types';
|
|
10
|
+
|
|
11
|
+
const PROFILE_DATA_ANALYST: ProfileId = 'data-analyst';
|
|
12
|
+
|
|
13
|
+
const op_run_metric_query = defineOperation({
|
|
14
|
+
id: 'data-analyst.query.metric-query.run',
|
|
15
|
+
summary: 'Execute an ad-hoc explore metric query with bounded async results',
|
|
16
|
+
http: { method: 'POST', path: '/api/v2/projects/{projectUuid}/query/metric-query' },
|
|
17
|
+
authorization: { safetyImpact: 'read' },
|
|
18
|
+
sensitivity: 'none',
|
|
19
|
+
mcp: {
|
|
20
|
+
toolName: 'run_metric_query',
|
|
21
|
+
annotations: READ_ONLY_TRANSIENT,
|
|
22
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
23
|
+
},
|
|
24
|
+
profiles: [PROFILE_DATA_ANALYST],
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const DATA_ANALYST_OPERATIONS: readonly OperationDescriptor[] = [op_run_metric_query];
|
package/src/operations/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export {
|
|
2
2
|
defineOperation,
|
|
3
|
+
PROFILE_IDS,
|
|
3
4
|
type AgentExposure,
|
|
4
|
-
type
|
|
5
|
+
type ProfileId,
|
|
5
6
|
type HttpMethod,
|
|
6
7
|
type McpTaskSupport,
|
|
7
8
|
type OperationAuthorization,
|
|
@@ -20,6 +21,7 @@ export { CLI_CONTENT_OPERATIONS } from './cli-content';
|
|
|
20
21
|
export { CONTENT_DEVELOPER_OPERATIONS } from './content-developer';
|
|
21
22
|
export { CONTENT_GOVERNANCE_OPERATIONS } from './content-governance';
|
|
22
23
|
export { CONTENT_READER_OPERATIONS } from './content-reader';
|
|
24
|
+
export { DATA_ANALYST_OPERATIONS } from './data-analyst';
|
|
23
25
|
export { ORGANIZATION_AUDIT_OPERATIONS } from './organization-audit';
|
|
24
26
|
export { SEMANTIC_LAYER_OPERATIONS } from './semantic-layer';
|
|
25
27
|
export { USER_OPERATIONS } from './users';
|
|
@@ -5,9 +5,9 @@ import { READ_ONLY_DEFAULT } from '../safety';
|
|
|
5
5
|
|
|
6
6
|
import { defineOperation } from './types';
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { ProfileId, OperationDescriptor } from './types';
|
|
9
9
|
|
|
10
|
-
const PROFILE_ORG_AUDIT:
|
|
10
|
+
const PROFILE_ORG_AUDIT: ProfileId = 'organization-audit';
|
|
11
11
|
|
|
12
12
|
const op_get_org_profile = defineOperation({
|
|
13
13
|
id: 'org-audit.org.profile.get',
|
|
@@ -5,13 +5,19 @@ import { CLI_CONTENT_OPERATIONS } from './cli-content';
|
|
|
5
5
|
import { CONTENT_DEVELOPER_OPERATIONS } from './content-developer';
|
|
6
6
|
import { CONTENT_GOVERNANCE_OPERATIONS } from './content-governance';
|
|
7
7
|
import { CONTENT_READER_OPERATIONS } from './content-reader';
|
|
8
|
+
import { DATA_ANALYST_OPERATIONS } from './data-analyst';
|
|
8
9
|
import { ORGANIZATION_AUDIT_OPERATIONS } from './organization-audit';
|
|
9
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
getOperation,
|
|
12
|
+
getOperationsByProfile,
|
|
13
|
+
listMcpToolNamesByProfile,
|
|
14
|
+
listOperations,
|
|
15
|
+
} from './registry';
|
|
10
16
|
import { SEMANTIC_LAYER_OPERATIONS } from './semantic-layer';
|
|
11
|
-
import { defineOperation } from './types';
|
|
17
|
+
import { defineOperation, PROFILE_IDS } from './types';
|
|
12
18
|
import { USER_OPERATIONS } from './users';
|
|
13
19
|
|
|
14
|
-
import type {
|
|
20
|
+
import type { OperationDescriptor, ProfileId } from './types';
|
|
15
21
|
|
|
16
22
|
const P0_OPERATION_IDS = [
|
|
17
23
|
'ai-agents.admin.agents.list',
|
|
@@ -34,13 +40,7 @@ const P0_OPERATION_IDS = [
|
|
|
34
40
|
'ai-agents.project.evaluations.runs.list',
|
|
35
41
|
] as const;
|
|
36
42
|
|
|
37
|
-
const ALL_PROFILES:
|
|
38
|
-
'ai-agent-ops',
|
|
39
|
-
'core-lifecycle',
|
|
40
|
-
'evaluations',
|
|
41
|
-
'conversations',
|
|
42
|
-
'discovery-readonly',
|
|
43
|
-
];
|
|
43
|
+
const ALL_PROFILES: ProfileId[] = [...PROFILE_IDS];
|
|
44
44
|
|
|
45
45
|
function requiredFields(operation: OperationDescriptor): string[] {
|
|
46
46
|
const agentExposure = operation.agentExposure ?? 'agent';
|
|
@@ -85,6 +85,7 @@ describe('operation registry', () => {
|
|
|
85
85
|
CONTENT_READER_OPERATIONS.length +
|
|
86
86
|
CONTENT_DEVELOPER_OPERATIONS.length +
|
|
87
87
|
CONTENT_GOVERNANCE_OPERATIONS.length +
|
|
88
|
+
DATA_ANALYST_OPERATIONS.length +
|
|
88
89
|
CLI_CONTENT_OPERATIONS.length,
|
|
89
90
|
);
|
|
90
91
|
});
|
|
@@ -97,7 +98,12 @@ describe('operation registry', () => {
|
|
|
97
98
|
if (operation.agentExposure === 'agent') {
|
|
98
99
|
expect(operation.mcp !== undefined || operation.cli !== undefined).toBe(true);
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
+
const mcpExposed = operation.mcp?.taskSupport.exposed === true;
|
|
102
|
+
if (mcpExposed) {
|
|
103
|
+
expect(operation.profiles.length).toBeGreaterThan(0);
|
|
104
|
+
} else {
|
|
105
|
+
expect(operation.profiles).toEqual([]);
|
|
106
|
+
}
|
|
101
107
|
expect(
|
|
102
108
|
operation.http.path.startsWith('/api/v1/') || operation.http.path.startsWith('/api/v2/'),
|
|
103
109
|
).toBe(true);
|
|
@@ -120,7 +126,7 @@ describe('operation registry', () => {
|
|
|
120
126
|
}
|
|
121
127
|
});
|
|
122
128
|
|
|
123
|
-
it('exposes profile filters for all
|
|
129
|
+
it('exposes profile filters for all serving profiles', () => {
|
|
124
130
|
for (const profile of ALL_PROFILES) {
|
|
125
131
|
const operations = getOperationsByProfile(profile);
|
|
126
132
|
expect(operations.length).toBeGreaterThan(0);
|
|
@@ -130,23 +136,20 @@ describe('operation registry', () => {
|
|
|
130
136
|
}
|
|
131
137
|
});
|
|
132
138
|
|
|
133
|
-
it('
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
for (const id of crudIds) {
|
|
142
|
-
const operation = getOperation(id);
|
|
143
|
-
expect(operation?.profiles).toContain('core-lifecycle');
|
|
139
|
+
it('listMcpToolNamesByProfile matches exposed ops per profile', () => {
|
|
140
|
+
for (const profile of ALL_PROFILES) {
|
|
141
|
+
const toolNames = listMcpToolNamesByProfile(profile);
|
|
142
|
+
const exposedOps = getOperationsByProfile(profile).filter(
|
|
143
|
+
(operation) => operation.mcp?.taskSupport.exposed === true,
|
|
144
|
+
);
|
|
145
|
+
expect(toolNames).toHaveLength(exposedOps.length);
|
|
146
|
+
expect(new Set(toolNames).size).toBe(toolNames.length);
|
|
144
147
|
}
|
|
145
148
|
});
|
|
146
149
|
|
|
147
|
-
it('maps
|
|
148
|
-
expect(getOperation('ai-agents.project.
|
|
149
|
-
expect(getOperation('ai-agents.project.
|
|
150
|
+
it('maps exposed ai-agent-ops tools to ai-agent-ops profile only', () => {
|
|
151
|
+
expect(getOperation('ai-agents.project.agents.list')?.profiles).toEqual(['ai-agent-ops']);
|
|
152
|
+
expect(getOperation('ai-agents.project.agents.create')?.profiles).toEqual([]);
|
|
150
153
|
});
|
|
151
154
|
|
|
152
155
|
it('documents multi-step workflow for thread start', () => {
|
|
@@ -167,27 +170,10 @@ describe('operation registry', () => {
|
|
|
167
170
|
expect(operation?.workflow?.[1]?.path).toContain('/generate');
|
|
168
171
|
});
|
|
169
172
|
|
|
170
|
-
it('maps evaluation lifecycle operations to evaluations profile', () => {
|
|
171
|
-
const evalIds = [
|
|
172
|
-
'ai-agents.project.evaluations.create',
|
|
173
|
-
'ai-agents.project.evaluations.append',
|
|
174
|
-
'ai-agents.project.evaluations.run',
|
|
175
|
-
'ai-agents.project.evaluations.runs.list',
|
|
176
|
-
];
|
|
177
|
-
for (const id of evalIds) {
|
|
178
|
-
expect(getOperation(id)?.profiles).toContain('evaluations');
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
|
|
182
173
|
it('returns undefined for unknown operation id', () => {
|
|
183
174
|
expect(getOperation('ai-agents.unknown.operation')).toBeUndefined();
|
|
184
175
|
});
|
|
185
176
|
|
|
186
|
-
it('filters operations by profile with empty result for unknown profile usage', () => {
|
|
187
|
-
const ops = getOperationsByProfile('core-lifecycle');
|
|
188
|
-
expect(ops.every((op) => op.profiles.includes('core-lifecycle'))).toBe(true);
|
|
189
|
-
});
|
|
190
|
-
|
|
191
177
|
it('registers users.members.delete as client-only', () => {
|
|
192
178
|
const operation = getOperation('users.members.delete');
|
|
193
179
|
expect(operation?.agentExposure).toBe('client-only');
|
|
@@ -195,6 +181,7 @@ describe('operation registry', () => {
|
|
|
195
181
|
expect(operation?.cli).toBeUndefined();
|
|
196
182
|
expect(operation?.bannedMcpToolName).toBe('delete_member');
|
|
197
183
|
expect(operation?.http.path).toBe('/api/v1/org/user/{userUuid}');
|
|
184
|
+
expect(operation?.profiles).toEqual([]);
|
|
198
185
|
});
|
|
199
186
|
|
|
200
187
|
it('excludes client-only operations from profile discovery catalogs', () => {
|
|
@@ -204,15 +191,6 @@ describe('operation registry', () => {
|
|
|
204
191
|
}
|
|
205
192
|
}
|
|
206
193
|
expect(getOperation('users.members.delete')).toBeDefined();
|
|
207
|
-
expect(
|
|
208
|
-
getOperationsByProfile('discovery-readonly').some((op) => op.id === 'users.members.delete'),
|
|
209
|
-
).toBe(false);
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
it('keeps discovery-readonly profile operations read-only', () => {
|
|
213
|
-
for (const operation of getOperationsByProfile('discovery-readonly')) {
|
|
214
|
-
expect(operation.authorization.safetyImpact).toBe('read');
|
|
215
|
-
}
|
|
216
194
|
});
|
|
217
195
|
|
|
218
196
|
it('never exposes client-only operations on MCP', () => {
|
|
@@ -244,7 +222,7 @@ describe('operation registry', () => {
|
|
|
244
222
|
},
|
|
245
223
|
cli: { commandPath: 'test' },
|
|
246
224
|
agentExposure: 'agent',
|
|
247
|
-
profiles: ['
|
|
225
|
+
profiles: ['semantic-layer'],
|
|
248
226
|
}),
|
|
249
227
|
).toThrow(/authorization\.safetyImpact/);
|
|
250
228
|
});
|