lua-cli 3.2.0 ā 3.3.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/api/logs.api.service.d.ts +1 -1
- package/dist/api/logs.api.service.js.map +1 -1
- package/dist/api/products.api.service.d.ts +17 -5
- package/dist/api/products.api.service.js +21 -9
- package/dist/api/products.api.service.js.map +1 -1
- package/dist/api-exports.d.ts +17 -5
- package/dist/api-exports.js +20 -5
- package/dist/api-exports.js.map +1 -1
- package/dist/cli/command-definitions.js +320 -88
- package/dist/cli/command-definitions.js.map +1 -1
- package/dist/commands/apiKey.d.ts +5 -2
- package/dist/commands/apiKey.js +8 -2
- package/dist/commands/apiKey.js.map +1 -1
- package/dist/commands/channels.d.ts +4 -9
- package/dist/commands/channels.js +140 -84
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat.d.ts +4 -2
- package/dist/commands/chat.js +126 -32
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/chatClear.d.ts +3 -2
- package/dist/commands/chatClear.js +16 -15
- package/dist/commands/chatClear.js.map +1 -1
- package/dist/commands/compile.js +67 -4
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/deploy.d.ts +5 -24
- package/dist/commands/deploy.js +75 -48
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/destroy.d.ts +5 -2
- package/dist/commands/destroy.js +14 -2
- package/dist/commands/destroy.js.map +1 -1
- package/dist/commands/env.d.ts +3 -1
- package/dist/commands/env.js +322 -122
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/features.d.ts +5 -9
- package/dist/commands/features.js +249 -129
- package/dist/commands/features.js.map +1 -1
- package/dist/commands/init.d.ts +7 -1
- package/dist/commands/init.js +242 -59
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/jobs.d.ts +5 -13
- package/dist/commands/jobs.js +449 -364
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/logs.d.ts +5 -10
- package/dist/commands/logs.js +259 -103
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/marketplace.d.ts +23 -2
- package/dist/commands/marketplace.js +530 -7
- package/dist/commands/marketplace.js.map +1 -1
- package/dist/commands/mcp.d.ts +5 -11
- package/dist/commands/mcp.js +303 -288
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/persona.d.ts +5 -9
- package/dist/commands/persona.js +349 -232
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/postprocessors.d.ts +6 -2
- package/dist/commands/postprocessors.js +387 -280
- package/dist/commands/postprocessors.js.map +1 -1
- package/dist/commands/preprocessors.d.ts +6 -2
- package/dist/commands/preprocessors.js +387 -280
- package/dist/commands/preprocessors.js.map +1 -1
- package/dist/commands/production.d.ts +5 -8
- package/dist/commands/production.js +317 -228
- package/dist/commands/production.js.map +1 -1
- package/dist/commands/push.js +385 -427
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/resources.d.ts +5 -10
- package/dist/commands/resources.js +219 -154
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/skills.d.ts +5 -9
- package/dist/commands/skills.js +354 -277
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/sync.d.ts +10 -8
- package/dist/commands/sync.js +110 -19
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/test.d.ts +1 -11
- package/dist/commands/test.js +395 -438
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/webhooks.d.ts +5 -11
- package/dist/commands/webhooks.js +356 -290
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/interfaces/mcp.d.ts +28 -1
- package/dist/interfaces/product.d.ts +26 -0
- package/dist/types/api-contracts.d.ts +8 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/skill.d.ts +92 -17
- package/dist/types/skill.js +15 -11
- package/dist/types/skill.js.map +1 -1
- package/dist/utils/bundling.d.ts +17 -0
- package/dist/utils/bundling.js +96 -0
- package/dist/utils/bundling.js.map +1 -1
- package/dist/utils/compile.d.ts +4 -0
- package/dist/utils/compile.js +5 -0
- package/dist/utils/compile.js.map +1 -1
- package/dist/utils/dev-helpers.d.ts +3 -2
- package/dist/utils/dev-helpers.js +3 -5
- package/dist/utils/dev-helpers.js.map +1 -1
- package/dist/utils/mcp-server-management.d.ts +1 -1
- package/dist/utils/mcp-server-management.js +13 -14
- package/dist/utils/mcp-server-management.js.map +1 -1
- package/package.json +1 -1
- package/template/package.json +1 -1
|
@@ -9,11 +9,22 @@ import { BASE_URLS } from '../config/constants.js';
|
|
|
9
9
|
import { safePrompt } from '../utils/prompt-handler.js';
|
|
10
10
|
import { validateConfig, validateAgentConfig, } from '../utils/dev-helpers.js';
|
|
11
11
|
import PostProcessorApi from '../api/postprocessor.api.service.js';
|
|
12
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
13
|
+
// Main Command Entry
|
|
14
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
12
15
|
/**
|
|
13
|
-
* Main postprocessors command - manages agent postprocessors
|
|
16
|
+
* Main postprocessors command - manages agent postprocessors.
|
|
17
|
+
*
|
|
18
|
+
* Supports both interactive and non-interactive modes:
|
|
19
|
+
* - Interactive: prompts for action and postprocessor selection
|
|
20
|
+
* - Non-interactive: use action argument with -i and -v flags
|
|
14
21
|
*/
|
|
15
|
-
export async function postprocessorsCommand() {
|
|
22
|
+
export async function postprocessorsCommand(action, cmdObj) {
|
|
16
23
|
return withErrorHandling(async () => {
|
|
24
|
+
const options = {
|
|
25
|
+
postprocessorName: cmdObj?.postprocessorName || null,
|
|
26
|
+
postprocessorVersion: cmdObj?.postprocessorVersion || null,
|
|
27
|
+
};
|
|
17
28
|
// Step 1: Load configuration
|
|
18
29
|
const config = readSkillConfig();
|
|
19
30
|
validateConfig(config);
|
|
@@ -31,14 +42,310 @@ export async function postprocessorsCommand() {
|
|
|
31
42
|
agentId,
|
|
32
43
|
apiKey,
|
|
33
44
|
};
|
|
34
|
-
//
|
|
35
|
-
|
|
45
|
+
// Determine mode
|
|
46
|
+
if (action) {
|
|
47
|
+
await executeNonInteractive(context, config, action, options);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
await managePostProcessorsInteractive(context, config);
|
|
51
|
+
}
|
|
36
52
|
}, "postprocessors");
|
|
37
53
|
}
|
|
54
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
55
|
+
// Shared Core Functions
|
|
56
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
57
|
+
/**
|
|
58
|
+
* Displays all postprocessors with their current status.
|
|
59
|
+
*/
|
|
60
|
+
async function displayPostProcessorsCore(context, postprocessors) {
|
|
61
|
+
console.log("\n" + "=".repeat(60));
|
|
62
|
+
console.log("āļø Production PostProcessors");
|
|
63
|
+
console.log("=".repeat(60) + "\n");
|
|
64
|
+
const api = new PostProcessorApi(BASE_URLS.API, context.apiKey, context.agentId);
|
|
65
|
+
for (const postprocessor of postprocessors) {
|
|
66
|
+
try {
|
|
67
|
+
const response = await api.getPostProcessorVersions(postprocessor.postprocessorId);
|
|
68
|
+
if (response.success && response.data) {
|
|
69
|
+
const versions = response.data.versions || [];
|
|
70
|
+
const activeVersionId = response.data.activeVersionId;
|
|
71
|
+
const activeVersion = versions.find((v) => v.versionId === activeVersionId);
|
|
72
|
+
console.log(`š¤ ${postprocessor.name}`);
|
|
73
|
+
console.log(` PostProcessor ID: ${postprocessor.postprocessorId}`);
|
|
74
|
+
if (activeVersion) {
|
|
75
|
+
console.log(` Deployed Version: ${activeVersion.version} ā`);
|
|
76
|
+
console.log(` Deployed: ${new Date(activeVersion.createdAt).toLocaleString()}`);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
console.log(` Deployed Version: Not deployed`);
|
|
80
|
+
}
|
|
81
|
+
console.log(` Total Versions: ${versions.length}`);
|
|
82
|
+
console.log();
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
displayPostProcessorError(postprocessor, "Unable to fetch version info");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
displayPostProcessorError(postprocessor, "Error loading versions");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
console.log("=".repeat(60));
|
|
93
|
+
}
|
|
94
|
+
function displayPostProcessorError(postprocessor, status) {
|
|
95
|
+
console.log(`š¤ ${postprocessor.name}`);
|
|
96
|
+
console.log(` PostProcessor ID: ${postprocessor.postprocessorId}`);
|
|
97
|
+
console.log(` Status: ${status}`);
|
|
98
|
+
console.log();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Fetches and returns sorted postprocessor versions.
|
|
102
|
+
*/
|
|
103
|
+
async function fetchVersionsCore(context, postprocessor) {
|
|
104
|
+
const api = new PostProcessorApi(BASE_URLS.API, context.apiKey, context.agentId);
|
|
105
|
+
const response = await api.getPostProcessorVersions(postprocessor.postprocessorId);
|
|
106
|
+
if (!response.success || !response.data) {
|
|
107
|
+
console.error(`ā Failed to fetch versions: ${response.error?.message || 'Unknown error'}`);
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
const versions = (response.data.versions || []).sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
111
|
+
return { versions, activeVersionId: response.data.activeVersionId };
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Displays versions for a postprocessor.
|
|
115
|
+
*/
|
|
116
|
+
function displayVersionsCore(postprocessor, versions, activeVersionId) {
|
|
117
|
+
console.log("\n" + "=".repeat(60));
|
|
118
|
+
console.log(`š Versions for ${postprocessor.name}`);
|
|
119
|
+
console.log("=".repeat(60) + "\n");
|
|
120
|
+
versions.forEach((version, index) => {
|
|
121
|
+
const isActive = version.postprocessorId === activeVersionId;
|
|
122
|
+
console.log(`${index + 1}. Version ${version.version}${isActive ? ' ā DEPLOYED' : ''}`);
|
|
123
|
+
console.log(` Created: ${new Date(version.createdAt).toLocaleString()}`);
|
|
124
|
+
console.log();
|
|
125
|
+
});
|
|
126
|
+
console.log("=".repeat(60));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Deploys a specific version of a postprocessor.
|
|
130
|
+
*/
|
|
131
|
+
async function deployVersionCore(context, postprocessor, version) {
|
|
132
|
+
writeProgress(`š Deploying version ${version} of "${postprocessor.name}"...`);
|
|
133
|
+
const api = new PostProcessorApi(BASE_URLS.API, context.apiKey, context.agentId);
|
|
134
|
+
const deployResponse = await api.publishPostProcessorVersion(postprocessor.postprocessorId, version);
|
|
135
|
+
if (!deployResponse.success) {
|
|
136
|
+
console.error(`ā Deploy Error: ${deployResponse.error?.message || 'Unknown error'}`);
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
writeSuccess(`ā
Version ${version} of "${postprocessor.name}" deployed successfully`);
|
|
140
|
+
writeInfo("š” The new version is now active and will process all outgoing responses.");
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Activates a postprocessor.
|
|
145
|
+
*/
|
|
146
|
+
async function activatePostProcessorCore(context, postprocessor) {
|
|
147
|
+
writeProgress(`š Activating postprocessor "${postprocessor.name}"...`);
|
|
148
|
+
const api = new PostProcessorApi(BASE_URLS.API, context.apiKey, context.agentId);
|
|
149
|
+
const response = await api.activatePostProcessor(postprocessor.postprocessorId);
|
|
150
|
+
if (response.success) {
|
|
151
|
+
writeSuccess(`ā
PostProcessor "${postprocessor.name}" activated successfully`);
|
|
152
|
+
writeInfo("š” The postprocessor is now enabled and will process all outgoing responses.");
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
console.error(`ā Failed to activate postprocessor: ${response.error?.message || 'Unknown error'}`);
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Deactivates a postprocessor.
|
|
162
|
+
*/
|
|
163
|
+
async function deactivatePostProcessorCore(context, postprocessor) {
|
|
164
|
+
writeProgress(`š Deactivating postprocessor "${postprocessor.name}"...`);
|
|
165
|
+
const api = new PostProcessorApi(BASE_URLS.API, context.apiKey, context.agentId);
|
|
166
|
+
const response = await api.deactivatePostProcessor(postprocessor.postprocessorId);
|
|
167
|
+
if (response.success) {
|
|
168
|
+
writeSuccess(`ā
PostProcessor "${postprocessor.name}" deactivated successfully`);
|
|
169
|
+
writeInfo("š” The postprocessor is now disabled.");
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
console.error(`ā Failed to deactivate postprocessor: ${response.error?.message || 'Unknown error'}`);
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Deletes a postprocessor.
|
|
179
|
+
*/
|
|
180
|
+
async function deletePostProcessorCore(context, postprocessor) {
|
|
181
|
+
writeProgress(`š Deleting postprocessor "${postprocessor.name}"...`);
|
|
182
|
+
const api = new PostProcessorApi(BASE_URLS.API, context.apiKey, context.agentId);
|
|
183
|
+
const response = await api.deletePostProcessor(postprocessor.postprocessorId);
|
|
184
|
+
if (response.success) {
|
|
185
|
+
if (response.data?.deleted) {
|
|
186
|
+
writeSuccess(`ā
PostProcessor "${postprocessor.name}" deleted successfully`);
|
|
187
|
+
}
|
|
188
|
+
else if (response.data?.deactivated) {
|
|
189
|
+
writeInfo(`ā ļø PostProcessor "${postprocessor.name}" has versions and cannot be deleted. It has been deactivated instead.`);
|
|
190
|
+
}
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
console.error(`ā Failed to delete postprocessor: ${response.error?.message || 'Unknown error'}`);
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Resolves a version string to an actual version, supporting "latest".
|
|
200
|
+
*/
|
|
201
|
+
function resolveVersion(versions, versionArg) {
|
|
202
|
+
if (versionArg.toLowerCase() === 'latest') {
|
|
203
|
+
return versions[0].version;
|
|
204
|
+
}
|
|
205
|
+
const exists = versions.some((v) => v.version === versionArg);
|
|
206
|
+
if (!exists) {
|
|
207
|
+
console.error(`ā Version "${versionArg}" not found`);
|
|
208
|
+
console.log('\nAvailable versions:');
|
|
209
|
+
versions.slice(0, 5).forEach((v) => console.log(` - ${v.version}`));
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
return versionArg;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Prompts user to select a postprocessor from a list.
|
|
216
|
+
*/
|
|
217
|
+
async function promptPostProcessorSelection(postprocessors, message) {
|
|
218
|
+
const answer = await safePrompt([
|
|
219
|
+
{
|
|
220
|
+
type: 'list',
|
|
221
|
+
name: 'selected',
|
|
222
|
+
message,
|
|
223
|
+
choices: postprocessors.map((p) => ({
|
|
224
|
+
name: `${p.name} (${p.postprocessorId})`,
|
|
225
|
+
value: p
|
|
226
|
+
}))
|
|
227
|
+
}
|
|
228
|
+
]);
|
|
229
|
+
return answer?.selected || null;
|
|
230
|
+
}
|
|
38
231
|
/**
|
|
39
|
-
*
|
|
232
|
+
* Prompts user to select a version from a list.
|
|
40
233
|
*/
|
|
41
|
-
async function
|
|
234
|
+
async function promptVersionSelection(versions, activeVersionId) {
|
|
235
|
+
const answer = await safePrompt([
|
|
236
|
+
{
|
|
237
|
+
type: 'list',
|
|
238
|
+
name: 'selectedVersion',
|
|
239
|
+
message: 'Select a version to deploy:',
|
|
240
|
+
choices: versions.map((version) => {
|
|
241
|
+
const isActive = version.postprocessorId === activeVersionId;
|
|
242
|
+
return {
|
|
243
|
+
name: `Version ${version.version} (${new Date(version.createdAt).toLocaleDateString()})${isActive ? ' ā CURRENT' : ''}`,
|
|
244
|
+
value: version
|
|
245
|
+
};
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
]);
|
|
249
|
+
return answer?.selectedVersion || null;
|
|
250
|
+
}
|
|
251
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
252
|
+
// Non-Interactive Mode
|
|
253
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
254
|
+
async function executeNonInteractive(context, config, action, options) {
|
|
255
|
+
const validActions = ['view', 'versions', 'deploy', 'activate', 'deactivate', 'delete'];
|
|
256
|
+
const normalizedAction = action.toLowerCase();
|
|
257
|
+
if (!validActions.includes(normalizedAction)) {
|
|
258
|
+
console.error(`ā Invalid action: "${action}"`);
|
|
259
|
+
console.log('\nValid actions: view, versions, deploy, activate, deactivate, delete');
|
|
260
|
+
console.log('\nExamples:');
|
|
261
|
+
console.log(' lua postprocessors view List all postprocessors');
|
|
262
|
+
console.log(' lua postprocessors activate -i myPost Activate a postprocessor');
|
|
263
|
+
console.log(' lua postprocessors deploy -i myPost -v 1.0.3 Deploy specific version');
|
|
264
|
+
process.exit(1);
|
|
265
|
+
}
|
|
266
|
+
const postprocessors = config.postprocessors || [];
|
|
267
|
+
// View action doesn't require postprocessor selection
|
|
268
|
+
if (normalizedAction === 'view') {
|
|
269
|
+
if (postprocessors.length === 0) {
|
|
270
|
+
console.log("ā¹ļø No postprocessors found in configuration.");
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
await displayPostProcessorsCore(context, postprocessors);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
// All other actions require postprocessor selection
|
|
277
|
+
if (!options.postprocessorName) {
|
|
278
|
+
console.error(`ā --postprocessor-name is required for action "${normalizedAction}"`);
|
|
279
|
+
console.log(`\nUsage: lua postprocessors ${normalizedAction} --postprocessor-name <name>`);
|
|
280
|
+
process.exit(1);
|
|
281
|
+
}
|
|
282
|
+
const selected = postprocessors.find((p) => p.postprocessorId === options.postprocessorName || p.name === options.postprocessorName);
|
|
283
|
+
if (!selected) {
|
|
284
|
+
console.error(`ā PostProcessor "${options.postprocessorName}" not found`);
|
|
285
|
+
console.log('\nAvailable postprocessors:');
|
|
286
|
+
postprocessors.forEach((p) => console.log(` - ${p.name} (${p.postprocessorId})`));
|
|
287
|
+
process.exit(1);
|
|
288
|
+
}
|
|
289
|
+
switch (normalizedAction) {
|
|
290
|
+
case 'versions': {
|
|
291
|
+
const data = await fetchVersionsCore(context, selected);
|
|
292
|
+
if (!data)
|
|
293
|
+
process.exit(1);
|
|
294
|
+
if (data.versions.length === 0) {
|
|
295
|
+
console.log(`ā¹ļø No versions found for ${selected.name}.`);
|
|
296
|
+
console.log("š” Push a version first using 'lua push postprocessor'.");
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
displayVersionsCore(selected, data.versions, data.activeVersionId);
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
case 'deploy': {
|
|
303
|
+
if (!options.postprocessorVersion) {
|
|
304
|
+
console.error('ā --postprocessor-version is required for deploy action');
|
|
305
|
+
console.log('\nUsage: lua postprocessors deploy --postprocessor-name myPost --postprocessor-version 1.0.3');
|
|
306
|
+
console.log(' lua postprocessors deploy -i myPost -v latest');
|
|
307
|
+
process.exit(1);
|
|
308
|
+
}
|
|
309
|
+
const data = await fetchVersionsCore(context, selected);
|
|
310
|
+
if (!data)
|
|
311
|
+
process.exit(1);
|
|
312
|
+
if (data.versions.length === 0) {
|
|
313
|
+
console.error(`ā No versions found for ${selected.name}.`);
|
|
314
|
+
console.log("š” Push a version first using 'lua push postprocessor'.");
|
|
315
|
+
process.exit(1);
|
|
316
|
+
}
|
|
317
|
+
const resolvedVersion = resolveVersion(data.versions, options.postprocessorVersion);
|
|
318
|
+
if (!resolvedVersion)
|
|
319
|
+
process.exit(1);
|
|
320
|
+
const success = await deployVersionCore(context, selected, resolvedVersion);
|
|
321
|
+
if (!success)
|
|
322
|
+
process.exit(1);
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
case 'activate': {
|
|
326
|
+
const success = await activatePostProcessorCore(context, selected);
|
|
327
|
+
if (!success)
|
|
328
|
+
process.exit(1);
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
case 'deactivate': {
|
|
332
|
+
const success = await deactivatePostProcessorCore(context, selected);
|
|
333
|
+
if (!success)
|
|
334
|
+
process.exit(1);
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
case 'delete': {
|
|
338
|
+
const success = await deletePostProcessorCore(context, selected);
|
|
339
|
+
if (!success)
|
|
340
|
+
process.exit(1);
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
346
|
+
// Interactive Mode
|
|
347
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
348
|
+
async function managePostProcessorsInteractive(context, config) {
|
|
42
349
|
let continueManaging = true;
|
|
43
350
|
while (continueManaging) {
|
|
44
351
|
console.log("\n" + "=".repeat(60));
|
|
@@ -65,22 +372,22 @@ async function manageProductionPostProcessors(context, config) {
|
|
|
65
372
|
const { action } = actionAnswer;
|
|
66
373
|
switch (action) {
|
|
67
374
|
case 'view':
|
|
68
|
-
await
|
|
375
|
+
await viewPostProcessorsInteractive(context, config);
|
|
69
376
|
break;
|
|
70
377
|
case 'versions':
|
|
71
|
-
await
|
|
378
|
+
await viewVersionsInteractive(context, config);
|
|
72
379
|
break;
|
|
73
380
|
case 'deploy':
|
|
74
|
-
await
|
|
381
|
+
await deployVersionInteractive(context, config);
|
|
75
382
|
break;
|
|
76
383
|
case 'activate':
|
|
77
|
-
await
|
|
384
|
+
await activatePostProcessorInteractive(context, config);
|
|
78
385
|
break;
|
|
79
386
|
case 'deactivate':
|
|
80
|
-
await
|
|
387
|
+
await deactivatePostProcessorInteractive(context, config);
|
|
81
388
|
break;
|
|
82
389
|
case 'delete':
|
|
83
|
-
await
|
|
390
|
+
await deletePostProcessorInteractive(context, config);
|
|
84
391
|
break;
|
|
85
392
|
case 'exit':
|
|
86
393
|
continueManaging = false;
|
|
@@ -89,279 +396,114 @@ async function manageProductionPostProcessors(context, config) {
|
|
|
89
396
|
}
|
|
90
397
|
}
|
|
91
398
|
}
|
|
92
|
-
|
|
93
|
-
* View deployed postprocessors in production
|
|
94
|
-
*/
|
|
95
|
-
async function viewDeployedPostProcessors(context, config) {
|
|
399
|
+
async function viewPostProcessorsInteractive(context, config) {
|
|
96
400
|
writeProgress("š Loading postprocessor information...");
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
console.log("\nā¹ļø No postprocessors found in configuration.\n");
|
|
101
|
-
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
console.log("\n" + "=".repeat(60));
|
|
105
|
-
console.log("āļø Production PostProcessors");
|
|
106
|
-
console.log("=".repeat(60) + "\n");
|
|
107
|
-
const api = new PostProcessorApi(BASE_URLS.API, context.apiKey, context.agentId);
|
|
108
|
-
for (const postprocessor of postprocessors) {
|
|
109
|
-
try {
|
|
110
|
-
const response = await api.getPostProcessorVersions(postprocessor.postprocessorId);
|
|
111
|
-
if (response.success && response.data) {
|
|
112
|
-
const versions = response.data.versions || [];
|
|
113
|
-
const activeVersionId = response.data.activeVersionId;
|
|
114
|
-
const activeVersion = versions.find((v) => v.versionId === activeVersionId);
|
|
115
|
-
console.log(`š¤ ${postprocessor.name}`);
|
|
116
|
-
console.log(` PostProcessor ID: ${postprocessor.postprocessorId}`);
|
|
117
|
-
if (activeVersion) {
|
|
118
|
-
console.log(` Deployed Version: ${activeVersion.version} ā`);
|
|
119
|
-
const date = new Date(activeVersion.createdAt);
|
|
120
|
-
console.log(` Deployed: ${date.toLocaleString()}`);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
console.log(` Deployed Version: Not deployed`);
|
|
124
|
-
}
|
|
125
|
-
console.log(` Total Versions: ${versions.length}`);
|
|
126
|
-
console.log();
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
console.log(`š¤ ${postprocessor.name}`);
|
|
130
|
-
console.log(` PostProcessor ID: ${postprocessor.postprocessorId}`);
|
|
131
|
-
console.log(` Status: Unable to fetch version info`);
|
|
132
|
-
console.log();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
console.log(`š¤ ${postprocessor.name}`);
|
|
137
|
-
console.log(` PostProcessor ID: ${postprocessor.postprocessorId}`);
|
|
138
|
-
console.log(` Status: Error loading versions`);
|
|
139
|
-
console.log();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
console.log("=".repeat(60) + "\n");
|
|
143
|
-
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
401
|
+
const postprocessors = config.postprocessors || [];
|
|
402
|
+
if (postprocessors.length === 0) {
|
|
403
|
+
console.log("\nā¹ļø No postprocessors found in configuration.\n");
|
|
144
404
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
405
|
+
else {
|
|
406
|
+
await displayPostProcessorsCore(context, postprocessors);
|
|
407
|
+
console.log();
|
|
148
408
|
}
|
|
409
|
+
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
149
410
|
}
|
|
150
|
-
|
|
151
|
-
* View versions for a specific postprocessor
|
|
152
|
-
*/
|
|
153
|
-
async function viewPostProcessorVersions(context, config) {
|
|
411
|
+
async function viewVersionsInteractive(context, config) {
|
|
154
412
|
const postprocessors = config.postprocessors || [];
|
|
155
413
|
if (postprocessors.length === 0) {
|
|
156
414
|
console.log("\nā¹ļø No postprocessors found in configuration.\n");
|
|
157
415
|
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
158
416
|
return;
|
|
159
417
|
}
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
type: 'list',
|
|
163
|
-
name: 'selected',
|
|
164
|
-
message: 'Select a postprocessor to view versions:',
|
|
165
|
-
choices: postprocessors.map((p) => ({
|
|
166
|
-
name: `${p.name} (${p.postprocessorId})`,
|
|
167
|
-
value: p
|
|
168
|
-
}))
|
|
169
|
-
}
|
|
170
|
-
]);
|
|
171
|
-
if (!answer)
|
|
418
|
+
const selected = await promptPostProcessorSelection(postprocessors, 'Select a postprocessor to view versions:');
|
|
419
|
+
if (!selected)
|
|
172
420
|
return;
|
|
173
|
-
const selected = answer.selected;
|
|
174
421
|
writeProgress(`š Loading versions for ${selected.name}...`);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const response = await api.getPostProcessorVersions(selected.postprocessorId);
|
|
178
|
-
if (!response.success || !response.data) {
|
|
179
|
-
throw new Error(response.error?.message || 'Failed to fetch versions');
|
|
180
|
-
}
|
|
181
|
-
const versions = response.data.versions || [];
|
|
182
|
-
const activeVersionId = response.data.activeVersionId;
|
|
183
|
-
if (versions.length === 0) {
|
|
184
|
-
console.log(`\nā¹ļø No versions found for ${selected.name}.\n`);
|
|
185
|
-
console.log("š” Push a version first using 'lua push postprocessor'.\n");
|
|
186
|
-
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
const sortedVersions = versions.sort((a, b) => {
|
|
190
|
-
const dateA = new Date(a.createdAt).getTime();
|
|
191
|
-
const dateB = new Date(b.createdAt).getTime();
|
|
192
|
-
return dateB - dateA;
|
|
193
|
-
});
|
|
194
|
-
console.log("\n" + "=".repeat(60));
|
|
195
|
-
console.log(`š Versions for ${selected.name}`);
|
|
196
|
-
console.log("=".repeat(60) + "\n");
|
|
197
|
-
sortedVersions.forEach((version) => {
|
|
198
|
-
const isActive = version.postprocessorId === activeVersionId;
|
|
199
|
-
const date = new Date(version.createdAt);
|
|
200
|
-
console.log(`${isActive ? 'ā' : ' '} Version ${version.version}`);
|
|
201
|
-
console.log(` Created: ${date.toLocaleString()}`);
|
|
202
|
-
console.log();
|
|
203
|
-
});
|
|
204
|
-
console.log("=".repeat(60) + "\n");
|
|
422
|
+
const data = await fetchVersionsCore(context, selected);
|
|
423
|
+
if (!data) {
|
|
205
424
|
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
425
|
+
return;
|
|
206
426
|
}
|
|
207
|
-
|
|
208
|
-
console.
|
|
209
|
-
|
|
427
|
+
if (data.versions.length === 0) {
|
|
428
|
+
console.log(`\nā¹ļø No versions found for ${selected.name}.\n`);
|
|
429
|
+
console.log("š” Push a version first using 'lua push postprocessor'.\n");
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
displayVersionsCore(selected, data.versions, data.activeVersionId);
|
|
433
|
+
console.log();
|
|
210
434
|
}
|
|
435
|
+
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
211
436
|
}
|
|
212
|
-
|
|
213
|
-
* Deploy a postprocessor version to production
|
|
214
|
-
*/
|
|
215
|
-
async function deployPostProcessorVersion(context, config) {
|
|
437
|
+
async function deployVersionInteractive(context, config) {
|
|
216
438
|
const postprocessors = config.postprocessors || [];
|
|
217
439
|
if (postprocessors.length === 0) {
|
|
218
440
|
console.log("\nā¹ļø No postprocessors found in configuration.\n");
|
|
219
441
|
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
220
442
|
return;
|
|
221
443
|
}
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
type: 'list',
|
|
225
|
-
name: 'selected',
|
|
226
|
-
message: 'Select a postprocessor to deploy:',
|
|
227
|
-
choices: postprocessors.map((p) => ({
|
|
228
|
-
name: `${p.name} (${p.postprocessorId})`,
|
|
229
|
-
value: p
|
|
230
|
-
}))
|
|
231
|
-
}
|
|
232
|
-
]);
|
|
233
|
-
if (!answer)
|
|
444
|
+
const selected = await promptPostProcessorSelection(postprocessors, 'Select a postprocessor to deploy:');
|
|
445
|
+
if (!selected)
|
|
234
446
|
return;
|
|
235
|
-
const selected = answer.selected;
|
|
236
447
|
writeProgress(`š Loading versions for ${selected.name}...`);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
const response = await api.getPostProcessorVersions(selected.postprocessorId);
|
|
240
|
-
if (!response.success || !response.data) {
|
|
241
|
-
throw new Error(response.error?.message || 'Failed to fetch versions');
|
|
242
|
-
}
|
|
243
|
-
const versions = response.data.versions || [];
|
|
244
|
-
const activeVersionId = response.data.activeVersionId;
|
|
245
|
-
if (versions.length === 0) {
|
|
246
|
-
console.log(`\nā¹ļø No versions found for ${selected.name}.\n`);
|
|
247
|
-
console.log("š” Push a version first using 'lua push postprocessor'.\n");
|
|
248
|
-
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
const sortedVersions = versions.sort((a, b) => {
|
|
252
|
-
const dateA = new Date(a.createdAt).getTime();
|
|
253
|
-
const dateB = new Date(b.createdAt).getTime();
|
|
254
|
-
return dateB - dateA;
|
|
255
|
-
});
|
|
256
|
-
const versionAnswer = await safePrompt([
|
|
257
|
-
{
|
|
258
|
-
type: 'list',
|
|
259
|
-
name: 'selectedVersion',
|
|
260
|
-
message: 'Select a version to deploy:',
|
|
261
|
-
choices: sortedVersions.map((version) => {
|
|
262
|
-
const isActive = version.postprocessorId === activeVersionId;
|
|
263
|
-
const date = new Date(version.createdAt);
|
|
264
|
-
return {
|
|
265
|
-
name: `Version ${version.version} (${date.toLocaleDateString()})${isActive ? ' ā CURRENT' : ''}`,
|
|
266
|
-
value: version
|
|
267
|
-
};
|
|
268
|
-
})
|
|
269
|
-
}
|
|
270
|
-
]);
|
|
271
|
-
if (!versionAnswer)
|
|
272
|
-
return;
|
|
273
|
-
const selectedVersion = versionAnswer.selectedVersion;
|
|
274
|
-
console.log("\nā ļø WARNING: You are about to deploy to PRODUCTION!");
|
|
275
|
-
console.log("ā ļø This will affect ALL users immediately.\n");
|
|
276
|
-
console.log(`PostProcessor: ${selected.name}`);
|
|
277
|
-
console.log(`Version: ${selectedVersion.version}\n`);
|
|
278
|
-
const confirmAnswer = await safePrompt([
|
|
279
|
-
{
|
|
280
|
-
type: 'confirm',
|
|
281
|
-
name: 'confirm',
|
|
282
|
-
message: 'Are you absolutely sure you want to deploy this version?',
|
|
283
|
-
default: false
|
|
284
|
-
}
|
|
285
|
-
]);
|
|
286
|
-
if (!confirmAnswer || !confirmAnswer.confirm) {
|
|
287
|
-
console.log("\nā Deployment cancelled.\n");
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
writeProgress("š Deploying version...");
|
|
291
|
-
const deployResponse = await api.publishPostProcessorVersion(selected.postprocessorId, selectedVersion.version);
|
|
292
|
-
if (!deployResponse.success) {
|
|
293
|
-
console.error(`\nā Deploy Error: ${deployResponse.error?.message || 'Unknown error'}\n`);
|
|
294
|
-
throw new Error(deployResponse.error?.message || 'Failed to publish postprocessor version');
|
|
295
|
-
}
|
|
296
|
-
writeSuccess(`\nā
Version ${selectedVersion.version} of "${selected.name}" deployed successfully to production\n`);
|
|
297
|
-
writeInfo("š” The new version is now active and will process all outgoing responses.");
|
|
448
|
+
const data = await fetchVersionsCore(context, selected);
|
|
449
|
+
if (!data) {
|
|
298
450
|
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
451
|
+
return;
|
|
299
452
|
}
|
|
300
|
-
|
|
301
|
-
console.
|
|
453
|
+
if (data.versions.length === 0) {
|
|
454
|
+
console.log(`\nā¹ļø No versions found for ${selected.name}.\n`);
|
|
455
|
+
console.log("š” Push a version first using 'lua push postprocessor'.\n");
|
|
302
456
|
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Activate a postprocessor
|
|
307
|
-
*/
|
|
308
|
-
async function activatePostProcessor(context, config) {
|
|
309
|
-
const postprocessors = config.postprocessors || [];
|
|
310
|
-
if (postprocessors.length === 0) {
|
|
311
|
-
console.log("\nā¹ļø No postprocessors found.\n");
|
|
312
457
|
return;
|
|
313
458
|
}
|
|
314
|
-
const
|
|
459
|
+
const selectedVersion = await promptVersionSelection(data.versions, data.activeVersionId);
|
|
460
|
+
if (!selectedVersion)
|
|
461
|
+
return;
|
|
462
|
+
// Show warning and confirm
|
|
463
|
+
console.log("\nā ļø WARNING: You are about to deploy to PRODUCTION!");
|
|
464
|
+
console.log("ā ļø This will affect ALL users immediately.\n");
|
|
465
|
+
console.log(`PostProcessor: ${selected.name}`);
|
|
466
|
+
console.log(`Version: ${selectedVersion.version}\n`);
|
|
467
|
+
const confirmAnswer = await safePrompt([
|
|
315
468
|
{
|
|
316
|
-
type: '
|
|
317
|
-
name: '
|
|
318
|
-
message: '
|
|
319
|
-
|
|
320
|
-
name: `${p.name} (${p.postprocessorId})`,
|
|
321
|
-
value: p
|
|
322
|
-
}))
|
|
469
|
+
type: 'confirm',
|
|
470
|
+
name: 'confirm',
|
|
471
|
+
message: 'Are you absolutely sure you want to deploy this version?',
|
|
472
|
+
default: false
|
|
323
473
|
}
|
|
324
474
|
]);
|
|
325
|
-
if (!
|
|
475
|
+
if (!confirmAnswer || !confirmAnswer.confirm) {
|
|
476
|
+
console.log("\nā Deployment cancelled.\n");
|
|
326
477
|
return;
|
|
327
|
-
writeProgress(`š Activating postprocessor "${answer.selected.name}"...`);
|
|
328
|
-
const api = new PostProcessorApi(BASE_URLS.API, context.apiKey, context.agentId);
|
|
329
|
-
const response = await api.activatePostProcessor(answer.selected.postprocessorId);
|
|
330
|
-
if (response.success) {
|
|
331
|
-
writeSuccess(`ā
PostProcessor "${answer.selected.name}" activated successfully`);
|
|
332
|
-
writeInfo("š” The postprocessor is now enabled and will process all outgoing responses.");
|
|
333
478
|
}
|
|
334
|
-
|
|
335
|
-
|
|
479
|
+
await deployVersionCore(context, selected, selectedVersion.version);
|
|
480
|
+
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
481
|
+
}
|
|
482
|
+
async function activatePostProcessorInteractive(context, config) {
|
|
483
|
+
const postprocessors = config.postprocessors || [];
|
|
484
|
+
if (postprocessors.length === 0) {
|
|
485
|
+
console.log("\nā¹ļø No postprocessors found.\n");
|
|
486
|
+
return;
|
|
336
487
|
}
|
|
488
|
+
const selected = await promptPostProcessorSelection(postprocessors, 'Select a postprocessor to activate:');
|
|
489
|
+
if (!selected)
|
|
490
|
+
return;
|
|
491
|
+
await activatePostProcessorCore(context, selected);
|
|
337
492
|
}
|
|
338
|
-
|
|
339
|
-
* Deactivate a postprocessor
|
|
340
|
-
*/
|
|
341
|
-
async function deactivatePostProcessor(context, config) {
|
|
493
|
+
async function deactivatePostProcessorInteractive(context, config) {
|
|
342
494
|
const postprocessors = config.postprocessors || [];
|
|
343
495
|
if (postprocessors.length === 0) {
|
|
344
496
|
console.log("\nā¹ļø No postprocessors found.\n");
|
|
345
497
|
return;
|
|
346
498
|
}
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
type: 'list',
|
|
350
|
-
name: 'selected',
|
|
351
|
-
message: 'Select a postprocessor to deactivate:',
|
|
352
|
-
choices: postprocessors.map((p) => ({
|
|
353
|
-
name: `${p.name} (${p.postprocessorId})`,
|
|
354
|
-
value: p
|
|
355
|
-
}))
|
|
356
|
-
}
|
|
357
|
-
]);
|
|
358
|
-
if (!answer)
|
|
499
|
+
const selected = await promptPostProcessorSelection(postprocessors, 'Select a postprocessor to deactivate:');
|
|
500
|
+
if (!selected)
|
|
359
501
|
return;
|
|
360
502
|
const confirmAnswer = await safePrompt([
|
|
361
503
|
{
|
|
362
504
|
type: 'confirm',
|
|
363
505
|
name: 'confirm',
|
|
364
|
-
message: `Are you sure you want to deactivate "${
|
|
506
|
+
message: `Are you sure you want to deactivate "${selected.name}"? Responses will not be postprocessed.`,
|
|
365
507
|
default: false
|
|
366
508
|
}
|
|
367
509
|
]);
|
|
@@ -369,44 +511,22 @@ async function deactivatePostProcessor(context, config) {
|
|
|
369
511
|
console.log("\nā Deactivation cancelled.\n");
|
|
370
512
|
return;
|
|
371
513
|
}
|
|
372
|
-
|
|
373
|
-
const api = new PostProcessorApi(BASE_URLS.API, context.apiKey, context.agentId);
|
|
374
|
-
const response = await api.deactivatePostProcessor(answer.selected.postprocessorId);
|
|
375
|
-
if (response.success) {
|
|
376
|
-
writeSuccess(`ā
PostProcessor "${answer.selected.name}" deactivated successfully`);
|
|
377
|
-
writeInfo("š” The postprocessor is now disabled.");
|
|
378
|
-
}
|
|
379
|
-
else {
|
|
380
|
-
console.error(`ā Failed to deactivate postprocessor: ${response.error?.message || 'Unknown error'}`);
|
|
381
|
-
}
|
|
514
|
+
await deactivatePostProcessorCore(context, selected);
|
|
382
515
|
}
|
|
383
|
-
|
|
384
|
-
* Delete a postprocessor
|
|
385
|
-
*/
|
|
386
|
-
async function deletePostProcessor(context, config) {
|
|
516
|
+
async function deletePostProcessorInteractive(context, config) {
|
|
387
517
|
const postprocessors = config.postprocessors || [];
|
|
388
518
|
if (postprocessors.length === 0) {
|
|
389
519
|
console.log("\nā¹ļø No postprocessors found.\n");
|
|
390
520
|
return;
|
|
391
521
|
}
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
type: 'list',
|
|
395
|
-
name: 'selected',
|
|
396
|
-
message: 'Select a postprocessor to delete:',
|
|
397
|
-
choices: postprocessors.map((p) => ({
|
|
398
|
-
name: `${p.name} (${p.postprocessorId})`,
|
|
399
|
-
value: p
|
|
400
|
-
}))
|
|
401
|
-
}
|
|
402
|
-
]);
|
|
403
|
-
if (!answer)
|
|
522
|
+
const selected = await promptPostProcessorSelection(postprocessors, 'Select a postprocessor to delete:');
|
|
523
|
+
if (!selected)
|
|
404
524
|
return;
|
|
405
525
|
const confirmAnswer = await safePrompt([
|
|
406
526
|
{
|
|
407
527
|
type: 'confirm',
|
|
408
528
|
name: 'confirm',
|
|
409
|
-
message: `ā ļø Are you sure you want to DELETE "${
|
|
529
|
+
message: `ā ļø Are you sure you want to DELETE "${selected.name}"? This cannot be undone.`,
|
|
410
530
|
default: false
|
|
411
531
|
}
|
|
412
532
|
]);
|
|
@@ -414,19 +534,6 @@ async function deletePostProcessor(context, config) {
|
|
|
414
534
|
console.log("\nā Deletion cancelled.\n");
|
|
415
535
|
return;
|
|
416
536
|
}
|
|
417
|
-
|
|
418
|
-
const api = new PostProcessorApi(BASE_URLS.API, context.apiKey, context.agentId);
|
|
419
|
-
const response = await api.deletePostProcessor(answer.selected.postprocessorId);
|
|
420
|
-
if (response.success) {
|
|
421
|
-
if (response.data?.deleted) {
|
|
422
|
-
writeSuccess(`ā
PostProcessor "${answer.selected.name}" deleted successfully`);
|
|
423
|
-
}
|
|
424
|
-
else if (response.data?.deactivated) {
|
|
425
|
-
writeInfo(`ā ļø PostProcessor "${answer.selected.name}" has versions and cannot be deleted. It has been deactivated instead.`);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
console.error(`ā Failed to delete postprocessor: ${response.error?.message || 'Unknown error'}`);
|
|
430
|
-
}
|
|
537
|
+
await deletePostProcessorCore(context, selected);
|
|
431
538
|
}
|
|
432
539
|
//# sourceMappingURL=postprocessors.js.map
|