@lightdash-tools/common 0.6.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.
- package/dist/agentops/extract-yaml-project.d.ts +7 -0
- package/dist/agentops/extract-yaml-project.js +42 -0
- package/dist/agentops/formatters.d.ts +5 -0
- package/dist/agentops/formatters.js +47 -0
- package/dist/agentops/snapshots.d.ts +32 -0
- package/dist/agentops/snapshots.js +34 -0
- package/dist/agentops/types.d.ts +224 -0
- package/dist/agentops/types.js +430 -0
- package/dist/argument-validation.d.ts +25 -0
- package/dist/argument-validation.js +217 -0
- package/dist/argument-validation.test.d.ts +1 -0
- package/dist/argument-validation.test.js +205 -0
- package/dist/audit.d.ts +9 -2
- package/dist/audit.js +17 -2
- package/dist/audit.test.d.ts +1 -0
- package/dist/audit.test.js +73 -0
- package/dist/env.d.ts +8 -0
- package/dist/env.js +9 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.js +14 -2
- package/dist/input-validation.d.ts +35 -0
- package/dist/input-validation.js +87 -0
- package/dist/input-validation.test.js +93 -0
- package/dist/operations/agent-safe.d.ts +5 -0
- package/dist/operations/agent-safe.js +9 -0
- package/dist/operations/ai-agents.d.ts +6 -0
- package/dist/operations/ai-agents.js +427 -0
- package/dist/operations/cli-content.d.ts +5 -0
- package/dist/operations/cli-content.js +71 -0
- package/dist/operations/client-coverage.d.ts +113 -0
- package/dist/operations/client-coverage.js +130 -0
- package/dist/operations/client-coverage.test.d.ts +1 -0
- package/dist/operations/client-coverage.test.js +22 -0
- package/dist/operations/content-developer.d.ts +2 -0
- package/dist/operations/content-developer.js +457 -0
- package/dist/operations/content-governance.d.ts +7 -0
- package/dist/operations/content-governance.js +98 -0
- package/dist/operations/content-reader.d.ts +2 -0
- package/dist/operations/content-reader.js +183 -0
- package/dist/operations/index.d.ts +12 -0
- package/dist/operations/index.js +34 -0
- package/dist/operations/organization-audit.d.ts +2 -0
- package/dist/operations/organization-audit.js +273 -0
- package/dist/operations/parity.test.d.ts +1 -0
- package/dist/operations/parity.test.js +29 -0
- package/dist/operations/registry.d.ts +18 -0
- package/dist/operations/registry.js +110 -0
- package/dist/operations/registry.test.d.ts +1 -0
- package/dist/operations/registry.test.js +223 -0
- package/dist/operations/semantic-layer.d.ts +6 -0
- package/dist/operations/semantic-layer.js +154 -0
- package/dist/operations/types.d.ts +86 -0
- package/dist/operations/types.js +104 -0
- package/dist/operations/types.test.d.ts +1 -0
- package/dist/operations/types.test.js +92 -0
- package/dist/operations/users.d.ts +6 -0
- package/dist/operations/users.js +58 -0
- package/dist/safety.d.ts +32 -2
- package/dist/safety.js +62 -5
- package/dist/safety.test.js +217 -4
- package/dist/types/generated/openapi-types.d.ts +32623 -11194
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.js +29 -0
- package/dist/types/lightdash-api.d.ts +1 -1
- package/dist/types/v1/ai-agents.d.ts +112 -3
- package/dist/types/v1/charts.d.ts +5 -3
- package/dist/types/v1/dashboards.d.ts +13 -0
- package/dist/types/v1/index.d.ts +45 -8
- package/dist/types/v1/index.js +1 -1
- package/dist/types/v1/lightdash-api.d.ts +107 -16
- package/dist/types/v1/users.d.ts +4 -0
- package/dist/types/v2/content.d.ts +2 -0
- package/dist/types/v2/content.js +8 -0
- package/dist/types/v2/index.d.ts +11 -9
- package/dist/types/v2/index.js +1 -1
- package/package.json +17 -3
- package/src/agentops/extract-yaml-project.ts +42 -0
- package/src/agentops/formatters.ts +52 -0
- package/src/agentops/snapshots.ts +56 -0
- package/src/agentops/types.ts +599 -0
- package/src/argument-validation.test.ts +301 -0
- package/src/argument-validation.ts +258 -0
- package/src/audit.test.ts +87 -0
- package/src/audit.ts +32 -3
- package/src/env.ts +9 -0
- package/src/index.test.ts +1 -0
- package/src/index.ts +17 -6
- package/src/input-validation.test.ts +157 -1
- package/src/input-validation.ts +95 -0
- package/src/operations/agent-safe.ts +8 -0
- package/src/operations/ai-agents.ts +467 -0
- package/src/operations/cli-content.ts +79 -0
- package/src/operations/client-coverage.test.ts +23 -0
- package/src/operations/client-coverage.ts +147 -0
- package/src/operations/content-developer.ts +485 -0
- package/src/operations/content-governance.ts +110 -0
- package/src/operations/content-reader.ts +197 -0
- package/src/operations/index.ts +42 -0
- package/src/operations/organization-audit.ts +293 -0
- package/src/operations/parity.test.ts +33 -0
- package/src/operations/registry.test.ts +250 -0
- package/src/operations/registry.ts +128 -0
- package/src/operations/semantic-layer.ts +166 -0
- package/src/operations/types.test.ts +110 -0
- package/src/operations/types.ts +231 -0
- package/src/operations/users.ts +65 -0
- package/src/safety.test.ts +276 -4
- package/src/safety.ts +83 -4
- package/src/types/generated/openapi-types.ts +33701 -11813
- package/src/types/index.ts +13 -0
- package/src/types/lightdash-api.ts +39 -0
- package/src/types/v1/ai-agents.ts +133 -3
- package/src/types/v1/charts.ts +5 -3
- package/src/types/v1/dashboards.ts +19 -0
- package/src/types/v1/index.ts +51 -8
- package/src/types/v1/lightdash-api.ts +129 -20
- package/src/types/v1/users.ts +4 -0
- package/src/types/v2/content.ts +8 -0
- package/src/types/v2/index.ts +11 -9
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content-governance operations (ADR-0015 / ADR-0017).
|
|
3
|
+
* Soft-delete charts/dashboards and dashboard promote via elicitation-required MCP tools.
|
|
4
|
+
* Permanent purge stays client-only. Chart/SQL-chart promote stay off MCP in v1.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { READ_ONLY_DEFAULT, WRITE_DESTRUCTIVE } from '../safety';
|
|
8
|
+
|
|
9
|
+
import { defineOperation } from './types';
|
|
10
|
+
|
|
11
|
+
import type { CapabilityProfile, OperationDescriptor, SafetyImpact } from './types';
|
|
12
|
+
|
|
13
|
+
const IMPACT_READ: SafetyImpact = 'read';
|
|
14
|
+
const IMPACT_WRITE_DESTRUCTIVE: SafetyImpact = 'write-destructive';
|
|
15
|
+
const PROFILE_CONTENT_GOVERNANCE: CapabilityProfile = 'content-governance';
|
|
16
|
+
|
|
17
|
+
const API_V1 = '/api/v1';
|
|
18
|
+
const API_V2 = '/api/v2';
|
|
19
|
+
|
|
20
|
+
const op_delete_chart = defineOperation({
|
|
21
|
+
id: 'content-governance.charts.delete',
|
|
22
|
+
summary:
|
|
23
|
+
'Soft-delete a saved chart (MCP requires form elicitation; restorable until permanently purged)',
|
|
24
|
+
http: {
|
|
25
|
+
method: 'DELETE',
|
|
26
|
+
path: `${API_V2}/projects/{projectUuid}/saved/{chartUuidOrSlug}`,
|
|
27
|
+
},
|
|
28
|
+
authorization: { safetyImpact: IMPACT_WRITE_DESTRUCTIVE },
|
|
29
|
+
sensitivity: 'none',
|
|
30
|
+
mcp: {
|
|
31
|
+
toolName: 'delete_chart',
|
|
32
|
+
// Catalog keeps WRITE_DESTRUCTIVE defaults (idempotentHint: false). Soft-delete
|
|
33
|
+
// retries are marked idempotent at MCP registration time (registerDestructiveDeleteTool).
|
|
34
|
+
annotations: WRITE_DESTRUCTIVE,
|
|
35
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
36
|
+
},
|
|
37
|
+
profiles: [PROFILE_CONTENT_GOVERNANCE],
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const op_delete_dashboard = defineOperation({
|
|
41
|
+
id: 'content-governance.dashboards.delete',
|
|
42
|
+
summary:
|
|
43
|
+
'Soft-delete a dashboard (MCP requires form elicitation; restorable until permanently purged)',
|
|
44
|
+
http: {
|
|
45
|
+
method: 'DELETE',
|
|
46
|
+
path: `${API_V2}/projects/{projectUuid}/dashboards/{dashboardUuidOrSlug}`,
|
|
47
|
+
},
|
|
48
|
+
authorization: { safetyImpact: IMPACT_WRITE_DESTRUCTIVE },
|
|
49
|
+
sensitivity: 'none',
|
|
50
|
+
mcp: {
|
|
51
|
+
toolName: 'delete_dashboard',
|
|
52
|
+
annotations: WRITE_DESTRUCTIVE,
|
|
53
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
54
|
+
},
|
|
55
|
+
profiles: [PROFILE_CONTENT_GOVERNANCE],
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const op_get_dashboard_promote_diff = defineOperation({
|
|
59
|
+
id: 'content-governance.dashboards.promote-diff',
|
|
60
|
+
summary: 'Get promotion diff for a dashboard against its configured upstream project (read-only)',
|
|
61
|
+
http: {
|
|
62
|
+
method: 'GET',
|
|
63
|
+
path: `${API_V1}/dashboards/{dashboardUuidOrSlug}/promoteDiff`,
|
|
64
|
+
},
|
|
65
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
66
|
+
sensitivity: 'none',
|
|
67
|
+
mcp: {
|
|
68
|
+
toolName: 'get_dashboard_promote_diff',
|
|
69
|
+
annotations: READ_ONLY_DEFAULT,
|
|
70
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
71
|
+
},
|
|
72
|
+
profiles: [PROFILE_CONTENT_GOVERNANCE],
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const op_promote_dashboard = defineOperation({
|
|
76
|
+
id: 'content-governance.dashboards.promote',
|
|
77
|
+
summary: 'Promote a dashboard to its configured upstream project (MCP requires form elicitation)',
|
|
78
|
+
http: {
|
|
79
|
+
method: 'POST',
|
|
80
|
+
path: `${API_V1}/dashboards/{dashboardUuidOrSlug}/promote`,
|
|
81
|
+
},
|
|
82
|
+
authorization: { safetyImpact: IMPACT_WRITE_DESTRUCTIVE },
|
|
83
|
+
sensitivity: 'none',
|
|
84
|
+
mcp: {
|
|
85
|
+
toolName: 'promote_dashboard',
|
|
86
|
+
annotations: WRITE_DESTRUCTIVE,
|
|
87
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
88
|
+
},
|
|
89
|
+
profiles: [PROFILE_CONTENT_GOVERNANCE],
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const op_permanent_purge = defineOperation({
|
|
93
|
+
id: 'content-governance.content.permanent-delete',
|
|
94
|
+
summary:
|
|
95
|
+
'Permanently delete soft-deleted content (client-only; irrecoverable — not exposed on MCP)',
|
|
96
|
+
http: { method: 'DELETE', path: `${API_V2}/content/{projectUuid}/permanent` },
|
|
97
|
+
authorization: { safetyImpact: IMPACT_WRITE_DESTRUCTIVE },
|
|
98
|
+
sensitivity: 'none',
|
|
99
|
+
agentExposure: 'client-only',
|
|
100
|
+
bannedMcpToolName: 'permanent_delete_content',
|
|
101
|
+
profiles: [PROFILE_CONTENT_GOVERNANCE],
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
export const CONTENT_GOVERNANCE_OPERATIONS: readonly OperationDescriptor[] = [
|
|
105
|
+
op_delete_chart,
|
|
106
|
+
op_delete_dashboard,
|
|
107
|
+
op_get_dashboard_promote_diff,
|
|
108
|
+
op_promote_dashboard,
|
|
109
|
+
op_permanent_purge,
|
|
110
|
+
];
|
|
@@ -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
|
+
];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export {
|
|
2
|
+
defineOperation,
|
|
3
|
+
type AgentExposure,
|
|
4
|
+
type CapabilityProfile,
|
|
5
|
+
type HttpMethod,
|
|
6
|
+
type McpTaskSupport,
|
|
7
|
+
type OperationAuthorization,
|
|
8
|
+
type OperationCli,
|
|
9
|
+
type OperationDefinitionInput,
|
|
10
|
+
type OperationDescriptor,
|
|
11
|
+
type OperationHttp,
|
|
12
|
+
type OperationMcp,
|
|
13
|
+
type SensitivityClass,
|
|
14
|
+
} from './types';
|
|
15
|
+
|
|
16
|
+
export { IRRECOVERABLE_TOOL_DENYLIST } from './agent-safe';
|
|
17
|
+
|
|
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';
|
|
25
|
+
export { USER_OPERATIONS } from './users';
|
|
26
|
+
|
|
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
|
+
];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { listBannedMcpToolNames, listOperations } from './registry';
|
|
4
|
+
|
|
5
|
+
describe('agent-safe surface parity', () => {
|
|
6
|
+
it('requires MCP tool name or CLI path for agent operations', () => {
|
|
7
|
+
const agentOps = listOperations().filter((operation) => operation.agentExposure === 'agent');
|
|
8
|
+
|
|
9
|
+
expect(agentOps.length).toBeGreaterThan(0);
|
|
10
|
+
|
|
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);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('keeps client-only banned MCP tool names off the agent surface', () => {
|
|
19
|
+
const banned = listBannedMcpToolNames();
|
|
20
|
+
expect(banned).toContain('delete_member');
|
|
21
|
+
|
|
22
|
+
for (const operation of listOperations()) {
|
|
23
|
+
if (operation.agentExposure !== 'client-only') {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
expect(operation.mcp).toBeUndefined();
|
|
27
|
+
expect(operation.cli).toBeUndefined();
|
|
28
|
+
if (operation.bannedMcpToolName) {
|
|
29
|
+
expect(banned).toContain(operation.bannedMcpToolName);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|