@lightdash-tools/common 0.7.0 → 0.8.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 (63) hide show
  1. package/dist/argument-validation.js +20 -2
  2. package/dist/argument-validation.test.js +22 -0
  3. package/dist/audit.d.ts +1 -1
  4. package/dist/index.d.ts +1 -3
  5. package/dist/index.js +6 -8
  6. package/dist/operations/agent-safe.d.ts +1 -3
  7. package/dist/operations/agent-safe.js +2 -9
  8. package/dist/operations/ai-agents.js +45 -29
  9. package/dist/operations/cli-content.d.ts +5 -0
  10. package/dist/operations/cli-content.js +71 -0
  11. package/dist/operations/client-coverage.d.ts +113 -0
  12. package/dist/operations/client-coverage.js +130 -0
  13. package/dist/operations/client-coverage.test.d.ts +1 -0
  14. package/dist/operations/client-coverage.test.js +22 -0
  15. package/dist/operations/content-developer.d.ts +2 -0
  16. package/dist/operations/content-developer.js +457 -0
  17. package/dist/operations/content-governance.d.ts +7 -0
  18. package/dist/operations/content-governance.js +98 -0
  19. package/dist/operations/content-reader.d.ts +2 -0
  20. package/dist/operations/content-reader.js +183 -0
  21. package/dist/operations/index.d.ts +10 -3
  22. package/dist/operations/index.js +20 -2
  23. package/dist/operations/organization-audit.d.ts +2 -0
  24. package/dist/operations/organization-audit.js +273 -0
  25. package/dist/operations/parity.test.js +12 -11
  26. package/dist/operations/registry.d.ts +9 -1
  27. package/dist/operations/registry.js +77 -2
  28. package/dist/operations/registry.test.js +38 -11
  29. package/dist/operations/semantic-layer.d.ts +6 -0
  30. package/dist/operations/semantic-layer.js +154 -0
  31. package/dist/operations/types.d.ts +29 -12
  32. package/dist/operations/types.js +63 -29
  33. package/dist/operations/types.test.js +33 -45
  34. package/dist/operations/users.d.ts +2 -2
  35. package/dist/operations/users.js +8 -10
  36. package/dist/safety.d.ts +5 -0
  37. package/dist/safety.js +11 -1
  38. package/dist/types/index.d.ts +12 -0
  39. package/dist/types/index.js +29 -0
  40. package/package.json +2 -1
  41. package/src/argument-validation.test.ts +31 -0
  42. package/src/argument-validation.ts +20 -2
  43. package/src/audit.ts +12 -1
  44. package/src/index.ts +5 -9
  45. package/src/operations/agent-safe.ts +2 -12
  46. package/src/operations/ai-agents.ts +46 -30
  47. package/src/operations/cli-content.ts +79 -0
  48. package/src/operations/client-coverage.test.ts +23 -0
  49. package/src/operations/client-coverage.ts +147 -0
  50. package/src/operations/content-developer.ts +485 -0
  51. package/src/operations/content-governance.ts +110 -0
  52. package/src/operations/content-reader.ts +197 -0
  53. package/src/operations/index.ts +25 -2
  54. package/src/operations/organization-audit.ts +293 -0
  55. package/src/operations/parity.test.ts +12 -14
  56. package/src/operations/registry.test.ts +40 -9
  57. package/src/operations/registry.ts +86 -2
  58. package/src/operations/semantic-layer.ts +166 -0
  59. package/src/operations/types.test.ts +38 -76
  60. package/src/operations/types.ts +110 -47
  61. package/src/operations/users.ts +9 -11
  62. package/src/safety.ts +11 -0
  63. package/src/types/index.ts +13 -0
