@vellumai/cli 0.4.8 → 0.4.9
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/lib/constants.ts +13 -13
- package/src/lib/local.ts +30 -27
package/package.json
CHANGED
package/src/lib/constants.ts
CHANGED
|
@@ -51,25 +51,25 @@ export const SPECIES_CONFIG: Record<Species, SpeciesConfig> = {
|
|
|
51
51
|
vellum: {
|
|
52
52
|
color: ANSI.magenta,
|
|
53
53
|
art: [
|
|
54
|
-
`${ANSI.magenta}
|
|
55
|
-
`${ANSI.magenta}
|
|
56
|
-
`${ANSI.magenta}
|
|
57
|
-
`${ANSI.magenta}
|
|
58
|
-
`${ANSI.magenta}
|
|
59
|
-
`${ANSI.magenta}
|
|
54
|
+
`${ANSI.magenta} .-.-.-.${ANSI.reset}`,
|
|
55
|
+
`${ANSI.magenta} |${ANSI.reset}${ANSI.bold} o o ${ANSI.reset}${ANSI.magenta}|${ANSI.reset}`,
|
|
56
|
+
`${ANSI.magenta} |${ANSI.reset}${ANSI.bold} --- ${ANSI.reset}${ANSI.magenta}|${ANSI.reset}`,
|
|
57
|
+
`${ANSI.magenta} |_|_|_|_|${ANSI.reset}`,
|
|
58
|
+
`${ANSI.magenta} | | | |${ANSI.reset}`,
|
|
59
|
+
`${ANSI.magenta} ^ ^_^ ^${ANSI.reset}`,
|
|
60
60
|
],
|
|
61
|
-
hatchedEmoji: "
|
|
61
|
+
hatchedEmoji: "👾",
|
|
62
62
|
waitingMessages: [
|
|
63
|
-
"Warming up the
|
|
63
|
+
"Warming up the mothership...",
|
|
64
64
|
"Getting cozy in there...",
|
|
65
|
-
"
|
|
66
|
-
"
|
|
65
|
+
"Calibrating the antenna...",
|
|
66
|
+
"Scanning the galaxy...",
|
|
67
67
|
],
|
|
68
68
|
runningMessages: [
|
|
69
69
|
"Running startup script...",
|
|
70
|
-
"Teaching the
|
|
71
|
-
"
|
|
72
|
-
"Almost ready to
|
|
70
|
+
"Teaching the alien to code...",
|
|
71
|
+
"Powering up...",
|
|
72
|
+
"Almost ready to beam down...",
|
|
73
73
|
],
|
|
74
74
|
},
|
|
75
75
|
};
|
package/src/lib/local.ts
CHANGED
|
@@ -251,39 +251,40 @@ function isSocketResponsive(socketPath: string, timeoutMs = 1500): Promise<boole
|
|
|
251
251
|
|
|
252
252
|
async function discoverPublicUrl(): Promise<string | undefined> {
|
|
253
253
|
const cloud = process.env.VELLUM_CLOUD;
|
|
254
|
-
if (!cloud || cloud === "local") {
|
|
255
|
-
return `http://localhost:${GATEWAY_PORT}`;
|
|
256
|
-
}
|
|
257
254
|
|
|
258
255
|
let externalIp: string | undefined;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
// Use IMDSv2 (token-based) for compatibility with HttpTokens=required
|
|
268
|
-
const tokenResp = await fetch(
|
|
269
|
-
"http://169.254.169.254/latest/api/token",
|
|
270
|
-
{ method: "PUT", headers: { "X-aws-ec2-metadata-token-ttl-seconds": "30" } },
|
|
271
|
-
);
|
|
272
|
-
if (tokenResp.ok) {
|
|
273
|
-
const token = await tokenResp.text();
|
|
274
|
-
const ipResp = await fetch(
|
|
275
|
-
"http://169.254.169.254/latest/meta-data/public-ipv4",
|
|
276
|
-
{ headers: { "X-aws-ec2-metadata-token": token } },
|
|
256
|
+
|
|
257
|
+
// Try cloud-specific metadata services first for GCP and AWS.
|
|
258
|
+
if (cloud && cloud !== "local") {
|
|
259
|
+
try {
|
|
260
|
+
if (cloud === "gcp") {
|
|
261
|
+
const resp = await fetch(
|
|
262
|
+
"http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip",
|
|
263
|
+
{ headers: { "Metadata-Flavor": "Google" } },
|
|
277
264
|
);
|
|
278
|
-
if (
|
|
265
|
+
if (resp.ok) externalIp = (await resp.text()).trim();
|
|
266
|
+
} else if (cloud === "aws") {
|
|
267
|
+
// Use IMDSv2 (token-based) for compatibility with HttpTokens=required
|
|
268
|
+
const tokenResp = await fetch(
|
|
269
|
+
"http://169.254.169.254/latest/api/token",
|
|
270
|
+
{ method: "PUT", headers: { "X-aws-ec2-metadata-token-ttl-seconds": "30" } },
|
|
271
|
+
);
|
|
272
|
+
if (tokenResp.ok) {
|
|
273
|
+
const token = await tokenResp.text();
|
|
274
|
+
const ipResp = await fetch(
|
|
275
|
+
"http://169.254.169.254/latest/meta-data/public-ipv4",
|
|
276
|
+
{ headers: { "X-aws-ec2-metadata-token": token } },
|
|
277
|
+
);
|
|
278
|
+
if (ipResp.ok) externalIp = (await ipResp.text()).trim();
|
|
279
|
+
}
|
|
279
280
|
}
|
|
281
|
+
} catch {
|
|
282
|
+
// metadata service not reachable
|
|
280
283
|
}
|
|
281
|
-
} catch {
|
|
282
|
-
// metadata service not reachable
|
|
283
284
|
}
|
|
284
285
|
|
|
285
|
-
//
|
|
286
|
-
//
|
|
286
|
+
// Fall back to a public IP discovery service for all environments
|
|
287
|
+
// (local, custom, or when cloud-specific metadata didn't resolve).
|
|
287
288
|
if (!externalIp) {
|
|
288
289
|
externalIp = await discoverPublicIpFallback();
|
|
289
290
|
}
|
|
@@ -292,7 +293,9 @@ async function discoverPublicUrl(): Promise<string | undefined> {
|
|
|
292
293
|
console.log(` Discovered external IP: ${externalIp}`);
|
|
293
294
|
return `http://${externalIp}:${GATEWAY_PORT}`;
|
|
294
295
|
}
|
|
295
|
-
|
|
296
|
+
|
|
297
|
+
// Final fallback to localhost when no public IP could be discovered.
|
|
298
|
+
return `http://localhost:${GATEWAY_PORT}`;
|
|
296
299
|
}
|
|
297
300
|
|
|
298
301
|
/** Try to discover the machine's public IP using external services.
|