@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
|
@@ -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,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Agent-safe surface policy helpers (ADR-0004 / ADR-0013).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IRRECOVERABLE_TOOL_DENYLIST = void 0;
|
|
7
|
+
const registry_1 = require("./registry");
|
|
8
|
+
/** Banned MCP tool names (without `lightdash_` prefix) for regression tests. */
|
|
9
|
+
exports.IRRECOVERABLE_TOOL_DENYLIST = (0, registry_1.listBannedMcpToolNames)();
|
|
@@ -0,0 +1,427 @@
|
|
|
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
|
+
sensitivity: 'none',
|
|
26
|
+
mcp: {
|
|
27
|
+
toolName: 'list_admin_agents',
|
|
28
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
29
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
30
|
+
},
|
|
31
|
+
cli: { commandPath: 'ai-agents list' },
|
|
32
|
+
profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
|
|
33
|
+
});
|
|
34
|
+
const adminListThreads = (0, types_1.defineOperation)({
|
|
35
|
+
id: 'ai-agents.admin.threads.list',
|
|
36
|
+
summary: 'List AI agent threads across the organization with optional filters (admin)',
|
|
37
|
+
http: { method: 'GET', path: `${API_V1}/aiAgents/admin/threads` },
|
|
38
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
39
|
+
sensitivity: 'none',
|
|
40
|
+
mcp: {
|
|
41
|
+
toolName: 'list_admin_agent_threads',
|
|
42
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
43
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
44
|
+
},
|
|
45
|
+
cli: { commandPath: 'ai-agents threads' },
|
|
46
|
+
profiles: [PROFILE_DISCOVERY],
|
|
47
|
+
});
|
|
48
|
+
const adminSettingsGet = (0, types_1.defineOperation)({
|
|
49
|
+
id: 'ai-agents.admin.settings.get',
|
|
50
|
+
summary: 'Get AI organization settings (admin)',
|
|
51
|
+
http: { method: 'GET', path: `${API_V1}/aiAgents/admin/settings` },
|
|
52
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
53
|
+
sensitivity: 'none',
|
|
54
|
+
mcp: {
|
|
55
|
+
toolName: 'get_ai_organization_settings',
|
|
56
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
57
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
58
|
+
},
|
|
59
|
+
cli: { commandPath: 'ai-agents settings get' },
|
|
60
|
+
profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
|
|
61
|
+
});
|
|
62
|
+
const adminSettingsUpdate = (0, types_1.defineOperation)({
|
|
63
|
+
id: 'ai-agents.admin.settings.update',
|
|
64
|
+
summary: 'Update AI organization settings (admin)',
|
|
65
|
+
http: { method: 'PATCH', path: `${API_V1}/aiAgents/admin/settings` },
|
|
66
|
+
authorization: { safetyImpact: IMPACT_WRITE_NONDESTRUCTIVE },
|
|
67
|
+
sensitivity: 'none',
|
|
68
|
+
mcp: {
|
|
69
|
+
toolName: 'update_ai_organization_settings',
|
|
70
|
+
annotations: safety_1.WRITE_IDEMPOTENT,
|
|
71
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
72
|
+
},
|
|
73
|
+
cli: { commandPath: 'ai-agents settings update' },
|
|
74
|
+
profiles: [PROFILE_CORE_LIFECYCLE],
|
|
75
|
+
});
|
|
76
|
+
const projectAgentsList = (0, types_1.defineOperation)({
|
|
77
|
+
id: 'ai-agents.project.agents.list',
|
|
78
|
+
summary: 'List all AI agents in a project',
|
|
79
|
+
http: { method: 'GET', path: PROJECT_AGENTS_PATH },
|
|
80
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
81
|
+
sensitivity: 'none',
|
|
82
|
+
mcp: {
|
|
83
|
+
toolName: 'list_project_agents',
|
|
84
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
85
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
86
|
+
},
|
|
87
|
+
cli: { commandPath: 'agents list' },
|
|
88
|
+
profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
|
|
89
|
+
});
|
|
90
|
+
const projectAgentsGet = (0, types_1.defineOperation)({
|
|
91
|
+
id: 'ai-agents.project.agents.get',
|
|
92
|
+
summary: 'Get a single AI agent in a project',
|
|
93
|
+
http: { method: 'GET', path: PROJECT_AGENT_PATH },
|
|
94
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
95
|
+
sensitivity: 'none',
|
|
96
|
+
mcp: {
|
|
97
|
+
toolName: 'get_project_agent',
|
|
98
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
99
|
+
taskSupport: { exposed: false, 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
|
+
sensitivity: 'none',
|
|
110
|
+
mcp: {
|
|
111
|
+
toolName: 'create_project_agent',
|
|
112
|
+
annotations: safety_1.WRITE_NONDESTRUCTIVE,
|
|
113
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
114
|
+
},
|
|
115
|
+
cli: { commandPath: 'agents create' },
|
|
116
|
+
profiles: [PROFILE_CORE_LIFECYCLE],
|
|
117
|
+
});
|
|
118
|
+
const projectAgentsUpdate = (0, types_1.defineOperation)({
|
|
119
|
+
id: 'ai-agents.project.agents.update',
|
|
120
|
+
summary: 'Update an existing AI agent in a project',
|
|
121
|
+
http: { method: 'PATCH', path: PROJECT_AGENT_PATH },
|
|
122
|
+
authorization: { safetyImpact: IMPACT_WRITE_NONDESTRUCTIVE },
|
|
123
|
+
sensitivity: 'none',
|
|
124
|
+
mcp: {
|
|
125
|
+
toolName: 'update_project_agent',
|
|
126
|
+
annotations: safety_1.WRITE_NONDESTRUCTIVE,
|
|
127
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
128
|
+
},
|
|
129
|
+
cli: { commandPath: 'agents update' },
|
|
130
|
+
profiles: [PROFILE_CORE_LIFECYCLE],
|
|
131
|
+
});
|
|
132
|
+
const projectAgentsDelete = (0, types_1.defineOperation)({
|
|
133
|
+
id: 'ai-agents.project.agents.delete',
|
|
134
|
+
summary: 'Delete an AI agent from a project',
|
|
135
|
+
http: { method: 'DELETE', path: PROJECT_AGENT_PATH },
|
|
136
|
+
authorization: { safetyImpact: IMPACT_WRITE_DESTRUCTIVE },
|
|
137
|
+
sensitivity: 'none',
|
|
138
|
+
mcp: {
|
|
139
|
+
toolName: 'delete_project_agent',
|
|
140
|
+
annotations: safety_1.WRITE_DESTRUCTIVE,
|
|
141
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
142
|
+
},
|
|
143
|
+
cli: { commandPath: 'agents delete' },
|
|
144
|
+
profiles: [PROFILE_CORE_LIFECYCLE],
|
|
145
|
+
});
|
|
146
|
+
const PROJECT_AGENT_THREADS_PATH = `${PROJECT_AGENT_PATH}/threads`;
|
|
147
|
+
const threadsList = (0, types_1.defineOperation)({
|
|
148
|
+
id: 'ai-agents.project.threads.list',
|
|
149
|
+
summary: 'List conversation threads for an agent',
|
|
150
|
+
http: {
|
|
151
|
+
method: 'GET',
|
|
152
|
+
path: PROJECT_AGENT_THREADS_PATH,
|
|
153
|
+
},
|
|
154
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
155
|
+
sensitivity: 'none',
|
|
156
|
+
mcp: {
|
|
157
|
+
toolName: 'list_agent_threads',
|
|
158
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
159
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
160
|
+
},
|
|
161
|
+
cli: { commandPath: 'agents threads list' },
|
|
162
|
+
profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY],
|
|
163
|
+
});
|
|
164
|
+
const PROJECT_AGENT_THREAD_PATH = `${PROJECT_AGENT_THREADS_PATH}/{threadUuid}`;
|
|
165
|
+
const threadsGet = (0, types_1.defineOperation)({
|
|
166
|
+
id: 'ai-agents.project.threads.get',
|
|
167
|
+
summary: 'Get a conversation thread with all messages',
|
|
168
|
+
http: {
|
|
169
|
+
method: 'GET',
|
|
170
|
+
path: PROJECT_AGENT_THREAD_PATH,
|
|
171
|
+
},
|
|
172
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
173
|
+
sensitivity: 'none',
|
|
174
|
+
mcp: {
|
|
175
|
+
toolName: 'get_agent_thread',
|
|
176
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
177
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
178
|
+
},
|
|
179
|
+
cli: { commandPath: 'agents threads get' },
|
|
180
|
+
profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY],
|
|
181
|
+
});
|
|
182
|
+
const PROJECT_AGENT_THREAD_MESSAGES_PATH = `${PROJECT_AGENT_THREAD_PATH}/messages`;
|
|
183
|
+
const PROJECT_AGENT_THREAD_GENERATE_PATH = `${PROJECT_AGENT_THREAD_PATH}/generate`;
|
|
184
|
+
const threadsStart = (0, types_1.defineOperation)({
|
|
185
|
+
id: 'ai-agents.project.threads.start',
|
|
186
|
+
summary: 'Start a new conversation (client workflow: create thread, add message, generate response)',
|
|
187
|
+
http: {
|
|
188
|
+
method: 'POST',
|
|
189
|
+
path: PROJECT_AGENT_THREADS_PATH,
|
|
190
|
+
},
|
|
191
|
+
workflow: [
|
|
192
|
+
{
|
|
193
|
+
method: 'POST',
|
|
194
|
+
path: PROJECT_AGENT_THREADS_PATH,
|
|
195
|
+
summary: 'Create thread',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
method: 'POST',
|
|
199
|
+
path: PROJECT_AGENT_THREAD_MESSAGES_PATH,
|
|
200
|
+
summary: 'Add user message',
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
method: 'POST',
|
|
204
|
+
path: PROJECT_AGENT_THREAD_GENERATE_PATH,
|
|
205
|
+
summary: 'Generate agent response',
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
authorization: { safetyImpact: IMPACT_EXTERNAL },
|
|
209
|
+
sensitivity: 'none',
|
|
210
|
+
mcp: {
|
|
211
|
+
toolName: 'generate_agent_message',
|
|
212
|
+
annotations: safety_1.WRITE_OPEN_WORLD,
|
|
213
|
+
taskSupport: { exposed: false, taskEligible: true },
|
|
214
|
+
},
|
|
215
|
+
cli: { commandPath: 'agents threads start' },
|
|
216
|
+
profiles: [PROFILE_CONVERSATIONS],
|
|
217
|
+
});
|
|
218
|
+
const threadsContinue = (0, types_1.defineOperation)({
|
|
219
|
+
id: 'ai-agents.project.threads.continue',
|
|
220
|
+
summary: 'Continue an existing conversation (client workflow: add message, generate response)',
|
|
221
|
+
http: {
|
|
222
|
+
method: 'POST',
|
|
223
|
+
path: PROJECT_AGENT_THREAD_GENERATE_PATH,
|
|
224
|
+
},
|
|
225
|
+
workflow: [
|
|
226
|
+
{
|
|
227
|
+
method: 'POST',
|
|
228
|
+
path: PROJECT_AGENT_THREAD_MESSAGES_PATH,
|
|
229
|
+
summary: 'Add user message',
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
method: 'POST',
|
|
233
|
+
path: PROJECT_AGENT_THREAD_GENERATE_PATH,
|
|
234
|
+
summary: 'Generate agent response',
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
authorization: { safetyImpact: IMPACT_EXTERNAL },
|
|
238
|
+
sensitivity: 'none',
|
|
239
|
+
mcp: {
|
|
240
|
+
toolName: 'continue_agent_thread',
|
|
241
|
+
annotations: safety_1.WRITE_OPEN_WORLD,
|
|
242
|
+
taskSupport: { exposed: false, taskEligible: true },
|
|
243
|
+
},
|
|
244
|
+
cli: { commandPath: 'agents threads continue' },
|
|
245
|
+
profiles: [PROFILE_CONVERSATIONS],
|
|
246
|
+
});
|
|
247
|
+
const PROJECT_AGENT_EVALUATIONS_PATH = `${PROJECT_AGENT_PATH}/evaluations`;
|
|
248
|
+
const evaluationsList = (0, types_1.defineOperation)({
|
|
249
|
+
id: 'ai-agents.project.evaluations.list',
|
|
250
|
+
summary: 'List all evaluations for an agent',
|
|
251
|
+
http: {
|
|
252
|
+
method: 'GET',
|
|
253
|
+
path: PROJECT_AGENT_EVALUATIONS_PATH,
|
|
254
|
+
},
|
|
255
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
256
|
+
sensitivity: 'none',
|
|
257
|
+
mcp: {
|
|
258
|
+
toolName: 'list_agent_evaluations',
|
|
259
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
260
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
261
|
+
},
|
|
262
|
+
cli: { commandPath: 'agents evals list' },
|
|
263
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
264
|
+
});
|
|
265
|
+
const PROJECT_AGENT_EVALUATION_PATH = `${PROJECT_AGENT_EVALUATIONS_PATH}/{evalUuid}`;
|
|
266
|
+
const evaluationsGet = (0, types_1.defineOperation)({
|
|
267
|
+
id: 'ai-agents.project.evaluations.get',
|
|
268
|
+
summary: 'Get a full evaluation including test prompts',
|
|
269
|
+
http: {
|
|
270
|
+
method: 'GET',
|
|
271
|
+
path: PROJECT_AGENT_EVALUATION_PATH,
|
|
272
|
+
},
|
|
273
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
274
|
+
sensitivity: 'none',
|
|
275
|
+
mcp: {
|
|
276
|
+
toolName: 'get_agent_evaluation',
|
|
277
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
278
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
279
|
+
},
|
|
280
|
+
cli: { commandPath: 'agents evals get' },
|
|
281
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
282
|
+
});
|
|
283
|
+
const evaluationsCreate = (0, types_1.defineOperation)({
|
|
284
|
+
id: 'ai-agents.project.evaluations.create',
|
|
285
|
+
summary: 'Create a new evaluation test suite for an agent',
|
|
286
|
+
http: {
|
|
287
|
+
method: 'POST',
|
|
288
|
+
path: PROJECT_AGENT_EVALUATIONS_PATH,
|
|
289
|
+
},
|
|
290
|
+
authorization: { safetyImpact: IMPACT_WRITE_NONDESTRUCTIVE },
|
|
291
|
+
sensitivity: 'none',
|
|
292
|
+
mcp: {
|
|
293
|
+
toolName: 'create_agent_evaluation',
|
|
294
|
+
annotations: safety_1.WRITE_NONDESTRUCTIVE,
|
|
295
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
296
|
+
},
|
|
297
|
+
cli: { commandPath: 'agents evals create' },
|
|
298
|
+
profiles: [PROFILE_EVALUATIONS],
|
|
299
|
+
});
|
|
300
|
+
const evaluationsUpdate = (0, types_1.defineOperation)({
|
|
301
|
+
id: 'ai-agents.project.evaluations.update',
|
|
302
|
+
summary: 'Update an evaluation title, description, or prompts',
|
|
303
|
+
http: {
|
|
304
|
+
method: 'PATCH',
|
|
305
|
+
path: PROJECT_AGENT_EVALUATION_PATH,
|
|
306
|
+
},
|
|
307
|
+
authorization: { safetyImpact: IMPACT_WRITE_NONDESTRUCTIVE },
|
|
308
|
+
sensitivity: 'none',
|
|
309
|
+
mcp: {
|
|
310
|
+
toolName: 'update_agent_evaluation',
|
|
311
|
+
annotations: safety_1.WRITE_NONDESTRUCTIVE,
|
|
312
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
313
|
+
},
|
|
314
|
+
cli: { commandPath: 'agents evals update' },
|
|
315
|
+
profiles: [PROFILE_EVALUATIONS],
|
|
316
|
+
});
|
|
317
|
+
const evaluationsAppend = (0, types_1.defineOperation)({
|
|
318
|
+
id: 'ai-agents.project.evaluations.append',
|
|
319
|
+
summary: 'Append additional prompts to an existing evaluation',
|
|
320
|
+
http: {
|
|
321
|
+
method: 'POST',
|
|
322
|
+
path: `${PROJECT_AGENT_EVALUATION_PATH}/append`,
|
|
323
|
+
},
|
|
324
|
+
authorization: { safetyImpact: IMPACT_WRITE_NONDESTRUCTIVE },
|
|
325
|
+
sensitivity: 'none',
|
|
326
|
+
mcp: {
|
|
327
|
+
toolName: 'append_agent_evaluation_prompts',
|
|
328
|
+
annotations: safety_1.WRITE_NONDESTRUCTIVE,
|
|
329
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
330
|
+
},
|
|
331
|
+
cli: { commandPath: 'agents evals append' },
|
|
332
|
+
profiles: [PROFILE_EVALUATIONS],
|
|
333
|
+
});
|
|
334
|
+
const evaluationsDelete = (0, types_1.defineOperation)({
|
|
335
|
+
id: 'ai-agents.project.evaluations.delete',
|
|
336
|
+
summary: 'Delete an evaluation and all its runs',
|
|
337
|
+
http: {
|
|
338
|
+
method: 'DELETE',
|
|
339
|
+
path: PROJECT_AGENT_EVALUATION_PATH,
|
|
340
|
+
},
|
|
341
|
+
authorization: { safetyImpact: IMPACT_WRITE_DESTRUCTIVE },
|
|
342
|
+
sensitivity: 'none',
|
|
343
|
+
mcp: {
|
|
344
|
+
toolName: 'delete_agent_evaluation',
|
|
345
|
+
annotations: safety_1.WRITE_DESTRUCTIVE,
|
|
346
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
347
|
+
},
|
|
348
|
+
cli: { commandPath: 'agents evals delete' },
|
|
349
|
+
profiles: [PROFILE_EVALUATIONS],
|
|
350
|
+
});
|
|
351
|
+
const evaluationsRun = (0, types_1.defineOperation)({
|
|
352
|
+
id: 'ai-agents.project.evaluations.run',
|
|
353
|
+
summary: 'Trigger a new evaluation run for an agent',
|
|
354
|
+
http: {
|
|
355
|
+
method: 'POST',
|
|
356
|
+
path: `${PROJECT_AGENT_EVALUATION_PATH}/run`,
|
|
357
|
+
},
|
|
358
|
+
authorization: { safetyImpact: IMPACT_EXTERNAL },
|
|
359
|
+
sensitivity: 'none',
|
|
360
|
+
mcp: {
|
|
361
|
+
toolName: 'run_agent_evaluation',
|
|
362
|
+
annotations: safety_1.WRITE_OPEN_WORLD,
|
|
363
|
+
taskSupport: { exposed: false, taskEligible: true },
|
|
364
|
+
},
|
|
365
|
+
cli: { commandPath: 'agents evals run' },
|
|
366
|
+
profiles: [PROFILE_EVALUATIONS],
|
|
367
|
+
});
|
|
368
|
+
const PROJECT_AGENT_EVALUATION_RUNS_PATH = `${PROJECT_AGENT_EVALUATION_PATH}/runs`;
|
|
369
|
+
const evaluationsRunsList = (0, types_1.defineOperation)({
|
|
370
|
+
id: 'ai-agents.project.evaluations.runs.list',
|
|
371
|
+
summary: 'List all runs for an evaluation with status and pass/fail counts',
|
|
372
|
+
http: {
|
|
373
|
+
method: 'GET',
|
|
374
|
+
path: PROJECT_AGENT_EVALUATION_RUNS_PATH,
|
|
375
|
+
},
|
|
376
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
377
|
+
sensitivity: 'none',
|
|
378
|
+
mcp: {
|
|
379
|
+
toolName: 'list_agent_evaluation_runs',
|
|
380
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
381
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
382
|
+
},
|
|
383
|
+
cli: { commandPath: 'agents evals runs' },
|
|
384
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
385
|
+
});
|
|
386
|
+
const evaluationsRunResultsGet = (0, types_1.defineOperation)({
|
|
387
|
+
id: 'ai-agents.project.evaluations.runs.get',
|
|
388
|
+
summary: 'Get detailed per-prompt results for a specific evaluation run',
|
|
389
|
+
http: {
|
|
390
|
+
method: 'GET',
|
|
391
|
+
path: `${PROJECT_AGENT_EVALUATION_RUNS_PATH}/{runUuid}`,
|
|
392
|
+
},
|
|
393
|
+
authorization: { safetyImpact: IMPACT_READ },
|
|
394
|
+
sensitivity: 'none',
|
|
395
|
+
mcp: {
|
|
396
|
+
toolName: 'get_agent_evaluation_run_results',
|
|
397
|
+
annotations: safety_1.READ_ONLY_DEFAULT,
|
|
398
|
+
taskSupport: { exposed: false, taskEligible: false },
|
|
399
|
+
},
|
|
400
|
+
cli: { commandPath: 'agents evals run-results' },
|
|
401
|
+
profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
|
|
402
|
+
});
|
|
403
|
+
/** All registered P0 AI agent operations. */
|
|
404
|
+
exports.AI_AGENT_OPERATIONS = [
|
|
405
|
+
adminListAgents,
|
|
406
|
+
adminListThreads,
|
|
407
|
+
adminSettingsGet,
|
|
408
|
+
adminSettingsUpdate,
|
|
409
|
+
projectAgentsList,
|
|
410
|
+
projectAgentsGet,
|
|
411
|
+
projectAgentsCreate,
|
|
412
|
+
projectAgentsUpdate,
|
|
413
|
+
projectAgentsDelete,
|
|
414
|
+
threadsList,
|
|
415
|
+
threadsGet,
|
|
416
|
+
threadsStart,
|
|
417
|
+
threadsContinue,
|
|
418
|
+
evaluationsList,
|
|
419
|
+
evaluationsGet,
|
|
420
|
+
evaluationsCreate,
|
|
421
|
+
evaluationsUpdate,
|
|
422
|
+
evaluationsAppend,
|
|
423
|
+
evaluationsDelete,
|
|
424
|
+
evaluationsRun,
|
|
425
|
+
evaluationsRunsList,
|
|
426
|
+
evaluationsRunResultsGet,
|
|
427
|
+
];
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CLI content/validation operations (ADR-0013). Catalog metadata only — not MCP tools.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CLI_CONTENT_OPERATIONS = void 0;
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
const PROFILE_DISCOVERY = 'discovery-readonly';
|
|
9
|
+
const PROFILE_CORE = 'core-lifecycle';
|
|
10
|
+
const chartsList = (0, types_1.defineOperation)({
|
|
11
|
+
id: 'cli.charts.list',
|
|
12
|
+
summary: 'List charts in a project (Commander alias of charts-as-code list)',
|
|
13
|
+
http: { method: 'GET', path: '/api/v1/projects/{projectUuid}/code/charts' },
|
|
14
|
+
authorization: { safetyImpact: 'read' },
|
|
15
|
+
sensitivity: 'none',
|
|
16
|
+
cli: { commandPath: 'projects charts list' },
|
|
17
|
+
profiles: [PROFILE_DISCOVERY],
|
|
18
|
+
});
|
|
19
|
+
const chartsCodeList = (0, types_1.defineOperation)({
|
|
20
|
+
id: 'cli.charts.code.list',
|
|
21
|
+
summary: 'Get charts in code representation',
|
|
22
|
+
http: { method: 'GET', path: '/api/v1/projects/{projectUuid}/code/charts' },
|
|
23
|
+
authorization: { safetyImpact: 'read' },
|
|
24
|
+
sensitivity: 'none',
|
|
25
|
+
cli: { commandPath: 'projects charts code list' },
|
|
26
|
+
profiles: [PROFILE_DISCOVERY],
|
|
27
|
+
});
|
|
28
|
+
const chartsCodeUpsert = (0, types_1.defineOperation)({
|
|
29
|
+
id: 'cli.charts.code.upsert',
|
|
30
|
+
summary: 'Create or update chart by slug',
|
|
31
|
+
http: { method: 'POST', path: '/api/v1/projects/{projectUuid}/code/charts/{slug}' },
|
|
32
|
+
authorization: { safetyImpact: 'write-nondestructive' },
|
|
33
|
+
sensitivity: 'none',
|
|
34
|
+
cli: { commandPath: 'projects charts code upsert' },
|
|
35
|
+
profiles: [PROFILE_CORE],
|
|
36
|
+
});
|
|
37
|
+
const dashboardsList = (0, types_1.defineOperation)({
|
|
38
|
+
id: 'cli.dashboards.list',
|
|
39
|
+
summary: 'List dashboards in a project',
|
|
40
|
+
http: { method: 'GET', path: '/api/v1/projects/{projectUuid}/dashboards' },
|
|
41
|
+
authorization: { safetyImpact: 'read' },
|
|
42
|
+
sensitivity: 'none',
|
|
43
|
+
cli: { commandPath: 'projects dashboards list' },
|
|
44
|
+
profiles: [PROFILE_DISCOVERY],
|
|
45
|
+
});
|
|
46
|
+
const validateRun = (0, types_1.defineOperation)({
|
|
47
|
+
id: 'cli.projects.validate.run',
|
|
48
|
+
summary: 'Start project validation job',
|
|
49
|
+
http: { method: 'POST', path: '/api/v1/projects/{projectUuid}/validate' },
|
|
50
|
+
authorization: { safetyImpact: 'write-nondestructive' },
|
|
51
|
+
sensitivity: 'none',
|
|
52
|
+
cli: { commandPath: 'projects validate run' },
|
|
53
|
+
profiles: [PROFILE_CORE],
|
|
54
|
+
});
|
|
55
|
+
const validateResults = (0, types_1.defineOperation)({
|
|
56
|
+
id: 'cli.projects.validate.results',
|
|
57
|
+
summary: 'List project validation results (v2, paginated)',
|
|
58
|
+
http: { method: 'GET', path: '/api/v2/projects/{projectUuid}/validate' },
|
|
59
|
+
authorization: { safetyImpact: 'read' },
|
|
60
|
+
sensitivity: 'none',
|
|
61
|
+
cli: { commandPath: 'projects validate results' },
|
|
62
|
+
profiles: [PROFILE_DISCOVERY],
|
|
63
|
+
});
|
|
64
|
+
exports.CLI_CONTENT_OPERATIONS = [
|
|
65
|
+
chartsList,
|
|
66
|
+
chartsCodeList,
|
|
67
|
+
chartsCodeUpsert,
|
|
68
|
+
dashboardsList,
|
|
69
|
+
validateRun,
|
|
70
|
+
validateResults,
|
|
71
|
+
];
|