@@ -0,0 +1,197 @@
1
+ /**
2
+ * Content-reader operations in the shared operation catalog (ADR-0013).
3
+ */
4
+ import { READ_ONLY_DEFAULT, READ_ONLY_TRANSIENT } from '../safety';
5
+
6
+ import { defineOperation } from './types';
7
+
8
+ import type { CapabilityProfile, OperationDescriptor } from './types';
9
+
10
+ const PROFILE_CONTENT_READER: CapabilityProfile = 'content-reader';
11
+ const PROFILE_CONTENT_DEVELOPER: CapabilityProfile = 'content-developer';
12
+
13
+ const op_search_content = defineOperation({
14
+ id: 'content-reader.content.search',
15
+ summary: 'Search charts dashboards and spaces in a project',
16
+ http: { method: 'GET', path: '/api/v2/content' },
17
+ authorization: { safetyImpact: 'read' },
18
+ sensitivity: 'none',
19
+ mcp: {
20
+ toolName: 'search_content',
21
+ annotations: READ_ONLY_DEFAULT,
22
+ taskSupport: { exposed: true, taskEligible: false },
23
+ },
24
+ cli: { commandPath: 'content search' },
25
+ profiles: [PROFILE_CONTENT_READER, PROFILE_CONTENT_DEVELOPER],
26
+ });
27
+
28
+ const op_list_spaces = defineOperation({
29
+ id: 'content-reader.spaces.list',
30
+ summary: 'List project spaces',
31
+ http: { method: 'GET', path: '/api/v1/projects/{projectUuid}/spaces' },
32
+ authorization: { safetyImpact: 'read' },
33
+ sensitivity: 'none',
34
+ mcp: {
35
+ toolName: 'list_spaces',
36
+ annotations: READ_ONLY_DEFAULT,
37
+ taskSupport: { exposed: true, taskEligible: false },
38
+ },
39
+ cli: { commandPath: 'projects spaces list' },
40
+ profiles: [PROFILE_CONTENT_READER, PROFILE_CONTENT_DEVELOPER],
41
+ });
42
+
43
+ const op_get_space = defineOperation({
44
+ id: 'content-reader.spaces.get',
45
+ summary: 'Get a space with breadcrumbs and content summaries',
46
+ http: { method: 'GET', path: '/api/v1/projects/{projectUuid}/spaces/{spaceUuid}' },
47
+ authorization: { safetyImpact: 'read' },
48
+ sensitivity: 'none',
49
+ mcp: {
50
+ toolName: 'get_space',
51
+ annotations: READ_ONLY_DEFAULT,
52
+ taskSupport: { exposed: true, taskEligible: false },
53
+ },
54
+ cli: { commandPath: 'projects spaces get' },
55
+ profiles: [PROFILE_CONTENT_READER, PROFILE_CONTENT_DEVELOPER],
56
+ });
57
+
58
+ const op_get_dashboard = defineOperation({
59
+ id: 'content-reader.dashboards.get',
60
+ summary: 'Get dashboard structure before tile execution',
61
+ http: { method: 'GET', path: '/api/v2/projects/{projectUuid}/dashboards/{dashboardUuidOrSlug}' },
62
+ authorization: { safetyImpact: 'read' },
63
+ sensitivity: 'none',
64
+ mcp: {
65
+ toolName: 'get_dashboard',
66
+ annotations: READ_ONLY_DEFAULT,
67
+ taskSupport: { exposed: true, taskEligible: false },
68
+ },
69
+ profiles: [PROFILE_CONTENT_READER, PROFILE_CONTENT_DEVELOPER],
70
+ });
71
+
72
+ const op_get_chart = defineOperation({
73
+ id: 'content-reader.charts.get',
74
+ summary: 'Get a saved chart definition',
75
+ http: { method: 'GET', path: '/api/v2/projects/{projectUuid}/saved/{chartUuidOrSlug}' },
76
+ authorization: { safetyImpact: 'read' },
77
+ sensitivity: 'none',
78
+ mcp: {
79
+ toolName: 'get_chart',
80
+ annotations: READ_ONLY_DEFAULT,
81
+ taskSupport: { exposed: true, taskEligible: false },
82
+ },
83
+ profiles: [PROFILE_CONTENT_READER, PROFILE_CONTENT_DEVELOPER],
84
+ });
85
+
86
+ const op_list_project_parameters = defineOperation({
87
+ id: 'content-reader.parameters.list',
88
+ summary: 'List project parameter definitions',
89
+ http: { method: 'GET', path: '/api/v2/projects/{projectUuid}/parameters/list' },
90
+ authorization: { safetyImpact: 'read' },
91
+ sensitivity: 'none',
92
+ mcp: {
93
+ toolName: 'list_project_parameters',
94
+ annotations: READ_ONLY_DEFAULT,
95
+ taskSupport: { exposed: true, taskEligible: false },
96
+ },
97
+ profiles: [PROFILE_CONTENT_READER],
98
+ });
99
+
100
+ const op_get_project_parameters = defineOperation({
101
+ id: 'content-reader.parameters.get',
102
+ summary: 'Get project parameters by name',
103
+ http: { method: 'GET', path: '/api/v2/projects/{projectUuid}/parameters' },
104
+ authorization: { safetyImpact: 'read' },
105
+ sensitivity: 'none',
106
+ mcp: {
107
+ toolName: 'get_project_parameters',
108
+ annotations: READ_ONLY_DEFAULT,
109
+ taskSupport: { exposed: true, taskEligible: false },
110
+ },
111
+ profiles: [PROFILE_CONTENT_READER],
112
+ });
113
+
114
+ const op_explain_content = defineOperation({
115
+ id: 'content-reader.content.explain',
116
+ summary: 'Explain saved content from metadata',
117
+ http: { method: 'GET', path: '/api/v2/content' },
118
+ authorization: { safetyImpact: 'read' },
119
+ sensitivity: 'none',
120
+ mcp: {
121
+ toolName: 'explain_content',
122
+ annotations: READ_ONLY_DEFAULT,
123
+ taskSupport: { exposed: true, taskEligible: false },
124
+ },
125
+ profiles: [PROFILE_CONTENT_READER],
126
+ });
127
+
128
+ const op_run_chart = defineOperation({
129
+ id: 'content-reader.charts.run',
130
+ summary: 'Execute a saved semantic chart with bounded results',
131
+ http: { method: 'POST', path: '/api/v2/projects/{projectUuid}/query/chart' },
132
+ authorization: { safetyImpact: 'read' },
133
+ sensitivity: 'none',
134
+ mcp: {
135
+ toolName: 'run_chart',
136
+ annotations: READ_ONLY_TRANSIENT,
137
+ taskSupport: { exposed: true, taskEligible: false },
138
+ },
139
+ profiles: [PROFILE_CONTENT_READER],
140
+ });
141
+
142
+ const op_run_dashboard_tile = defineOperation({
143
+ id: 'content-reader.dashboards.run-tile',
144
+ summary: 'Execute a dashboard tile with bounded results',
145
+ http: { method: 'POST', path: '/api/v2/projects/{projectUuid}/query/dashboard-chart' },
146
+ authorization: { safetyImpact: 'read' },
147
+ sensitivity: 'none',
148
+ mcp: {
149
+ toolName: 'run_dashboard_tile',
150
+ annotations: READ_ONLY_TRANSIENT,
151
+ taskSupport: { exposed: true, taskEligible: false },
152
+ },
153
+ profiles: [PROFILE_CONTENT_READER],
154
+ });
155
+
156
+ const op_get_query_result = defineOperation({
157
+ id: 'content-reader.query.result.get',
158
+ summary: 'Get or poll a session-owned query result',
159
+ http: { method: 'GET', path: '/api/v2/projects/{projectUuid}/query/{queryUuid}' },
160
+ authorization: { safetyImpact: 'read' },
161
+ sensitivity: 'none',
162
+ mcp: {
163
+ toolName: 'get_query_result',
164
+ annotations: READ_ONLY_DEFAULT,
165
+ taskSupport: { exposed: true, taskEligible: false },
166
+ },
167
+ profiles: [PROFILE_CONTENT_READER],
168
+ });
169
+
170
+ const op_cancel_query = defineOperation({
171
+ id: 'content-reader.query.cancel',
172
+ summary: 'Cancel a running session-owned query',
173
+ http: { method: 'POST', path: '/api/v2/projects/{projectUuid}/query/{queryUuid}/cancel' },
174
+ authorization: { safetyImpact: 'read' },
175
+ sensitivity: 'none',
176
+ mcp: {
177
+ toolName: 'cancel_query',
178
+ annotations: READ_ONLY_TRANSIENT,
179
+ taskSupport: { exposed: true, taskEligible: false },
180
+ },
181
+ profiles: [PROFILE_CONTENT_READER],
182
+ });
183
+
184
+ export const CONTENT_READER_OPERATIONS: readonly OperationDescriptor[] = [
185
+ op_search_content,
186
+ op_list_spaces,
187
+ op_get_space,
188
+ op_get_dashboard,
189
+ op_get_chart,
190
+ op_list_project_parameters,
191
+ op_get_project_parameters,
192
+ op_explain_content,
193
+ op_run_chart,
194
+ op_run_dashboard_tile,
195
+ op_get_query_result,
196
+ op_cancel_query,
197
+ ];
@@ -6,14 +6,37 @@ export {
6
6
  type McpTaskSupport,
7
7
  type OperationAuthorization,
8
8
  type OperationCli,
9
+ type OperationDefinitionInput,
9
10
  type OperationDescriptor,
10
11
  type OperationHttp,
11
12
  type OperationMcp,
13
+ type SensitivityClass,
12
14
  } from './types';
