@lightdash-tools/common 0.8.0 → 0.9.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/audit.d.ts CHANGED
@@ -1,33 +1,53 @@
1
1
  /**
2
2
  * Structured audit logger for Lightdash tool invocations (MCP and CLI).
3
3
  *
4
- * Each operation is recorded as a single NDJSON line containing:
5
- * timestamp, sessionId, tool/command name, projectUuids (if present), status, durationMs,
6
- * and optional OAuth attribution fields (tokenHash, subject) when available.
4
+ * Each operation is recorded as a single NDJSON line. On stderr the line is pure JSON
5
+ * (Cloud Logging–parseable); text prefixes prevent jsonPayload parsing on Cloud Run.
7
6
  *
8
- * Output destination:
9
- * - If LIGHTDASH_TOOLS_AUDIT_LOG is set to a file path, entries are appended to that file.
10
- * - Otherwise entries are written to stderr with an "[audit]" prefix.
7
+ * If LIGHTDASH_TOOLS_AUDIT_LOG is a file path, entries are appended there; otherwise stderr.
11
8
  */
12
9
  export type AuditStatus = 'blocked' | 'confirmation_cancelled' | 'confirmation_declined' | 'confirmation_requested' | 'deletion_failed' | 'deletion_succeeded' | 'error' | 'promotion_failed' | 'promotion_succeeded' | 'resource_changed' | 'success';
10
+ /** Cloud Logging LogSeverity-compatible strings for structured stderr JSON. */
11
+ export type AuditSeverity = 'ERROR' | 'INFO' | 'NOTICE' | 'WARNING';
13
12
  export type AuditLogEntry = {
13
+ /** Stable filter key for Cloud Logging (`jsonPayload.channel="audit"`). */
14
+ channel: 'audit';
15
+ severity: AuditSeverity;
16
+ message: string;
14
17
  timestamp: string;
18
+ /** Process-lifetime instance id (not the MCP client session). */
15
19
  sessionId: string;
16
- /** MCP tool name or CLI command name. */
17
20
  tool: string;
18
- /** Project UUIDs involved in the call, if any (covers both projectUuid and projectUuids[]). */
19
21
  projectUuids?: string[];
20
22
  /** SHA-256 hash of the OAuth bearer token (never the raw token). */
21
23
  tokenHash?: string;
22
24
  /** Lightdash user UUID when the call runs under OAuth bearer auth. */
23
25
  subject?: string;
26
+ clientSessionId?: string;
27
+ personaId?: string;
24
28
  status: AuditStatus;
25
29
  durationMs: number;
26
30
  };
31
+ export type BuildAuditLogEntryInput = {
32
+ tool: string;
33
+ status: AuditStatus;
34
+ /** Epoch ms when the operation started (`durationMs = now - startMs`). */
35
+ startMs: number;
36
+ projectUuids?: string[];
37
+ tokenHash?: string;
38
+ subject?: string;
39
+ clientSessionId?: string;
40
+ personaId?: string;
41
+ };
27
42
  export declare function getSessionId(): string;
43
+ /** Map audit status to Cloud Logging severity. */
44
+ export declare function auditSeverityForStatus(status: AuditStatus): AuditSeverity;
45
+ /** Assemble a full audit entry (shared by CLI and MCP). */
46
+ export declare function buildAuditLogEntry(input: BuildAuditLogEntryInput): AuditLogEntry;
28
47
  /**
29
48
  * Initialise the audit log. Call once at process startup.
30
49
  * If filePath is provided, entries are appended to that file; otherwise stderr is used.
50
+ * Startup banners go to stdout so they do not mix with structured audit JSON on stderr.
31
51
  */
32
52
  export declare function initAuditLog(filePath?: string): void;
33
53
  /** Append one NDJSON entry to the configured output. */
package/dist/audit.js CHANGED
@@ -2,16 +2,15 @@
2
2
  /**
3
3
  * Structured audit logger for Lightdash tool invocations (MCP and CLI).
4
4
  *
5
- * Each operation is recorded as a single NDJSON line containing:
6
- * timestamp, sessionId, tool/command name, projectUuids (if present), status, durationMs,
7
- * and optional OAuth attribution fields (tokenHash, subject) when available.
5
+ * Each operation is recorded as a single NDJSON line. On stderr the line is pure JSON
6
+ * (Cloud Logging–parseable); text prefixes prevent jsonPayload parsing on Cloud Run.
8
7
  *
9
- * Output destination:
10
- * - If LIGHTDASH_TOOLS_AUDIT_LOG is set to a file path, entries are appended to that file.
11
- * - Otherwise entries are written to stderr with an "[audit]" prefix.
8
+ * If LIGHTDASH_TOOLS_AUDIT_LOG is a file path, entries are appended there; otherwise stderr.
12
9
  */
13
10
  Object.defineProperty(exports, "__esModule", { value: true });
14
11
  exports.getSessionId = getSessionId;
12
+ exports.auditSeverityForStatus = auditSeverityForStatus;
13
+ exports.buildAuditLogEntry = buildAuditLogEntry;
15
14
  exports.initAuditLog = initAuditLog;
16
15
  exports.logAuditEntry = logAuditEntry;
17
16
  exports.closeAuditLog = closeAuditLog;
