@lightdash-tools/common 0.8.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/audit.d.ts +29 -8
  2. package/dist/audit.js +53 -9
  3. package/dist/audit.test.js +51 -24
  4. package/dist/env.d.ts +1 -1
  5. package/dist/env.js +2 -2
  6. package/dist/operations/ai-agents.js +108 -40
  7. package/dist/operations/cli-content.js +6 -8
  8. package/dist/operations/client-coverage.d.ts +7 -0
  9. package/dist/operations/client-coverage.js +13 -4
  10. package/dist/operations/content-developer.js +19 -5
  11. package/dist/operations/content-governance.js +1 -1
  12. package/dist/operations/content-reader.js +19 -4
  13. package/dist/operations/data-analyst.d.ts +5 -0
  14. package/dist/operations/data-analyst.js +23 -0
  15. package/dist/operations/index.d.ts +2 -1
  16. package/dist/operations/index.js +4 -1
  17. package/dist/operations/organization-audit.js +1 -1
  18. package/dist/operations/registry.d.ts +5 -5
  19. package/dist/operations/registry.js +35 -9
  20. package/dist/operations/registry.test.js +23 -45
  21. package/dist/operations/semantic-layer.js +8 -7
  22. package/dist/operations/types.d.ts +10 -6
  23. package/dist/operations/types.js +23 -14
  24. package/dist/operations/types.test.js +14 -5
  25. package/dist/operations/users.js +3 -5
  26. package/dist/safety.d.ts +3 -2
  27. package/dist/safety.js +11 -3
  28. package/dist/safety.test.js +29 -6
  29. package/package.json +1 -1
  30. package/src/audit.test.ts +70 -30
  31. package/src/audit.ts +78 -11
  32. package/src/env.ts +1 -1
  33. package/src/operations/ai-agents.ts +113 -41
  34. package/src/operations/cli-content.ts +7 -10
  35. package/src/operations/client-coverage.ts +14 -5
  36. package/src/operations/content-developer.ts +23 -7
  37. package/src/operations/content-governance.ts +3 -3
  38. package/src/operations/content-reader.ts +23 -7
  39. package/src/operations/data-analyst.ts +27 -0
  40. package/src/operations/index.ts +3 -1
  41. package/src/operations/organization-audit.ts +2 -2
  42. package/src/operations/registry.test.ts +31 -52
  43. package/src/operations/registry.ts +42 -12
  44. package/src/operations/semantic-layer.ts +9 -8
  45. package/src/operations/types.test.ts +34 -6
  46. package/src/operations/types.ts +41 -31
  47. package/src/operations/users.ts +4 -7
  48. package/src/safety.test.ts +32 -6
  49. package/src/safety.ts +15 -4
