@lightdash-tools/common 0.5.0 → 0.7.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 +199 -0
- package/dist/argument-validation.test.d.ts +1 -0
- package/dist/argument-validation.test.js +183 -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 -1
- package/dist/index.js +14 -0
- 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 +7 -0
- package/dist/operations/agent-safe.js +16 -0
- package/dist/operations/ai-agents.d.ts +6 -0
- package/dist/operations/ai-agents.js +411 -0
- package/dist/operations/index.d.ts +5 -0
- package/dist/operations/index.js +16 -0
- package/dist/operations/parity.test.d.ts +1 -0
- package/dist/operations/parity.test.js +28 -0
- package/dist/operations/registry.d.ts +10 -0
- package/dist/operations/registry.js +35 -0
- package/dist/operations/registry.test.d.ts +1 -0
- package/dist/operations/registry.test.js +196 -0
- package/dist/operations/types.d.ts +69 -0
- package/dist/operations/types.js +70 -0
- package/dist/operations/types.test.d.ts +1 -0
- package/dist/operations/types.test.js +104 -0
- package/dist/operations/users.d.ts +6 -0
- package/dist/operations/users.js +60 -0
- package/dist/safety.d.ts +27 -2
- package/dist/safety.js +52 -5
- package/dist/safety.test.js +217 -4
- package/dist/types/generated/openapi-types.d.ts +35895 -10622
- package/dist/types/generated/openapi-types.js +0 -1
- 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 +16 -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 +270 -0
- package/src/argument-validation.ts +240 -0
- package/src/audit.test.ts +87 -0
- package/src/audit.ts +21 -3
- package/src/env.ts +9 -0
- package/src/index.test.ts +1 -0
- package/src/index.ts +16 -1
- package/src/input-validation.test.ts +157 -1
- package/src/input-validation.ts +95 -0
- package/src/operations/agent-safe.ts +18 -0
- package/src/operations/ai-agents.ts +451 -0
- package/src/operations/index.ts +19 -0
- package/src/operations/parity.test.ts +35 -0
- package/src/operations/registry.test.ts +219 -0
- package/src/operations/registry.ts +44 -0
- package/src/operations/types.test.ts +148 -0
- package/src/operations/types.ts +168 -0
- package/src/operations/users.ts +67 -0
- package/src/safety.test.ts +276 -4
- package/src/safety.ts +72 -4
- package/src/types/generated/openapi-types.ts +37017 -11241
- 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
|
@@ -87,6 +87,99 @@ const input_validation_1 = require("./input-validation");
|
|
|
87
87
|
(0, vitest_1.expect)(() => (0, input_validation_1.validateResourceId)(123)).toThrow('Resource ID must be a string');
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
|
+
(0, vitest_1.describe)('validateUuid', () => {
|
|
91
|
+
const validUuid = '550e8400-e29b-41d4-a716-446655440000';
|
|
92
|
+
(0, vitest_1.it)('accepts lowercase UUID', () => {
|
|
93
|
+
(0, vitest_1.expect)((0, input_validation_1.validateUuid)(validUuid)).toBe(validUuid);
|
|
94
|
+
});
|
|
95
|
+
(0, vitest_1.it)('accepts uppercase UUID', () => {
|
|
96
|
+
(0, vitest_1.expect)((0, input_validation_1.validateUuid)(validUuid.toUpperCase())).toBe(validUuid.toUpperCase());
|
|
97
|
+
});
|
|
98
|
+
(0, vitest_1.it)('throws on invalid format', () => {
|
|
99
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateUuid)('not-a-uuid')).toThrow('Invalid UUID format');
|
|
100
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateUuid)('550e8400-e29b-41d4-a716')).toThrow('Invalid UUID format');
|
|
101
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateUuid)('550e8400-e29b-41d4-a716-446655440000-extra')).toThrow('Invalid UUID format');
|
|
102
|
+
});
|
|
103
|
+
(0, vitest_1.it)('throws on control characters', () => {
|
|
104
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateUuid)('550e8400-e29b-41d4-a716\u000044655440000')).toThrow('Input contains invalid control characters');
|
|
105
|
+
});
|
|
106
|
+
(0, vitest_1.it)('throws when id is not a string', () => {
|
|
107
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateUuid)(123)).toThrow('UUID must be a string');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
(0, vitest_1.describe)('validateSlug', () => {
|
|
111
|
+
(0, vitest_1.it)('accepts valid slugs', () => {
|
|
112
|
+
(0, vitest_1.expect)((0, input_validation_1.validateSlug)('my-chart')).toBe('my-chart');
|
|
113
|
+
(0, vitest_1.expect)((0, input_validation_1.validateSlug)('chart_123')).toBe('chart_123');
|
|
114
|
+
(0, vitest_1.expect)((0, input_validation_1.validateSlug)('a.b-c_d')).toBe('a.b-c_d');
|
|
115
|
+
});
|
|
116
|
+
(0, vitest_1.it)('throws on empty slug', () => {
|
|
117
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateSlug)('')).toThrow('Slug must be between 1 and 256 characters');
|
|
118
|
+
});
|
|
119
|
+
(0, vitest_1.it)('throws when slug exceeds max length', () => {
|
|
120
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateSlug)('a'.repeat(257))).toThrow('Slug must be between 1 and 256 characters');
|
|
121
|
+
});
|
|
122
|
+
(0, vitest_1.it)('accepts slug at max length', () => {
|
|
123
|
+
const slug = 'a'.repeat(256);
|
|
124
|
+
(0, vitest_1.expect)((0, input_validation_1.validateSlug)(slug)).toBe(slug);
|
|
125
|
+
});
|
|
126
|
+
(0, vitest_1.it)('throws on invalid characters', () => {
|
|
127
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateSlug)('has space')).toThrow('Slug must contain only alphanumeric characters, dots, underscores, and hyphens');
|
|
128
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateSlug)('slug?query')).toThrow('Slug must contain only alphanumeric characters, dots, underscores, and hyphens');
|
|
129
|
+
});
|
|
130
|
+
(0, vitest_1.it)('rejects path traversal segments', () => {
|
|
131
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateSlug)('.')).toThrow('Slug must not contain path traversal segments');
|
|
132
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateSlug)('..')).toThrow('Slug must not contain path traversal segments');
|
|
133
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateSlug)('foo..bar')).toThrow('Slug must not contain path traversal segments');
|
|
134
|
+
});
|
|
135
|
+
(0, vitest_1.it)('throws on control characters', () => {
|
|
136
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateSlug)('slug\u0001')).toThrow('Input contains invalid control characters');
|
|
137
|
+
});
|
|
138
|
+
(0, vitest_1.it)('throws when id is not a string', () => {
|
|
139
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateSlug)(123)).toThrow('Slug must be a string');
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
(0, vitest_1.describe)('validateUuidOrSlug', () => {
|
|
143
|
+
const validUuid = '550e8400-e29b-41d4-a716-446655440000';
|
|
144
|
+
(0, vitest_1.it)('accepts UUIDs', () => {
|
|
145
|
+
(0, vitest_1.expect)((0, input_validation_1.validateUuidOrSlug)(validUuid)).toBe(validUuid);
|
|
146
|
+
});
|
|
147
|
+
(0, vitest_1.it)('accepts slugs such as dashboard names', () => {
|
|
148
|
+
(0, vitest_1.expect)((0, input_validation_1.validateUuidOrSlug)('sales-overview')).toBe('sales-overview');
|
|
149
|
+
});
|
|
150
|
+
(0, vitest_1.it)('rejects invalid slug characters', () => {
|
|
151
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateUuidOrSlug)('bad?')).toThrow('Slug must contain only alphanumeric characters');
|
|
152
|
+
});
|
|
153
|
+
(0, vitest_1.it)('rejects path traversal slugs', () => {
|
|
154
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateUuidOrSlug)('.')).toThrow('Slug must not contain path traversal segments');
|
|
155
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateUuidOrSlug)('..')).toThrow('Slug must not contain path traversal segments');
|
|
156
|
+
});
|
|
157
|
+
(0, vitest_1.it)('throws when id is not a string', () => {
|
|
158
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateUuidOrSlug)(123)).toThrow('Resource ID must be a string');
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
(0, vitest_1.describe)('validateFingerprint', () => {
|
|
162
|
+
(0, vitest_1.it)('accepts non-empty fingerprints', () => {
|
|
163
|
+
(0, vitest_1.expect)((0, input_validation_1.validateFingerprint)('abc123')).toBe('abc123');
|
|
164
|
+
(0, vitest_1.expect)((0, input_validation_1.validateFingerprint)('sha256:deadbeef')).toBe('sha256:deadbeef');
|
|
165
|
+
});
|
|
166
|
+
(0, vitest_1.it)('throws on empty fingerprint', () => {
|
|
167
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateFingerprint)('')).toThrow('Fingerprint must be between 1 and 512 characters');
|
|
168
|
+
});
|
|
169
|
+
(0, vitest_1.it)('throws when fingerprint exceeds max length', () => {
|
|
170
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateFingerprint)('x'.repeat(513))).toThrow('Fingerprint must be between 1 and 512 characters');
|
|
171
|
+
});
|
|
172
|
+
(0, vitest_1.it)('accepts fingerprint at max length', () => {
|
|
173
|
+
const fp = 'x'.repeat(512);
|
|
174
|
+
(0, vitest_1.expect)((0, input_validation_1.validateFingerprint)(fp)).toBe(fp);
|
|
175
|
+
});
|
|
176
|
+
(0, vitest_1.it)('throws on control characters', () => {
|
|
177
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateFingerprint)('fp\u0000')).toThrow('Input contains invalid control characters');
|
|
178
|
+
});
|
|
179
|
+
(0, vitest_1.it)('throws when id is not a string', () => {
|
|
180
|
+
(0, vitest_1.expect)(() => (0, input_validation_1.validateFingerprint)(123)).toThrow('Fingerprint must be a string');
|
|
181
|
+
});
|
|
182
|
+
});
|
|
90
183
|
(0, vitest_1.describe)('validateSafeOutputDir', () => {
|
|
91
184
|
(0, vitest_1.it)('accepts path within CWD', () => {
|
|
92
185
|
const result = (0, input_validation_1.validateSafeOutputDir)('output');
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-safe surface policy helpers (ADR-0004).
|
|
3
|
+
*/
|
|
4
|
+
/** MCP tool names that must never be registered, derived from client-only registry entries. */
|
|
5
|
+
export declare function listBannedMcpToolNames(): readonly string[];
|
|
6
|
+
/** Banned MCP tool names (without `lightdash_` prefix) for regression tests. */
|
|
7
|
+
export declare const IRRECOVERABLE_TOOL_DENYLIST: readonly string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Agent-safe surface policy helpers (ADR-0004).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IRRECOVERABLE_TOOL_DENYLIST = void 0;
|
|
7
|
+
exports.listBannedMcpToolNames = listBannedMcpToolNames;
|
|
8
|
+
const registry_1 = require("./registry");
|
|
9
|
+
/** MCP tool names that must never be registered, derived from client-only registry entries. */
|
|
10
|
+
function listBannedMcpToolNames() {
|
|
11
|
+
return (0, registry_1.listOperations)()
|
|
12
|
+
.filter((operation) => operation.agentExposure === 'client-only' && operation.mcp.toolName.trim().length > 0)
|
|
13
|
+
.map((operation) => operation.mcp.toolName);
|
|
14
|
+
}
|
|
15
|
+
/** Banned MCP tool names (without `lightdash_` prefix) for regression tests. */
|
|
16
|
+
exports.IRRECOVERABLE_TOOL_DENYLIST = listBannedMcpToolNames();
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* P0 AI agent operations registered in the shared operation registry.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AI_AGENT_OPERATIONS = void 0;
|
|
7
|
+
const safety_1 = require("../safety");
|
|
8
|
+
const types_1 = require("./types");
|
|
9
|
+
const IMPACT_READ = 'read';
|
|
10
|
+
const IMPACT_WRITE_NONDESTRUCTIVE = 'write-nondestructive';
|
|
11
|
+
const IMPACT_WRITE_DESTRUCTIVE = 'write-destructive';
|
|
12
|
+
const IMPACT_EXTERNAL = 'external-side-effect';
|
|
13
|
+
const PROFILE_CORE_LIFECYCLE = 'core-lifecycle';
|
|
14
|
+
const PROFILE_DISCOVERY = 'discovery-readonly';
|
|
15
|
+
const PROFILE_CONVERSATIONS = 'conversations';
|
|
16
|
+
const PROFILE_EVALUATIONS = 'evaluations';
|
|
17
|
+
const API_V1 = '/api/v1';
|
|
18
|
+
const PROJECT_AGENTS_PATH = `${API_V1}/projects/{projectUuid}/aiAgents`;
|
|
19
|
+
const PROJECT_AGENT_PATH = `${PROJECT_AGENTS_PATH}/{agentUuid}`;
|
|
20
|
+
const adminListAgents = (0, types_1.defineOperation)({
|
|
21
|
+
id: 'ai-agents.admin.agents.list',
|
|
22
|
+
summary: 'List all AI agents across the organization (admin)',
|
|
23
|
+
http: { method: 'GET', path: `${API_V1}/aiAgents/admin/agents` },
|
|
24
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
25
|
+
mcp: {
|
|
26
|
+
toolName: 'list_admin_agents',
|
|
27
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
28
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
29
|
+
},
|
|
30
|
+
cli: { commandPath: 'ai-agents list' },
|
|
31
|
+
profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
|
|
32
|
+
});
|
|
33
|
+
const adminListThreads = (0, types_1.defineOperation)({
|
|
34
|
+
id: 'ai-agents.admin.threads.list',
|
|
35
|
+
summary: 'List AI agent threads across the organization with optional filters (admin)',
|
|
36
|
+
http: { method: 'GET', path: `${API_V1}/aiAgents/admin/threads` },
|
|
37
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
38
|
+
mcp: {
|
|
39
|
+
toolName: 'list_admin_agent_threads',
|
|
40
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
41
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
42
|
+
},
|
|
43
|
+
cli: { commandPath: 'ai-agents threads' },
|
|
44
|
+
profiles: [PROFILE_DISCOVERY],
|
|
45
|
+
});
|
|
46
|
+
const adminSettingsGet = (0, types_1.defineOperation)({
|
|
47
|
+
id: 'ai-agents.admin.settings.get',
|
|
48
|
+
summary: 'Get AI organization settings (admin)',
|
|
49
|
+
http: { method: 'GET', path: `${API_V1}/aiAgents/admin/settings` },
|
|
50
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
51
|
+
mcp: {
|
|
52
|
+
toolName: 'get_ai_organization_settings',
|
|
53
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
54
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
55
|
+
},
|
|
56
|
+
cli: { commandPath: 'ai-agents settings get' },
|
|
57
|
+
profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
|
|
58
|
+
});
|
|
59
|
+
const WRITE_SETTINGS_UPDATE = {
|
|
60
|
+
readOnlyHint: false,
|
|
61
|
+
openWorldHint: false,
|
|
62
|
+
destructiveHint: false,
|
|
63
|
+
idempotentHint: true,
|
|
64
|
+
};
|
|
65
|
+
const adminSettingsUpdate = (0, types_1.defineOperation)({
|
|
66
|
+
id: 'ai-agents.admin.settings.update',
|
|
67
|
+
summary: 'Update AI organization settings (admin)',
|
|
68
|
+
http: { method: 'PATCH', path: `${API_V1}/aiAgents/admin/settings` },
|
|
69
|
+
authorization: { safetyImpact: IMPACT_WRITE_NONDESTRUCTIVE },
|
|
70
|
+
mcp: {
|
|
71
|
+
toolName: 'update_ai_organization_settings',
|
|
72
|
+
annotations: WRITE_SETTINGS_UPDATE,
|
|
73
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
74
|
+
},
|
|
75
|
+
cli: { commandPath: 'ai-agents settings update' },
|
|
76
|
+
profiles: [PROFILE_CORE_LIFECYCLE],
|
|
77
|
+
});
|
|
78
|
+
const projectAgentsList = (0, types_1.defineOperation)({
|
|
79
|
+
id: 'ai-agents.project.agents.list',
|
|
80
|
+
summary: 'List all AI agents in a project',
|
|
81
|
+
http: { method: 'GET', path: PROJECT_AGENTS_PATH },
|
|
82
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
83
|
+
mcp: {
|
|
84
|
+
toolName: 'list_project_agents',
|
|
85
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
86
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
87
|
+
},
|
|
88
|
+
cli: { commandPath: 'agents list' },
|
|
89
|
+
profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
|
|
90
|
+
});
|
|
91
|
+
const projectAgentsGet = (0, types_1.defineOperation)({
|
|
92
|
+
id: 'ai-agents.project.agents.get',
|
|
93
|
+
summary: 'Get a single AI agent in a project',
|
|
94
|
+
http: { method: 'GET', path: PROJECT_AGENT_PATH },
|
|
95
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
96
|
+
mcp: {
|
|
97
|
+
toolName: 'get_project_agent',
|
|
98
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
99
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
100
|
+
},
|
|
101
|
+
cli: { commandPath: 'agents get' },
|
|
102
|
+
profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
|
|
103
|
+
});
|
|
104
|
+
const projectAgentsCreate = (0, types_1.defineOperation)({
|
|
105
|
+
id: 'ai-agents.project.agents.create',
|
|
106
|
+
summary: 'Create a new AI agent in a project',
|
|
107
|
+
http: { method: 'POST', path: PROJECT_AGENTS_PATH },
|
|
108
|
+
authorization: { safetyImpact: IMPACT_WRITE_NONDESTRUCTIVE },
|
|
109
|
+
mcp: {
|
|
110
|
+
toolName: 'create_project_agent',
|
|
111
|
+
annotations: safety_1.WRITE_NONDESTRUCTIVE,
|
|
112
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
113
|
+
},
|
|
114
|
+
cli: { commandPath: 'agents create' },
|
|
115
|
+
profiles: [PROFILE_CORE_LIFECYCLE],
|
|
116
|
+
});
|
|
117
|
+
const projectAgentsUpdate = (0, types_1.defineOperation)({
|
|
118
|
+
id: 'ai-agents.project.agents.update',
|
|
119
|
+
summary: 'Update an existing AI agent in a project',
|
|
120
|
+
http: { method: 'PATCH', path: PROJECT_AGENT_PATH },
|
|
121
|
+
authorization: { safetyImpact: IMPACT_WRITE_NONDESTRUCTIVE },
|
|
122
|
+
mcp: {
|
|
123
|
+
toolName: 'update_project_agent',
|
|
124
|
+
annotations: safety_1.WRITE_NONDESTRUCTIVE,
|
|
125
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
126
|
+
},
|
|
127
|
+
cli: { commandPath: 'agents update' },
|
|
128
|
+
profiles: [PROFILE_CORE_LIFECYCLE],
|
|
129
|
+
});
|
|
130
|
+
const projectAgentsDelete = (0, types_1.defineOperation)({
|
|
131
|
+
id: 'ai-agents.project.agents.delete',
|
|
132
|
+
summary: 'Delete an AI agent from a project',
|
|
133
|
+
http: { method: 'DELETE', path: PROJECT_AGENT_PATH },
|
|
134
|
+
authorization: { safetyImpact: IMPACT_WRITE_DESTRUCTIVE },
|
|
135
|
+
mcp: {
|
|
136
|
+
toolName: 'delete_project_agent',
|
|
137
|
+
annotations: safety_1.WRITE_DESTRUCTIVE,
|
|
138
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
139
|
+
},
|
|
140
|
+
cli: { commandPath: 'agents delete' },
|
|
141
|
+
profiles: [PROFILE_CORE_LIFECYCLE],
|
|
142
|
+
});
|
|
143
|
+
const PROJECT_AGENT_THREADS_PATH = `${PROJECT_AGENT_PATH}/threads`;
|
|
144
|
+
const threadsList = (0, types_1.defineOperation)({
|
|
145
|
+
id: 'ai-agents.project.threads.list',
|
|
146
|
+
summary: 'List conversation threads for an agent',
|
|
147
|
+
http: {
|
|
148
|
+
method: 'GET',
|
|
149
|
+
path: PROJECT_AGENT_THREADS_PATH,
|
|
150
|
+
},
|
|
151
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
152
|
+
mcp: {
|
|
153
|
+
toolName: 'list_agent_threads',
|
|
154
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
155
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
156
|
+
},
|
|
157
|
+
cli: { commandPath: 'agents threads list' },
|
|
158
|
+
profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY],
|
|
159
|
+
});
|
|
160
|
+
const PROJECT_AGENT_THREAD_PATH = `${PROJECT_AGENT_THREADS_PATH}/{threadUuid}`;
|
|
161
|
+
const threadsGet = (0, types_1.defineOperation)({
|
|
162
|
+
id: 'ai-agents.project.threads.get',
|
|
163
|
+
summary: 'Get a conversation thread with all messages',
|
|
164
|
+
http: {
|
|
165
|
+
method: 'GET',
|
|
166
|
+
path: PROJECT_AGENT_THREAD_PATH,
|
|
167
|
+
},
|
|
168
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
169
|
+
mcp: {
|
|
170
|
+
toolName: 'get_agent_thread',
|
|
171
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
172
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
173
|
+
},
|
|
174
|
+
cli: { commandPath: 'agents threads get' },
|
|
175
|
+
profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY],
|
|
176
|
+
});
|
|
177
|
+
const PROJECT_AGENT_THREAD_MESSAGES_PATH = `${PROJECT_AGENT_THREAD_PATH}/messages`;
|
|
178
|
+
const PROJECT_AGENT_THREAD_GENERATE_PATH = `${PROJECT_AGENT_THREAD_PATH}/generate`;
|
|
179
|
+
const threadsStart = (0, types_1.defineOperation)({
|
|
180
|
+
id: 'ai-agents.project.threads.start',
|
|
181
|
+
summary: 'Start a new conversation (client workflow: create thread, add message, generate response)',
|
|
182
|
+
http: {
|
|
183
|
+
method: 'POST',
|
|
184
|
+
path: PROJECT_AGENT_THREADS_PATH,
|
|
185
|
+
},
|
|
186
|
+
workflow: [
|
|
187
|
+
{
|
|
188
|
+
method: 'POST',
|
|
189
|
+
path: PROJECT_AGENT_THREADS_PATH,
|
|
190
|
+
summary: 'Create thread',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
method: 'POST',
|
|
194
|
+
path: PROJECT_AGENT_THREAD_MESSAGES_PATH,
|
|
195
|
+
summary: 'Add user message',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
method: 'POST',
|
|
199
|
+
path: PROJECT_AGENT_THREAD_GENERATE_PATH,
|
|
200
|
+
summary: 'Generate agent response',
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
authorization: { safetyImpact: IMPACT_EXTERNAL },
|
|
204
|
+
mcp: {
|
|
205
|
+
toolName: 'generate_agent_message',
|
|
206
|
+
annotations: safety_1.WRITE_OPEN_WORLD,
|
|
207
|
+
taskSupport: { exposed: true, taskEligible: true },
|
|
208
|
+
},
|
|
209
|
+
cli: { commandPath: 'agents threads start' },
|
|
210
|
+
profiles: [PROFILE_CONVERSATIONS],
|
|
211
|
+
});
|
|
212
|
+
const threadsContinue = (0, types_1.defineOperation)({
|
|
213
|
+
id: 'ai-agents.project.threads.continue',
|
|
214
|
+
summary: 'Continue an existing conversation (client workflow: add message, generate response)',
|
|
215
|
+
http: {
|
|
216
|
+
method: 'POST',
|
|
217
|
+
path: PROJECT_AGENT_THREAD_GENERATE_PATH,
|
|
218
|
+
},
|
|
219
|
+
workflow: [
|
|
220
|
+
{
|
|
221
|
+
method: 'POST',
|
|
222
|
+
path: PROJECT_AGENT_THREAD_MESSAGES_PATH,
|
|
223
|
+
summary: 'Add user message',
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
method: 'POST',
|
|
227
|
+
path: PROJECT_AGENT_THREAD_GENERATE_PATH,
|
|
228
|
+
summary: 'Generate agent response',
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
authorization: { safetyImpact: IMPACT_EXTERNAL },
|
|
232
|
+
mcp: {
|
|
233
|
+
toolName: 'continue_agent_thread',
|
|
234
|
+
annotations: safety_1.WRITE_OPEN_WORLD,
|
|
235
|
+
taskSupport: { exposed: true, taskEligible: true },
|
|
236
|
+
},
|
|
237
|
+
cli: { commandPath: 'agents threads continue' },
|
|
238
|
+
profiles: [PROFILE_CONVERSATIONS],
|
|
239
|
+
});
|
|
240
|
+
const PROJECT_AGENT_EVALUATIONS_PATH = `${PROJECT_AGENT_PATH}/evaluations`;
|
|
241
|
+
const evaluationsList = (0, types_1.defineOperation)({
|
|
242
|
+
id: 'ai-agents.project.evaluations.list',
|
|
243
|
+
summary: 'List all evaluations for an agent',
|
|
244
|
+
http: {
|
|
245
|
+
method: 'GET',
|
|
246
|
+
path: PROJECT_AGENT_EVALUATIONS_PATH,
|
|
247
|
+
},
|
|
248
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
249
|
+
mcp: {
|
|
250
|
+
toolName: 'list_agent_evaluations',
|
|
251
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
252
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
253
|
+
},
|
|
254
|
+
cli: { commandPath: 'agents evals list' },
|
|
255
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
256
|
+
});
|
|
257
|
+
const PROJECT_AGENT_EVALUATION_PATH = `${PROJECT_AGENT_EVALUATIONS_PATH}/{evalUuid}`;
|
|
258
|
+
const evaluationsGet = (0, types_1.defineOperation)({
|
|
259
|
+
id: 'ai-agents.project.evaluations.get',
|
|
260
|
+
summary: 'Get a full evaluation including test prompts',
|
|
261
|
+
http: {
|
|
262
|
+
method: 'GET',
|
|
263
|
+
path: PROJECT_AGENT_EVALUATION_PATH,
|
|
264
|
+
},
|
|
265
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
266
|
+
mcp: {
|
|
267
|
+
toolName: 'get_agent_evaluation',
|
|
268
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
269
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
270
|
+
},
|
|
271
|
+
cli: { commandPath: 'agents evals get' },
|
|
272
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
273
|
+
});
|
|
274
|
+
const evaluationsCreate = (0, types_1.defineOperation)({
|
|
275
|
+
id: 'ai-agents.project.evaluations.create',
|
|
276
|
+
summary: 'Create a new evaluation test suite for an agent',
|
|
277
|
+
http: {
|
|
278
|
+
method: 'POST',
|
|
279
|
+
path: PROJECT_AGENT_EVALUATIONS_PATH,
|
|
280
|
+
},
|
|
281
|
+
authorization: { safetyImpact: IMPACT_WRITE_NONDESTRUCTIVE },
|
|
282
|
+
mcp: {
|
|
283
|
+
toolName: 'create_agent_evaluation',
|
|
284
|
+
annotations: safety_1.WRITE_NONDESTRUCTIVE,
|
|
285
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
286
|
+
},
|
|
287
|
+
cli: { commandPath: 'agents evals create' },
|
|
288
|
+
profiles: [PROFILE_EVALUATIONS],
|
|
289
|
+
});
|
|
290
|
+
const evaluationsUpdate = (0, types_1.defineOperation)({
|
|
291
|
+
id: 'ai-agents.project.evaluations.update',
|
|
292
|
+
summary: 'Update an evaluation title, description, or prompts',
|
|
293
|
+
http: {
|
|
294
|
+
method: 'PATCH',
|
|
295
|
+
path: PROJECT_AGENT_EVALUATION_PATH,
|
|
296
|
+
},
|
|
297
|
+
authorization: { safetyImpact: IMPACT_WRITE_NONDESTRUCTIVE },
|
|
298
|
+
mcp: {
|
|
299
|
+
toolName: 'update_agent_evaluation',
|
|
300
|
+
annotations: safety_1.WRITE_NONDESTRUCTIVE,
|
|
301
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
302
|
+
},
|
|
303
|
+
cli: { commandPath: 'agents evals update' },
|
|
304
|
+
profiles: [PROFILE_EVALUATIONS],
|
|
305
|
+
});
|
|
306
|
+
const evaluationsAppend = (0, types_1.defineOperation)({
|
|
307
|
+
id: 'ai-agents.project.evaluations.append',
|
|
308
|
+
summary: 'Append additional prompts to an existing evaluation',
|
|
309
|
+
http: {
|
|
310
|
+
method: 'POST',
|
|
311
|
+
path: `${PROJECT_AGENT_EVALUATION_PATH}/append`,
|
|
312
|
+
},
|
|
313
|
+
authorization: { safetyImpact: IMPACT_WRITE_NONDESTRUCTIVE },
|
|
314
|
+
mcp: {
|
|
315
|
+
toolName: 'append_agent_evaluation_prompts',
|
|
316
|
+
annotations: safety_1.WRITE_NONDESTRUCTIVE,
|
|
317
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
318
|
+
},
|
|
319
|
+
cli: { commandPath: 'agents evals append' },
|
|
320
|
+
profiles: [PROFILE_EVALUATIONS],
|
|
321
|
+
});
|
|
322
|
+
const evaluationsDelete = (0, types_1.defineOperation)({
|
|
323
|
+
id: 'ai-agents.project.evaluations.delete',
|
|
324
|
+
summary: 'Delete an evaluation and all its runs',
|
|
325
|
+
http: {
|
|
326
|
+
method: 'DELETE',
|
|
327
|
+
path: PROJECT_AGENT_EVALUATION_PATH,
|
|
328
|
+
},
|
|
329
|
+
authorization: { safetyImpact: IMPACT_WRITE_DESTRUCTIVE },
|
|
330
|
+
mcp: {
|
|
331
|
+
toolName: 'delete_agent_evaluation',
|
|
332
|
+
annotations: safety_1.WRITE_DESTRUCTIVE,
|
|
333
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
334
|
+
},
|
|
335
|
+
cli: { commandPath: 'agents evals delete' },
|
|
336
|
+
profiles: [PROFILE_EVALUATIONS],
|
|
337
|
+
});
|
|
338
|
+
const evaluationsRun = (0, types_1.defineOperation)({
|
|
339
|
+
id: 'ai-agents.project.evaluations.run',
|
|
340
|
+
summary: 'Trigger a new evaluation run for an agent',
|
|
341
|
+
http: {
|
|
342
|
+
method: 'POST',
|
|
343
|
+
path: `${PROJECT_AGENT_EVALUATION_PATH}/run`,
|
|
344
|
+
},
|
|
345
|
+
authorization: { safetyImpact: IMPACT_EXTERNAL },
|
|
346
|
+
mcp: {
|
|
347
|
+
toolName: 'run_agent_evaluation',
|
|
348
|
+
annotations: safety_1.WRITE_OPEN_WORLD,
|
|
349
|
+
taskSupport: { exposed: true, taskEligible: true },
|
|
350
|
+
},
|
|
351
|
+
cli: { commandPath: 'agents evals run' },
|
|
352
|
+
profiles: [PROFILE_EVALUATIONS],
|
|
353
|
+
});
|
|
354
|
+
const PROJECT_AGENT_EVALUATION_RUNS_PATH = `${PROJECT_AGENT_EVALUATION_PATH}/runs`;
|
|
355
|
+
const evaluationsRunsList = (0, types_1.defineOperation)({
|
|
356
|
+
id: 'ai-agents.project.evaluations.runs.list',
|
|
357
|
+
summary: 'List all runs for an evaluation with status and pass/fail counts',
|
|
358
|
+
http: {
|
|
359
|
+
method: 'GET',
|
|
360
|
+
path: PROJECT_AGENT_EVALUATION_RUNS_PATH,
|
|
361
|
+
},
|
|
362
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
363
|
+
mcp: {
|
|
364
|
+
toolName: 'list_agent_evaluation_runs',
|
|
365
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
366
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
367
|
+
},
|
|
368
|
+
cli: { commandPath: 'agents evals runs' },
|
|
369
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
370
|
+
});
|
|
371
|
+
const evaluationsRunResultsGet = (0, types_1.defineOperation)({
|
|
372
|
+
id: 'ai-agents.project.evaluations.runs.get',
|
|
373
|
+
summary: 'Get detailed per-prompt results for a specific evaluation run',
|
|
374
|
+
http: {
|
|
375
|
+
method: 'GET',
|
|
376
|
+
path: `${PROJECT_AGENT_EVALUATION_RUNS_PATH}/{runUuid}`,
|
|
377
|
+
},
|
|
378
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
379
|
+
mcp: {
|
|
380
|
+
toolName: 'get_agent_evaluation_run_results',
|
|
381
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
382
|
+
taskSupport: { exposed: true, taskEligible: false },
|
|
383
|
+
},
|
|
384
|
+
cli: { commandPath: 'agents evals run-results' },
|
|
385
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
386
|
+
});
|
|
387
|
+
/** All registered P0 AI agent operations. */
|
|
388
|
+
exports.AI_AGENT_OPERATIONS = [
|
|
389
|
+
adminListAgents,
|
|
390
|
+
adminListThreads,
|
|
391
|
+
adminSettingsGet,
|
|
392
|
+
adminSettingsUpdate,
|
|
393
|
+
projectAgentsList,
|
|
394
|
+
projectAgentsGet,
|
|
395
|
+
projectAgentsCreate,
|
|
396
|
+
projectAgentsUpdate,
|
|
397
|
+
projectAgentsDelete,
|
|
398
|
+
threadsList,
|
|
399
|
+
threadsGet,
|
|
400
|
+
threadsStart,
|
|
401
|
+
threadsContinue,
|
|
402
|
+
evaluationsList,
|
|
403
|
+
evaluationsGet,
|
|
404
|
+
evaluationsCreate,
|
|
405
|
+
evaluationsUpdate,
|
|
406
|
+
evaluationsAppend,
|
|
407
|
+
evaluationsDelete,
|
|
408
|
+
evaluationsRun,
|
|
409
|
+
evaluationsRunsList,
|
|
410
|
+
evaluationsRunResultsGet,
|
|
411
|
+
];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { defineOperation, type AgentExposure, type CapabilityProfile, type HttpMethod, type McpTaskSupport, type OperationAuthorization, type OperationCli, type OperationDescriptor, type OperationHttp, type OperationMcp, } from './types';
|
|
2
|
+
export { IRRECOVERABLE_TOOL_DENYLIST, listBannedMcpToolNames } from './agent-safe';
|
|
3
|
+
export { AI_AGENT_OPERATIONS } from './ai-agents';
|
|
4
|
+
export { USER_OPERATIONS } from './users';
|
|
5
|
+
export { getOperation, getOperationsByProfile, listOperations } from './registry';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listOperations = exports.getOperationsByProfile = exports.getOperation = exports.USER_OPERATIONS = exports.AI_AGENT_OPERATIONS = exports.listBannedMcpToolNames = exports.IRRECOVERABLE_TOOL_DENYLIST = exports.defineOperation = void 0;
|
|
4
|
+
var types_1 = require("./types");
|
|
5
|
+
Object.defineProperty(exports, "defineOperation", { enumerable: true, get: function () { return types_1.defineOperation; } });
|
|
6
|
+
var agent_safe_1 = require("./agent-safe");
|
|
7
|
+
Object.defineProperty(exports, "IRRECOVERABLE_TOOL_DENYLIST", { enumerable: true, get: function () { return agent_safe_1.IRRECOVERABLE_TOOL_DENYLIST; } });
|
|
8
|
+
Object.defineProperty(exports, "listBannedMcpToolNames", { enumerable: true, get: function () { return agent_safe_1.listBannedMcpToolNames; } });
|
|
9
|
+
var ai_agents_1 = require("./ai-agents");
|
|
10
|
+
Object.defineProperty(exports, "AI_AGENT_OPERATIONS", { enumerable: true, get: function () { return ai_agents_1.AI_AGENT_OPERATIONS; } });
|
|
11
|
+
var users_1 = require("./users");
|
|
12
|
+
Object.defineProperty(exports, "USER_OPERATIONS", { enumerable: true, get: function () { return users_1.USER_OPERATIONS; } });
|
|
13
|
+
var registry_1 = require("./registry");
|
|
14
|
+
Object.defineProperty(exports, "getOperation", { enumerable: true, get: function () { return registry_1.getOperation; } });
|
|
15
|
+
Object.defineProperty(exports, "getOperationsByProfile", { enumerable: true, get: function () { return registry_1.getOperationsByProfile; } });
|
|
16
|
+
Object.defineProperty(exports, "listOperations", { enumerable: true, get: function () { return registry_1.listOperations; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const agent_safe_1 = require("./agent-safe");
|
|
5
|
+
const registry_1 = require("./registry");
|
|
6
|
+
(0, vitest_1.describe)('agent-safe surface parity', () => {
|
|
7
|
+
(0, vitest_1.it)('requires MCP tool name and CLI path for exposed agent operations', () => {
|
|
8
|
+
const exposedAgentOps = (0, registry_1.listOperations)().filter((operation) => operation.agentExposure === 'agent' && operation.mcp.taskSupport.exposed === true);
|
|
9
|
+
(0, vitest_1.expect)(exposedAgentOps.length).toBeGreaterThan(0);
|
|
10
|
+
for (const operation of exposedAgentOps) {
|
|
11
|
+
(0, vitest_1.expect)(operation.mcp.toolName.trim().length).toBeGreaterThan(0);
|
|
12
|
+
(0, vitest_1.expect)(operation.cli.commandPath.trim().length).toBeGreaterThan(0);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
(0, vitest_1.it)('keeps client-only banned MCP tool names off the agent surface', () => {
|
|
16
|
+
const banned = (0, agent_safe_1.listBannedMcpToolNames)();
|
|
17
|
+
(0, vitest_1.expect)(banned).toContain('delete_member');
|
|
18
|
+
for (const operation of (0, registry_1.listOperations)()) {
|
|
19
|
+
if (operation.agentExposure !== 'client-only') {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
(0, vitest_1.expect)(operation.mcp.taskSupport.exposed).toBe(false);
|
|
23
|
+
if (operation.mcp.toolName.trim().length > 0) {
|
|
24
|
+
(0, vitest_1.expect)(banned).toContain(operation.mcp.toolName);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central operation registry — aggregates domain modules and exposes lookup helpers.
|
|
3
|
+
*/
|
|
4
|
+
import type { CapabilityProfile, OperationDescriptor } from './types';
|
|
5
|
+
/** Returns a registered operation by id, or undefined when not found. */
|
|
6
|
+
export declare function getOperation(id: string): OperationDescriptor | undefined;
|
|
7
|
+
/** Returns every registered operation descriptor. */
|
|
8
|
+
export declare function listOperations(): readonly OperationDescriptor[];
|
|
9
|
+
/** Returns agent-surface operations that include the given capability profile. */
|
|
10
|
+
export declare function getOperationsByProfile(profile: CapabilityProfile): readonly OperationDescriptor[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Central operation registry — aggregates domain modules and exposes lookup helpers.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getOperation = getOperation;
|
|
7
|
+
exports.listOperations = listOperations;
|
|
8
|
+
exports.getOperationsByProfile = getOperationsByProfile;
|
|
9
|
+
const ai_agents_1 = require("./ai-agents");
|
|
10
|
+
const users_1 = require("./users");
|
|
11
|
+
const ALL_OPERATIONS = [...ai_agents_1.AI_AGENT_OPERATIONS, ...users_1.USER_OPERATIONS];
|
|
12
|
+
const operationsById = new Map(ALL_OPERATIONS.map((operation) => [operation.id, operation]));
|
|
13
|
+
if (operationsById.size !== ALL_OPERATIONS.length) {
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
const duplicates = [];
|
|
16
|
+
for (const operation of ALL_OPERATIONS) {
|
|
17
|
+
if (seen.has(operation.id)) {
|
|
18
|
+
duplicates.push(operation.id);
|
|
19
|
+
}
|
|
20
|
+
seen.add(operation.id);
|
|
21
|
+
}
|
|
22
|
+
throw new Error(`Duplicate operation ids in registry: ${duplicates.join(', ')}`);
|
|
23
|
+
}
|
|
24
|
+
/** Returns a registered operation by id, or undefined when not found. */
|
|
25
|
+
function getOperation(id) {
|
|
26
|
+
return operationsById.get(id);
|
|
27
|
+
}
|
|
28
|
+
/** Returns every registered operation descriptor. */
|
|
29
|
+
function listOperations() {
|
|
30
|
+
return ALL_OPERATIONS;
|
|
31
|
+
}
|
|
32
|
+
/** Returns agent-surface operations that include the given capability profile. */
|
|
33
|
+
function getOperationsByProfile(profile) {
|
|
34
|
+
return ALL_OPERATIONS.filter((operation) => operation.agentExposure !== 'client-only' && operation.profiles.includes(profile));
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|