@@ -23,20 +22,65 @@ let _writeStream;
23
22
  function getSessionId() {
24
23
  return SESSION_ID;
25
24
  }
25
+ /** Map audit status to Cloud Logging severity. */
26
+ function auditSeverityForStatus(status) {
27
+ switch (status) {
28
+ case 'success':
29
+ return 'INFO';
30
+ case 'deletion_succeeded':
31
+ case 'promotion_succeeded':
32
+ return 'NOTICE';
33
+ case 'blocked':
34
+ case 'confirmation_cancelled':
35
+ case 'confirmation_declined':
36
+ case 'confirmation_requested':
37
+ case 'resource_changed':
38
+ return 'WARNING';
39
+ case 'deletion_failed':
40
+ case 'error':
41
+ case 'promotion_failed':
42
+ return 'ERROR';
43
+ default: {
44
+ const _exhaustive = status;
45
+ return _exhaustive;
46
+ }
47
+ }
48
+ }
49
+ /** Assemble a full audit entry (shared by CLI and MCP). */
50
+ function buildAuditLogEntry(input) {
51
+ const projectUuids = input.projectUuids && input.projectUuids.length > 0 ? input.projectUuids : undefined;
52
+ return {
53
+ channel: 'audit',
54
+ severity: auditSeverityForStatus(input.status),
55
+ message: `${input.tool} ${input.status}`,
56
+ timestamp: new Date().toISOString(),
57
+ sessionId: SESSION_ID,
58
+ tool: input.tool,
59
+ projectUuids,
60
+ tokenHash: input.tokenHash,
61
+ subject: input.subject,
62
+ clientSessionId: input.clientSessionId,
63
+ personaId: input.personaId,
64
+ status: input.status,
65
+ durationMs: Date.now() - input.startMs,
66
+ };
67
+ }
26
68
  /**
27
69
  * Initialise the audit log. Call once at process startup.
28
70
  * If filePath is provided, entries are appended to that file; otherwise stderr is used.
71
+ * Startup banners go to stdout so they do not mix with structured audit JSON on stderr.
29
72
  */
30
73
  function initAuditLog(filePath) {
31
74
  if (filePath) {
32
75
  _writeStream = (0, node_fs_1.createWriteStream)(filePath, { flags: 'a' });
33
76
  _writeStream.on('error', (err) => {
77
+ // Diagnostic only — not an audit row.
34
78
  console.error('[audit] Failed to write to audit log file:', err);
35
79
  });
36
- console.error(`[audit] Writing to file: ${filePath} (session: ${SESSION_ID})`);
80
+ console.log(`[audit] Writing to file: ${filePath} (session: ${SESSION_ID})`);
37
81
  }
38
82
  else {
39
- console.error(`[audit] Writing to stderr (session: ${SESSION_ID})`);
83
+ console.log(`[audit] Writing to stderr (session: ${SESSION_ID})`);
40
84
  }
41
85
  }
42
86
  /** Append one NDJSON entry to the configured output. */
@@ -46,7 +90,7 @@ function logAuditEntry(entry) {
46
90
  _writeStream.write(line);
47
91
  }
48
92
  else {
49
- process.stderr.write(`[audit] ${line}`);
93
+ process.stderr.write(line);
50
94
  }
51
95
  }
52
96
  /** Closes the file stream, if any. Awaits pending writes before resolving. */
@@ -14,56 +14,83 @@ const audit_1 = require("./audit");
14
14
  (0, vitest_1.expect)((0, audit_1.getSessionId)()).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
15
15
  (0, vitest_1.expect)((0, audit_1.getSessionId)()).toBe((0, audit_1.getSessionId)());
16
16
  });