13
15
 
14
- export { IRRECOVERABLE_TOOL_DENYLIST, listBannedMcpToolNames } from './agent-safe';
16
+ export { IRRECOVERABLE_TOOL_DENYLIST } from './agent-safe';
15
17
 
16
18
  export { AI_AGENT_OPERATIONS } from './ai-agents';
19
+ export { CLI_CONTENT_OPERATIONS } from './cli-content';
20
+ export { CONTENT_DEVELOPER_OPERATIONS } from './content-developer';
21
+ export { CONTENT_GOVERNANCE_OPERATIONS } from './content-governance';
22
+ export { CONTENT_READER_OPERATIONS } from './content-reader';
23
+ export { ORGANIZATION_AUDIT_OPERATIONS } from './organization-audit';
24
+ export { SEMANTIC_LAYER_OPERATIONS } from './semantic-layer';
17
25
  export { USER_OPERATIONS } from './users';
18
26
 
19
- export { getOperation, getOperationsByProfile, listOperations } from './registry';
27
+ export {
28
+ getOperation,
29
+ getOperationByMcpToolName,
30
+ getOperationsByProfile,
31
+ listBannedMcpToolNames,
32
+ listExposedMcpToolNames,
33
+ listMcpToolNamesByProfile,
34
+ listOperations,
35
+ } from './registry';
36
+
37
+ export {
38
+ OPERATION_CLIENT_METHOD_MAP,
39
+ getClientMethodForOperation,
40
+ type CataloguedOperationId,
41
+ type ClientMethodRef,
42
+ } from './client-coverage';
@@ -0,0 +1,293 @@
1
+ /**
2
+ * Organization-audit operations in the shared operation catalog (ADR-0013).
3
+ */
4
+ import { READ_ONLY_DEFAULT } from '../safety';
5
+
6
+ import { defineOperation } from './types';
7
+
8
+ import type { CapabilityProfile, OperationDescriptor } from './types';
9
+
10
+ const PROFILE_ORG_AUDIT: CapabilityProfile = 'org-audit-readonly';
11
+
12
+ const op_get_org_profile = defineOperation({
13
+ id: 'org-audit.org.profile.get',
14
+ summary: 'Get organization profile for the authenticated user',
15
+ http: { method: 'GET', path: '/api/v1/org' },
16
+ authorization: { safetyImpact: 'read' },
17
+ sensitivity: 'none',
18
+ mcp: {
19
+ toolName: 'get_org_profile',
20
+ annotations: READ_ONLY_DEFAULT,
21
+ taskSupport: { exposed: true, taskEligible: false },
22
+ },
23
+ cli: { commandPath: 'organization get' },
24
+ profiles: [PROFILE_ORG_AUDIT],
25
+ });
26
+
27
+ const op_list_org_members = defineOperation({
28
+ id: 'org-audit.members.list',
29
+ summary: 'List organization members',
30
+ http: { method: 'GET', path: '/api/v1/org/users' },
31
+ authorization: { safetyImpact: 'read' },
32
+ sensitivity: 'pii.email',
33
+ mcp: {
34
+ toolName: 'list_org_members',
35
+ annotations: READ_ONLY_DEFAULT,
36
+ taskSupport: { exposed: true, taskEligible: false },
37
+ },
38
+ cli: { commandPath: 'users list' },
39
+ profiles: [PROFILE_ORG_AUDIT],
40
+ });
41
+
42
+ const op_get_org_member = defineOperation({
43
+ id: 'org-audit.members.get',
44
+ summary: 'Get an organization member by UUID',
45
+ http: { method: 'GET', path: '/api/v1/org/users/{userUuid}' },
46
+ authorization: { safetyImpact: 'read' },
47
+ sensitivity: 'pii.email',
48
+ mcp: {
49
+ toolName: 'get_org_member',
50
+ annotations: READ_ONLY_DEFAULT,
51
+ taskSupport: { exposed: true, taskEligible: false },
52
+ },
53
+ cli: { commandPath: 'users get' },
54
+ profiles: [PROFILE_ORG_AUDIT],
55
+ });
56
+
57
+ const op_list_org_groups = defineOperation({
58
+ id: 'org-audit.groups.list',
59
+ summary: 'List organization groups',
60
+ http: { method: 'GET', path: '/api/v1/org/groups' },
61
+ authorization: { safetyImpact: 'read' },
62
+ sensitivity: 'pii.email',
63
+ mcp: {
64
+ toolName: 'list_org_groups',
65
+ annotations: READ_ONLY_DEFAULT,
66
+ taskSupport: { exposed: true, taskEligible: false },
67
+ },
68
+ cli: { commandPath: 'groups list' },
69
+ profiles: [PROFILE_ORG_AUDIT],
70
+ });
71
+
72
+ const op_list_org_projects = defineOperation({
73
+ id: 'org-audit.projects.list',
74
+ summary: 'List organization projects without connection secrets',
75
+ http: { method: 'GET', path: '/api/v1/org/projects' },
76
+ authorization: { safetyImpact: 'read' },
77
+ sensitivity: 'secret.connection',
78
+ mcp: {
79
+ toolName: 'list_org_projects',
80
+ annotations: READ_ONLY_DEFAULT,
81
+ taskSupport: { exposed: true, taskEligible: false },
82
+ },
83
+ cli: { commandPath: 'projects list' },
84
+ profiles: [PROFILE_ORG_AUDIT],
85
+ });
86
+
87
+ const op_list_org_role_assignments = defineOperation({
88
+ id: 'org-audit.roles.assignments.list',
89
+ summary: 'List organization role assignments',
90
+ http: { method: 'GET', path: '/api/v2/orgs/{orgUuid}/roles/assignments' },
91
+ authorization: { safetyImpact: 'read' },
92
+ sensitivity: 'none',
93
+ mcp: {
94
+ toolName: 'list_org_role_assignments',
95
+ annotations: READ_ONLY_DEFAULT,
96
+ taskSupport: { exposed: true, taskEligible: false },
97
+ },
98
+ profiles: [PROFILE_ORG_AUDIT],
99
+ });
100
+
101
+ const op_list_custom_roles = defineOperation({
102
+ id: 'org-audit.roles.list',
103
+ summary: 'List organization custom and system roles',
104
+ http: { method: 'GET', path: '/api/v2/orgs/{orgUuid}/roles' },
105
+ authorization: { safetyImpact: 'read' },
106
+ sensitivity: 'none',
107
+ mcp: {
108
+ toolName: 'list_custom_roles',
109
+ annotations: READ_ONLY_DEFAULT,
110
+ taskSupport: { exposed: true, taskEligible: false },
111
+ },
112
+ profiles: [PROFILE_ORG_AUDIT],
113
+ });
114
+
115
+ const op_get_custom_role = defineOperation({
116
+ id: 'org-audit.roles.get',
117
+ summary: 'Get a role including scopes',
118
+ http: { method: 'GET', path: '/api/v2/orgs/{orgUuid}/roles/{roleUuid}' },
119
+ authorization: { safetyImpact: 'read' },
120
+ sensitivity: 'none',
121
+ mcp: {
122
+ toolName: 'get_custom_role',
123
+ annotations: READ_ONLY_DEFAULT,
124
+ taskSupport: { exposed: true, taskEligible: false },
125
+ },
126
+ profiles: [PROFILE_ORG_AUDIT],
127
+ });
128
+
129
+ const op_list_project_roles = defineOperation({
130
+ id: 'org-audit.project.roles.list',
131
+ summary: 'List project role assignments',
132
+ http: { method: 'GET', path: '/api/v2/projects/{projectId}/roles/assignments' },
133
+ authorization: { safetyImpact: 'read' },
134
+ sensitivity: 'none',
135
+ mcp: {
136
+ toolName: 'list_project_roles',
137
+ annotations: READ_ONLY_DEFAULT,
138
+ taskSupport: { exposed: true, taskEligible: false },
139
+ },
140
+ cli: { commandPath: 'projects roles list' },
141
+ profiles: [PROFILE_ORG_AUDIT],
142
+ });
143
+
144
+ const op_list_project_direct_access = defineOperation({
145
+ id: 'org-audit.project.access.list',
146
+ summary: 'List direct project user access grants',
147
+ http: { method: 'GET', path: '/api/v1/projects/{projectUuid}/access' },
148
+ authorization: { safetyImpact: 'read' },
149
+ sensitivity: 'pii.email',
150
+ mcp: {
151
+ toolName: 'list_project_direct_access',
152
+ annotations: READ_ONLY_DEFAULT,
153
+ taskSupport: { exposed: true, taskEligible: false },
154
+ },
155
+ cli: { commandPath: 'projects access list' },
156
+ profiles: [PROFILE_ORG_AUDIT],
157
+ });
158
+
159
+ const op_list_space_access = defineOperation({
160
+ id: 'org-audit.space.access.list',
161
+ summary: 'Compose space ACL from space list/get',
162
+ http: { method: 'GET', path: '/api/v1/projects/{projectUuid}/spaces' },
163
+ authorization: { safetyImpact: 'read' },
164
+ sensitivity: 'none',
165
+ mcp: {
166
+ toolName: 'list_space_access',
167
+ annotations: READ_ONLY_DEFAULT,
168
+ taskSupport: { exposed: true, taskEligible: false },
169
+ },
170
+ profiles: [PROFILE_ORG_AUDIT],
171
+ });
172
+
173
+ const op_resolve_effective_access = defineOperation({
174
+ id: 'org-audit.access.resolve',
175
+ summary: 'Best-effort effective access composition',
176
+ http: { method: 'GET', path: '/api/v2/orgs/{orgUuid}/roles/assignments' },
177
+ authorization: { safetyImpact: 'read' },
178
+ sensitivity: 'none',
179
+ mcp: {
180
+ toolName: 'resolve_effective_access',
181
+ annotations: READ_ONLY_DEFAULT,
182
+ taskSupport: { exposed: true, taskEligible: false },
183
+ },
184
+ profiles: [PROFILE_ORG_AUDIT],
185
+ });
186
+
187
+ const op_list_content = defineOperation({
188
+ id: 'org-audit.content.list',
189
+ summary: 'List charts dashboards and spaces',
190
+ http: { method: 'GET', path: '/api/v2/content' },
191
+ authorization: { safetyImpact: 'read' },
192
+ sensitivity: 'none',
193
+ mcp: {
194
+ toolName: 'list_content',
195
+ annotations: READ_ONLY_DEFAULT,
196
+ taskSupport: { exposed: true, taskEligible: false },
197
+ },
198
+ cli: { commandPath: 'content search' },
199
+ profiles: [PROFILE_ORG_AUDIT],
200
+ });
201
+
202
+ const op_get_dashboard_meta = defineOperation({
203
+ id: 'org-audit.dashboards.meta.get',
204
+ summary: 'Get dashboard metadata without executing queries',
205
+ http: { method: 'GET', path: '/api/v2/projects/{projectUuid}/dashboards/{dashboardUuidOrSlug}' },
206
+ authorization: { safetyImpact: 'read' },
207
+ sensitivity: 'none',
208
+ mcp: {
209
+ toolName: 'get_dashboard_meta',
210
+ annotations: READ_ONLY_DEFAULT,
211
+ taskSupport: { exposed: true, taskEligible: false },
212
+ },
213
+ profiles: [PROFILE_ORG_AUDIT],
214
+ });
215
+
216
+ const op_list_validation_results = defineOperation({
217
+ id: 'org-audit.validation.list',
218
+ summary: 'List project validation failures',
219
+ http: { method: 'GET', path: '/api/v2/projects/{projectUuid}/validate' },
220
+ authorization: { safetyImpact: 'read' },
221
+ sensitivity: 'none',
222
+ mcp: {
223
+ toolName: 'list_validation_results',
224
+ annotations: READ_ONLY_DEFAULT,
225
+ taskSupport: { exposed: true, taskEligible: false },
226
+ },
227
+ profiles: [PROFILE_ORG_AUDIT],
228
+ });
229
+
230
+ const op_get_project_user_activity = defineOperation({
231
+ id: 'org-audit.analytics.user-activity.get',
232
+ summary: 'Get project user activity analytics',
233
+ http: { method: 'GET', path: '/api/v1/analytics/user-activity/{projectUuid}' },
234
+ authorization: { safetyImpact: 'read' },
235
+ sensitivity: 'none',
236
+ mcp: {
237
+ toolName: 'get_project_user_activity',
238
+ annotations: READ_ONLY_DEFAULT,
239
+ taskSupport: { exposed: true, taskEligible: false },
240
+ },
241
+ profiles: [PROFILE_ORG_AUDIT],
242
+ });
243
+
244
+ const op_list_project_schedulers = defineOperation({
245
+ id: 'org-audit.schedulers.list',
246
+ summary: 'List project schedulers with destinations redacted by default',
247
+ http: { method: 'GET', path: '/api/v1/schedulers/{projectUuid}/list' },
248
+ authorization: { safetyImpact: 'read' },
249
+ sensitivity: 'secret.destination',
250
+ mcp: {
251
+ toolName: 'list_project_schedulers',
252
+ annotations: READ_ONLY_DEFAULT,
253
+ taskSupport: { exposed: true, taskEligible: false },
254
+ },
255
+ cli: { commandPath: 'schedulers list' },
256
+ profiles: [PROFILE_ORG_AUDIT],
257
+ });
258
+
259
+ const op_get_scheduler = defineOperation({
260
+ id: 'org-audit.schedulers.get',
261
+ summary: 'Get a scheduler by UUID with destinations redacted by default',
262
+ http: { method: 'GET', path: '/api/v1/schedulers/{schedulerUuid}' },
263
+ authorization: { safetyImpact: 'read' },
264
+ sensitivity: 'secret.destination',
265
+ mcp: {
266
+ toolName: 'get_scheduler',
267
+ annotations: READ_ONLY_DEFAULT,
268
+ taskSupport: { exposed: true, taskEligible: false },
269
+ },
270
+ cli: { commandPath: 'schedulers get' },
271
+ profiles: [PROFILE_ORG_AUDIT],
272
+ });
273
+
274
+ export const ORGANIZATION_AUDIT_OPERATIONS: readonly OperationDescriptor[] = [
275
+ op_get_org_profile,
276
+ op_list_org_members,
277
+ op_get_org_member,
278
+ op_list_org_groups,
279
+ op_list_org_projects,
280
+ op_list_org_role_assignments,
281
+ op_list_custom_roles,
282
+ op_get_custom_role,
283
+ op_list_project_roles,
284
+ op_list_project_direct_access,
285
+ op_list_space_access,
286
+ op_resolve_effective_access,
287
+ op_list_content,
288
+ op_get_dashboard_meta,
289
+ op_list_validation_results,
290
+ op_get_project_user_activity,
291
+ op_list_project_schedulers,
292
+ op_get_scheduler,
293
+ ];
@@ -1,20 +1,17 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
 
