@lightdash-tools/common 0.9.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/audit.d.ts +3 -2
  2. package/dist/audit.js +1 -1
  3. package/dist/audit.test.js +4 -4
  4. package/dist/operations/ai-agents.js +26 -30
  5. package/dist/operations/cli-content.js +6 -8
  6. package/dist/operations/client-coverage.d.ts +1 -0
  7. package/dist/operations/client-coverage.js +2 -0
  8. package/dist/operations/content-developer.js +3 -3
  9. package/dist/operations/content-governance.js +1 -1
  10. package/dist/operations/content-reader.js +3 -2
  11. package/dist/operations/data-analyst.d.ts +5 -0
  12. package/dist/operations/data-analyst.js +23 -0
  13. package/dist/operations/index.d.ts +2 -1
  14. package/dist/operations/index.js +4 -1
  15. package/dist/operations/organization-audit.js +1 -1
  16. package/dist/operations/registry.d.ts +5 -5
  17. package/dist/operations/registry.js +35 -9
  18. package/dist/operations/registry.test.js +23 -46
  19. package/dist/operations/semantic-layer.js +8 -7
  20. package/dist/operations/types.d.ts +10 -6
  21. package/dist/operations/types.js +22 -14
  22. package/dist/operations/types.test.js +14 -5
  23. package/dist/operations/users.js +3 -5
  24. package/package.json +1 -1
  25. package/src/audit.test.ts +4 -4
  26. package/src/audit.ts +5 -3
  27. package/src/operations/ai-agents.ts +28 -32
  28. package/src/operations/cli-content.ts +7 -10
  29. package/src/operations/client-coverage.ts +3 -0
  30. package/src/operations/content-developer.ts +5 -5
  31. package/src/operations/content-governance.ts +3 -3
  32. package/src/operations/content-reader.ts +6 -5
  33. package/src/operations/data-analyst.ts +27 -0
  34. package/src/operations/index.ts +3 -1
  35. package/src/operations/organization-audit.ts +2 -2
  36. package/src/operations/registry.test.ts +31 -53
  37. package/src/operations/registry.ts +42 -12
  38. package/src/operations/semantic-layer.ts +9 -8
  39. package/src/operations/types.test.ts +34 -6
  40. package/src/operations/types.ts +41 -33
  41. package/src/operations/users.ts +4 -7
package/dist/audit.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * If LIGHTDASH_TOOLS_AUDIT_LOG is a file path, entries are appended there; otherwise stderr.
8
8
  */
9
+ import type { ProfileId } from './operations/types';
9
10
  export type AuditStatus = 'blocked' | 'confirmation_cancelled' | 'confirmation_declined' | 'confirmation_requested' | 'deletion_failed' | 'deletion_succeeded' | 'error' | 'promotion_failed' | 'promotion_succeeded' | 'resource_changed' | 'success';
10
11
  /** Cloud Logging LogSeverity-compatible strings for structured stderr JSON. */
11
12
  export type AuditSeverity = 'ERROR' | 'INFO' | 'NOTICE' | 'WARNING';
@@ -24,7 +25,7 @@ export type AuditLogEntry = {
24
25
  /** Lightdash user UUID when the call runs under OAuth bearer auth. */
25
26
  subject?: string;
26
27
  clientSessionId?: string;
27
- personaId?: string;
28
+ profileId?: ProfileId;
28
29
  status: AuditStatus;
29
30
  durationMs: number;
30
31
  };
@@ -37,7 +38,7 @@ export type BuildAuditLogEntryInput = {
37
38
  tokenHash?: string;
38
39
  subject?: string;
39
40
  clientSessionId?: string;
40
- personaId?: string;
41
+ profileId?: ProfileId;
41
42
  };
42
43
  export declare function getSessionId(): string;
43
44
  /** Map audit status to Cloud Logging severity. */
package/dist/audit.js CHANGED
@@ -60,7 +60,7 @@ function buildAuditLogEntry(input) {
60
60
  tokenHash: input.tokenHash,
61
61
  subject: input.subject,
62
62
  clientSessionId: input.clientSessionId,
63
- personaId: input.personaId,
63
+ profileId: input.profileId,
64
64
  status: input.status,
65
65
  durationMs: Date.now() - input.startMs,
66
66
  };
@@ -26,13 +26,13 @@ const audit_1 = require("./audit");
26
26
  status: 'blocked',
27
27
  startMs: Date.now() - 5,
28
28
  projectUuids: [],
29
- personaId: 'semantic-layer',
29
+ profileId: 'semantic-layer',
30
30
  });
31
31
  (0, vitest_1.expect)(entry.channel).toBe('audit');
32
32
  (0, vitest_1.expect)(entry.severity).toBe('WARNING');
33
33
  (0, vitest_1.expect)(entry.message).toBe('demo_tool blocked');
34
34
  (0, vitest_1.expect)(entry.projectUuids).toBeUndefined();
35
- (0, vitest_1.expect)(entry.personaId).toBe('semantic-layer');
35
+ (0, vitest_1.expect)(entry.profileId).toBe('semantic-layer');
36
36
  (0, vitest_1.expect)(entry.sessionId).toBe((0, audit_1.getSessionId)());
37
37
  });