17
- (0, vitest_1.it)('initAuditLog announces stderr destination when no file path is given', () => {
18
- const consoleErrorSpy = vitest_1.vi.spyOn(console, 'error').mockImplementation(() => { });
17
+ (0, vitest_1.it)('auditSeverityForStatus maps statuses for Cloud Logging', () => {
18
+ (0, vitest_1.expect)((0, audit_1.auditSeverityForStatus)('success')).toBe('INFO');
19
+ (0, vitest_1.expect)((0, audit_1.auditSeverityForStatus)('deletion_succeeded')).toBe('NOTICE');
20
+ (0, vitest_1.expect)((0, audit_1.auditSeverityForStatus)('blocked')).toBe('WARNING');
21
+ (0, vitest_1.expect)((0, audit_1.auditSeverityForStatus)('error')).toBe('ERROR');
22
+ });
23
+ (0, vitest_1.it)('buildAuditLogEntry derives channel, severity, and message', () => {
24
+ const entry = (0, audit_1.buildAuditLogEntry)({
25
+ tool: 'demo_tool',
26
+ status: 'blocked',
27
+ startMs: Date.now() - 5,
28
+ projectUuids: [],
29
+ personaId: 'semantic-layer',
30
+ });
31
+ (0, vitest_1.expect)(entry.channel).toBe('audit');
32
+ (0, vitest_1.expect)(entry.severity).toBe('WARNING');
33
+ (0, vitest_1.expect)(entry.message).toBe('demo_tool blocked');
34
+ (0, vitest_1.expect)(entry.projectUuids).toBeUndefined();
35
+ (0, vitest_1.expect)(entry.personaId).toBe('semantic-layer');
36
+ (0, vitest_1.expect)(entry.sessionId).toBe((0, audit_1.getSessionId)());
37
+ });
38
+ (0, vitest_1.it)('initAuditLog announces stderr destination on stdout when no file path is given', () => {
39
+ const consoleLogSpy = vitest_1.vi.spyOn(console, 'log').mockImplementation(() => { });
19
40
  try {
20
41
  (0, audit_1.initAuditLog)();
21
- (0, vitest_1.expect)(consoleErrorSpy).toHaveBeenCalledWith(vitest_1.expect.stringContaining('[audit] Writing to stderr'));
42
+ (0, vitest_1.expect)(consoleLogSpy).toHaveBeenCalledWith(vitest_1.expect.stringContaining('[audit] Writing to stderr'));
22
43
  }
23
44
  finally {
24
- consoleErrorSpy.mockRestore();
45
+ consoleLogSpy.mockRestore();
25
46
  }
26
47
  });
27
- (0, vitest_1.it)('logAuditEntry writes NDJSON to stderr by default', () => {
48
+ (0, vitest_1.it)('logAuditEntry writes pure JSON NDJSON to stderr (Cloud Logging–parseable)', () => {
28
49
  (0, audit_1.initAuditLog)();
29
- (0, audit_1.logAuditEntry)({
30
- timestamp: '2026-01-01T00:00:00.000Z',
31
- sessionId: (0, audit_1.getSessionId)(),
50
+ (0, audit_1.logAuditEntry)((0, audit_1.buildAuditLogEntry)({
32
51
  tool: 'test_tool',
52
+ status: 'success',
53
+ startMs: Date.now() - 12,
33
54
  tokenHash: 'abc123',
34
55
  subject: 'user-uuid',
35
- status: 'success',
36
- durationMs: 12,
37
- });
56
+ clientSessionId: 'mcp-session-1',
57
+ personaId: 'semantic-layer',
58
+ }));
38
59
  const auditLine = stderrSpy.mock.calls
39
60
  .map(([chunk]) => String(chunk))
40
61
  .find((line) => line.includes('"tool":"test_tool"'));
41
62
  (0, vitest_1.expect)(auditLine).toBeDefined();
42
- (0, vitest_1.expect)(auditLine).toContain('[audit]');
43
- (0, vitest_1.expect)(auditLine).toContain('"status":"success"');
44
- (0, vitest_1.expect)(auditLine).toContain('"tokenHash":"abc123"');
45
- (0, vitest_1.expect)(auditLine).toContain('"subject":"user-uuid"');
63
+ (0, vitest_1.expect)(auditLine).not.toContain('[audit]');
64
+ const parsed = JSON.parse(auditLine.trim());
65
+ (0, vitest_1.expect)(parsed.channel).toBe('audit');
66
+ (0, vitest_1.expect)(parsed.severity).toBe('INFO');
67
+ (0, vitest_1.expect)(parsed.message).toBe('test_tool success');
68
+ (0, vitest_1.expect)(parsed.status).toBe('success');
69
+ (0, vitest_1.expect)(parsed.tokenHash).toBe('abc123');
70
+ (0, vitest_1.expect)(parsed.subject).toBe('user-uuid');
71
+ (0, vitest_1.expect)(parsed.clientSessionId).toBe('mcp-session-1');
72
+ (0, vitest_1.expect)(parsed.personaId).toBe('semantic-layer');
46
73
  });
47
74
  (0, vitest_1.it)('logAuditEntry appends to a file when initAuditLog receives a path', async () => {
48
75
  const dir = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'audit-test-'));
49
76
  const filePath = (0, node_path_1.join)(dir, 'audit.ndjson');
50
77
  try {
51
78
  (0, audit_1.initAuditLog)(filePath);
52
- (0, audit_1.logAuditEntry)({
53
- timestamp: '2026-01-01T00:00:00.000Z',
54
- sessionId: (0, audit_1.getSessionId)(),
79
+ (0, audit_1.logAuditEntry)((0, audit_1.buildAuditLogEntry)({
55
80
  tool: 'file_tool',
56
- projectUuids: ['uuid-a'],
57
81
  status: 'blocked',
58
- durationMs: 3,
59
- });
82
+ startMs: Date.now() - 3,
83
+ projectUuids: ['uuid-a'],
84
+ }));
60
85
  await (0, audit_1.closeAuditLog)();
61
86
  // filePath is a temp path from mkdtempSync in this test only
62
87
  // eslint-disable-next-line security/detect-non-literal-fs-filename
63
88
  const contents = (0, node_fs_1.readFileSync)(filePath, 'utf8');
64
- (0, vitest_1.expect)(contents).toContain('"tool":"file_tool"');
65
- (0, vitest_1.expect)(contents).toContain('"projectUuids":["uuid-a"]');
66
- (0, vitest_1.expect)(contents).toContain('"status":"blocked"');
89
+ const parsed = JSON.parse(contents.trim());
90
+ (0, vitest_1.expect)(parsed.channel).toBe('audit');
91
+ (0, vitest_1.expect)(parsed.tool).toBe('file_tool');
92
+ (0, vitest_1.expect)(parsed.projectUuids).toEqual(['uuid-a']);
93
+ (0, vitest_1.expect)(parsed.status).toBe('blocked');
67
94
  }
68
95
  finally {
69
96
  await (0, audit_1.closeAuditLog)();
package/dist/env.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  export declare const ENV_LIGHTDASH_TOOLS_DRY_RUN = "LIGHTDASH_TOOLS_DRY_RUN";
7
7
  export declare const ENV_LIGHTDASH_TOOLS_AUDIT_LOG = "LIGHTDASH_TOOLS_AUDIT_LOG";
8
8
  export declare const ENV_LIGHTDASH_TOOLS_SAFETY_MODE = "LIGHTDASH_TOOLS_SAFETY_MODE";
9
- export declare const ENV_LIGHTDASH_TOOLS_ALLOWED_PROJECTS = "LIGHTDASH_TOOLS_ALLOWED_PROJECTS";
9
+ export declare const ENV_LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS = "LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS";
10
10
  /** MCP HTTP server env vars (`LIGHTDASH_TOOLS_MCP_*` / `LIGHTDASH_TOOLS_OAUTH_*` per ADR-0009). */
11
11
  /** @deprecated Removed — auth is credential-inferred (ADR-0007). Kept for migration error messages. */
12
12
  export declare const ENV_LIGHTDASH_TOOLS_MCP_AUTH_MODE = "LIGHTDASH_TOOLS_MCP_AUTH_MODE";
package/dist/env.js CHANGED
@@ -5,11 +5,11 @@
5
5
  * from official Lightdash vars (LIGHTDASH_URL, LIGHTDASH_API_KEY).
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ENV_LIGHTDASH_TOOLS_OAUTH_CLIENT_SECRET = exports.ENV_LIGHTDASH_TOOLS_OAUTH_CLIENT_ID = exports.ENV_LIGHTDASH_TOOLS_MCP_SHARED_KEY = exports.ENV_LIGHTDASH_TOOLS_MCP_PUBLIC_URL = exports.ENV_LIGHTDASH_TOOLS_MCP_HTTP_PORT = exports.ENV_LIGHTDASH_TOOLS_MCP_AUTH_MODE = exports.ENV_LIGHTDASH_TOOLS_ALLOWED_PROJECTS = exports.ENV_LIGHTDASH_TOOLS_SAFETY_MODE = exports.ENV_LIGHTDASH_TOOLS_AUDIT_LOG = exports.ENV_LIGHTDASH_TOOLS_DRY_RUN = void 0;
8
+ exports.ENV_LIGHTDASH_TOOLS_OAUTH_CLIENT_SECRET = exports.ENV_LIGHTDASH_TOOLS_OAUTH_CLIENT_ID = exports.ENV_LIGHTDASH_TOOLS_MCP_SHARED_KEY = exports.ENV_LIGHTDASH_TOOLS_MCP_PUBLIC_URL = exports.ENV_LIGHTDASH_TOOLS_MCP_HTTP_PORT = exports.ENV_LIGHTDASH_TOOLS_MCP_AUTH_MODE = exports.ENV_LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS = exports.ENV_LIGHTDASH_TOOLS_SAFETY_MODE = exports.ENV_LIGHTDASH_TOOLS_AUDIT_LOG = exports.ENV_LIGHTDASH_TOOLS_DRY_RUN = void 0;
9
9
  exports.ENV_LIGHTDASH_TOOLS_DRY_RUN = 'LIGHTDASH_TOOLS_DRY_RUN';
10
10
  exports.ENV_LIGHTDASH_TOOLS_AUDIT_LOG = 'LIGHTDASH_TOOLS_AUDIT_LOG';
11
11
  exports.ENV_LIGHTDASH_TOOLS_SAFETY_MODE = 'LIGHTDASH_TOOLS_SAFETY_MODE';
12
- exports.ENV_LIGHTDASH_TOOLS_ALLOWED_PROJECTS = 'LIGHTDASH_TOOLS_ALLOWED_PROJECTS';
12
+ exports.ENV_LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS = 'LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS';
13
13
  /** MCP HTTP server env vars (`LIGHTDASH_TOOLS_MCP_*` / `LIGHTDASH_TOOLS_OAUTH_*` per ADR-0009). */
14
14
  /** @deprecated Removed — auth is credential-inferred (ADR-0007). Kept for migration error messages. */
15
15
  exports.ENV_LIGHTDASH_TOOLS_MCP_AUTH_MODE = 'LIGHTDASH_TOOLS_MCP_AUTH_MODE';
@@ -14,6 +14,7 @@ const PROFILE_CORE_LIFECYCLE = 'core-lifecycle';
14
14
  const PROFILE_DISCOVERY = 'discovery-readonly';
15
15
  const PROFILE_CONVERSATIONS = 'conversations';
16
16
  const PROFILE_EVALUATIONS = 'evaluations';
17
+ const PROFILE_AI_AGENT_OPS = 'ai-agent-ops';
17
18
  const API_V1 = '/api/v1';
18
19
  const PROJECT_AGENTS_PATH = `${API_V1}/projects/{projectUuid}/aiAgents`;
19
20
  const PROJECT_AGENT_PATH = `${PROJECT_AGENTS_PATH}/{agentUuid}`;
@@ -82,10 +83,10 @@ const projectAgentsList = (0, types_1.defineOperation)({
82
83
  mcp: {
83
84
  toolName: 'list_project_agents',
84
85
  annotations: safety_1.READ_ONLY_DEFAULT,
85
- taskSupport: { exposed: false, taskEligible: false },
86
+ taskSupport: { exposed: true, taskEligible: false },
86
87
  },
87
88
  cli: { commandPath: 'agents list' },
88
- profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
89
+ profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
89
90
  });
90
91
  const projectAgentsGet = (0, types_1.defineOperation)({
91
92
  id: 'ai-agents.project.agents.get',
@@ -96,10 +97,10 @@ const projectAgentsGet = (0, types_1.defineOperation)({
96
97
  mcp: {
97
98
  toolName: 'get_project_agent',
98
99
  annotations: safety_1.READ_ONLY_DEFAULT,
99
- taskSupport: { exposed: false, taskEligible: false },
100
+ taskSupport: { exposed: true, taskEligible: false },
100
101
  },
101
102
  cli: { commandPath: 'agents get' },
102
- profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY],
103
+ profiles: [PROFILE_CORE_LIFECYCLE, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
103
104
  });
104
105
  const projectAgentsCreate = (0, types_1.defineOperation)({
105
106
  id: 'ai-agents.project.agents.create',
@@ -156,10 +157,10 @@ const threadsList = (0, types_1.defineOperation)({
156
157
  mcp: {
157
158
  toolName: 'list_agent_threads',
158
159
  annotations: safety_1.READ_ONLY_DEFAULT,
159
- taskSupport: { exposed: false, taskEligible: false },
160
+ taskSupport: { exposed: true, taskEligible: false },
160
161
  },
161
162
  cli: { commandPath: 'agents threads list' },
162
- profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY],
163
+ profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
163
164
  });
164
165
  const PROJECT_AGENT_THREAD_PATH = `${PROJECT_AGENT_THREADS_PATH}/{threadUuid}`;
165
166
  const threadsGet = (0, types_1.defineOperation)({
@@ -174,10 +175,10 @@ const threadsGet = (0, types_1.defineOperation)({
174
175
  mcp: {
175
176
  toolName: 'get_agent_thread',
176
177
  annotations: safety_1.READ_ONLY_DEFAULT,
177
- taskSupport: { exposed: false, taskEligible: false },
178
+ taskSupport: { exposed: true, taskEligible: false },
178
179
  },
179
180
  cli: { commandPath: 'agents threads get' },
180
- profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY],
181
+ profiles: [PROFILE_CONVERSATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
181
182
  });
182
183
  const PROJECT_AGENT_THREAD_MESSAGES_PATH = `${PROJECT_AGENT_THREAD_PATH}/messages`;
183
184
  const PROJECT_AGENT_THREAD_GENERATE_PATH = `${PROJECT_AGENT_THREAD_PATH}/generate`;
@@ -257,10 +258,10 @@ const evaluationsList = (0, types_1.defineOperation)({
257
258
  mcp: {
258
259
  toolName: 'list_agent_evaluations',
259
260
  annotations: safety_1.READ_ONLY_DEFAULT,
260
- taskSupport: { exposed: false, taskEligible: false },
261
+ taskSupport: { exposed: true, taskEligible: false },
261
262
  },
262
263
  cli: { commandPath: 'agents evals list' },
263
- profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
264
+ profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
264
265
  });
265
266
  const PROJECT_AGENT_EVALUATION_PATH = `${PROJECT_AGENT_EVALUATIONS_PATH}/{evalUuid}`;
266
267
  const evaluationsGet = (0, types_1.defineOperation)({
@@ -275,10 +276,10 @@ const evaluationsGet = (0, types_1.defineOperation)({
275
276
  mcp: {
276
277
  toolName: 'get_agent_evaluation',
277
278
  annotations: safety_1.READ_ONLY_DEFAULT,
278
- taskSupport: { exposed: false, taskEligible: false },
279
+ taskSupport: { exposed: true, taskEligible: false },
279
280
  },
280
281
  cli: { commandPath: 'agents evals get' },
281
- profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
282
+ profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
282
283
  });
283
284
  const evaluationsCreate = (0, types_1.defineOperation)({
284
285
  id: 'ai-agents.project.evaluations.create',
@@ -292,10 +293,10 @@ const evaluationsCreate = (0, types_1.defineOperation)({
292
293
  mcp: {
293
294
  toolName: 'create_agent_evaluation',
294
295
  annotations: safety_1.WRITE_NONDESTRUCTIVE,
295
- taskSupport: { exposed: false, taskEligible: false },
296
+ taskSupport: { exposed: true, taskEligible: false },
296
297
  },
297
298
  cli: { commandPath: 'agents evals create' },
298
- profiles: [PROFILE_EVALUATIONS],
299
+ profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
299
300
  });
300
301
  const evaluationsUpdate = (0, types_1.defineOperation)({
301
302
  id: 'ai-agents.project.evaluations.update',
@@ -309,10 +310,10 @@ const evaluationsUpdate = (0, types_1.defineOperation)({
309
310
  mcp: {
310
311
  toolName: 'update_agent_evaluation',
311
312
  annotations: safety_1.WRITE_NONDESTRUCTIVE,
312
- taskSupport: { exposed: false, taskEligible: false },
313
+ taskSupport: { exposed: true, taskEligible: false },
313
314
  },
314
315
  cli: { commandPath: 'agents evals update' },
315
- profiles: [PROFILE_EVALUATIONS],
316
+ profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
316
317
  });
317
318
  const evaluationsAppend = (0, types_1.defineOperation)({
318
319
  id: 'ai-agents.project.evaluations.append',
@@ -326,10 +327,10 @@ const evaluationsAppend = (0, types_1.defineOperation)({
326
327
  mcp: {
327
328
  toolName: 'append_agent_evaluation_prompts',
328
329
  annotations: safety_1.WRITE_NONDESTRUCTIVE,
329
- taskSupport: { exposed: false, taskEligible: false },
330
+ taskSupport: { exposed: true, taskEligible: false },
330
331
  },
331
332
  cli: { commandPath: 'agents evals append' },
332
- profiles: [PROFILE_EVALUATIONS],
333
+ profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
333
334
  });
334
335
  const evaluationsDelete = (0, types_1.defineOperation)({
335
336
  id: 'ai-agents.project.evaluations.delete',
@@ -343,10 +344,10 @@ const evaluationsDelete = (0, types_1.defineOperation)({
343
344
  mcp: {
344
345
  toolName: 'delete_agent_evaluation',
345
346
  annotations: safety_1.WRITE_DESTRUCTIVE,
346
- taskSupport: { exposed: false, taskEligible: false },
347
+ taskSupport: { exposed: true, taskEligible: false },
347
348
  },
348
349
  cli: { commandPath: 'agents evals delete' },
349
- profiles: [PROFILE_EVALUATIONS],
350
+ profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
350
351
  });
351
352
  const evaluationsRun = (0, types_1.defineOperation)({
352
353
  id: 'ai-agents.project.evaluations.run',
@@ -360,10 +361,10 @@ const evaluationsRun = (0, types_1.defineOperation)({
360
361
  mcp: {
361
362
  toolName: 'run_agent_evaluation',
362
363
  annotations: safety_1.WRITE_OPEN_WORLD,
363
- taskSupport: { exposed: false, taskEligible: true },
364
+ taskSupport: { exposed: true, taskEligible: true },
364
365
  },
365
366
  cli: { commandPath: 'agents evals run' },
366
- profiles: [PROFILE_EVALUATIONS],
367
+ profiles: [PROFILE_EVALUATIONS, PROFILE_AI_AGENT_OPS],
367
368
  });
368
369
  const PROJECT_AGENT_EVALUATION_RUNS_PATH = `${PROJECT_AGENT_EVALUATION_PATH}/runs`;
369
370
  const evaluationsRunsList = (0, types_1.defineOperation)({
@@ -378,10 +379,10 @@ const evaluationsRunsList = (0, types_1.defineOperation)({
378
379
  mcp: {
379
380
  toolName: 'list_agent_evaluation_runs',
380
381
  annotations: safety_1.READ_ONLY_DEFAULT,
381
- taskSupport: { exposed: false, taskEligible: false },
382
+ taskSupport: { exposed: true, taskEligible: false },
382
383
  },
383
384
  cli: { commandPath: 'agents evals runs' },
384
- profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
385
+ profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
385
386
  });
386
387
  const evaluationsRunResultsGet = (0, types_1.defineOperation)({
387
388
  id: 'ai-agents.project.evaluations.runs.get',
@@ -393,12 +394,79 @@ const evaluationsRunResultsGet = (0, types_1.defineOperation)({
393
394
  authorization: { safetyImpact: IMPACT_READ },
394
395
  sensitivity: 'none',
395
396
  mcp: {
396
- toolName: 'get_agent_evaluation_run_results',
397
+ toolName: 'get_agent_eval_run_results',
397
398
  annotations: safety_1.READ_ONLY_DEFAULT,
398
- taskSupport: { exposed: false, taskEligible: false },
399
+ taskSupport: { exposed: true, taskEligible: false },
399
400
  },
400
401
  cli: { commandPath: 'agents evals run-results' },
401
- profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY],
402
+ profiles: [PROFILE_EVALUATIONS, PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
403
+ });
404
+ const evaluateAgentReadiness = (0, types_1.defineOperation)({
405
+ id: 'ai-agents.project.agents.evaluate-readiness',
406
+ summary: 'Evaluate release readiness score for an agent (not an evaluation-suite run)',
407
+ http: {
408
+ method: 'POST',
409
+ path: `${PROJECT_AGENT_PATH}/evaluateReadiness`,
410
+ },
411
+ authorization: { safetyImpact: IMPACT_READ },
412
+ sensitivity: 'none',
413
+ mcp: {
414
+ toolName: 'evaluate_agent_readiness',
415
+ annotations: safety_1.READ_ONLY_DEFAULT,
416
+ taskSupport: { exposed: true, taskEligible: false },
417
+ },
418
+ cli: { commandPath: 'agents readiness evaluate' },
419
+ profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
420
+ });
421
+ const getAgentSuggestions = (0, types_1.defineOperation)({
422
+ id: 'ai-agents.project.agents.suggestions',
423
+ summary: 'List suggestion chips for an agent',
424
+ http: {
425
+ method: 'GET',
426
+ path: `${PROJECT_AGENT_PATH}/suggestions`,
427
+ },
428
+ authorization: { safetyImpact: IMPACT_READ },
429
+ sensitivity: 'none',
430
+ mcp: {
431
+ toolName: 'get_agent_suggestions',
432
+ annotations: safety_1.READ_ONLY_DEFAULT,
433
+ taskSupport: { exposed: true, taskEligible: false },
434
+ },
435
+ cli: { commandPath: 'agents suggestions' },
436
+ profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
437
+ });
438
+ const getAgentModels = (0, types_1.defineOperation)({
439
+ id: 'ai-agents.project.agents.models',
440
+ summary: 'List available AI model options for an agent',
441
+ http: {
442
+ method: 'GET',
443
+ path: `${PROJECT_AGENT_PATH}/models`,
444
+ },
445
+ authorization: { safetyImpact: IMPACT_READ },
446
+ sensitivity: 'none',
447
+ mcp: {
448
+ toolName: 'get_agent_models',
449
+ annotations: safety_1.READ_ONLY_DEFAULT,
450
+ taskSupport: { exposed: true, taskEligible: false },
451
+ },
452
+ cli: { commandPath: 'agents models' },
453
+ profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
454
+ });
455
+ const getExploreAccessSummary = (0, types_1.defineOperation)({
456
+ id: 'ai-agents.project.explore-access-summary',
457
+ summary: 'Summarize explore access for tag-filtered explores',
458
+ http: {
459
+ method: 'POST',
460
+ path: `${PROJECT_AGENTS_PATH}/explore-access-summary`,
461
+ },
462
+ authorization: { safetyImpact: IMPACT_READ },
463
+ sensitivity: 'none',
464
+ mcp: {
465
+ toolName: 'get_explore_access_summary',
466
+ annotations: safety_1.READ_ONLY_DEFAULT,
467
+ taskSupport: { exposed: true, taskEligible: false },
468
+ },
469
+ profiles: [PROFILE_DISCOVERY, PROFILE_AI_AGENT_OPS],
402
470
  });
403
471
  /** All registered P0 AI agent operations. */
404
472
  exports.AI_AGENT_OPERATIONS = [
@@ -411,6 +479,10 @@ exports.AI_AGENT_OPERATIONS = [
411
479
  projectAgentsCreate,
412
480
  projectAgentsUpdate,
413
481
  projectAgentsDelete,
482
+ evaluateAgentReadiness,
483
+ getAgentSuggestions,
484
+ getAgentModels,
485
+ getExploreAccessSummary,
414
486
  threadsList,
415
487
  threadsGet,
416
488
  threadsStart,
@@ -19,6 +19,10 @@ export declare const OPERATION_CLIENT_METHOD_MAP: {
19
19
  readonly 'ai-agents.project.agents.create': "v1.aiAgents.createAgent";
20
20
  readonly 'ai-agents.project.agents.update': "v1.aiAgents.updateAgent";
21
21
  readonly 'ai-agents.project.agents.delete': "v1.aiAgents.deleteAgent";
22
+ readonly 'ai-agents.project.agents.evaluate-readiness': "v1.aiAgents.evaluateAgentReadiness";
23
+ readonly 'ai-agents.project.agents.suggestions': "v1.aiAgents.getAgentSuggestions";
24
+ readonly 'ai-agents.project.agents.models': "v1.aiAgents.getAgentModelOptions";
25
+ readonly 'ai-agents.project.explore-access-summary': "v1.aiAgents.getExploreAccessSummary";
22
26
  readonly 'ai-agents.project.threads.list': "v1.aiAgents.listAgentThreads";
23
27
  readonly 'ai-agents.project.threads.get': "v1.aiAgents.getAgentThread";
24
28
  readonly 'ai-agents.project.threads.start': "v1.aiAgents.startConversation";
@@ -71,12 +75,14 @@ export declare const OPERATION_CLIENT_METHOD_MAP: {
71
75
  readonly 'content-reader.parameters.get': "v2.parameters.getParameters";
72
76
  readonly 'content-reader.content.explain': "composed:v2.charts.getSavedChart+v2.dashboards.getDashboard";
73
77
  readonly 'content-reader.charts.run': "v2.query.runChartQuery";
78
+ readonly 'content-reader.charts.export-image': "composed:v1.charts.exportChartImagePng";
74
79
  readonly 'content-reader.dashboards.run-tile': "v2.query.runDashboardChartQuery";
75
80
  readonly 'content-reader.query.result.get': "v2.query.getAsyncQueryResults";
76
81
  readonly 'content-reader.query.cancel': "v2.query.cancelAsyncQuery";
77
82
  readonly 'content-developer.preview.chart': "composed:v2.charts.getSavedChart";
78
83
  readonly 'content-developer.preview.dashboard': "composed:v2.dashboards.getDashboard";
79
84
  readonly 'content-developer.preview.content-move': "ledger:preview";
85
+ readonly 'content-developer.charts.get-as-code': "v1.charts.getChartsAsCode";
80
86
  readonly 'content-developer.charts.validate': "v1.validation.validateChart";
81
87
  readonly 'content-developer.dashboards.validate': "v1.validation.validateDashboard";
82
88
  readonly 'content-developer.preview.confirm': "ledger:preview";
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.OPERATION_CLIENT_METHOD_MAP = void 0;
9
9
  exports.getClientMethodForOperation = getClientMethodForOperation;
10
10
  const CLIENT_CHARTS_UPSERT_AS_CODE = 'v1.charts.upsertChartAsCode';
11
+ const CLIENT_CHARTS_GET_AS_CODE = 'v1.charts.getChartsAsCode';
11
12
  const CLIENT_DASHBOARDS_V2_UPDATE = 'v2.dashboards.updateDashboard';
12
13
  const CLIENT_CONTENT_SEARCH = 'v2.content.searchContent';
13
14
  const LEDGER_PREVIEW = 'ledger:preview';
@@ -27,6 +28,10 @@ exports.OPERATION_CLIENT_METHOD_MAP = {
27
28
  'ai-agents.project.agents.create': 'v1.aiAgents.createAgent',
28
29
  'ai-agents.project.agents.update': 'v1.aiAgents.updateAgent',
29
30
  'ai-agents.project.agents.delete': 'v1.aiAgents.deleteAgent',
31
+ 'ai-agents.project.agents.evaluate-readiness': 'v1.aiAgents.evaluateAgentReadiness',
32
+ 'ai-agents.project.agents.suggestions': 'v1.aiAgents.getAgentSuggestions',
33
+ 'ai-agents.project.agents.models': 'v1.aiAgents.getAgentModelOptions',
34
+ 'ai-agents.project.explore-access-summary': 'v1.aiAgents.getExploreAccessSummary',
30
35
  'ai-agents.project.threads.list': 'v1.aiAgents.listAgentThreads',
31
36
  'ai-agents.project.threads.get': 'v1.aiAgents.getAgentThread',
32
37
  'ai-agents.project.threads.start': 'v1.aiAgents.startConversation',
@@ -83,6 +88,7 @@ exports.OPERATION_CLIENT_METHOD_MAP = {
83
88
  'content-reader.parameters.get': 'v2.parameters.getParameters',
84
89
  'content-reader.content.explain': 'composed:v2.charts.getSavedChart+v2.dashboards.getDashboard',
85
90
  'content-reader.charts.run': 'v2.query.runChartQuery',
91
+ 'content-reader.charts.export-image': 'composed:v1.charts.exportChartImagePng',
86
92
  'content-reader.dashboards.run-tile': 'v2.query.runDashboardChartQuery',
87
93
  'content-reader.query.result.get': 'v2.query.getAsyncQueryResults',
88
94
  'content-reader.query.cancel': 'v2.query.cancelAsyncQuery',
@@ -90,6 +96,7 @@ exports.OPERATION_CLIENT_METHOD_MAP = {
90
96
  'content-developer.preview.chart': 'composed:v2.charts.getSavedChart',
91
97
  'content-developer.preview.dashboard': 'composed:v2.dashboards.getDashboard',
92
98
  'content-developer.preview.content-move': LEDGER_PREVIEW,
99
+ 'content-developer.charts.get-as-code': CLIENT_CHARTS_GET_AS_CODE,
93
100
  'content-developer.charts.validate': 'v1.validation.validateChart',
94
101
  'content-developer.dashboards.validate': 'v1.validation.validateDashboard',
95
102
  'content-developer.preview.confirm': LEDGER_PREVIEW,
@@ -97,7 +104,7 @@ exports.OPERATION_CLIENT_METHOD_MAP = {
97
104
  'content-developer.dashboards.compare-versions': 'composed:v2.dashboards.getDashboard+v1.dashboards.getDashboardHistory+v1.dashboards.getDashboardVersion',
98
105
  'content-developer.charts.create': CLIENT_CHARTS_UPSERT_AS_CODE,
99
106
  'content-developer.charts.update': CLIENT_CHARTS_UPSERT_AS_CODE,
100
- 'content-developer.charts.duplicate': 'composed:v1.charts.getChartsAsCode+v1.charts.upsertChartAsCode',
107
+ 'content-developer.charts.duplicate': `composed:${CLIENT_CHARTS_GET_AS_CODE}+${CLIENT_CHARTS_UPSERT_AS_CODE}`,
101
108
  'content-developer.dashboards.create': 'v1.dashboards.createDashboard',
102
109
  'content-developer.dashboards.update': CLIENT_DASHBOARDS_V2_UPDATE,
103
110
  'content-developer.dashboards.duplicate': 'v1.dashboards.createDashboard',
@@ -115,9 +122,9 @@ exports.OPERATION_CLIENT_METHOD_MAP = {
115
122
  'content-governance.dashboards.promote': 'v1.dashboards.promoteDashboard',
116
123
  'content-governance.content.permanent-delete': 'v2.content.permanentlyDeleteContent',
117
124
  // cli content
118
- 'cli.charts.list': 'v1.charts.getChartsAsCode',
119
- 'cli.charts.code.list': 'v1.charts.getChartsAsCode',
120
- 'cli.charts.code.upsert': 'v1.charts.upsertChartAsCode',
125
+ 'cli.charts.list': CLIENT_CHARTS_GET_AS_CODE,
126
+ 'cli.charts.code.list': CLIENT_CHARTS_GET_AS_CODE,
127
+ 'cli.charts.code.upsert': CLIENT_CHARTS_UPSERT_AS_CODE,
121
128
  'cli.dashboards.list': 'v1.dashboards.listDashboards',
122
129
  'cli.projects.validate.run': 'v1.validation.validateProject',
123
130
  'cli.projects.validate.results': 'v2.validation.listValidationResults',