@lightdash-tools/common 0.12.0 → 0.13.1
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/agent-safe.d.ts +4 -0
- package/dist/agent-safe.js +13 -0
- package/dist/audit.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -2
- package/dist/profile-ids.d.ts +5 -0
- package/dist/profile-ids.js +15 -0
- package/package.json +1 -3
- package/src/agent-safe.ts +11 -0
- package/src/audit.ts +1 -1
- package/src/index.ts +5 -2
- package/src/profile-ids.ts +15 -0
- package/dist/operations/agent-safe.d.ts +0 -5
- package/dist/operations/agent-safe.js +0 -9
- package/dist/operations/ai-agents.d.ts +0 -6
- package/dist/operations/ai-agents.js +0 -495
- package/dist/operations/cli-content.d.ts +0 -5
- package/dist/operations/cli-content.js +0 -69
- package/dist/operations/client-coverage.d.ts +0 -120
- package/dist/operations/client-coverage.js +0 -139
- package/dist/operations/client-coverage.test.d.ts +0 -1
- package/dist/operations/client-coverage.test.js +0 -22
- package/dist/operations/content-developer.d.ts +0 -2
- package/dist/operations/content-developer.js +0 -471
- package/dist/operations/content-governance.d.ts +0 -7
- package/dist/operations/content-governance.js +0 -98
- package/dist/operations/content-reader.d.ts +0 -2
- package/dist/operations/content-reader.js +0 -198
- package/dist/operations/data-analyst.d.ts +0 -5
- package/dist/operations/data-analyst.js +0 -23
- package/dist/operations/index.d.ts +0 -13
- package/dist/operations/index.js +0 -37
- package/dist/operations/organization-audit.d.ts +0 -2
- package/dist/operations/organization-audit.js +0 -273
- package/dist/operations/parity.test.d.ts +0 -1
- package/dist/operations/parity.test.js +0 -29
- package/dist/operations/registry.d.ts +0 -18
- package/dist/operations/registry.js +0 -136
- package/dist/operations/registry.test.d.ts +0 -1
- package/dist/operations/registry.test.js +0 -201
- package/dist/operations/semantic-layer.d.ts +0 -6
- package/dist/operations/semantic-layer.js +0 -155
- package/dist/operations/types.d.ts +0 -90
- package/dist/operations/types.js +0 -113
- package/dist/operations/types.test.d.ts +0 -1
- package/dist/operations/types.test.js +0 -101
- package/dist/operations/users.d.ts +0 -6
- package/dist/operations/users.js +0 -56
- package/src/operations/agent-safe.ts +0 -8
- package/src/operations/ai-agents.ts +0 -539
- package/src/operations/cli-content.ts +0 -76
- package/src/operations/client-coverage.test.ts +0 -23
- package/src/operations/client-coverage.ts +0 -156
- package/src/operations/content-developer.ts +0 -501
- package/src/operations/content-governance.ts +0 -110
- package/src/operations/content-reader.ts +0 -213
- package/src/operations/data-analyst.ts +0 -27
- package/src/operations/index.ts +0 -44
- package/src/operations/organization-audit.ts +0 -293
- package/src/operations/parity.test.ts +0 -33
- package/src/operations/registry.test.ts +0 -229
- package/src/operations/registry.ts +0 -158
- package/src/operations/semantic-layer.ts +0 -167
- package/src/operations/types.test.ts +0 -138
- package/src/operations/types.ts +0 -241
- package/src/operations/users.ts +0 -62
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { defineOperation } from './types';
|
|
4
|
-
|
|
5
|
-
const baseDescriptor = {
|
|
6
|
-
id: 'test.operation',
|
|
7
|
-
summary: 'Test operation',
|
|
8
|
-
http: { method: 'GET' as const, path: '/api/v1/test' },
|
|
9
|
-
authorization: { safetyImpact: 'read' as const },
|
|
10
|
-
sensitivity: 'none' as const,
|
|
11
|
-
mcp: {
|
|
12
|
-
toolName: 'test_op',
|
|
13
|
-
annotations: {
|
|
14
|
-
readOnlyHint: true,
|
|
15
|
-
destructiveHint: false,
|
|
16
|
-
idempotentHint: true,
|
|
17
|
-
openWorldHint: false,
|
|
18
|
-
},
|
|
19
|
-
taskSupport: { exposed: true, taskEligible: false },
|
|
20
|
-
},
|
|
21
|
-
cli: { commandPath: 'test op' },
|
|
22
|
-
agentExposure: 'agent' as const,
|
|
23
|
-
profiles: ['semantic-layer' as const],
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
describe('defineOperation', () => {
|
|
27
|
-
it('accepts a valid read descriptor', () => {
|
|
28
|
-
expect(defineOperation(baseDescriptor)).toEqual({
|
|
29
|
-
...baseDescriptor,
|
|
30
|
-
agentExposure: 'agent',
|
|
31
|
-
sensitivity: 'none',
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('defaults agentExposure to agent and sensitivity to none', () => {
|
|
36
|
-
const { agentExposure, sensitivity, ...withoutDefaults } = baseDescriptor;
|
|
37
|
-
void agentExposure;
|
|
38
|
-
void sensitivity;
|
|
39
|
-
const op = defineOperation(withoutDefaults);
|
|
40
|
-
expect(op.agentExposure).toBe('agent');
|
|
41
|
-
expect(op.sensitivity).toBe('none');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('allows agent ops with mcp only', () => {
|
|
45
|
-
const { cli: _cli, ...rest } = baseDescriptor;
|
|
46
|
-
void _cli;
|
|
47
|
-
expect(defineOperation(rest).cli).toBeUndefined();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('allows agent ops with cli only', () => {
|
|
51
|
-
const { mcp: _mcp, ...rest } = baseDescriptor;
|
|
52
|
-
void _mcp;
|
|
53
|
-
expect(defineOperation({ ...rest, profiles: [] }).mcp).toBeUndefined();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('rejects agent ops with neither mcp nor cli', () => {
|
|
57
|
-
const { mcp: _mcp, cli: _cli, ...rest } = baseDescriptor;
|
|
58
|
-
void _mcp;
|
|
59
|
-
void _cli;
|
|
60
|
-
expect(() => defineOperation({ ...rest, profiles: [] })).toThrow(/require mcp and\/or cli/);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('rejects empty id', () => {
|
|
64
|
-
expect(() => defineOperation({ ...baseDescriptor, id: ' ' })).toThrow(/id/);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('rejects unknown profile', () => {
|
|
68
|
-
expect(() =>
|
|
69
|
-
defineOperation({
|
|
70
|
-
...baseDescriptor,
|
|
71
|
-
profiles: ['unknown-profile' as 'semantic-layer'],
|
|
72
|
-
}),
|
|
73
|
-
).toThrow(/unknown profile/);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('rejects empty profiles when MCP-exposed', () => {
|
|
77
|
-
expect(() => defineOperation({ ...baseDescriptor, profiles: [] })).toThrow(
|
|
78
|
-
/at least one profile/,
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('rejects duplicate profiles', () => {
|
|
83
|
-
expect(() =>
|
|
84
|
-
defineOperation({
|
|
85
|
-
...baseDescriptor,
|
|
86
|
-
profiles: ['semantic-layer', 'semantic-layer'],
|
|
87
|
-
}),
|
|
88
|
-
).toThrow(/duplicate profiles/);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('rejects non-empty profiles when not MCP-exposed', () => {
|
|
92
|
-
expect(() =>
|
|
93
|
-
defineOperation({
|
|
94
|
-
...baseDescriptor,
|
|
95
|
-
mcp: {
|
|
96
|
-
...baseDescriptor.mcp,
|
|
97
|
-
taskSupport: { exposed: false, taskEligible: false },
|
|
98
|
-
},
|
|
99
|
-
profiles: ['semantic-layer'],
|
|
100
|
-
}),
|
|
101
|
-
).toThrow(/empty profiles/);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('allows read operation with idempotentHint false (transient execution)', () => {
|
|
105
|
-
const op = defineOperation({
|
|
106
|
-
...baseDescriptor,
|
|
107
|
-
mcp: {
|
|
108
|
-
...baseDescriptor.mcp,
|
|
109
|
-
annotations: { ...baseDescriptor.mcp.annotations, idempotentHint: false },
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
expect(op.mcp?.annotations.idempotentHint).toBe(false);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('rejects client-only operation that still has mcp', () => {
|
|
116
|
-
expect(() =>
|
|
117
|
-
defineOperation({
|
|
118
|
-
...baseDescriptor,
|
|
119
|
-
agentExposure: 'client-only',
|
|
120
|
-
}),
|
|
121
|
-
).toThrow(/must omit mcp and cli/);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('allows client-only operation with bannedMcpToolName and no mcp/cli', () => {
|
|
125
|
-
const op = defineOperation({
|
|
126
|
-
id: 'test.client-only',
|
|
127
|
-
summary: 'Client only delete',
|
|
128
|
-
http: { method: 'DELETE', path: '/api/v1/test/{id}' },
|
|
129
|
-
authorization: { safetyImpact: 'write-destructive' },
|
|
130
|
-
agentExposure: 'client-only',
|
|
131
|
-
bannedMcpToolName: 'delete_test',
|
|
132
|
-
profiles: [],
|
|
133
|
-
});
|
|
134
|
-
expect(op.agentExposure).toBe('client-only');
|
|
135
|
-
expect(op.bannedMcpToolName).toBe('delete_test');
|
|
136
|
-
expect(op.sensitivity).toBe('none');
|
|
137
|
-
});
|
|
138
|
-
});
|
package/src/operations/types.ts
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared typed operation catalog (ADR-0013 / ADR-0006).
|
|
3
|
-
* Single source of truth for HTTP, CLI, and MCP exposure of Lightdash API operations.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { SafetyImpact, ToolAnnotations } from '../safety';
|
|
7
|
-
|
|
8
|
-
export type { SafetyImpact };
|
|
9
|
-
|
|
10
|
-
/** Whether an operation may appear on MCP/CLI agent surfaces. */
|
|
11
|
-
export type AgentExposure = 'agent' | 'client-only';
|
|
12
|
-
|
|
13
|
-
/** HTTP verbs supported by registered operations. */
|
|
14
|
-
export type HttpMethod = 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';
|
|
15
|
-
|
|
16
|
-
/** Runtime list of every MCP serving profile id (ADR-0006; fixed mounts / stdio). */
|
|
17
|
-
export const PROFILE_IDS = [
|
|
18
|
-
'ai-agent-ops',
|
|
19
|
-
'content-developer',
|
|
20
|
-
'content-governance',
|
|
21
|
-
'content-reader',
|
|
22
|
-
'data-analyst',
|
|
23
|
-
'organization-audit',
|
|
24
|
-
'semantic-layer',
|
|
25
|
-
] as const;
|
|
26
|
-
|
|
27
|
-
/** MCP serving profile ids aligned to fixed HTTP mounts / stdio subcommands (ADR-0006). */
|
|
28
|
-
export type ProfileId = (typeof PROFILE_IDS)[number];
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* MCP response sensitivity class (ADR-0011).
|
|
32
|
-
* Documents which redaction class handlers must apply; does not auto-redact.
|
|
33
|
-
*/
|
|
34
|
-
export type SensitivityClass = 'none' | 'pii.email' | 'secret.connection' | 'secret.destination';
|
|
35
|
-
|
|
36
|
-
/** MCP task semantics for an operation. */
|
|
37
|
-
export type McpTaskSupport = {
|
|
38
|
-
/** When true, the operation is exposed as an MCP tool. */
|
|
39
|
-
exposed: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* When true, the operation may complete asynchronously via MCP Tasks.
|
|
42
|
-
* Long-running evaluation runs and LLM generation are task-eligible.
|
|
43
|
-
*/
|
|
44
|
-
taskEligible: boolean;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type OperationAuthorization = {
|
|
48
|
-
safetyImpact: SafetyImpact;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type OperationHttp = {
|
|
52
|
-
method: HttpMethod;
|
|
53
|
-
/** OpenAPI-style path template (includes `/api/v1` or `/api/v2` prefix). */
|
|
54
|
-
path: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export type OperationMcp = {
|
|
58
|
-
/** MCP tool name without the `lightdash_` prefix. */
|
|
59
|
-
toolName: string;
|
|
60
|
-
annotations: ToolAnnotations;
|
|
61
|
-
taskSupport: McpTaskSupport;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export type OperationCli = {
|
|
65
|
-
/** Space-delimited CLI command path from the root program (e.g. `agents list`). */
|
|
66
|
-
commandPath: string;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/** Optional multi-step HTTP workflow when a single registry entry orchestrates several API calls. */
|
|
70
|
-
export type OperationWorkflowStep = {
|
|
71
|
-
method: HttpMethod;
|
|
72
|
-
path: string;
|
|
73
|
-
summary: string;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export type OperationDescriptor = {
|
|
77
|
-
/** Stable dot-separated identifier (e.g. `ai-agents.project.agents.list`). */
|
|
78
|
-
id: string;
|
|
79
|
-
summary: string;
|
|
80
|
-
http: OperationHttp;
|
|
81
|
-
authorization: OperationAuthorization;
|
|
82
|
-
/**
|
|
83
|
-
* Response sensitivity class for agent surfaces (ADR-0011).
|
|
84
|
-
* Defaults to `none` when omitted from `defineOperation` input.
|
|
85
|
-
*/
|
|
86
|
-
sensitivity: SensitivityClass;
|
|
87
|
-
/**
|
|
88
|
-
* MCP mounts that expose this op when `mcp.taskSupport.exposed` is true (ADR-0006).
|
|
89
|
-
* Empty when the op is not MCP-exposed (CLI-only / reserved / client-only).
|
|
90
|
-
*/
|
|
91
|
-
profiles: readonly ProfileId[];
|
|
92
|
-
/** `agent` (default) = may appear on MCP and/or CLI; `client-only` = typed client only. */
|
|
93
|
-
agentExposure: AgentExposure;
|
|
94
|
-
/** Present when the operation is registered (or reserved) as an MCP tool. */
|
|
95
|
-
mcp?: OperationMcp;
|
|
96
|
-
/** Present when a real CLI command exists (`commandPath` must match Commander). */
|
|
97
|
-
cli?: OperationCli;
|
|
98
|
-
/** Irrecoverable denylist name for client-only ops (sans `lightdash_` prefix). */
|
|
99
|
-
bannedMcpToolName?: string;
|
|
100
|
-
/** When set, documents the ordered client-side HTTP steps behind this operation. */
|
|
101
|
-
workflow?: readonly OperationWorkflowStep[];
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/** Input to `defineOperation` before defaults are applied. */
|
|
105
|
-
export type OperationDefinitionInput = Omit<
|
|
106
|
-
OperationDescriptor,
|
|
107
|
-
'agentExposure' | 'sensitivity'
|
|
108
|
-
> & {
|
|
109
|
-
agentExposure?: AgentExposure;
|
|
110
|
-
sensitivity?: SensitivityClass;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const VALID_PROFILES = new Set<ProfileId>(PROFILE_IDS);
|
|
114
|
-
|
|
115
|
-
const VALID_SENSITIVITY = new Set<SensitivityClass>([
|
|
116
|
-
'none',
|
|
117
|
-
'pii.email',
|
|
118
|
-
'secret.connection',
|
|
119
|
-
'secret.destination',
|
|
120
|
-
]);
|
|
121
|
-
|
|
122
|
-
function assertNonEmpty(value: string, field: string): void {
|
|
123
|
-
if (value.trim().length === 0) {
|
|
124
|
-
throw new Error(`Operation ${field} must be a non-empty string`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function expectedImpactFromAnnotations(annotations: ToolAnnotations): SafetyImpact {
|
|
129
|
-
if (annotations.readOnlyHint) {
|
|
130
|
-
return 'read';
|
|
131
|
-
}
|
|
132
|
-
if (annotations.destructiveHint) {
|
|
133
|
-
return 'write-destructive';
|
|
134
|
-
}
|
|
135
|
-
if (annotations.openWorldHint) {
|
|
136
|
-
return 'external-side-effect';
|
|
137
|
-
}
|
|
138
|
-
return 'write-nondestructive';
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function validateIdempotentHint(
|
|
142
|
-
annotations: ToolAnnotations,
|
|
143
|
-
impact: SafetyImpact,
|
|
144
|
-
id: string,
|
|
145
|
-
): void {
|
|
146
|
-
if (impact === 'write-destructive' && annotations.idempotentHint === true) {
|
|
147
|
-
throw new Error(
|
|
148
|
-
`Operation '${id}': destructive operations must not set mcp.annotations.idempotentHint = true`,
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function validateProfiles(input: OperationDefinitionInput): void {
|
|
154
|
-
const { id, profiles, mcp } = input;
|
|
155
|
-
const mcpExposed = mcp?.taskSupport.exposed === true;
|
|
156
|
-
|
|
157
|
-
if (mcpExposed && profiles.length === 0) {
|
|
158
|
-
throw new Error(
|
|
159
|
-
`Operation '${id}' must declare at least one profile when mcp.taskSupport.exposed is true`,
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (new Set(profiles).size !== profiles.length) {
|
|
164
|
-
throw new Error(`Operation '${id}' has duplicate profiles: ${profiles.join(', ')}`);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
for (const profile of profiles) {
|
|
168
|
-
if (!VALID_PROFILES.has(profile)) {
|
|
169
|
-
throw new Error(`Operation '${id}' has unknown profile '${profile}'`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (!mcpExposed && profiles.length > 0) {
|
|
174
|
-
throw new Error(
|
|
175
|
-
`Operation '${id}' must use empty profiles when not MCP-exposed (got ${profiles.join(', ')})`,
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function validateClientOnlyOperation(input: OperationDefinitionInput): OperationDescriptor {
|
|
181
|
-
if (input.mcp !== undefined || input.cli !== undefined) {
|
|
182
|
-
throw new Error(
|
|
183
|
-
`Operation '${input.id}': client-only operations must omit mcp and cli metadata`,
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
if (input.bannedMcpToolName !== undefined && input.bannedMcpToolName.trim().length === 0) {
|
|
187
|
-
throw new Error(`Operation '${input.id}': bannedMcpToolName must be non-empty when set`);
|
|
188
|
-
}
|
|
189
|
-
return {
|
|
190
|
-
...input,
|
|
191
|
-
agentExposure: 'client-only',
|
|
192
|
-
sensitivity: input.sensitivity ?? 'none',
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function validateAgentMcp(input: OperationDefinitionInput): void {
|
|
197
|
-
if (input.mcp === undefined) {
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
assertNonEmpty(input.mcp.toolName, 'mcp.toolName');
|
|
201
|
-
const expectedImpact = expectedImpactFromAnnotations(input.mcp.annotations);
|
|
202
|
-
if (input.authorization.safetyImpact !== expectedImpact) {
|
|
203
|
-
throw new Error(
|
|
204
|
-
`Operation '${input.id}': authorization.safetyImpact is '${input.authorization.safetyImpact}' but MCP annotations imply '${expectedImpact}'`,
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
validateIdempotentHint(input.mcp.annotations, input.authorization.safetyImpact, input.id);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Defines a typed operation descriptor with catalog consistency checks (ADR-0013).
|
|
212
|
-
* Agent ops require at least one of `mcp` or `cli`. Client-only ops omit both.
|
|
213
|
-
*/
|
|
214
|
-
export function defineOperation(input: OperationDefinitionInput): OperationDescriptor {
|
|
215
|
-
assertNonEmpty(input.id, 'id');
|
|
216
|
-
assertNonEmpty(input.summary, 'summary');
|
|
217
|
-
assertNonEmpty(input.http.path, 'http.path');
|
|
218
|
-
|
|
219
|
-
const sensitivity = input.sensitivity ?? 'none';
|
|
220
|
-
if (!VALID_SENSITIVITY.has(sensitivity)) {
|
|
221
|
-
throw new Error(`Operation '${input.id}' has unknown sensitivity '${String(sensitivity)}'`);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
validateProfiles(input);
|
|
225
|
-
|
|
226
|
-
const agentExposure = input.agentExposure ?? 'agent';
|
|
227
|
-
if (agentExposure === 'client-only') {
|
|
228
|
-
return validateClientOnlyOperation({ ...input, sensitivity });
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (input.mcp === undefined && input.cli === undefined) {
|
|
232
|
-
throw new Error(`Operation '${input.id}': agent operations require mcp and/or cli metadata`);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
validateAgentMcp(input);
|
|
236
|
-
if (input.cli !== undefined) {
|
|
237
|
-
assertNonEmpty(input.cli.commandPath, 'cli.commandPath');
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return { ...input, agentExposure: 'agent', sensitivity };
|
|
241
|
-
}
|
package/src/operations/users.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Organization member operations in the shared operation catalog.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { READ_ONLY_DEFAULT } from '../safety';
|
|
6
|
-
|
|
7
|
-
import { defineOperation } from './types';
|
|
8
|
-
|
|
9
|
-
import type { OperationDescriptor } from './types';
|
|
10
|
-
|
|
11
|
-
const API_V1 = '/api/v1';
|
|
12
|
-
const MEMBERS_PATH = `${API_V1}/org/users`;
|
|
13
|
-
const MEMBER_PATH = `${MEMBERS_PATH}/{userUuid}`;
|
|
14
|
-
const DELETE_MEMBER_PATH = `${API_V1}/org/user/{userUuid}`;
|
|
15
|
-
|
|
16
|
-
const membersList = defineOperation({
|
|
17
|
-
id: 'users.members.list',
|
|
18
|
-
summary: 'List organization members (one page)',
|
|
19
|
-
http: { method: 'GET', path: MEMBERS_PATH },
|
|
20
|
-
authorization: { safetyImpact: 'read' },
|
|
21
|
-
sensitivity: 'pii.email',
|
|
22
|
-
mcp: {
|
|
23
|
-
toolName: 'list_organization_members',
|
|
24
|
-
annotations: READ_ONLY_DEFAULT,
|
|
25
|
-
taskSupport: { exposed: false, taskEligible: false },
|
|
26
|
-
},
|
|
27
|
-
cli: { commandPath: 'users list' },
|
|
28
|
-
profiles: [],
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const membersGet = defineOperation({
|
|
32
|
-
id: 'users.members.get',
|
|
33
|
-
summary: 'Get an organization member by UUID',
|
|
34
|
-
http: { method: 'GET', path: MEMBER_PATH },
|
|
35
|
-
authorization: { safetyImpact: 'read' },
|
|
36
|
-
sensitivity: 'pii.email',
|
|
37
|
-
mcp: {
|
|
38
|
-
toolName: 'get_member',
|
|
39
|
-
annotations: READ_ONLY_DEFAULT,
|
|
40
|
-
taskSupport: { exposed: false, taskEligible: false },
|
|
41
|
-
},
|
|
42
|
-
cli: { commandPath: 'users get' },
|
|
43
|
-
profiles: [],
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const membersDelete = defineOperation({
|
|
47
|
-
id: 'users.members.delete',
|
|
48
|
-
summary: 'Permanently remove a user from the organization (irrecoverable; client-only)',
|
|
49
|
-
http: { method: 'DELETE', path: DELETE_MEMBER_PATH },
|
|
50
|
-
authorization: { safetyImpact: 'write-destructive' },
|
|
51
|
-
sensitivity: 'none',
|
|
52
|
-
agentExposure: 'client-only',
|
|
53
|
-
bannedMcpToolName: 'delete_member',
|
|
54
|
-
profiles: [],
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
/** Organization member operations registered in the shared operation catalog. */
|
|
58
|
-
export const USER_OPERATIONS: readonly OperationDescriptor[] = [
|
|
59
|
-
membersList,
|
|
60
|
-
membersGet,
|
|
61
|
-
membersDelete,
|
|
62
|
-
];
|