3
- import { listBannedMcpToolNames } from './agent-safe';
4
- import { listOperations } from './registry';
3
+ import { listBannedMcpToolNames, listOperations } from './registry';
5
4
 
6
5
  describe('agent-safe surface parity', () => {
7
- it('requires MCP tool name and CLI path for exposed agent operations', () => {
8
- const exposedAgentOps = listOperations().filter(
9
- (operation) =>
10
- operation.agentExposure === 'agent' && operation.mcp.taskSupport.exposed === true,
11
- );
6
+ it('requires MCP tool name or CLI path for agent operations', () => {
7
+ const agentOps = listOperations().filter((operation) => operation.agentExposure === 'agent');
12
8
 
13
- expect(exposedAgentOps.length).toBeGreaterThan(0);
9
+ expect(agentOps.length).toBeGreaterThan(0);
14
10
 
15
- for (const operation of exposedAgentOps) {
16
- expect(operation.mcp.toolName.trim().length).toBeGreaterThan(0);
17
- expect(operation.cli.commandPath.trim().length).toBeGreaterThan(0);
11
+ for (const operation of agentOps) {
12
+ const hasMcp = operation.mcp !== undefined && operation.mcp.toolName.trim().length > 0;
13
+ const hasCli = operation.cli !== undefined && operation.cli.commandPath.trim().length > 0;
14
+ expect(hasMcp || hasCli).toBe(true);
18
15
  }
19
16
  });
20
17
 
@@ -26,9 +23,10 @@ describe('agent-safe surface parity', () => {
26
23
  if (operation.agentExposure !== 'client-only') {
27
24
  continue;
28
25
  }
29
- expect(operation.mcp.taskSupport.exposed).toBe(false);
30
- if (operation.mcp.toolName.trim().length > 0) {
31
- expect(banned).toContain(operation.mcp.toolName);
26
+ expect(operation.mcp).toBeUndefined();
27
+ expect(operation.cli).toBeUndefined();
28
+ if (operation.bannedMcpToolName) {
29
+ expect(banned).toContain(operation.bannedMcpToolName);
32
30
  }
33
31
  }
34
32
  });
@@ -1,7 +1,13 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
 
3
3
  import { AI_AGENT_OPERATIONS } from './ai-agents';
4
+ import { CLI_CONTENT_OPERATIONS } from './cli-content';
5
+ import { CONTENT_DEVELOPER_OPERATIONS } from './content-developer';
6
+ import { CONTENT_GOVERNANCE_OPERATIONS } from './content-governance';
7
+ import { CONTENT_READER_OPERATIONS } from './content-reader';
8
+ import { ORGANIZATION_AUDIT_OPERATIONS } from './organization-audit';
4
9
  import { getOperation, getOperationsByProfile, listOperations } from './registry';
10
+ import { SEMANTIC_LAYER_OPERATIONS } from './semantic-layer';
5
11
  import { defineOperation } from './types';
6
12
  import { USER_OPERATIONS } from './users';
7
13
 
@@ -43,10 +49,16 @@ function requiredFields(operation: OperationDescriptor): string[] {
43
49
  operation.http.method,
44
50
  operation.http.path,
45
51
  operation.authorization.safetyImpact,
52
+ operation.sensitivity,
46
53
  agentExposure,
47
54
  ];
48
55
  if (agentExposure === 'agent') {
49
- fields.push(operation.mcp.toolName, operation.cli.commandPath);
56
+ if (operation.mcp !== undefined) {
57
+ fields.push(operation.mcp.toolName);
58
+ }
59
+ if (operation.cli !== undefined) {
60
+ fields.push(operation.cli.commandPath);
61
+ }
50
62
  }
51
63
  return fields;
52
64
  }
@@ -64,7 +76,16 @@ describe('operation registry', () => {
64
76
  });
65
77
 
66
78
  it('matches aggregated domain export count', () => {
67
- expect(listOperations()).toHaveLength(AI_AGENT_OPERATIONS.length + USER_OPERATIONS.length);
79
+ expect(listOperations()).toHaveLength(
80
+ AI_AGENT_OPERATIONS.length +
81
+ USER_OPERATIONS.length +
82
+ SEMANTIC_LAYER_OPERATIONS.length +
83
+ ORGANIZATION_AUDIT_OPERATIONS.length +
84
+ CONTENT_READER_OPERATIONS.length +
85
+ CONTENT_DEVELOPER_OPERATIONS.length +
86
+ CONTENT_GOVERNANCE_OPERATIONS.length +
87
+ CLI_CONTENT_OPERATIONS.length,
88
+ );
68
89
  });
69
90
 
70
91
  it('includes required descriptor fields on every operation', () => {
@@ -72,16 +93,23 @@ describe('operation registry', () => {
72
93
  for (const field of requiredFields(operation)) {
73
94
  expect(field).toBeTruthy();
74
95
  }
96
+ if (operation.agentExposure === 'agent') {
97
+ expect(operation.mcp !== undefined || operation.cli !== undefined).toBe(true);
98
+ }
75
99
  expect(operation.profiles.length).toBeGreaterThan(0);
76
- expect(operation.http.path.startsWith('/api/v1/')).toBe(true);
100
+ expect(
101
+ operation.http.path.startsWith('/api/v1/') || operation.http.path.startsWith('/api/v2/'),
102
+ ).toBe(true);
77
103
  }
78
104
  });
79
105
 
80
- it('assigns idempotentHint correctly for read and destructive operations', () => {
106
+ it('assigns idempotentHint correctly for read and destructive agent operations', () => {
81
107
  for (const operation of listOperations()) {
108
+ if (operation.mcp === undefined) {
109
+ continue;
110
+ }
82
111
  const { annotations } = operation.mcp;
83
112
  if (operation.authorization.safetyImpact === 'read') {
84
- expect(annotations.idempotentHint).toBe(true);
85
113
  expect(annotations.readOnlyHint).toBe(true);
86
114
  }
87
115
  if (operation.authorization.safetyImpact === 'write-destructive') {
@@ -125,7 +153,7 @@ describe('operation registry', () => {
125
153
  expect(operation?.http.path).toBe(
126
154
  '/api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads',
127
155
  );
128
- expect(operation?.cli.commandPath).toBe('agents threads start');
156
+ expect(operation?.cli?.commandPath).toBe('agents threads start');
129
157
  expect(operation?.workflow).toHaveLength(3);
130
158
  const lastStep = operation?.workflow?.[operation.workflow.length - 1];
131
159
  expect(lastStep?.path).toContain('/generate');
@@ -162,8 +190,9 @@ describe('operation registry', () => {
162
190
  it('registers users.members.delete as client-only', () => {
163
191
  const operation = getOperation('users.members.delete');
164
192
  expect(operation?.agentExposure).toBe('client-only');
165
- expect(operation?.mcp.taskSupport.exposed).toBe(false);
166
- expect(operation?.mcp.toolName).toBe('delete_member');
193
+ expect(operation?.mcp).toBeUndefined();
194
+ expect(operation?.cli).toBeUndefined();
195
+ expect(operation?.bannedMcpToolName).toBe('delete_member');
167
196
  expect(operation?.http.path).toBe('/api/v1/org/user/{userUuid}');
168
197
  });
169
198
 
@@ -188,7 +217,8 @@ describe('operation registry', () => {
188
217
  it('never exposes client-only operations on MCP', () => {
189
218
  for (const operation of listOperations()) {
190
219
  if (operation.agentExposure === 'client-only') {
191
- expect(operation.mcp.taskSupport.exposed).toBe(false);
220
+ expect(operation.mcp).toBeUndefined();
221
+ expect(operation.cli).toBeUndefined();
192
222
  }
193
223
  }
194
224
  });
@@ -200,6 +230,7 @@ describe('operation registry', () => {
200
230
  summary: 'Invalid impact pairing',
201
231
  http: { method: 'GET', path: '/api/v1/test' },
202
232
  authorization: { safetyImpact: 'write-destructive' },
233
+ sensitivity: 'none',
203
234
  mcp: {
204
235
  toolName: 'test_tool',
205
236
  annotations: {