@@ -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,
@@ -19,6 +19,10 @@ export declare const OPERATION_CLIENT_METHOD_MAP: {
19
19
  readonly 'ai-agents.project.agents.create': "v1.aiAgents.createAgent";
20
20
  readonly 'ai-agents.project.agents.update': "v1.aiAgents.updateAgent";
21
21
  readonly 'ai-agents.project.agents.delete': "v1.aiAgents.deleteAgent";
22
+ readonly 'ai-agents.project.agents.evaluate-readiness': "v1.aiAgents.evaluateAgentReadiness";
23
+ readonly 'ai-agents.project.agents.suggestions': "v1.aiAgents.getAgentSuggestions";
24
+ readonly 'ai-agents.project.agents.models': "v1.aiAgents.getAgentModelOptions";
25
+ readonly 'ai-agents.project.explore-access-summary': "v1.aiAgents.getExploreAccessSummary";
22
26
  readonly 'ai-agents.project.threads.list': "v1.aiAgents.listAgentThreads";
23
27
  readonly 'ai-agents.project.threads.get': "v1.aiAgents.getAgentThread";
24
28
  readonly 'ai-agents.project.threads.start': "v1.aiAgents.startConversation";
@@ -71,12 +75,15 @@ export declare const OPERATION_CLIENT_METHOD_MAP: {
71
75
  readonly 'content-reader.parameters.get': "v2.parameters.getParameters";
72
76
  readonly 'content-reader.content.explain': "composed:v2.charts.getSavedChart+v2.dashboards.getDashboard";
73
77
  readonly 'content-reader.charts.run': "v2.query.runChartQuery";
78
+ readonly 'content-reader.charts.export-image': "composed:v1.charts.exportChartImagePng";
74
79
  readonly 'content-reader.dashboards.run-tile': "v2.query.runDashboardChartQuery";
75
80
  readonly 'content-reader.query.result.get': "v2.query.getAsyncQueryResults";
76
81
  readonly 'content-reader.query.cancel': "v2.query.cancelAsyncQuery";
82
+ readonly 'data-analyst.query.metric-query.run': "v2.query.runMetricQuery";
77
83
  readonly 'content-developer.preview.chart': "composed:v2.charts.getSavedChart";
78
84
  readonly 'content-developer.preview.dashboard': "composed:v2.dashboards.getDashboard";
79
85
  readonly 'content-developer.preview.content-move': "ledger:preview";
86
+ readonly 'content-developer.charts.get-as-code': "v1.charts.getChartsAsCode";
80
87
  readonly 'content-developer.charts.validate': "v1.validation.validateChart";
81
88
  readonly 'content-developer.dashboards.validate': "v1.validation.validateDashboard";
82
89
  readonly 'content-developer.preview.confirm': "ledger:preview";
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.OPERATION_CLIENT_METHOD_MAP = void 0;
9
9
  exports.getClientMethodForOperation = getClientMethodForOperation;
10
10
  const CLIENT_CHARTS_UPSERT_AS_CODE = 'v1.charts.upsertChartAsCode';
11
+ const CLIENT_CHARTS_GET_AS_CODE = 'v1.charts.getChartsAsCode';
11
12
  const CLIENT_DASHBOARDS_V2_UPDATE = 'v2.dashboards.updateDashboard';
12
13
  const CLIENT_CONTENT_SEARCH = 'v2.content.searchContent';
13
14
  const LEDGER_PREVIEW = 'ledger:preview';
@@ -27,6 +28,10 @@ exports.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',
@@ -83,13 +88,17 @@ exports.OPERATION_CLIENT_METHOD_MAP = {
83
88
  'content-reader.parameters.get': 'v2.parameters.getParameters',
84
89
  'content-reader.content.explain': 'composed:v2.charts.getSavedChart+v2.dashboards.getDashboard',
85
90
  'content-reader.charts.run': 'v2.query.runChartQuery',
91
+ 'content-reader.charts.export-image': 'composed:v1.charts.exportChartImagePng',
86
92
  'content-reader.dashboards.run-tile': 'v2.query.runDashboardChartQuery',
87
93
  'content-reader.query.result.get': 'v2.query.getAsyncQueryResults',
88
94
  'content-reader.query.cancel': 'v2.query.cancelAsyncQuery',
95
+ // data-analyst
96
+ 'data-analyst.query.metric-query.run': 'v2.query.runMetricQuery',
89
97
  // content-developer
90
98
  'content-developer.preview.chart': 'composed:v2.charts.getSavedChart',
91
99
  'content-developer.preview.dashboard': 'composed:v2.dashboards.getDashboard',
92
100
  'content-developer.preview.content-move': LEDGER_PREVIEW,
101
+ 'content-developer.charts.get-as-code': CLIENT_CHARTS_GET_AS_CODE,
93
102
  'content-developer.charts.validate': 'v1.validation.validateChart',
94
103
  'content-developer.dashboards.validate': 'v1.validation.validateDashboard',
95
104
  'content-developer.preview.confirm': LEDGER_PREVIEW,
@@ -97,7 +106,7 @@ exports.OPERATION_CLIENT_METHOD_MAP = {
97
106
  'content-developer.dashboards.compare-versions': 'composed:v2.dashboards.getDashboard+v1.dashboards.getDashboardHistory+v1.dashboards.getDashboardVersion',
98
107
  'content-developer.charts.create': CLIENT_CHARTS_UPSERT_AS_CODE,
99
108
  'content-developer.charts.update': CLIENT_CHARTS_UPSERT_AS_CODE,
100
- 'content-developer.charts.duplicate': 'composed:v1.charts.getChartsAsCode+v1.charts.upsertChartAsCode',
109
+ 'content-developer.charts.duplicate': `composed:${CLIENT_CHARTS_GET_AS_CODE}+${CLIENT_CHARTS_UPSERT_AS_CODE}`,
101
110
  'content-developer.dashboards.create': 'v1.dashboards.createDashboard',
102
111
  'content-developer.dashboards.update': CLIENT_DASHBOARDS_V2_UPDATE,
103
112
  'content-developer.dashboards.duplicate': 'v1.dashboards.createDashboard',
@@ -115,9 +124,9 @@ exports.OPERATION_CLIENT_METHOD_MAP = {
115
124
  'content-governance.dashboards.promote': 'v1.dashboards.promoteDashboard',
116
125
  'content-governance.content.permanent-delete': 'v2.content.permanentlyDeleteContent',
117
126
  // cli content
118
- 'cli.charts.list': 'v1.charts.getChartsAsCode',
119
- 'cli.charts.code.list': 'v1.charts.getChartsAsCode',
120
- 'cli.charts.code.upsert': 'v1.charts.upsertChartAsCode',
127
+ 'cli.charts.list': CLIENT_CHARTS_GET_AS_CODE,
128
+ 'cli.charts.code.list': CLIENT_CHARTS_GET_AS_CODE,
129
+ 'cli.charts.code.upsert': CLIENT_CHARTS_UPSERT_AS_CODE,
121
130
  'cli.dashboards.list': 'v1.dashboards.listDashboards',
122
131
  'cli.projects.validate.run': 'v1.validation.validateProject',
123
132
  'cli.projects.validate.results': 'v2.validation.listValidationResults',
@@ -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");
@@ -14,7 +14,7 @@ const PROFILE_CONTENT_DEVELOPER = 'content-developer';
14
14
  const API_V1 = '/api/v1';
15
15
  const API_V2 = '/api/v2';
16
16
  const WRITE_NONDESTRUCTIVE_IMPACT = 'write-nondestructive';
17
- const PREVIEW_DIFF_SUMMARY = 'Compute an in-memory diff and issue a single-use previewId (no upstream preview API)';
17
+ const PREVIEW_DIFF_SUMMARY = 'Compute an in-memory diff and issue an HMAC-signed previewToken (no upstream preview API)';
18
18
  const TILE_READ_SUMMARY = 'Read the current tile array (no per-tile REST route exists)';
19
19
  const op_preview_chart_changes = (0, types_1.defineOperation)({
20
20
  id: 'content-developer.preview.chart',
@@ -71,7 +71,7 @@ const op_preview_dashboard_changes = (0, types_1.defineOperation)({
71
71
  });
72
72
  const op_preview_content_move = (0, types_1.defineOperation)({
73
73
  id: 'content-developer.preview.content-move',
74
- summary: 'Preview a bulk content move into an existing space (MCP ledger only; issues a single-use previewId)',
74
+ summary: 'Preview a bulk content move into an existing space (issues an HMAC-signed previewToken)',
75
75
  http: { method: 'GET', path: `${API_V2}/content` },
76
76
  authorization: { safetyImpact: 'read' },
77
77
  sensitivity: 'none',
@@ -89,6 +89,19 @@ const op_preview_content_move = (0, types_1.defineOperation)({
89
89
  ],
90
90
  profiles: [PROFILE_CONTENT_DEVELOPER],
91
91
  });
92
+ const op_get_chart_as_code = (0, types_1.defineOperation)({
93
+ id: 'content-developer.charts.get-as-code',
94
+ summary: 'Get a chart in as-code (upsert) shape for cloning chartConfig/metricQuery before dashboard-scoped create',
95
+ http: { method: 'GET', path: `${API_V1}/projects/{projectUuid}/code/charts` },
96
+ authorization: { safetyImpact: 'read' },
97
+ sensitivity: 'none',
98
+ mcp: {
99
+ toolName: 'get_chart_as_code',
100
+ annotations: safety_1.READ_ONLY_DEFAULT,
101
+ taskSupport: { exposed: true, taskEligible: false },
102
+ },
103
+ profiles: [PROFILE_CONTENT_DEVELOPER],
104
+ });
92
105
  const op_validate_chart = (0, types_1.defineOperation)({
93
106
  id: 'content-developer.charts.validate',
94
107
  summary: "Validate a saved chart's fields against its underlying explore",
@@ -407,7 +420,7 @@ const op_create_space = (0, types_1.defineOperation)({
407
420
  sensitivity: 'none',
408
421
  agentExposure: 'client-only',
409
422
  bannedMcpToolName: 'create_space',
410
- profiles: [PROFILE_CONTENT_DEVELOPER],
423
+ profiles: [],
411
424
  });
412
425
  const op_update_space = (0, types_1.defineOperation)({
413
426
  id: 'content-developer.spaces.update',
@@ -417,7 +430,7 @@ const op_update_space = (0, types_1.defineOperation)({
417
430
  sensitivity: 'none',
418
431
  agentExposure: 'client-only',
419
432
  bannedMcpToolName: 'update_space',
420
- profiles: [PROFILE_CONTENT_DEVELOPER],
433
+ profiles: [],
421
434
  });
422
435
  const op_move_content = (0, types_1.defineOperation)({
423
436
  id: 'content-developer.content.move',
@@ -436,6 +449,7 @@ exports.CONTENT_DEVELOPER_OPERATIONS = [
436
449
  op_preview_chart_changes,
437
450
  op_preview_dashboard_changes,
438
451
  op_preview_content_move,
452
+ op_get_chart_as_code,
439
453
  op_validate_chart,
440
454
  op_validate_dashboard,
441
455
  op_confirm_preview,
@@ -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',
@@ -128,6 +129,19 @@ const op_run_chart = (0, types_1.defineOperation)({
128
129
  },
129
130
  profiles: [PROFILE_CONTENT_READER],
130
131
  });
132
+ const op_export_chart_image = (0, types_1.defineOperation)({
133
+ id: 'content-reader.charts.export-image',
134
+ summary: 'Export a saved chart as a PNG image snapshot',
135
+ http: { method: 'POST', path: '/api/v1/saved/{chartUuid}/export' },
136
+ authorization: { safetyImpact: 'read' },
137
+ sensitivity: 'none',
138
+ mcp: {
139
+ toolName: 'export_chart_image',
140
+ annotations: safety_1.READ_ONLY_TRANSIENT,
141
+ taskSupport: { exposed: true, taskEligible: false },
142
+ },
143
+ profiles: [PROFILE_CONTENT_READER],
144
+ });
131
145
  const op_run_dashboard_tile = (0, types_1.defineOperation)({
132
146
  id: 'content-reader.dashboards.run-tile',
133
147
  summary: 'Execute a dashboard tile with bounded results',
@@ -143,7 +157,7 @@ const op_run_dashboard_tile = (0, types_1.defineOperation)({
143
157
  });
144
158
  const op_get_query_result = (0, types_1.defineOperation)({
145
159
  id: 'content-reader.query.result.get',
146
- summary: 'Get or poll a session-owned query result',
160
+ summary: 'Get or poll a query result by queryUuid',
147
161
  http: { method: 'GET', path: '/api/v2/projects/{projectUuid}/query/{queryUuid}' },
148
162
  authorization: { safetyImpact: 'read' },
149
163
  sensitivity: 'none',
@@ -152,11 +166,11 @@ const op_get_query_result = (0, types_1.defineOperation)({
152
166
  annotations: safety_1.READ_ONLY_DEFAULT,
153
167
  taskSupport: { exposed: true, taskEligible: false },
154
168
  },
155
- profiles: [PROFILE_CONTENT_READER],
169
+ profiles: [PROFILE_CONTENT_READER, PROFILE_DATA_ANALYST],
156
170
  });
157
171
  const op_cancel_query = (0, types_1.defineOperation)({
158
172
  id: 'content-reader.query.cancel',
159
- summary: 'Cancel a running session-owned query',
173
+ summary: 'Cancel a running query by queryUuid',
160
174
  http: { method: 'POST', path: '/api/v2/projects/{projectUuid}/query/{queryUuid}/cancel' },
161
175
  authorization: { safetyImpact: 'read' },
162
176
  sensitivity: 'none',
@@ -165,7 +179,7 @@ const op_cancel_query = (0, types_1.defineOperation)({
165
179
  annotations: safety_1.READ_ONLY_TRANSIENT,
166
180
  taskSupport: { exposed: true, taskEligible: false },
167
181
  },
168
- profiles: [PROFILE_CONTENT_READER],
182
+ profiles: [PROFILE_CONTENT_READER, PROFILE_DATA_ANALYST],
169
183
  });
170
184
  exports.CONTENT_READER_OPERATIONS = [
171
185
  op_search_content,
@@ -177,6 +191,7 @@ exports.CONTENT_READER_OPERATIONS = [
177
191
  op_get_project_parameters,
178
192
  op_explain_content,
179
193
  op_run_chart,
194
+ op_export_chart_image,
180
195
  op_run_dashboard_tile,
181
196
  op_get_query_result,
182
197
  op_cancel_query,
@@ -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
  }
@@ -6,6 +6,7 @@ const cli_content_1 = require("./cli-content");
6
6
  const content_developer_1 = require("./content-developer");
7
7
  const content_governance_1 = require("./content-governance");
8
8
  const content_reader_1 = require("./content-reader");
9
+ const data_analyst_1 = require("./data-analyst");
9
10
  const organization_audit_1 = require("./organization-audit");
10
11
  const registry_1 = require("./registry");
11
12
  const semantic_layer_1 = require("./semantic-layer");
@@ -31,12 +32,7 @@ const P0_OPERATION_IDS = [
31
32
  'ai-agents.project.evaluations.run',
32
33
  'ai-agents.project.evaluations.runs.list',
33
34
  ];
34
- const ALL_PROFILES = [
35
- 'core-lifecycle',
36
- 'evaluations',
37
- 'conversations',
38
- 'discovery-readonly',
39
- ];
35
+ const ALL_PROFILES = [...types_1.PROFILE_IDS];
40
36
  function requiredFields(operation) {
41
37
  var _a;
42
38
  const agentExposure = (_a = operation.agentExposure) !== null && _a !== void 0 ? _a : 'agent';
@@ -77,9 +73,11 @@ function requiredFields(operation) {
77
73
  content_reader_1.CONTENT_READER_OPERATIONS.length +
78
74
  content_developer_1.CONTENT_DEVELOPER_OPERATIONS.length +
79
75
  content_governance_1.CONTENT_GOVERNANCE_OPERATIONS.length +
76
+ data_analyst_1.DATA_ANALYST_OPERATIONS.length +
80
77
  cli_content_1.CLI_CONTENT_OPERATIONS.length);
81
78
  });
82
79
  (0, vitest_1.it)('includes required descriptor fields on every operation', () => {
80
+ var _a;
83
81
  for (const operation of (0, registry_1.listOperations)()) {
84
82
  for (const field of requiredFields(operation)) {
85
83
  (0, vitest_1.expect)(field).toBeTruthy();
@@ -87,7 +85,13 @@ function requiredFields(operation) {
87
85
  if (operation.agentExposure === 'agent') {
88
86
  (0, vitest_1.expect)(operation.mcp !== undefined || operation.cli !== undefined).toBe(true);
89
87
  }
90
- (0, vitest_1.expect)(operation.profiles.length).toBeGreaterThan(0);
88
+ const mcpExposed = ((_a = operation.mcp) === null || _a === void 0 ? void 0 : _a.taskSupport.exposed) === true;
89
+ if (mcpExposed) {
90
+ (0, vitest_1.expect)(operation.profiles.length).toBeGreaterThan(0);
91
+ }
92
+ else {
93
+ (0, vitest_1.expect)(operation.profiles).toEqual([]);
94
+ }
91
95
  (0, vitest_1.expect)(operation.http.path.startsWith('/api/v1/') || operation.http.path.startsWith('/api/v2/')).toBe(true);
92
96
  }
93
97
  });
@@ -106,7 +110,7 @@ function requiredFields(operation) {
106
110
  }
107
111
  }
108
112
  });
109
- (0, vitest_1.it)('exposes profile filters for all capability profiles', () => {
113
+ (0, vitest_1.it)('exposes profile filters for all serving profiles', () => {
110
114
  for (const profile of ALL_PROFILES) {
111
115
  const operations = (0, registry_1.getOperationsByProfile)(profile);
112
116
  (0, vitest_1.expect)(operations.length).toBeGreaterThan(0);
@@ -115,23 +119,18 @@ function requiredFields(operation) {
115
119
  }
116
120
  }
117
121
  });
118
- (0, vitest_1.it)('maps agent CRUD to core-lifecycle profile', () => {
119
- const crudIds = [
120
- 'ai-agents.project.agents.list',
121
- 'ai-agents.project.agents.get',
122
- 'ai-agents.project.agents.create',
123
- 'ai-agents.project.agents.update',
124
- 'ai-agents.project.agents.delete',
125
- ];
126
- for (const id of crudIds) {
127
- const operation = (0, registry_1.getOperation)(id);
128
- (0, vitest_1.expect)(operation === null || operation === void 0 ? void 0 : operation.profiles).toContain('core-lifecycle');
122
+ (0, vitest_1.it)('listMcpToolNamesByProfile matches exposed ops per profile', () => {
123
+ for (const profile of ALL_PROFILES) {
124
+ const toolNames = (0, registry_1.listMcpToolNamesByProfile)(profile);
125
+ const exposedOps = (0, registry_1.getOperationsByProfile)(profile).filter((operation) => { var _a; return ((_a = operation.mcp) === null || _a === void 0 ? void 0 : _a.taskSupport.exposed) === true; });
126
+ (0, vitest_1.expect)(toolNames).toHaveLength(exposedOps.length);
127
+ (0, vitest_1.expect)(new Set(toolNames).size).toBe(toolNames.length);
129
128
  }
130
129
  });
131
- (0, vitest_1.it)('maps thread start and continue to conversations profile', () => {
130
+ (0, vitest_1.it)('maps exposed ai-agent-ops tools to ai-agent-ops profile only', () => {
132
131
  var _a, _b;
133
- (0, vitest_1.expect)((_a = (0, registry_1.getOperation)('ai-agents.project.threads.start')) === null || _a === void 0 ? void 0 : _a.profiles).toContain('conversations');
134
- (0, vitest_1.expect)((_b = (0, registry_1.getOperation)('ai-agents.project.threads.continue')) === null || _b === void 0 ? void 0 : _b.profiles).toContain('conversations');
132
+ (0, vitest_1.expect)((_a = (0, registry_1.getOperation)('ai-agents.project.agents.list')) === null || _a === void 0 ? void 0 : _a.profiles).toEqual(['ai-agent-ops']);
133
+ (0, vitest_1.expect)((_b = (0, registry_1.getOperation)('ai-agents.project.agents.create')) === null || _b === void 0 ? void 0 : _b.profiles).toEqual([]);
135
134
  });
136
135
  (0, vitest_1.it)('documents multi-step workflow for thread start', () => {
137
136
  var _a, _b;
@@ -149,25 +148,9 @@ function requiredFields(operation) {
149
148
  (0, vitest_1.expect)((_b = (_a = operation === null || operation === void 0 ? void 0 : operation.workflow) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.path).toContain('/messages');
150
149
  (0, vitest_1.expect)((_d = (_c = operation === null || operation === void 0 ? void 0 : operation.workflow) === null || _c === void 0 ? void 0 : _c[1]) === null || _d === void 0 ? void 0 : _d.path).toContain('/generate');
151
150
  });
152
- (0, vitest_1.it)('maps evaluation lifecycle operations to evaluations profile', () => {
153
- var _a;
154
- const evalIds = [
155
- 'ai-agents.project.evaluations.create',
156
- 'ai-agents.project.evaluations.append',
157
- 'ai-agents.project.evaluations.run',
158
- 'ai-agents.project.evaluations.runs.list',
159
- ];
160
- for (const id of evalIds) {
161
- (0, vitest_1.expect)((_a = (0, registry_1.getOperation)(id)) === null || _a === void 0 ? void 0 : _a.profiles).toContain('evaluations');
162
- }
163
- });
164
151
  (0, vitest_1.it)('returns undefined for unknown operation id', () => {
165
152
  (0, vitest_1.expect)((0, registry_1.getOperation)('ai-agents.unknown.operation')).toBeUndefined();
166
153
  });
167
- (0, vitest_1.it)('filters operations by profile with empty result for unknown profile usage', () => {
168
- const ops = (0, registry_1.getOperationsByProfile)('core-lifecycle');
169
- (0, vitest_1.expect)(ops.every((op) => op.profiles.includes('core-lifecycle'))).toBe(true);
170
- });
171
154
  (0, vitest_1.it)('registers users.members.delete as client-only', () => {
172
155
  const operation = (0, registry_1.getOperation)('users.members.delete');
173
156
  (0, vitest_1.expect)(operation === null || operation === void 0 ? void 0 : operation.agentExposure).toBe('client-only');
@@ -175,6 +158,7 @@ function requiredFields(operation) {
175
158
  (0, vitest_1.expect)(operation === null || operation === void 0 ? void 0 : operation.cli).toBeUndefined();
176
159
  (0, vitest_1.expect)(operation === null || operation === void 0 ? void 0 : operation.bannedMcpToolName).toBe('delete_member');
177
160
  (0, vitest_1.expect)(operation === null || operation === void 0 ? void 0 : operation.http.path).toBe('/api/v1/org/user/{userUuid}');
161
+ (0, vitest_1.expect)(operation === null || operation === void 0 ? void 0 : operation.profiles).toEqual([]);
178
162
  });
179
163
  (0, vitest_1.it)('excludes client-only operations from profile discovery catalogs', () => {
180
164
  for (const profile of ALL_PROFILES) {
@@ -183,12 +167,6 @@ function requiredFields(operation) {
183
167
  }
184
168
  }
185
169
  (0, vitest_1.expect)((0, registry_1.getOperation)('users.members.delete')).toBeDefined();
186
- (0, vitest_1.expect)((0, registry_1.getOperationsByProfile)('discovery-readonly').some((op) => op.id === 'users.members.delete')).toBe(false);
187
- });
188
- (0, vitest_1.it)('keeps discovery-readonly profile operations read-only', () => {
189
- for (const operation of (0, registry_1.getOperationsByProfile)('discovery-readonly')) {
190
- (0, vitest_1.expect)(operation.authorization.safetyImpact).toBe('read');
191
- }
192
170
  });
193
171
  (0, vitest_1.it)('never exposes client-only operations on MCP', () => {
194
172
  for (const operation of (0, registry_1.listOperations)()) {
@@ -217,7 +195,7 @@ function requiredFields(operation) {
217
195
  },
218
196
  cli: { commandPath: 'test' },
219
197
  agentExposure: 'agent',
220
- profiles: ['discovery-readonly'],
198
+ profiles: ['semantic-layer'],
221
199
  })).toThrow(/authorization\.safetyImpact/);
222
200
  });
223
201
  });