trainfabric 0.1.49 → 0.1.51

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 +50 -16
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -7951,6 +7951,7 @@ function validateChatJsonl(text) {
7951
7951
  valid: false,
7952
7952
  format: "chat_jsonl",
7953
7953
  rowCount: 0,
7954
+ lineCount: 0,
7954
7955
  duplicateCount: 0,
7955
7956
  tokenEstimate: 0,
7956
7957
  schemaVersion,
@@ -7958,7 +7959,6 @@ function validateChatJsonl(text) {
7958
7959
  };
7959
7960
  }
7960
7961
  for (const [index, line] of lines.entries()) {
7961
- rowCount += 1;
7962
7962
  let parsed;
7963
7963
  try {
7964
7964
  parsed = JSON.parse(line);
@@ -7979,6 +7979,7 @@ function validateChatJsonl(text) {
7979
7979
  });
7980
7980
  continue;
7981
7981
  }
7982
+ rowCount += 1;
7982
7983
  const assistantMessages = result.data.messages.filter((message) => message.role === "assistant");
7983
7984
  if (assistantMessages.length === 0) {
7984
7985
  warnings.push({
@@ -8027,6 +8028,7 @@ function validateChatJsonl(text) {
8027
8028
  valid: isValid2,
8028
8029
  format: "chat_jsonl",
8029
8030
  rowCount,
8031
+ lineCount: lines.length,
8030
8032
  duplicateCount,
8031
8033
  tokenEstimate,
8032
8034
  schemaVersion,
@@ -9362,7 +9364,7 @@ function buildComputeSpec(options) {
9362
9364
 
9363
9365
  // src/index.ts
9364
9366
  var DEFAULT_TRAINFABRIC_API_URL2 = "https://api.trainfabric.com";
9365
- var CLI_VERSION = "0.1.49";
9367
+ var CLI_VERSION = "0.1.51";
9366
9368
  var CONFIG_DIR = import_node_path3.default.join(import_node_os2.default.homedir(), ".trainfabric");
9367
9369
  var CONFIG_PATH = import_node_path3.default.join(CONFIG_DIR, "config.json");
9368
9370
  var FALLBACK_SECRET_PATH = import_node_path3.default.join(CONFIG_DIR, "session.enc");
@@ -9673,6 +9675,12 @@ function printQuoteSummary(bundle) {
9673
9675
  console.log(` data path: ${quote.dataPath ?? "auto"}`);
9674
9676
  console.log(` GPUs: ${gpuCount}`);
9675
9677
  console.log(` pool: ${quote.selectedPoolId}`);
9678
+ if (quote.fallbackPolicy) {
9679
+ console.log(` fallback: ${quote.fallbackPolicy.acceptedQuoteFallbackAllowed ? "allowed" : "disabled"} for accepted quote`);
9680
+ if (quote.fallbackPolicy.fallbackPoolId) {
9681
+ console.log(` fallback candidate: ${quote.fallbackPolicy.fallbackPoolId}`);
9682
+ }
9683
+ }
9676
9684
  console.log(` launch with: --quote ${quote.id}`);
9677
9685
  }
9678
9686
  console.log("");
@@ -9701,6 +9709,27 @@ function printUsageSummary(usage) {
9701
9709
  console.log(` ${item.label}: ${formatUsd(item.amountUsd)} - ${item.description}`);
9702
9710
  }
9703
9711
  }
9712
+ function printInvoiceSummary(invoices) {
9713
+ if (invoices.length === 0) {
9714
+ console.log("No invoices found.");
9715
+ return;
9716
+ }
9717
+ for (const invoice of invoices) {
9718
+ console.log(`${invoice.id}${invoice.runId ? ` (${invoice.runId})` : ""}`);
9719
+ console.log(` status: ${invoice.status}`);
9720
+ console.log(` amount due: ${formatUsd(invoice.amountDueUsd)}`);
9721
+ if (typeof invoice.customerChargeUsd === "number") {
9722
+ console.log(` run charge: ${formatUsd(invoice.customerChargeUsd)}`);
9723
+ }
9724
+ if (typeof invoice.creditAppliedUsd === "number") {
9725
+ console.log(` credits applied: ${formatUsd(invoice.creditAppliedUsd)}`);
9726
+ }
9727
+ if (invoice.settlementNote) {
9728
+ console.log(` note: ${invoice.settlementNote}`);
9729
+ }
9730
+ console.log("");
9731
+ }
9732
+ }
9704
9733
  function summarizeRunDetail(detail) {
9705
9734
  return {
9706
9735
  runId: detail.run.id,
@@ -10168,10 +10197,10 @@ program2.command("config:clear-api-key").description("Clear the stored API key")
10168
10197
  }
10169
10198
  printJson(visibleConfig(config));
10170
10199
  });
10171
- program2.command("orgs:list").description("List accessible organizations").action(async () => {
10200
+ program2.command("orgs:list").option("--json", "print raw JSON output; this is the default").description("List accessible organizations").action(async () => {
10172
10201
  printJson(await createClient(loadConfig()).organizations.list());
10173
10202
  });
10174
- program2.command("projects:list").description("List projects in the active organization").action(async () => {
10203
+ program2.command("projects:list").option("--json", "print raw JSON output; this is the default").description("List projects in the active organization").action(async () => {
10175
10204
  printJson(await createClient(loadConfig()).projects.list());
10176
10205
  });
10177
10206
  program2.command("projects:create").requiredOption("--name <name>").option("--org <organizationId>").description("Create a project").action(async (options) => {
@@ -10320,7 +10349,7 @@ program2.command("runs:usage").argument("<runId>").option("--json", "print raw J
10320
10349
  printJson(usage);
10321
10350
  }
10322
10351
  });
10323
- program2.command("runs:cost-breakdown").argument("<runId>").option("--summary", "print a human-readable cost summary instead of raw JSON").description("Fetch realized run cost and profitability").action(async (runId, options) => {
10352
+ program2.command("runs:cost-breakdown").argument("<runId>").option("--json", "print raw JSON output; this is the default unless --summary is used").option("--summary", "print a human-readable cost summary instead of raw JSON").description("Fetch realized run cost and profitability").action(async (runId, options) => {
10324
10353
  const breakdown = await createClient(loadConfig()).runs.costBreakdown(normalizeId(runId, "run", "Run ID"));
10325
10354
  if (options.summary) {
10326
10355
  printUsageSummary(breakdown);
@@ -10358,7 +10387,7 @@ program2.command("models:list").option("--json", "print raw JSON output; this is
10358
10387
  program2.command("models:export").argument("<modelId>").description("Fetch the export package path for a model").action(async (modelId) => {
10359
10388
  printJson(await createClient(loadConfig()).models.export(normalizeId(modelId, "model", "Model ID")));
10360
10389
  });
10361
- program2.command("deployments:list").description("List deployments").action(async () => {
10390
+ program2.command("deployments:list").option("--json", "print raw JSON output; this is the default").description("List deployments").action(async () => {
10362
10391
  printJson(await createClient(loadConfig()).deployments.list());
10363
10392
  });
10364
10393
  program2.command("deployments:create").requiredOption("--model <modelId>").option("--project <projectId>", "accepted for consistency; deployment project is inferred from the model").description("Create a hosted deployment for a model. Requires TRAINING_DEPLOYMENT_BASE_URL to be configured on the backend.").action(async (options) => {
@@ -10384,7 +10413,7 @@ program2.command("deployments:delete").argument("<deploymentId>").description("D
10384
10413
  await createClient(loadConfig()).deployments.delete(normalizedDeploymentId);
10385
10414
  printJson({ deleted: true, id: normalizedDeploymentId });
10386
10415
  });
10387
- program2.command("billing:summary").description("Fetch billing summary").action(async () => {
10416
+ program2.command("billing:summary").option("--json", "print raw JSON output; this is the default").description("Fetch billing summary").action(async () => {
10388
10417
  printJson(await createClient(loadConfig()).billing.getSummary());
10389
10418
  });
10390
10419
  program2.command("billing:usage").option("--unit <unit>", "normalized_tflop_seconds, reserved_gpu_seconds, or usd").option("--run <runId>", "filter usage records to one run").description("List billing usage records").action(async (options) => {
@@ -10398,22 +10427,27 @@ program2.command("billing:usage").option("--unit <unit>", "normalized_tflop_seco
10398
10427
  }
10399
10428
  printJson(await client.billing.getUsage(unit));
10400
10429
  });
10401
- program2.command("billing:invoices").description("List invoices").action(async () => {
10402
- printJson(await createClient(loadConfig()).billing.listInvoices());
10430
+ program2.command("billing:invoices").option("--json", "print raw JSON output; this is the default unless --summary is used").option("--summary", "print a human-readable invoice reconciliation summary").description("List invoices").action(async (options) => {
10431
+ const invoices = await createClient(loadConfig()).billing.listInvoices();
10432
+ if (options.summary) {
10433
+ printInvoiceSummary(invoices);
10434
+ return;
10435
+ }
10436
+ printJson(invoices);
10403
10437
  });
10404
- program2.command("billing:margin").description("Fetch margin summary").action(async () => {
10438
+ program2.command("billing:margin").option("--json", "print raw JSON output; this is the default").description("Fetch margin summary").action(async () => {
10405
10439
  printJson(await createClient(loadConfig()).billing.getMarginSummary());
10406
10440
  });
10407
- program2.command("treasury:suppliers").description("List supplier adapters").action(async () => {
10441
+ program2.command("treasury:suppliers").option("--json", "print raw JSON output; this is the default").description("List supplier adapters").action(async () => {
10408
10442
  printJson(await createClient(loadConfig()).treasury.listSuppliers());
10409
10443
  });
10410
- program2.command("treasury:verifications").description("List supplier verifications").action(async () => {
10444
+ program2.command("treasury:verifications").option("--json", "print raw JSON output; this is the default").description("List supplier verifications").action(async () => {
10411
10445
  printJson(await createClient(loadConfig()).treasury.listSupplierVerifications());
10412
10446
  });
10413
- program2.command("treasury:billing").description("List supplier billing records").action(async () => {
10447
+ program2.command("treasury:billing").option("--json", "print raw JSON output; this is the default").description("List supplier billing records").action(async () => {
10414
10448
  printJson(await createClient(loadConfig()).treasury.listSupplierBillings());
10415
10449
  });
10416
- program2.command("treasury:funding").description("List supplier funding summaries").action(async () => {
10450
+ program2.command("treasury:funding").option("--json", "print raw JSON output; this is the default").description("List supplier funding summaries").action(async () => {
10417
10451
  printJson(await createClient(loadConfig()).treasury.listSupplierFunding());
10418
10452
  });
10419
10453
  program2.command("treasury:funding-preview").requiredOption("--estimated-supplier-cost <usd>").option("--supplier <supplierId>").option("--pool <poolId>").description("Preview treasury funding readiness for a supplier-backed launch").action(async (options) => {
@@ -10436,7 +10470,7 @@ program2.command("api-keys:create").requiredOption("--name <name>").option("--ow
10436
10470
  });
10437
10471
  printJson(apiKey);
10438
10472
  });
10439
- program2.command("api-keys:list").description("List API keys").action(async () => {
10473
+ program2.command("api-keys:list").option("--json", "print raw JSON output; this is the default").description("List API keys").action(async () => {
10440
10474
  printJson(await createClient(loadConfig()).apiKeys.list());
10441
10475
  });
10442
10476
  program2.command("api-keys:revoke").argument("<apiKeyId>").description("Revoke an API key").action(async (apiKeyId) => {
@@ -10452,7 +10486,7 @@ program2.command("service-accounts:create").requiredOption("--name <name>").opti
10452
10486
  })
10453
10487
  );
10454
10488
  });
10455
- program2.command("service-accounts:list").description("List service accounts").action(async () => {
10489
+ program2.command("service-accounts:list").option("--json", "print raw JSON output; this is the default").description("List service accounts").action(async () => {
10456
10490
  printJson(await createClient(loadConfig()).serviceAccounts.list());
10457
10491
  });
10458
10492
  program2.command("service-accounts:revoke").argument("<serviceAccountId>").description("Revoke a service account").action(async (serviceAccountId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trainfabric",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
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",