trainfabric 0.1.55 → 0.1.57

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 (2) hide show
  1. package/dist/index.cjs +22 -8
  2. 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 : 9e4);
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.55";
9367
+ var CLI_VERSION = "0.1.57";
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
  }
@@ -10245,7 +10248,7 @@ program2.command("datasets:delete").argument("<datasetId>").description("Delete
10245
10248
  await client.datasets.delete(normalizedDatasetId);
10246
10249
  printJson({ deleted: true, id: normalizedDatasetId });
10247
10250
  });
10248
- program2.command("datasets:upload").argument("<file>").option("--project <projectId>").option("--name <name>").description("Upload a dataset through upload sessions").action(async (file, options) => {
10251
+ program2.command("datasets:upload").argument("<file>").option("--json", "print raw JSON output; this is the default").option("--project <projectId>").option("--name <name>").description("Upload a dataset through upload sessions").action(async (file, options) => {
10249
10252
  assertReadableFile(file, "Dataset path");
10250
10253
  const config = loadConfig();
10251
10254
  const projectId = normalizeOptionalId(options.project ?? config.projectId, "project", "Project ID");
@@ -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(
@@ -10384,7 +10387,7 @@ program2.command("cluster:pools").option("--json", "print raw JSON output; this
10384
10387
  program2.command("models:list").option("--json", "print raw JSON output; this is the default").description("List exported models").action(async () => {
10385
10388
  printJson(await createClient(loadConfig()).models.list());
10386
10389
  });
10387
- program2.command("models:export").argument("<modelId>").description("Fetch the export package path for a model").action(async (modelId) => {
10390
+ program2.command("models:export").argument("<modelId>").option("--json", "print raw JSON output; this is the default").description("Fetch the export package path for a model").action(async (modelId) => {
10388
10391
  printJson(await createClient(loadConfig()).models.export(normalizeId(modelId, "model", "Model ID")));
10389
10392
  });
10390
10393
  program2.command("deployments:list").option("--json", "print raw JSON output; this is the default").description("List deployments").action(async () => {
@@ -10405,7 +10408,7 @@ program2.command("deployments:create").requiredOption("--model <modelId>").optio
10405
10408
  process.exitCode = 1;
10406
10409
  }
10407
10410
  });
10408
- program2.command("deployments:get").argument("<deploymentId>").description("Fetch a deployment").action(async (deploymentId) => {
10411
+ program2.command("deployments:get").argument("<deploymentId>").option("--json", "print raw JSON output; this is the default").description("Fetch a deployment").action(async (deploymentId) => {
10409
10412
  printJson(await createClient(loadConfig()).deployments.get(normalizeId(deploymentId, "deployment", "Deployment ID")));
10410
10413
  });
10411
10414
  program2.command("deployments:delete").argument("<deploymentId>").description("Delete a pending or cataloged deployment").action(async (deploymentId) => {
@@ -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
- console.error(error instanceof Error ? error.message : String(error));
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trainfabric",
3
- "version": "0.1.55",
3
+ "version": "0.1.57",
4
4
  "description": "Trainfabric CLI for launching GPU training jobs on the hosted Trainfabric backend.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",