trainfabric 0.1.55 → 0.1.56
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/index.cjs +19 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8628,7 +8628,7 @@ function encodeRunId(runId) {
|
|
|
8628
8628
|
}
|
|
8629
8629
|
function isTransientQuoteError(error) {
|
|
8630
8630
|
const message = error instanceof Error ? error.message : String(error);
|
|
8631
|
-
return /status (502|503|504|429)\b|fetch failed|network|ECONNRESET|ETIMEDOUT/i.test(message);
|
|
8631
|
+
return /status (502|503|504|429)\b|fetch failed|network|ECONNRESET|ETIMEDOUT|Timed out waiting for profile session/i.test(message);
|
|
8632
8632
|
}
|
|
8633
8633
|
var RunsClient = class extends ResourceClient {
|
|
8634
8634
|
async retryQuoteOperation(operation) {
|
|
@@ -8684,7 +8684,7 @@ var RunsClient = class extends ResourceClient {
|
|
|
8684
8684
|
async waitForProfile(profileSessionId, options) {
|
|
8685
8685
|
const pollMs = options?.pollMs ?? 250;
|
|
8686
8686
|
const envTimeoutMs = Number(process.env.TRAINFABRIC_PROFILE_TIMEOUT_MS);
|
|
8687
|
-
const timeoutMs = options?.timeoutMs ?? (Number.isFinite(envTimeoutMs) && envTimeoutMs > 0 ? envTimeoutMs :
|
|
8687
|
+
const timeoutMs = options?.timeoutMs ?? (Number.isFinite(envTimeoutMs) && envTimeoutMs > 0 ? envTimeoutMs : 24e4);
|
|
8688
8688
|
const startedAt = Date.now();
|
|
8689
8689
|
for (; ; ) {
|
|
8690
8690
|
const detail = await this.profileStatus(profileSessionId);
|
|
@@ -9364,7 +9364,7 @@ function buildComputeSpec(options) {
|
|
|
9364
9364
|
|
|
9365
9365
|
// src/index.ts
|
|
9366
9366
|
var DEFAULT_TRAINFABRIC_API_URL2 = "https://api.trainfabric.com";
|
|
9367
|
-
var CLI_VERSION = "0.1.
|
|
9367
|
+
var CLI_VERSION = "0.1.56";
|
|
9368
9368
|
var CONFIG_DIR = import_node_path3.default.join(import_node_os2.default.homedir(), ".trainfabric");
|
|
9369
9369
|
var CONFIG_PATH = import_node_path3.default.join(CONFIG_DIR, "config.json");
|
|
9370
9370
|
var FALLBACK_SECRET_PATH = import_node_path3.default.join(CONFIG_DIR, "session.enc");
|
|
@@ -9634,6 +9634,9 @@ function saveConfig(config) {
|
|
|
9634
9634
|
function printJson(value) {
|
|
9635
9635
|
console.log(JSON.stringify(value, null, 2));
|
|
9636
9636
|
}
|
|
9637
|
+
function shouldEmitJsonError() {
|
|
9638
|
+
return process.argv.includes("--json") && !process.argv.includes("--summary");
|
|
9639
|
+
}
|
|
9637
9640
|
function formatUsd(value) {
|
|
9638
9641
|
return `$${(value ?? 0).toFixed(2)}`;
|
|
9639
9642
|
}
|
|
@@ -10294,7 +10297,7 @@ program2.command("runtime:detect").option("--project <projectId>").option("--rep
|
|
|
10294
10297
|
}
|
|
10295
10298
|
printJson(redactInlineSource(detection));
|
|
10296
10299
|
});
|
|
10297
|
-
program2.command("runtime:build").option("--project <projectId>").requiredOption("--detection <detectionId>").description("Build or reuse a cached runtime image from a runtime detection").action(async (options) => {
|
|
10300
|
+
program2.command("runtime:build").option("--json", "print raw JSON output; this is the default").option("--project <projectId>").requiredOption("--detection <detectionId>").description("Build or reuse a cached runtime image from a runtime detection").action(async (options) => {
|
|
10298
10301
|
const config = loadConfig();
|
|
10299
10302
|
printJson(
|
|
10300
10303
|
redactInlineSource(
|
|
@@ -10502,6 +10505,17 @@ program2.command("service-accounts:revoke").argument("<serviceAccountId>").descr
|
|
|
10502
10505
|
console.log(`Revoked service account ${normalizedServiceAccountId}.`);
|
|
10503
10506
|
});
|
|
10504
10507
|
void program2.parseAsync(process.argv).catch((error) => {
|
|
10505
|
-
|
|
10508
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
10509
|
+
if (shouldEmitJsonError()) {
|
|
10510
|
+
printJson({
|
|
10511
|
+
error: {
|
|
10512
|
+
code: "command_failed",
|
|
10513
|
+
message
|
|
10514
|
+
},
|
|
10515
|
+
ok: false
|
|
10516
|
+
});
|
|
10517
|
+
} else {
|
|
10518
|
+
console.error(message);
|
|
10519
|
+
}
|
|
10506
10520
|
process.exitCode = 1;
|
|
10507
10521
|
});
|