38
38
  (0, vitest_1.it)('initAuditLog announces stderr destination on stdout when no file path is given', () => {
@@ -54,7 +54,7 @@ const audit_1 = require("./audit");
54
54
  tokenHash: 'abc123',
55
55
  subject: 'user-uuid',
56
56
  clientSessionId: 'mcp-session-1',
57
- personaId: 'semantic-layer',
57
+ profileId: 'semantic-layer',
58
58
  }));
59
59
  const auditLine = stderrSpy.mock.calls
60
60
  .map(([chunk]) => String(chunk))
@@ -69,7 +69,7 @@ const audit_1 = require("./audit");
69
69
  (0, vitest_1.expect)(parsed.tokenHash).toBe('abc123');
70
70
  (0, vitest_1.expect)(parsed.subject).toBe('user-uuid');
71
71
  (0, vitest_1.expect)(parsed.clientSessionId).toBe('mcp-session-1');
72
- (0, vitest_1.expect)(parsed.personaId).toBe('semantic-layer');
72
+ (0, vitest_1.expect)(parsed.profileId).toBe('semantic-layer');
73
73
  });
74
74
  (0, vitest_1.it)('logAuditEntry appends to a file when initAuditLog receives a path', async () => {
75
75
  const dir = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'audit-test-'));
@@ -10,10 +10,6 @@ const IMPACT_READ = 'read';
10
10
  const IMPACT_WRITE_NONDESTRUCTIVE = 'write-nondestructive';
11
11
  const IMPACT_WRITE_DESTRUCTIVE = 'write-destructive';
12
12
  const IMPACT_EXTERNAL = 'external-side-effect';
13
- const PROFILE_CORE_LIFECYCLE = 'core-lifecycle';
14
- const PROFILE_DISCOVERY = 'discovery-readonly';
15
- const PROFILE_CONVERSATIONS = 'conversations';
16
- const PROFILE_EVALUATIONS = 'evaluations';
17
13
  const PROFILE_AI_AGENT_OPS = 'ai-agent-ops';
18
14
  const API_V1 = '/api/v1';
19
15
  const PROJECT_AGENTS_PATH = `${API_V1}/projects/{projectUuid}/aiAgents`;
@@ -30,7 +26,7 @@ const adminListAgents = (0, types_1.defineOperation)({
30
26
  taskSupport: { exposed: false, taskEligible: false },
31
27
  },
32
28
  cli: { commandPath: 'ai-agents list' },
33
- profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
29
+ profiles: [],
34
30
  });
