@vellumai/cli 0.4.46 → 0.4.48
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/package.json +1 -1
- package/src/commands/retire.ts +43 -1
package/package.json
CHANGED
package/src/commands/retire.ts
CHANGED
|
@@ -9,6 +9,10 @@ import {
|
|
|
9
9
|
removeAssistantEntry,
|
|
10
10
|
} from "../lib/assistant-config";
|
|
11
11
|
import type { AssistantEntry } from "../lib/assistant-config";
|
|
12
|
+
import {
|
|
13
|
+
getPlatformUrl,
|
|
14
|
+
readPlatformToken,
|
|
15
|
+
} from "../lib/platform-client";
|
|
12
16
|
import { retireInstance as retireAwsInstance } from "../lib/aws";
|
|
13
17
|
import { retireDocker } from "../lib/docker";
|
|
14
18
|
import { retireInstance as retireGcpInstance } from "../lib/gcp";
|
|
@@ -18,7 +22,12 @@ import {
|
|
|
18
22
|
} from "../lib/process";
|
|
19
23
|
import { getArchivePath, getMetadataPath } from "../lib/retire-archive";
|
|
20
24
|
import { exec } from "../lib/step-runner";
|
|
21
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
openLogFile,
|
|
27
|
+
closeLogFile,
|
|
28
|
+
resetLogFile,
|
|
29
|
+
writeToLogFile,
|
|
30
|
+
} from "../lib/xdg-log";
|
|
22
31
|
|
|
23
32
|
function resolveCloud(entry: AssistantEntry): string {
|
|
24
33
|
if (entry.cloud) {
|
|
@@ -172,6 +181,34 @@ async function retireCustom(entry: AssistantEntry): Promise<void> {
|
|
|
172
181
|
console.log(`\u2705 Custom instance retired.`);
|
|
173
182
|
}
|
|
174
183
|
|
|
184
|
+
async function retireVellum(assistantId: string): Promise<void> {
|
|
185
|
+
console.log("\u{1F5D1}\ufe0f Retiring platform-hosted instance...\n");
|
|
186
|
+
|
|
187
|
+
const token = readPlatformToken();
|
|
188
|
+
if (!token) {
|
|
189
|
+
console.error(
|
|
190
|
+
"Error: Not logged in. Run `vellum login --token <token>` first.",
|
|
191
|
+
);
|
|
192
|
+
process.exit(1);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const url = `${getPlatformUrl()}/v1/assistants/${encodeURIComponent(assistantId)}/retire/`;
|
|
196
|
+
const response = await fetch(url, {
|
|
197
|
+
method: "DELETE",
|
|
198
|
+
headers: { "X-Session-Token": token },
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
if (!response.ok) {
|
|
202
|
+
const body = await response.text();
|
|
203
|
+
console.error(
|
|
204
|
+
`Error: Platform retire failed (${response.status}): ${body}`,
|
|
205
|
+
);
|
|
206
|
+
process.exit(1);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
console.log("\u2705 Platform-hosted instance retired.");
|
|
210
|
+
}
|
|
211
|
+
|
|
175
212
|
function parseSource(): string | undefined {
|
|
176
213
|
const args = process.argv.slice(4);
|
|
177
214
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -213,6 +250,9 @@ function teeConsoleToLogFile(fd: number | "ignore"): void {
|
|
|
213
250
|
}
|
|
214
251
|
|
|
215
252
|
export async function retire(): Promise<void> {
|
|
253
|
+
if (process.env.VELLUM_DESKTOP_APP) {
|
|
254
|
+
resetLogFile("retire.log");
|
|
255
|
+
}
|
|
216
256
|
const logFd = process.env.VELLUM_DESKTOP_APP
|
|
217
257
|
? openLogFile("retire.log")
|
|
218
258
|
: "ignore";
|
|
@@ -281,6 +321,8 @@ async function retireInner(): Promise<void> {
|
|
|
281
321
|
await retireLocal(name, entry);
|
|
282
322
|
} else if (cloud === "custom") {
|
|
283
323
|
await retireCustom(entry);
|
|
324
|
+
} else if (cloud === "vellum") {
|
|
325
|
+
await retireVellum(entry.assistantId);
|
|
284
326
|
} else {
|
|
285
327
|
console.error(`Error: Unknown cloud type '${cloud}'.`);
|
|
286
328
|
process.exit(1);
|