@lightdash-tools/cli 0.6.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.
Files changed (109) hide show
  1. package/README.md +6 -2
  2. package/dist/commands/agentops/apply.d.ts +5 -0
  3. package/dist/commands/agentops/apply.js +53 -0
  4. package/dist/commands/agentops/bundle-schema.d.ts +5 -0
  5. package/dist/commands/agentops/bundle-schema.js +16 -0
  6. package/dist/commands/agentops/drift.d.ts +5 -0
  7. package/dist/commands/agentops/drift.js +46 -0
  8. package/dist/commands/agentops/evaluate-gate.d.ts +5 -0
  9. package/dist/commands/agentops/evaluate-gate.js +89 -0
  10. package/dist/commands/agentops/gate-schema.d.ts +5 -0
  11. package/dist/commands/agentops/gate-schema.js +16 -0
  12. package/dist/commands/agentops/plan.d.ts +5 -0
  13. package/dist/commands/agentops/plan.js +42 -0
  14. package/dist/commands/agentops/state.d.ts +4 -0
  15. package/dist/commands/agentops/state.js +8 -0
  16. package/dist/commands/agentops.d.ts +8 -0
  17. package/dist/commands/agentops.js +26 -0
  18. package/dist/commands/agentops.test.d.ts +1 -0
  19. package/dist/commands/agentops.test.js +400 -0
  20. package/dist/commands/agents-crud.d.ts +8 -0
  21. package/dist/commands/agents-crud.js +144 -0
  22. package/dist/commands/agents-discovery.d.ts +8 -0
  23. package/dist/commands/agents-discovery.js +139 -0
  24. package/dist/commands/agents-discovery.test.d.ts +1 -0
  25. package/dist/commands/agents-discovery.test.js +13 -0
  26. package/dist/commands/agents-evals.d.ts +8 -0
  27. package/dist/commands/agents-evals.js +246 -0
  28. package/dist/commands/agents-threads.d.ts +8 -0
  29. package/dist/commands/agents-threads.js +83 -0
  30. package/dist/commands/agents.js +8 -360
  31. package/dist/commands/ai-agents.js +52 -70
  32. package/dist/commands/charts.js +35 -46
  33. package/dist/commands/content.js +3 -12
  34. package/dist/commands/dashboards.js +3 -12
  35. package/dist/commands/explores.js +12 -21
  36. package/dist/commands/groups.js +44 -63
  37. package/dist/commands/metrics.js +6 -15
  38. package/dist/commands/organization-roles.js +28 -39
  39. package/dist/commands/organization.js +3 -12
  40. package/dist/commands/project-access.js +9 -18
  41. package/dist/commands/project-role-assignments.js +15 -24
  42. package/dist/commands/projects.js +33 -26
  43. package/dist/commands/query.js +30 -41
  44. package/dist/commands/schedulers.js +6 -15
  45. package/dist/commands/schema.js +33 -10
  46. package/dist/commands/schema.test.js +58 -1
  47. package/dist/commands/space-access.js +12 -21
  48. package/dist/commands/spaces.js +6 -15
  49. package/dist/commands/tags.js +6 -15
  50. package/dist/commands/users.js +23 -41
  51. package/dist/index.js +18 -16
  52. package/dist/index.test.js +9 -9
  53. package/dist/utils/cli-params.d.ts +4 -0
  54. package/dist/utils/cli-params.js +15 -0
  55. package/dist/utils/cli-params.test.d.ts +1 -0
  56. package/dist/utils/cli-params.test.js +12 -0
  57. package/dist/utils/file-input.d.ts +30 -0
  58. package/dist/utils/file-input.js +77 -0
  59. package/dist/utils/file-input.test.d.ts +1 -0
  60. package/dist/utils/file-input.test.js +68 -0
  61. package/dist/utils/safety.d.ts +5 -0
  62. package/dist/utils/safety.js +97 -109
  63. package/dist/utils/safety.test.js +135 -33
  64. package/package.json +14 -5
  65. package/src/commands/agentops/apply.ts +77 -0
  66. package/src/commands/agentops/bundle-schema.ts +20 -0
  67. package/src/commands/agentops/drift.ts +63 -0
  68. package/src/commands/agentops/evaluate-gate.ts +128 -0
  69. package/src/commands/agentops/gate-schema.ts +20 -0
  70. package/src/commands/agentops/plan.ts +55 -0
  71. package/src/commands/agentops/state.ts +5 -0
  72. package/src/commands/agentops.test.ts +454 -0
  73. package/src/commands/agentops.ts +28 -0
  74. package/src/commands/agents-crud.ts +193 -0
  75. package/src/commands/agents-discovery.test.ts +16 -0
  76. package/src/commands/agents-discovery.ts +180 -0
  77. package/src/commands/agents-evals.ts +353 -0
  78. package/src/commands/agents-threads.ts +116 -0
  79. package/src/commands/agents.ts +9 -493
  80. package/src/commands/ai-agents.ts +37 -28
  81. package/src/commands/charts.ts +6 -3
  82. package/src/commands/content.ts +3 -1
  83. package/src/commands/dashboards.ts +3 -1
  84. package/src/commands/explores.ts +3 -1
  85. package/src/commands/groups.ts +33 -33
  86. package/src/commands/metrics.ts +3 -1
  87. package/src/commands/organization-roles.ts +3 -1
  88. package/src/commands/organization.ts +3 -1
  89. package/src/commands/project-access.ts +3 -1
  90. package/src/commands/project-role-assignments.ts +3 -1
  91. package/src/commands/projects.ts +44 -18
  92. package/src/commands/query.ts +4 -1
  93. package/src/commands/schedulers.ts +3 -1
  94. package/src/commands/schema.test.ts +72 -1
  95. package/src/commands/schema.ts +60 -14
  96. package/src/commands/space-access.ts +3 -1
  97. package/src/commands/spaces.ts +3 -1
  98. package/src/commands/tags.ts +3 -1
  99. package/src/commands/users.ts +29 -25
  100. package/src/index.test.ts +10 -9
  101. package/src/index.ts +19 -16
  102. package/src/utils/cli-params.test.ts +13 -0
  103. package/src/utils/cli-params.ts +12 -0
  104. package/src/utils/client.test.ts +1 -0
  105. package/src/utils/file-input.test.ts +91 -0
  106. package/src/utils/file-input.ts +83 -0
  107. package/src/utils/safety.test.ts +158 -2
  108. package/src/utils/safety.ts +27 -20
  109. package/tsconfig.json +2 -1
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ /**
3
+ * Agent discovery commands — preferences, suggestions, models, readiness.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.registerAgentsDiscoveryCommands = registerAgentsDiscoveryCommands;
7
+ const common_1 = require("@lightdash-tools/common");
8
+ const client_1 = require("../utils/client");
9
+ const file_input_1 = require("../utils/file-input");
10
+ const safety_1 = require("../utils/safety");
11
+ /**
12
+ * Registers discovery subcommands on the `agents` command group.
13
+ */
14
+ function registerAgentsDiscoveryCommands(agentsCmd) {
15
+ const preferencesCmd = agentsCmd
16
+ .command('preferences')
17
+ .description('Manage per-user AI agent preferences in a project');
18
+ preferencesCmd
19
+ .command('get')
20
+ .description('Get current user agent preferences for a project')
21
+ .requiredOption('--project <uuid>', 'Project UUID')
22
+ .action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async function () {
23
+ const { project } = this.opts();
24
+ try {
25
+ const client = (0, client_1.getClient)();
26
+ const result = await client.v1.aiAgents.getUserAgentPreferences(project);
27
+ console.log(JSON.stringify(result, null, 2));
28
+ }
29
+ catch (error) {
30
+ console.error('Error fetching agent preferences:', error instanceof Error ? error.message : String(error));
31
+ process.exit(1);
32
+ }
33
+ }));
34
+ preferencesCmd
35
+ .command('set')
36
+ .description('Set user agent preferences (flags or JSON/YAML via --file/--stdin)')
37
+ .requiredOption('--project <uuid>', 'Project UUID')
38
+ .option('--default-agent <uuid>', 'Default agent UUID for the project')
39
+ .option('--file <path>', 'Read preferences JSON/YAML from file')
40
+ .option('--stdin', 'Read preferences JSON/YAML from stdin')
41
+ .action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, async function () {
42
+ const options = this.opts();
43
+ let body;
44
+ if ((0, file_input_1.hasExplicitFileInput)(options)) {
45
+ const parsed = await (0, file_input_1.readParsedInput)({ file: options.file, stdin: options.stdin });
46
+ if (parsed == null || typeof parsed !== 'object' || Array.isArray(parsed)) {
47
+ console.error('Error: preferences input must be a JSON/YAML object');
48
+ process.exit(1);
49
+ }
50
+ const record = parsed;
51
+ if (typeof record.defaultAgentUuid !== 'string') {
52
+ console.error('Error: preferences must include defaultAgentUuid (string)');
53
+ process.exit(1);
54
+ }
55
+ body = { defaultAgentUuid: record.defaultAgentUuid };
56
+ }
57
+ else if (options.defaultAgent != null) {
58
+ body = { defaultAgentUuid: options.defaultAgent };
59
+ }
60
+ else {
61
+ console.error('Error: provide --default-agent or preferences via --file/--stdin');
62
+ process.exit(1);
63
+ }
64
+ try {
65
+ const client = (0, client_1.getClient)();
66
+ await client.v1.aiAgents.setUserAgentPreferences(options.project, body);
67
+ console.log(JSON.stringify({ status: 'ok' }, null, 2));
68
+ }
69
+ catch (error) {
70
+ console.error('Error setting agent preferences:', error instanceof Error ? error.message : String(error));
71
+ process.exit(1);
72
+ }
73
+ }));
74
+ preferencesCmd
75
+ .command('delete')
76
+ .description('Clear user agent preferences for a project')
77
+ .requiredOption('--project <uuid>', 'Project UUID')
78
+ .action((0, safety_1.wrapAction)(common_1.WRITE_DESTRUCTIVE, async function () {
79
+ const { project } = this.opts();
80
+ try {
81
+ const client = (0, client_1.getClient)();
82
+ await client.v1.aiAgents.deleteUserAgentPreferences(project);
83
+ console.log(JSON.stringify({ status: 'ok' }, null, 2));
84
+ }
85
+ catch (error) {
86
+ console.error('Error deleting agent preferences:', error instanceof Error ? error.message : String(error));
87
+ process.exit(1);
88
+ }
89
+ }));
90
+ agentsCmd
91
+ .command('suggestions <agentUuid>')
92
+ .description('List verified question suggestions for an agent')
93
+ .requiredOption('--project <uuid>', 'Project UUID')
94
+ .action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (agentUuid, cmd) => {
95
+ const { project } = cmd.opts();
96
+ try {
97
+ const client = (0, client_1.getClient)();
98
+ const result = await client.v1.aiAgents.getAgentSuggestions(project, agentUuid);
99
+ console.log(JSON.stringify(result, null, 2));
100
+ }
101
+ catch (error) {
102
+ console.error('Error listing agent suggestions:', error instanceof Error ? error.message : String(error));
103
+ process.exit(1);
104
+ }
105
+ }));
106
+ agentsCmd
107
+ .command('models <agentUuid>')
108
+ .description('List available AI model options for an agent')
109
+ .requiredOption('--project <uuid>', 'Project UUID')
110
+ .action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (agentUuid, cmd) => {
111
+ const { project } = cmd.opts();
112
+ try {
113
+ const client = (0, client_1.getClient)();
114
+ const result = await client.v1.aiAgents.getAgentModelOptions(project, agentUuid);
115
+ console.log(JSON.stringify(result, null, 2));
116
+ }
117
+ catch (error) {
118
+ console.error('Error listing agent models:', error instanceof Error ? error.message : String(error));
119
+ process.exit(1);
120
+ }
121
+ }));
122
+ const readinessCmd = agentsCmd.command('readiness').description('Agent release readiness checks');
123
+ readinessCmd
124
+ .command('evaluate <agentUuid>')
125
+ .description('Evaluate release readiness score for an agent')
126
+ .requiredOption('--project <uuid>', 'Project UUID')
127
+ .action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (agentUuid, cmd) => {
128
+ const { project } = cmd.opts();
129
+ try {
130
+ const client = (0, client_1.getClient)();
131
+ const result = await client.v1.aiAgents.evaluateAgentReadiness(project, agentUuid);
132
+ console.log(JSON.stringify(result, null, 2));
133
+ }
134
+ catch (error) {
135
+ console.error('Error evaluating agent readiness:', error instanceof Error ? error.message : String(error));
136
+ process.exit(1);
137
+ }
138
+ }));
139
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const file_input_1 = require("../utils/file-input");
5
+ (0, vitest_1.describe)('agents preferences set input selection', () => {
6
+ (0, vitest_1.it)('prefers --default-agent when file/stdin were not explicitly requested', () => {
7
+ const fileOptions = {};
8
+ const defaultAgent = '22222222-2222-2222-2222-222222222222';
9
+ (0, vitest_1.expect)((0, file_input_1.hasExplicitFileInput)(fileOptions)).toBe(false);
10
+ const body = defaultAgent != null ? { defaultAgentUuid: defaultAgent } : undefined;
11
+ (0, vitest_1.expect)(body).toEqual({ defaultAgentUuid: defaultAgent });
12
+ });
13
+ });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Agent evaluation commands.
3
+ */
4
+ import type { Command } from 'commander';
5
+ /**
6
+ * Registers the `agents evals` subcommand group.
7
+ */
8
+ export declare function registerAgentsEvalCommands(agentsCmd: Command): void;
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+ /**
3
+ * Agent evaluation commands.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.registerAgentsEvalCommands = registerAgentsEvalCommands;
7
+ const common_1 = require("@lightdash-tools/common");
8
+ const client_1 = require("../utils/client");
9
+ const file_input_1 = require("../utils/file-input");
10
+ const safety_1 = require("../utils/safety");
11
+ function extractPrompts(parsed) {
12
+ if (Array.isArray(parsed)) {
13
+ return parsed;
14
+ }
15
+ if (parsed != null && typeof parsed === 'object' && 'prompts' in parsed) {
16
+ const prompts = parsed.prompts;
17
+ if (!Array.isArray(prompts)) {
18
+ throw new Error('prompts field must be an array');
19
+ }
20
+ return prompts;
21
+ }
22
+ throw new Error('input must be a prompts array or an object with a prompts array');
23
+ }
24
+ /**
25
+ * Registers the `agents evals` subcommand group.
26
+ */
27
+ function registerAgentsEvalCommands(agentsCmd) {
28
+ const evalsCmd = agentsCmd
29
+ .command('evals')
30
+ .description('Manage agent evaluations and run test suites');
31
+ evalsCmd
32
+ .command('list <agentUuid>')
33
+ .description('List all evaluations for an agent')
34
+ .requiredOption('--project <uuid>', 'Project UUID')
35
+ .action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (agentUuid, cmd) => {
36
+ const { project } = cmd.opts();
37
+ try {
38
+ const client = (0, client_1.getClient)();
39
+ const result = await client.v1.aiAgents.listEvaluations(project, agentUuid);
40
+ console.log(JSON.stringify(result, null, 2));
41
+ }
42
+ catch (error) {
43
+ console.error('Error listing evaluations:', error instanceof Error ? error.message : String(error));
44
+ process.exit(1);
45
+ }
46
+ }));
47
+ evalsCmd
48
+ .command('get <agentUuid> <evalUuid>')
49
+ .description('Get a full evaluation including its prompts')
50
+ .requiredOption('--project <uuid>', 'Project UUID')
51
+ .action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (agentUuid, evalUuid, cmd) => {
52
+ const { project } = cmd.opts();
53
+ try {
54
+ const client = (0, client_1.getClient)();
55
+ const result = await client.v1.aiAgents.getEvaluation(project, agentUuid, evalUuid);
56
+ console.log(JSON.stringify(result, null, 2));
57
+ }
58
+ catch (error) {
59
+ console.error('Error fetching evaluation:', error instanceof Error ? error.message : String(error));
60
+ process.exit(1);
61
+ }
62
+ }));
63
+ evalsCmd
64
+ .command('create <agentUuid>')
65
+ .description('Create a new evaluation with a title and optional prompts')
66
+ .requiredOption('--project <uuid>', 'Project UUID')
67
+ .option('--title <title>', 'Evaluation title')
68
+ .option('--description <text>', 'Evaluation description')
69
+ .option('--prompts <json>', 'JSON array of prompt objects: [{"prompt":"...","expectedResponse":"..."}]')
70
+ .option('--file <path>', 'Read evaluation JSON/YAML from file')
71
+ .option('--stdin', 'Read evaluation JSON/YAML from stdin')
72
+ .action((0, safety_1.wrapAction)(common_1.WRITE_NONDESTRUCTIVE, async (agentUuid, cmd) => {
73
+ const options = cmd.opts();
74
+ try {
75
+ const client = (0, client_1.getClient)();
76
+ let body;
77
+ if ((0, file_input_1.hasExplicitFileInput)(options)) {
78
+ const parsed = await (0, file_input_1.readParsedInput)({ file: options.file, stdin: options.stdin });
79
+ if (parsed == null || typeof parsed !== 'object' || Array.isArray(parsed)) {
80
+ console.error('Error: evaluation input must be a JSON/YAML object');
81
+ process.exit(1);
82
+ }
83
+ body = parsed;
84
+ }
85
+ else {
86
+ if (options.title == null) {
87
+ console.error('Error: --title is required unless using --file or --stdin');
88
+ process.exit(1);
89
+ }
90
+ body = {
91
+ title: options.title,
92
+ prompts: options.prompts ? JSON.parse(options.prompts) : [],
93
+ };
94
+ if (options.description != null)
95
+ body.description = options.description;
96
+ }
97
+ const result = await client.v1.aiAgents.createEvaluation(options.project, agentUuid, body);
98
+ console.log(JSON.stringify(result, null, 2));
99
+ }
100
+ catch (error) {
101
+ console.error('Error creating evaluation:', error instanceof Error ? error.message : String(error));
102
+ process.exit(1);
103
+ }
104
+ }));
105
+ evalsCmd
106
+ .command('update <agentUuid> <evalUuid>')
107
+ .description('Update an evaluation title, description, or prompts')
108
+ .requiredOption('--project <uuid>', 'Project UUID')
109
+ .option('--title <title>', 'New title')
110
+ .option('--description <text>', 'New description')
111
+ .option('--prompts <json>', 'Replacement JSON array of prompt objects')
112
+ .option('--file <path>', 'Read evaluation patch JSON/YAML from file')
113
+ .option('--stdin', 'Read evaluation patch JSON/YAML from stdin')
114
+ .action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, async (agentUuid, evalUuid, cmd) => {
115
+ const options = cmd.opts();
116
+ try {
117
+ const client = (0, client_1.getClient)();
118
+ let body;
119
+ if ((0, file_input_1.hasExplicitFileInput)(options)) {
120
+ const parsed = await (0, file_input_1.readParsedInput)({ file: options.file, stdin: options.stdin });
121
+ if (parsed == null || typeof parsed !== 'object' || Array.isArray(parsed)) {
122
+ console.error('Error: evaluation patch input must be a JSON/YAML object');
123
+ process.exit(1);
124
+ }
125
+ body = parsed;
126
+ }
127
+ else {
128
+ const patch = {};
129
+ if (options.title != null)
130
+ patch['title'] = options.title;
131
+ if (options.description != null)
132
+ patch['description'] = options.description;
133
+ if (options.prompts != null)
134
+ patch['prompts'] = JSON.parse(options.prompts);
135
+ if (Object.keys(patch).length === 0) {
136
+ console.error('Error: at least one of --title, --description, --prompts, --file, --stdin is required');
137
+ process.exit(1);
138
+ }
139
+ body = patch;
140
+ }
141
+ const result = await client.v1.aiAgents.updateEvaluation(options.project, agentUuid, evalUuid, body);
142
+ console.log(JSON.stringify(result, null, 2));
143
+ }
144
+ catch (error) {
145
+ console.error('Error updating evaluation:', error instanceof Error ? error.message : String(error));
146
+ process.exit(1);
147
+ }
148
+ }));
149
+ evalsCmd
150
+ .command('append <agentUuid> <evalUuid>')
151
+ .description('Append additional prompts to an existing evaluation')
152
+ .requiredOption('--project <uuid>', 'Project UUID')
153
+ .option('--prompts <json>', 'JSON array of prompt objects to append')
154
+ .option('--file <path>', 'Read prompts JSON/YAML from file')
155
+ .option('--stdin', 'Read prompts JSON/YAML from stdin')
156
+ .action((0, safety_1.wrapAction)(common_1.WRITE_NONDESTRUCTIVE, async (agentUuid, evalUuid, cmd) => {
157
+ const options = cmd.opts();
158
+ try {
159
+ const client = (0, client_1.getClient)();
160
+ let prompts;
161
+ if ((0, file_input_1.hasExplicitFileInput)(options)) {
162
+ const parsed = await (0, file_input_1.readParsedInput)({ file: options.file, stdin: options.stdin });
163
+ prompts = extractPrompts(parsed);
164
+ }
165
+ else if (options.prompts != null) {
166
+ prompts = JSON.parse(options.prompts);
167
+ }
168
+ else {
169
+ console.error('Error: --prompts, --file, or --stdin is required');
170
+ process.exit(1);
171
+ }
172
+ const result = await client.v1.aiAgents.appendToEvaluation(options.project, agentUuid, evalUuid, {
173
+ prompts: prompts,
174
+ });
175
+ console.log(JSON.stringify(result, null, 2));
176
+ }
177
+ catch (error) {
178
+ console.error('Error appending to evaluation:', error instanceof Error ? error.message : String(error));
179
+ process.exit(1);
180
+ }
181
+ }));
182
+ evalsCmd
183
+ .command('delete <agentUuid> <evalUuid>')
184
+ .description('Delete an evaluation')
185
+ .requiredOption('--project <uuid>', 'Project UUID')
186
+ .action((0, safety_1.wrapAction)(common_1.WRITE_DESTRUCTIVE, async (agentUuid, evalUuid, cmd) => {
187
+ const { project } = cmd.opts();
188
+ try {
189
+ const client = (0, client_1.getClient)();
190
+ await client.v1.aiAgents.deleteEvaluation(project, agentUuid, evalUuid);
191
+ console.error(`Evaluation ${evalUuid} deleted successfully`);
192
+ }
193
+ catch (error) {
194
+ console.error('Error deleting evaluation:', error instanceof Error ? error.message : String(error));
195
+ process.exit(1);
196
+ }
197
+ }));
198
+ evalsCmd
199
+ .command('run <agentUuid> <evalUuid>')
200
+ .description('Trigger a new evaluation run')
201
+ .requiredOption('--project <uuid>', 'Project UUID')
202
+ .action((0, safety_1.wrapAction)(common_1.WRITE_NONDESTRUCTIVE, async (agentUuid, evalUuid, cmd) => {
203
+ const { project } = cmd.opts();
204
+ try {
205
+ const client = (0, client_1.getClient)();
206
+ const result = await client.v1.aiAgents.runEvaluation(project, agentUuid, evalUuid);
207
+ console.log(JSON.stringify(result, null, 2));
208
+ }
209
+ catch (error) {
210
+ console.error('Error running evaluation:', error instanceof Error ? error.message : String(error));
211
+ process.exit(1);
212
+ }
213
+ }));
214
+ evalsCmd
215
+ .command('runs <agentUuid> <evalUuid>')
216
+ .description('List all runs for an evaluation')
217
+ .requiredOption('--project <uuid>', 'Project UUID')
218
+ .action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (agentUuid, evalUuid, cmd) => {
219
+ const { project } = cmd.opts();
220
+ try {
221
+ const client = (0, client_1.getClient)();
222
+ const result = await client.v1.aiAgents.listAllEvaluationRuns(project, agentUuid, evalUuid);
223
+ console.log(JSON.stringify(result, null, 2));
224
+ }
225
+ catch (error) {
226
+ console.error('Error listing evaluation runs:', error instanceof Error ? error.message : String(error));
227
+ process.exit(1);
228
+ }
229
+ }));
230
+ evalsCmd
231
+ .command('run-results <agentUuid> <evalUuid> <runUuid>')
232
+ .description('Get detailed results for a specific evaluation run')
233
+ .requiredOption('--project <uuid>', 'Project UUID')
234
+ .action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (agentUuid, evalUuid, runUuid, cmd) => {
235
+ const { project } = cmd.opts();
236
+ try {
237
+ const client = (0, client_1.getClient)();
238
+ const result = await client.v1.aiAgents.getEvaluationRunResults(project, agentUuid, evalUuid, runUuid);
239
+ console.log(JSON.stringify(result, null, 2));
240
+ }
241
+ catch (error) {
242
+ console.error('Error fetching evaluation run results:', error instanceof Error ? error.message : String(error));
243
+ process.exit(1);
244
+ }
245
+ }));
246
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Agent thread management commands.
3
+ */
4
+ import type { Command } from 'commander';
5
+ /**
6
+ * Registers the `agents threads` subcommand group.
7
+ */
8
+ export declare function registerAgentsThreadCommands(agentsCmd: Command): void;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /**
3
+ * Agent thread management commands.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.registerAgentsThreadCommands = registerAgentsThreadCommands;
7
+ const common_1 = require("@lightdash-tools/common");
8
+ const client_1 = require("../utils/client");
9
+ const safety_1 = require("../utils/safety");
10
+ /**
11
+ * Registers the `agents threads` subcommand group.
12
+ */
13
+ function registerAgentsThreadCommands(agentsCmd) {
14
+ const threadsCmd = agentsCmd.command('threads').description('Manage agent conversation threads');
15
+ threadsCmd
16
+ .command('list <agentUuid>')
17
+ .description('List all threads for an agent')
18
+ .requiredOption('--project <uuid>', 'Project UUID')
19
+ .action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (agentUuid, cmd) => {
20
+ const { project } = cmd.opts();
21
+ try {
22
+ const client = (0, client_1.getClient)();
23
+ const result = await client.v1.aiAgents.listAgentThreads(project, agentUuid);
24
+ console.log(JSON.stringify(result, null, 2));
25
+ }
26
+ catch (error) {
27
+ console.error('Error listing threads:', error instanceof Error ? error.message : String(error));
28
+ process.exit(1);
29
+ }
30
+ }));
31
+ threadsCmd
32
+ .command('get <agentUuid> <threadUuid>')
33
+ .description('Get a thread with all its messages')
34
+ .requiredOption('--project <uuid>', 'Project UUID')
35
+ .action((0, safety_1.wrapAction)(common_1.READ_ONLY_DEFAULT, async (agentUuid, threadUuid, cmd) => {
36
+ const { project } = cmd.opts();
37
+ try {
38
+ const client = (0, client_1.getClient)();
39
+ const result = await client.v1.aiAgents.getAgentThread(project, agentUuid, threadUuid);
40
+ console.log(JSON.stringify(result, null, 2));
41
+ }
42
+ catch (error) {
43
+ console.error('Error fetching thread:', error instanceof Error ? error.message : String(error));
44
+ process.exit(1);
45
+ }
46
+ }));
47
+ const startThreadHandler = (0, safety_1.wrapAction)(common_1.WRITE_OPEN_WORLD, async (agentUuid, cmd) => {
48
+ const options = cmd.opts();
49
+ try {
50
+ const client = (0, client_1.getClient)();
51
+ const { thread, result } = await client.v1.aiAgents.startConversation(options.project, agentUuid, { prompt: options.prompt });
52
+ console.log(JSON.stringify(Object.assign({ threadUuid: thread.uuid }, result), null, 2));
53
+ }
54
+ catch (error) {
55
+ console.error('Error starting agent conversation:', error instanceof Error ? error.message : String(error));
56
+ process.exit(1);
57
+ }
58
+ });
59
+ threadsCmd
60
+ .command('generate <agentUuid>')
61
+ .alias('start')
62
+ .description('Start a new thread and generate the first agent response')
63
+ .requiredOption('--project <uuid>', 'Project UUID')
64
+ .requiredOption('--prompt <text>', 'User prompt')
65
+ .action(startThreadHandler);
66
+ threadsCmd
67
+ .command('continue <agentUuid> <threadUuid>')
68
+ .description('Continue an existing thread with a new prompt')
69
+ .requiredOption('--project <uuid>', 'Project UUID')
70
+ .requiredOption('--prompt <text>', 'User prompt')
71
+ .action((0, safety_1.wrapAction)(common_1.WRITE_OPEN_WORLD, async (agentUuid, threadUuid, cmd) => {
72
+ const options = cmd.opts();
73
+ try {
74
+ const client = (0, client_1.getClient)();
75
+ const result = await client.v1.aiAgents.continueConversation(options.project, agentUuid, threadUuid, { prompt: options.prompt });
76
+ console.log(JSON.stringify(result, null, 2));
77
+ }
78
+ catch (error) {
79
+ console.error('Error continuing thread:', error instanceof Error ? error.message : String(error));
80
+ process.exit(1);
81
+ }
82
+ }));
83
+ }