35
31
  const adminListThreads = (0, types_1.defineOperation)({
36
32
  id: 'ai-agents.admin.threads.list',
@@ -44,7 +40,7 @@ const adminListThreads = (0, types_1.defineOperation)({
44
40
  taskSupport: { exposed: false, taskEligible: false },
45
41
  },
46
42
  cli: { commandPath: 'ai-agents threads' },
47
- profiles: [PROFILE_DISCOVERY],
43
+ profiles: [],
48
44
  });
49
45
  const adminSettingsGet = (0, types_1.defineOperation)({
50
46
  id: 'ai-agents.admin.settings.get',
@@ -58,7 +54,7 @@ const adminSettingsGet = (0, types_1.defineOperation)({
58
54
  taskSupport: { exposed: false, taskEligible: false },
59
55
  },
60
56
  cli: { commandPath: 'ai-agents settings get' },
61
- profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
57
+ profiles: [],
62
58
  });
63
59
  const adminSettingsUpdate = (0, types_1.defineOperation)({
64
60
  id: 'ai-agents.admin.settings.update',
@@ -72,7 +68,7 @@ const adminSettingsUpdate = (0, types_1.defineOperation)({
72
68
  taskSupport: { exposed: false, taskEligible: false },
73
69
  },
74
70
  cli: { commandPath: 'ai-agents settings update' },
75
- profiles: [PROFILE_CORE_LIFECYCLE],
71
+ profiles: [],
76
72
  });
77
73
  const projectAgentsList = (0, types_1.defineOperation)({
78
74
  id: 'ai-agents.project.agents.list',
@@ -86,7 +82,7 @@ const projectAgentsList = (0, types_1.defineOperation)({
86
82
  taskSupport: { exposed: true, taskEligible: false },
87
83
  },
88
84
  cli: { commandPath: 'agents list' },
89
- profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
85
+ profiles: [PROFILE_AI_AGENT_OPS],
90
86
  });
91
87
  const projectAgentsGet = (0, types_1.defineOperation)({
92
88
  id: 'ai-agents.project.agents.get',
@@ -100,7 +96,7 @@ const projectAgentsGet = (0, types_1.defineOperation)({
100
96
  taskSupport: { exposed: true, taskEligible: false },
101
97
  },
102
98
  cli: { commandPath: 'agents get' },
103
- profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
99
+ profiles: [PROFILE_AI_AGENT_OPS],
104
100
  });
105
101
  const projectAgentsCreate = (0, types_1.defineOperation)({
106
102
  id: 'ai-agents.project.agents.create',
@@ -114,7 +110,7 @@ const projectAgentsCreate = (0, types_1.defineOperation)({
114
110
  taskSupport: { exposed: false, taskEligible: false },
115
111
  },
116
112
  cli: { commandPath: 'agents create' },
117
- profiles: [PROFILE_CORE_LIFECYCLE],
113
+ profiles: [],
118
114
  });
119
115
  const projectAgentsUpdate = (0, types_1.defineOperation)({
120
116
  id: 'ai-agents.project.agents.update',
@@ -128,7 +124,7 @@ const projectAgentsUpdate = (0, types_1.defineOperation)({
128
124
  taskSupport: { exposed: false, taskEligible: false },
129
125
  },
130
126
  cli: { commandPath: 'agents update' },
131
- profiles: [PROFILE_CORE_LIFECYCLE],
127
+ profiles: [],
132
128
  });
133
129
  const projectAgentsDelete = (0, types_1.defineOperation)({
134
130
  id: 'ai-agents.project.agents.delete',
@@ -142,7 +138,7 @@ const projectAgentsDelete = (0, types_1.defineOperation)({
142
138
  taskSupport: { exposed: false, taskEligible: false },
143
139
  },
144
140
  cli: { commandPath: 'agents delete' },
145
- profiles: [PROFILE_CORE_LIFECYCLE],
141
+ profiles: [],
146
142
  });
147
143
  const PROJECT_AGENT_THREADS_PATH = `${PROJECT_AGENT_PATH}/threads`;
148
144
  const threadsList = (0, types_1.defineOperation)({
@@ -160,7 +156,7 @@ const threadsList = (0, types_1.defineOperation)({
160
156
  taskSupport: { exposed: true, taskEligible: false },
161
157
  },
162
158
  cli: { commandPath: 'agents threads list' },
163
- profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
159
+ profiles: [PROFILE_AI_AGENT_OPS],
164
160
  });
165
161
  const PROJECT_AGENT_THREAD_PATH = `${PROJECT_AGENT_THREADS_PATH}/{threadUuid}`;
166
162
  const threadsGet = (0, types_1.defineOperation)({
@@ -178,7 +174,7 @@ const threadsGet = (0, types_1.defineOperation)({
178
174
  taskSupport: { exposed: true, taskEligible: false },
179
175
  },
180
176
  cli: { commandPath: 'agents threads get' },
181
- profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
177
+ profiles: [PROFILE_AI_AGENT_OPS],
182
178
  });
183
179
  const PROJECT_AGENT_THREAD_MESSAGES_PATH = `${PROJECT_AGENT_THREAD_PATH}/messages`;
184
180
  const PROJECT_AGENT_THREAD_GENERATE_PATH = `${PROJECT_AGENT_THREAD_PATH}/generate`;
@@ -214,7 +210,7 @@ const threadsStart = (0, types_1.defineOperation)({
214
210
  taskSupport: { exposed: false, taskEligible: true },
215
211
  },
216
212
  cli: { commandPath: 'agents threads start' },
217
- profiles: [PROFILE_CONVERSATIONS],
213
+ profiles: [],
218
214
  });
219
215
  const threadsContinue = (0, types_1.defineOperation)({
220
216
  id: 'ai-agents.project.threads.continue',
@@ -243,7 +239,7 @@ const threadsContinue = (0, types_1.defineOperation)({
243
239
  taskSupport: { exposed: false, taskEligible: true },
244
240
  },
245
241
  cli: { commandPath: 'agents threads continue' },
246
- profiles: [PROFILE_CONVERSATIONS],
242
+ profiles: [],
247
243
  });
248
244
  const PROJECT_AGENT_EVALUATIONS_PATH = `${PROJECT_AGENT_PATH}/evaluations`;
249
245
  const evaluationsList = (0, types_1.defineOperation)({
@@ -261,7 +257,7 @@ const evaluationsList = (0, types_1.defineOperation)({
261
257
  taskSupport: { exposed: true, taskEligible: false },
262
258
  },
263
259
  cli: { commandPath: 'agents evals list' },
264
- profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
260
+ profiles: [PROFILE_AI_AGENT_OPS],
265
261
  });
266
262
  const PROJECT_AGENT_EVALUATION_PATH = `${PROJECT_AGENT_EVALUATIONS_PATH}/{evalUuid}`;
267
263
  const evaluationsGet = (0, types_1.defineOperation)({
@@ -279,7 +275,7 @@ const evaluationsGet = (0, types_1.defineOperation)({
279
275
  taskSupport: { exposed: true, taskEligible: false },
280
276
  },
281
277
  cli: { commandPath: 'agents evals get' },
282
- profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
278
+ profiles: [PROFILE_AI_AGENT_OPS],
283
279
  });
284
280
  const evaluationsCreate = (0, types_1.defineOperation)({
285
281
  id: 'ai-agents.project.evaluations.create',
@@ -296,7 +292,7 @@ const evaluationsCreate = (0, types_1.defineOperation)({
296
292
  taskSupport: { exposed: true, taskEligible: false },
297
293
  },
298
294
  cli: { commandPath: 'agents evals create' },
299
- profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
295
+ profiles: [PROFILE_AI_AGENT_OPS],
300
296
  });
301
297
  const evaluationsUpdate = (0, types_1.defineOperation)({
302
298
  id: 'ai-agents.project.evaluations.update',
@@ -313,7 +309,7 @@ const evaluationsUpdate = (0, types_1.defineOperation)({
313
309
  taskSupport: { exposed: true, taskEligible: false },
314
310
  },
315
311
  cli: { commandPath: 'agents evals update' },
316
- profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
312
+ profiles: [PROFILE_AI_AGENT_OPS],
317
313
  });
318
314
  const evaluationsAppend = (0, types_1.defineOperation)({
319
315
  id: 'ai-agents.project.evaluations.append',
@@ -330,7 +326,7 @@ const evaluationsAppend = (0, types_1.defineOperation)({
330
326
  taskSupport: { exposed: true, taskEligible: false },
331
327
  },
332
328
  cli: { commandPath: 'agents evals append' },
333
- profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
329
+ profiles: [PROFILE_AI_AGENT_OPS],
334
330
  });
335
331
  const evaluationsDelete = (0, types_1.defineOperation)({
336
332
  id: 'ai-agents.project.evaluations.delete',
@@ -347,7 +343,7 @@ const evaluationsDelete = (0, types_1.defineOperation)({
347
343
  taskSupport: { exposed: true, taskEligible: false },
348
344
  },
349
345
  cli: { commandPath: 'agents evals delete' },
350
- profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
346
+ profiles: [PROFILE_AI_AGENT_OPS],
351
347
  });
352
348
  const evaluationsRun = (0, types_1.defineOperation)({
353
349
  id: 'ai-agents.project.evaluations.run',
@@ -364,7 +360,7 @@ const evaluationsRun = (0, types_1.defineOperation)({
364
360
  taskSupport: { exposed: true, taskEligible: true },
365
361
  },
366
362
  cli: { commandPath: 'agents evals run' },
367
- profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
363
+ profiles: [PROFILE_AI_AGENT_OPS],
368
364
  });
369
365
  const PROJECT_AGENT_EVALUATION_RUNS_PATH = `${PROJECT_AGENT_EVALUATION_PATH}/runs`;
370
366
  const evaluationsRunsList = (0, types_1.defineOperation)({
@@ -382,7 +378,7 @@ const evaluationsRunsList = (0, types_1.defineOperation)({
382
378
  taskSupport: { exposed: true, taskEligible: false },
383
379
  },
384
380
  cli: { commandPath: 'agents evals runs' },
385
- profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
381
+ profiles: [PROFILE_AI_AGENT_OPS],
386
382
  });
387
383
  const evaluationsRunResultsGet = (0, types_1.defineOperation)({
388
384
  id: 'ai-agents.project.evaluations.runs.get',
@@ -399,7 +395,7 @@ const evaluationsRunResultsGet = (0, types_1.defineOperation)({
399
395
  taskSupport: { exposed: true, taskEligible: false },
400
396
  },
401
397
  cli: { commandPath: 'agents evals run-results' },
402
- profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
398
+ profiles: [PROFILE_AI_AGENT_OPS],
403
399
  });
404
400
  const evaluateAgentReadiness = (0, types_1.defineOperation)({
405
401
  id: 'ai-agents.project.agents.evaluate-readiness',
@@ -416,7 +412,7 @@ const evaluateAgentReadiness = (0, types_1.defineOperation)({
416
412
  taskSupport: { exposed: true, taskEligible: false },
417
413
  },
418
414
  cli: { commandPath: 'agents readiness evaluate' },
419
- profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
415
+ profiles: [PROFILE_AI_AGENT_OPS],
420
416
  });
421
417
  const getAgentSuggestions = (0, types_1.defineOperation)({
422
418
  id: 'ai-agents.project.agents.suggestions',
@@ -433,7 +429,7 @@ const getAgentSuggestions = (0, types_1.defineOperation)({
433
429
  taskSupport: { exposed: true, taskEligible: false },
434
430
  },
435
431
  cli: { commandPath: 'agents suggestions' },
436
- profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
432
+ profiles: [PROFILE_AI_AGENT_OPS],
437
433
  });
438
434
  const getAgentModels = (0, types_1.defineOperation)({
439
435
  id: 'ai-agents.project.agents.models',
@@ -450,7 +446,7 @@ const getAgentModels = (0, types_1.defineOperation)({
450
446
  taskSupport: { exposed: true, taskEligible: false },
451
447
  },
452
448
  cli: { commandPath: 'agents models' },
453
- profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
449
+ profiles: [PROFILE_AI_AGENT_OPS],
454
450
  });
455
451
  const getExploreAccessSummary = (0, types_1.defineOperation)({
456
452
  id: 'ai-agents.project.explore-access-summary',
@@ -466,7 +462,7 @@ const getExploreAccessSummary = (0, types_1.defineOperation)({
466
462
  annotations: safety_1.READ_ONLY_DEFAULT,
467
463
  taskSupport: { exposed: true, taskEligible: false },
468
464
  },
469
- profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
465
+ profiles: [PROFILE_AI_AGENT_OPS],
470
466
  });
471
467
  /** All registered P0 AI agent operations. */
472
468
  exports.AI_AGENT_OPERATIONS = [
@@ -5,8 +5,6 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CLI_CONTENT_OPERATIONS = void 0;
7
7
  const types_1 = require("./types");
8
- const PROFILE_DISCOVERY = 'discovery-readonly';
9
- const PROFILE_CORE = 'core-lifecycle';
10
8
  const chartsList = (0, types_1.defineOperation)({
11
9
  id: 'cli.charts.list',
12
10
  summary: 'List charts in a project (Commander alias of charts-as-code list)',
@@ -14,7 +12,7 @@ const chartsList = (0, types_1.defineOperation)({
14
12
  authorization: { safetyImpact: 'read' },
15
13
  sensitivity: 'none',
16
14
  cli: { commandPath: 'projects charts list' },
17
- profiles: [PROFILE_DISCOVERY],
15
+ profiles: [],
18
16
  });
19
17
  const chartsCodeList = (0, types_1.defineOperation)({
20
18
  id: 'cli.charts.code.list',
@@ -23,7 +21,7 @@ const chartsCodeList = (0, types_1.defineOperation)({
23
21
  authorization: { safetyImpact: 'read' },
24
22
  sensitivity: 'none',
25
23
  cli: { commandPath: 'projects charts code list' },
26
- profiles: [PROFILE_DISCOVERY],
24
+ profiles: [],
27
25
  });
28
26
  const chartsCodeUpsert = (0, types_1.defineOperation)({
29
27
  id: 'cli.charts.code.upsert',
@@ -32,7 +30,7 @@ const chartsCodeUpsert = (0, types_1.defineOperation)({
32
30
  authorization: { safetyImpact: 'write-nondestructive' },
33
31
  sensitivity: 'none',
34
32
  cli: { commandPath: 'projects charts code upsert' },
35
- profiles: [PROFILE_CORE],
33
+ profiles: [],
36
34
  });
37
35
  const dashboardsList = (0, types_1.defineOperation)({
38
36
  id: 'cli.dashboards.list',
@@ -41,7 +39,7 @@ const dashboardsList = (0, types_1.defineOperation)({
41
39
  authorization: { safetyImpact: 'read' },
42
40
  sensitivity: 'none',
43
41
  cli: { commandPath: 'projects dashboards list' },
44
- profiles: [PROFILE_DISCOVERY],
42
+ profiles: [],
45
43
  });
46
44
  const validateRun = (0, types_1.defineOperation)({
47
45
  id: 'cli.projects.validate.run',
@@ -50,7 +48,7 @@ const validateRun = (0, types_1.defineOperation)({
50
48
  authorization: { safetyImpact: 'write-nondestructive' },
51
49
  sensitivity: 'none',
52
50
  cli: { commandPath: 'projects validate run' },
53
- profiles: [PROFILE_CORE],
51
+ profiles: [],
54
52
  });
55
53
  const validateResults = (0, types_1.defineOperation)({
56
54
  id: 'cli.projects.validate.results',
@@ -59,7 +57,7 @@ const validateResults = (0, types_1.defineOperation)({
59
57
  authorization: { safetyImpact: 'read' },
60
58
  sensitivity: 'none',
61
59
  cli: { commandPath: 'projects validate results' },
62
- profiles: [PROFILE_DISCOVERY],
60
+ profiles: [],
63
61
  });
64
62
  exports.CLI_CONTENT_OPERATIONS = [
65
63
  chartsList,
@@ -79,6 +79,7 @@ export declare const OPERATION_CLIENT_METHOD_MAP: {
79
79
  readonly 'content-reader.dashboards.run-tile': "v2.query.runDashboardChartQuery";
80
80
  readonly 'content-reader.query.result.get': "v2.query.getAsyncQueryResults";
81
81
  readonly 'content-reader.query.cancel': "v2.query.cancelAsyncQuery";
82
+ readonly 'data-analyst.query.metric-query.run': "v2.query.runMetricQuery";
82
83
  readonly 'content-developer.preview.chart': "composed:v2.charts.getSavedChart";
83
84
  readonly 'content-developer.preview.dashboard': "composed:v2.dashboards.getDashboard";
84
85
  readonly 'content-developer.preview.content-move': "ledger:preview";
@@ -92,6 +92,8 @@ exports.OPERATION_CLIENT_METHOD_MAP = {
92
92
  'content-reader.dashboards.run-tile': 'v2.query.runDashboardChartQuery',
93
93
  'content-reader.query.result.get': 'v2.query.getAsyncQueryResults',
94
94
  'content-reader.query.cancel': 'v2.query.cancelAsyncQuery',
95
+ // data-analyst
96
+ 'data-analyst.query.metric-query.run': 'v2.query.runMetricQuery',
95
97
  // content-developer
96
98
  'content-developer.preview.chart': 'composed:v2.charts.getSavedChart',
97
99
  'content-developer.preview.dashboard': 'composed:v2.dashboards.getDashboard',
@@ -6,7 +6,7 @@ exports.CONTENT_DEVELOPER_OPERATIONS = void 0;
6
6
  * Hybrid authoring surface: chart as-code upsert, dashboard REST create/update,
7
7
  * MCP-composed tile layout, and bulk content move into existing spaces.
8
8
  * Space create/update are client-only (spaces managed out-of-band, e.g. Terraform).
9
- * Preview -> validate -> apply is enforced by the persona policy layer, not here.
9
+ * Preview -> validate -> apply is enforced by the profile policy layer, not here.
10
10
  */
11
11
  const safety_1 = require("../safety");
12
12
  const types_1 = require("./types");
@@ -420,7 +420,7 @@ const op_create_space = (0, types_1.defineOperation)({
420
420
  sensitivity: 'none',
421
421
  agentExposure: 'client-only',
422
422
  bannedMcpToolName: 'create_space',
423
- profiles: [PROFILE_CONTENT_DEVELOPER],
423
+ profiles: [],
424
424
  });
425
425
  const op_update_space = (0, types_1.defineOperation)({
426
426
  id: 'content-developer.spaces.update',
@@ -430,7 +430,7 @@ const op_update_space = (0, types_1.defineOperation)({
430
430
  sensitivity: 'none',
431
431
  agentExposure: 'client-only',
432
432
  bannedMcpToolName: 'update_space',
433
- profiles: [PROFILE_CONTENT_DEVELOPER],
433
+ profiles: [],
434
434
  });
435
435
  const op_move_content = (0, types_1.defineOperation)({
436
436
  id: 'content-developer.content.move',
@@ -87,7 +87,7 @@ const op_permanent_purge = (0, types_1.defineOperation)({
87
87
  sensitivity: 'none',
88
88
  agentExposure: 'client-only',
89
89
  bannedMcpToolName: 'permanent_delete_content',
90
- profiles: [PROFILE_CONTENT_GOVERNANCE],
90
+ profiles: [],
91
91
  });
92
92
  exports.CONTENT_GOVERNANCE_OPERATIONS = [
93
93
  op_delete_chart,
@@ -8,6 +8,7 @@ const safety_1 = require("../safety");
8
8
  const types_1 = require("./types");
9
9
  const PROFILE_CONTENT_READER = 'content-reader';
10
10
  const PROFILE_CONTENT_DEVELOPER = 'content-developer';
11
+ const PROFILE_DATA_ANALYST = 'data-analyst';
11
12
  const op_search_content = (0, types_1.defineOperation)({
12
13
  id: 'content-reader.content.search',
13
14
  summary: 'Search charts dashboards and spaces in a project',
@@ -165,7 +166,7 @@ const op_get_query_result = (0, types_1.defineOperation)({
165
166
  annotations: safety_1.READ_ONLY_DEFAULT,
166
167
  taskSupport: { exposed: true, taskEligible: false },
167
168
  },
168
- profiles: [PROFILE_CONTENT_READER],
169
+ profiles: [PROFILE_CONTENT_READER, PROFILE_DATA_ANALYST],
169
170
  });
170
171
  const op_cancel_query = (0, types_1.defineOperation)({
171
172
  id: 'content-reader.query.cancel',
@@ -178,7 +179,7 @@ const op_cancel_query = (0, types_1.defineOperation)({
178
179
  annotations: safety_1.READ_ONLY_TRANSIENT,
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
  exports.CONTENT_READER_OPERATIONS = [
184
185
  op_search_content,
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Data-analyst operations in the shared operation catalog (ADR-0020).
3
+ */
4
+ import type { OperationDescriptor } from './types';
5
+ export declare const DATA_ANALYST_OPERATIONS: readonly OperationDescriptor[];
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /**
3
+ * Data-analyst operations in the shared operation catalog (ADR-0020).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DATA_ANALYST_OPERATIONS = void 0;
7
+ const safety_1 = require("../safety");
8
+ const types_1 = require("./types");
9
+ const PROFILE_DATA_ANALYST = 'data-analyst';
10
+ const op_run_metric_query = (0, types_1.defineOperation)({
11
+ id: 'data-analyst.query.metric-query.run',
12
+ summary: 'Execute an ad-hoc explore metric query with bounded async results',
13
+ http: { method: 'POST', path: '/api/v2/projects/{projectUuid}/query/metric-query' },
14
+ authorization: { safetyImpact: 'read' },
15
+ sensitivity: 'none',
16
+ mcp: {
17
+ toolName: 'run_metric_query',
18
+ annotations: safety_1.READ_ONLY_TRANSIENT,
19
+ taskSupport: { exposed: true, taskEligible: false },
20
+ },
21
+ profiles: [PROFILE_DATA_ANALYST],
22
+ });
23
+ exports.DATA_ANALYST_OPERATIONS = [op_run_metric_query];
@@ -1,10 +1,11 @@
1
- export { defineOperation, type AgentExposure, type CapabilityProfile, type HttpMethod, type McpTaskSupport, type OperationAuthorization, type OperationCli, type OperationDefinitionInput, type OperationDescriptor, type OperationHttp, type OperationMcp, type SensitivityClass, } from './types';
1
+ export { defineOperation, PROFILE_IDS, type AgentExposure, type ProfileId, type HttpMethod, type McpTaskSupport, type OperationAuthorization, type OperationCli, type OperationDefinitionInput, type OperationDescriptor, type OperationHttp, type OperationMcp, type SensitivityClass, } from './types';
2
2
  export { IRRECOVERABLE_TOOL_DENYLIST } from './agent-safe';
3
3
  export { AI_AGENT_OPERATIONS } from './ai-agents';
4
4
  export { CLI_CONTENT_OPERATIONS } from './cli-content';
5
5
  export { CONTENT_DEVELOPER_OPERATIONS } from './content-developer';
6
6
  export { CONTENT_GOVERNANCE_OPERATIONS } from './content-governance';
7
7
  export { CONTENT_READER_OPERATIONS } from './content-reader';
8
+ export { DATA_ANALYST_OPERATIONS } from './data-analyst';
8
9
  export { ORGANIZATION_AUDIT_OPERATIONS } from './organization-audit';
9
10
  export { SEMANTIC_LAYER_OPERATIONS } from './semantic-layer';
10
11
  export { USER_OPERATIONS } from './users';
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getClientMethodForOperation = exports.OPERATION_CLIENT_METHOD_MAP = exports.listOperations = exports.listMcpToolNamesByProfile = exports.listExposedMcpToolNames = exports.listBannedMcpToolNames = exports.getOperationsByProfile = exports.getOperationByMcpToolName = exports.getOperation = exports.USER_OPERATIONS = exports.SEMANTIC_LAYER_OPERATIONS = exports.ORGANIZATION_AUDIT_OPERATIONS = exports.CONTENT_READER_OPERATIONS = exports.CONTENT_GOVERNANCE_OPERATIONS = exports.CONTENT_DEVELOPER_OPERATIONS = exports.CLI_CONTENT_OPERATIONS = exports.AI_AGENT_OPERATIONS = exports.IRRECOVERABLE_TOOL_DENYLIST = exports.defineOperation = void 0;
3
+ exports.getClientMethodForOperation = exports.OPERATION_CLIENT_METHOD_MAP = exports.listOperations = exports.listMcpToolNamesByProfile = exports.listExposedMcpToolNames = exports.listBannedMcpToolNames = exports.getOperationsByProfile = exports.getOperationByMcpToolName = exports.getOperation = exports.USER_OPERATIONS = exports.SEMANTIC_LAYER_OPERATIONS = exports.ORGANIZATION_AUDIT_OPERATIONS = exports.DATA_ANALYST_OPERATIONS = exports.CONTENT_READER_OPERATIONS = exports.CONTENT_GOVERNANCE_OPERATIONS = exports.CONTENT_DEVELOPER_OPERATIONS = exports.CLI_CONTENT_OPERATIONS = exports.AI_AGENT_OPERATIONS = exports.IRRECOVERABLE_TOOL_DENYLIST = exports.PROFILE_IDS = exports.defineOperation = void 0;
4
4
  var types_1 = require("./types");
5
5
  Object.defineProperty(exports, "defineOperation", { enumerable: true, get: function () { return types_1.defineOperation; } });
6
+ Object.defineProperty(exports, "PROFILE_IDS", { enumerable: true, get: function () { return types_1.PROFILE_IDS; } });
6
7
  var agent_safe_1 = require("./agent-safe");
7
8
  Object.defineProperty(exports, "IRRECOVERABLE_TOOL_DENYLIST", { enumerable: true, get: function () { return agent_safe_1.IRRECOVERABLE_TOOL_DENYLIST; } });
8
9
  var ai_agents_1 = require("./ai-agents");
@@ -15,6 +16,8 @@ var content_governance_1 = require("./content-governance");
15
16
  Object.defineProperty(exports, "CONTENT_GOVERNANCE_OPERATIONS", { enumerable: true, get: function () { return content_governance_1.CONTENT_GOVERNANCE_OPERATIONS; } });
16
17
  var content_reader_1 = require("./content-reader");
17
18
  Object.defineProperty(exports, "CONTENT_READER_OPERATIONS", { enumerable: true, get: function () { return content_reader_1.CONTENT_READER_OPERATIONS; } });
19
+ var data_analyst_1 = require("./data-analyst");
20
+ Object.defineProperty(exports, "DATA_ANALYST_OPERATIONS", { enumerable: true, get: function () { return data_analyst_1.DATA_ANALYST_OPERATIONS; } });
18
21
  var organization_audit_1 = require("./organization-audit");
19
22
  Object.defineProperty(exports, "ORGANIZATION_AUDIT_OPERATIONS", { enumerable: true, get: function () { return organization_audit_1.ORGANIZATION_AUDIT_OPERATIONS; } });
20
23
  var semantic_layer_1 = require("./semantic-layer");
@@ -6,7 +6,7 @@ exports.ORGANIZATION_AUDIT_OPERATIONS = void 0;
6
6
  */
7
7
  const safety_1 = require("../safety");
8
8
  const types_1 = require("./types");
9
- const PROFILE_ORG_AUDIT = 'org-audit-readonly';
9
+ const PROFILE_ORG_AUDIT = 'organization-audit';
10
10
  const op_get_org_profile = (0, types_1.defineOperation)({
11
11
  id: 'org-audit.org.profile.get',
12
12
  summary: 'Get organization profile for the authenticated user',
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * Central operation catalog — aggregates domain modules and exposes lookup helpers.
3
3
  */
4
- import type { CapabilityProfile, OperationDescriptor } from './types';
4
+ import type { OperationDescriptor, ProfileId } from './types';
5
5
  /** Returns a registered operation by id, or undefined when not found. */
6
6
  export declare function getOperation(id: string): OperationDescriptor | undefined;
7
7
  /** Returns the agent operation registered for an MCP tool name (sans prefix), if any. */
8
8
  export declare function getOperationByMcpToolName(toolName: string): OperationDescriptor | undefined;
9
9
  /** Returns every registered operation descriptor. */
10
10
  export declare function listOperations(): readonly OperationDescriptor[];
11
- /** Returns agent-surface operations that include the given capability profile. */
12
- export declare function getOperationsByProfile(profile: CapabilityProfile): readonly OperationDescriptor[];
11
+ /** Returns agent-surface operations that include the given MCP serving profile. */
12
+ export declare function getOperationsByProfile(profile: ProfileId): readonly OperationDescriptor[];
13
13
  /** MCP tool names (sans prefix) with `mcp.taskSupport.exposed === true`. */
14
14
  export declare function listExposedMcpToolNames(): readonly string[];
15
15
  /** MCP tool names that must never be registered (client-only denylist). */
16
16
  export declare function listBannedMcpToolNames(): readonly string[];
17
- /** Exposed MCP tool names for a capability profile (persona allowlist source). */
18
- export declare function listMcpToolNamesByProfile(profile: CapabilityProfile): readonly string[];
17
+ /** Exposed MCP tool names for a serving profile (registration source, ADR-0006). */
18
+ export declare function listMcpToolNamesByProfile(profile: ProfileId): readonly string[];
@@ -15,8 +15,10 @@ const cli_content_1 = require("./cli-content");
15
15
  const content_developer_1 = require("./content-developer");
16
16
  const content_governance_1 = require("./content-governance");
17
17
  const content_reader_1 = require("./content-reader");
18
+ const data_analyst_1 = require("./data-analyst");
18
19
  const organization_audit_1 = require("./organization-audit");
19
20
  const semantic_layer_1 = require("./semantic-layer");
21
+ const types_1 = require("./types");
20
22
  const users_1 = require("./users");
21
23
  const AGENT_EXPOSURE_CLIENT_ONLY = 'client-only';
22
24
  const ALL_OPERATIONS = [
@@ -27,6 +29,7 @@ const ALL_OPERATIONS = [
27
29
  ...content_reader_1.CONTENT_READER_OPERATIONS,
28
30
  ...content_developer_1.CONTENT_DEVELOPER_OPERATIONS,
29
31
  ...content_governance_1.CONTENT_GOVERNANCE_OPERATIONS,
32
+ ...data_analyst_1.DATA_ANALYST_OPERATIONS,
30
33
  ...cli_content_1.CLI_CONTENT_OPERATIONS,
31
34
  ];
32
35
  const operationsById = new Map(ALL_OPERATIONS.map((operation) => [operation.id, operation]));
@@ -74,6 +77,31 @@ const BANNED_MCP_TOOL_NAMES = ALL_OPERATIONS.filter((operation) => operation.age
74
77
  }
75
78
  return banned;
76
79
  });
80
+ /** Precomputed tool names per serving profile (ADR-0006 registration source). */
81
+ const MCP_TOOL_NAMES_BY_PROFILE = (() => {
82
+ const map = new Map(types_1.PROFILE_IDS.map((id) => [id, []]));
83
+ for (const operation of ALL_OPERATIONS) {
84
+ if (operation.agentExposure === AGENT_EXPOSURE_CLIENT_ONLY) {
85
+ continue;
86
+ }
87
+ const mcp = operation.mcp;
88
+ if (mcp === undefined || mcp.taskSupport.exposed !== true) {
89
+ continue;
90
+ }
91
+ for (const profile of operation.profiles) {
92
+ const names = map.get(profile);
93
+ if (names === undefined) {
94
+ throw new Error(`Unknown profile '${profile}' on operation '${operation.id}' while indexing MCP tools`);
95
+ }
96
+ names.push(mcp.toolName);
97
+ }
98
+ }
99
+ for (const [id, names] of map) {
100
+ Object.freeze(names);
101
+ map.set(id, names);
102
+ }
103
+ return map;
104
+ })();
77
105
  /** Returns a registered operation by id, or undefined when not found. */
78
106
  function getOperation(id) {
79
107
  return operationsById.get(id);
@@ -86,7 +114,7 @@ function getOperationByMcpToolName(toolName) {
86
114
  function listOperations() {
87
115
  return ALL_OPERATIONS;
88
116
  }
89
- /** Returns agent-surface operations that include the given capability profile. */
117
+ /** Returns agent-surface operations that include the given MCP serving profile. */
90
118
  function getOperationsByProfile(profile) {
91
119
  return ALL_OPERATIONS.filter((operation) => operation.agentExposure !== 'client-only' && operation.profiles.includes(profile));
92
120
  }
@@ -98,13 +126,11 @@ function listExposedMcpToolNames() {
98
126
  function listBannedMcpToolNames() {
99
127
  return BANNED_MCP_TOOL_NAMES;
100
128
  }
101
- /** Exposed MCP tool names for a capability profile (persona allowlist source). */
129
+ /** Exposed MCP tool names for a serving profile (registration source, ADR-0006). */
102
130
  function listMcpToolNamesByProfile(profile) {
103
- return getOperationsByProfile(profile).flatMap((operation) => {
104
- const mcp = operation.mcp;
105
- if (mcp === undefined || mcp.taskSupport.exposed !== true) {
106
- return [];
107
- }
108
- return [mcp.toolName];
109
- });
131
+ const names = MCP_TOOL_NAMES_BY_PROFILE.get(profile);
132
+ if (names === undefined) {
133
+ throw new Error(`Unknown profile id: ${profile}`);
134
+ }
135
+ return names;
110
136
  }