@computesdk/cli 2.4.0 → 2.5.0

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.js CHANGED
@@ -4,7 +4,7 @@
4
4
  import "dotenv/config";
5
5
  import { Command } from "commander";
6
6
  import * as p from "@clack/prompts";
7
- import pc4 from "picocolors";
7
+ import pc5 from "picocolors";
8
8
  import { readFileSync as readFileSync2 } from "fs";
9
9
  import { fileURLToPath } from "url";
10
10
  import { dirname, join as join2 } from "path";
@@ -65,9 +65,11 @@ function getProviderStatus() {
65
65
  }
66
66
 
67
67
  // src/actions.ts
68
- import pc from "picocolors";
68
+ import pc2 from "picocolors";
69
69
  import { mkdirSync, readFileSync, writeFileSync } from "fs";
70
- import { basename, join } from "path";
70
+
71
+ // src/settings.ts
72
+ import pc from "picocolors";
71
73
 
72
74
  // src/actions-client.ts
73
75
  var DEFAULT_BASE_URL = "https://platform.computesdk.com";
@@ -400,7 +402,224 @@ function isTrustedActionsHost(baseUrl) {
400
402
  return host === "computesdk.com" || host.endsWith(".computesdk.com") || isLoopbackHost(host);
401
403
  }
402
404
 
405
+ // src/rate-display.ts
406
+ var SECONDS_PER_MINUTE = 60;
407
+ var SECONDS_PER_HOUR = 3600;
408
+ function rateAllUnits(rate) {
409
+ const perSecond = rate.per === "second" ? rate.usd : rate.per === "minute" ? rate.usd / SECONDS_PER_MINUTE : rate.usd / SECONDS_PER_HOUR;
410
+ return {
411
+ perSecond,
412
+ perMinute: perSecond * SECONDS_PER_MINUTE,
413
+ perHour: perSecond * SECONDS_PER_HOUR
414
+ };
415
+ }
416
+ function formatUsd(usd) {
417
+ if (!Number.isFinite(usd)) return "$\u2014";
418
+ if (usd === 0) return "$0";
419
+ const decimals = Math.min(100, Math.max(0, 3 - Math.floor(Math.log10(Math.abs(usd)))));
420
+ const fixed = usd.toFixed(decimals);
421
+ const trimmed = fixed.includes(".") ? fixed.replace(/0+$/, "").replace(/\.$/, "") : fixed;
422
+ return `$${trimmed}`;
423
+ }
424
+ function formatMoney(usd) {
425
+ if (!Number.isFinite(usd)) return "$\u2014";
426
+ const sign = usd < 0 ? "-" : "";
427
+ const abs = Math.abs(usd);
428
+ if (abs !== 0 && abs < 0.01) {
429
+ return `${sign}${formatUsd(abs)}`;
430
+ }
431
+ const s = abs.toLocaleString("en-US", {
432
+ minimumFractionDigits: 2,
433
+ maximumFractionDigits: 2
434
+ });
435
+ return `${sign}$${s}`;
436
+ }
437
+ function formatRateAllUnits(rate) {
438
+ return `${formatUsd(rate.perHour)}/hr \xB7 ${formatUsd(rate.perMinute)}/min \xB7 ${formatUsd(rate.perSecond)}/s`;
439
+ }
440
+ function formatUsdPer(rate) {
441
+ return formatRateAllUnits(rateAllUnits(rate));
442
+ }
443
+
444
+ // src/settings.ts
445
+ var PLATFORM_SIZES = ["small", "medium", "large", "xlarge"];
446
+ function parseMaxPrice(value, per) {
447
+ if (value === void 0) {
448
+ if (per !== void 0) throw new Error("--max-price-per requires --max-price.");
449
+ return void 0;
450
+ }
451
+ let usdText = value;
452
+ let unit = per;
453
+ const slash = value.indexOf("/");
454
+ if (slash !== -1) {
455
+ usdText = value.slice(0, slash);
456
+ const inline = value.slice(slash + 1);
457
+ if (per !== void 0 && per !== inline) {
458
+ throw new Error(`--max-price "${value}" conflicts with --max-price-per "${per}".`);
459
+ }
460
+ unit = inline;
461
+ }
462
+ const usd = Number(usdText);
463
+ if (!/^\d+(\.\d+)?([eE][+-]?\d+)?$/.test(usdText) || !Number.isFinite(usd) || usd <= 0) {
464
+ throw new Error(`Invalid --max-price "${value}". Expected a positive dollar amount like 0.12/hour.`);
465
+ }
466
+ if (unit !== "second" && unit !== "minute" && unit !== "hour") {
467
+ throw new Error(
468
+ "a unit is required \u2014 write it as <usd>/<unit> (e.g. 0.12/hour)"
469
+ );
470
+ }
471
+ return { usd, per: unit };
472
+ }
473
+ function parseSizeCap(entry) {
474
+ const eq = entry.indexOf("=");
475
+ const size = eq === -1 ? entry : entry.slice(0, eq);
476
+ if (!PLATFORM_SIZES.includes(size)) {
477
+ throw new Error(
478
+ `Invalid --cap "${entry}" \u2014 size must be one of ${PLATFORM_SIZES.join(", ")}.`
479
+ );
480
+ }
481
+ const value = eq === -1 ? "" : entry.slice(eq + 1);
482
+ if (value === "none") return { size, cap: null };
483
+ const cap = parseMaxPrice(value, void 0);
484
+ if (!cap) {
485
+ throw new Error(
486
+ `Invalid --cap "${entry}" \u2014 expected <size>=<usd>/<unit> (e.g. small=0.11/hour) or <size>=none.`
487
+ );
488
+ }
489
+ return { size, cap };
490
+ }
491
+ var fmtRate = (cap) => cap ? formatUsdPer(cap) : "\u2014";
492
+ var fmtRef = (ref) => ref ? ` ${pc.dim(`reference ${formatUsdPer(ref)}`)}` : "";
493
+ function printLaneSettings(s, lane) {
494
+ const sandbox = lane === "sandboxes";
495
+ const orderType = s.marketOrderType ?? (sandbox ? "inherit" : "\u2014");
496
+ const orderSuffix = sandbox && s.marketOrderType == null ? pc.dim(` (Actions: ${s.actionsMarketOrderType ?? "\u2014"})`) : "";
497
+ console.log(`order type: ${orderType}${orderSuffix}`);
498
+ const capSuffix = sandbox && s.marketCap == null ? pc.dim(` (inherits Actions: ${fmtRate(s.actionsMarketCap)})`) : "";
499
+ console.log(`general cap: ${fmtRate(s.marketCap)}${capSuffix}`);
500
+ console.log("per-size caps:");
501
+ for (const size of PLATFORM_SIZES) {
502
+ const cap = s.marketCaps?.[size];
503
+ console.log(
504
+ ` ${size.padEnd(7)} ${fmtRate(cap)}${cap ? "" : fmtRef(s.referencePrices?.[size])}`
505
+ );
506
+ }
507
+ const orderText = s.providerOrder.length > 0 ? s.providerOrder.join(", ") : sandbox ? pc.dim(`inherit (Actions: ${(s.actionsProviderOrder ?? []).join(", ") || "\u2014"})`) : "\u2014";
508
+ console.log(`provider order: ${orderText}`);
509
+ const resources = Object.entries(s.providerResources ?? {});
510
+ console.log("sizes:");
511
+ if (resources.length === 0) console.log(" \u2014");
512
+ for (const [provider, r] of resources) {
513
+ console.log(
514
+ ` ${provider} ${r.cpus ?? "?"} vCPU / ${r.memoryMb ?? "?"} MB${r.ephemeralDiskMb ? ` / ${r.ephemeralDiskMb} MB disk` : ""}`
515
+ );
516
+ }
517
+ const pool = Object.entries(s.warmPool ?? {});
518
+ console.log("warm pool:");
519
+ if (pool.length === 0) console.log(" \u2014");
520
+ for (const [entry, floor] of pool) console.log(` ${entry} ${floor}`);
521
+ if (s.snapshotPool !== void 0) {
522
+ const snap = Object.entries(s.snapshotPool);
523
+ console.log("snapshot pool:");
524
+ if (snap.length === 0) console.log(" \u2014");
525
+ for (const [entry, cap] of snap) console.log(` ${entry} ${cap}`);
526
+ }
527
+ }
528
+ function settingsFail(e, opts, lane, verb, deps) {
529
+ if (e instanceof ActionsApiError && e.status === 403) {
530
+ return deps.fail(
531
+ new ActionsApiError(
532
+ 403,
533
+ `Only org owners/admins can ${verb} ${lane} settings`,
534
+ e.body
535
+ ),
536
+ opts
537
+ );
538
+ }
539
+ return deps.fail(e, opts);
540
+ }
541
+ function registerSettingsCommands(group, lane, common, deps) {
542
+ const settings = common(
543
+ group.command("settings").description(`Show the org's ${lane} routing policy (order, caps, sizes, pools)`).configureOutput({
544
+ outputError: (str, write) => deps.usageErrorOutput(str, write)
545
+ })
546
+ ).action(async (opts) => {
547
+ try {
548
+ const c = await deps.client(opts);
549
+ const res = await c.get(`/api/v1/${lane}/settings`);
550
+ deps.output(opts, res, (s) => printLaneSettings(s, lane));
551
+ } catch (e) {
552
+ settingsFail(e, opts, lane, "view", deps);
553
+ }
554
+ });
555
+ common(
556
+ settings.command("set").description(`Update the org's ${lane} routing policy`).option(
557
+ "--cap <size=rate>",
558
+ "per-size cap: <size>=<usd>/<unit> or <size>=none to clear (repeatable)",
559
+ (v, a) => a.concat(v),
560
+ []
561
+ ).option("--general-cap <rate|none>", 'whole-lane price cap (e.g. 0.40/hour); "none" clears it').option(
562
+ "--order-type <type>",
563
+ lane === "sandboxes" ? "market order type: limit | market | inherit (the Actions value)" : "market order type: limit | market"
564
+ ).option(
565
+ "--order <providers>",
566
+ lane === "sandboxes" ? 'provider order, comma-separated (e.g. "market,blaxel,vercel"); "inherit" restores the Actions order' : 'provider order, comma-separated (e.g. "market,blaxel,vercel"); "default" restores the platform default'
567
+ )
568
+ ).action(async (opts) => {
569
+ try {
570
+ const body = {};
571
+ if (opts.cap.length > 0) {
572
+ const caps = {};
573
+ for (const entry of opts.cap) {
574
+ const { size, cap } = parseSizeCap(entry);
575
+ caps[size] = cap;
576
+ }
577
+ body.marketCaps = caps;
578
+ }
579
+ if (opts.generalCap !== void 0) {
580
+ body.marketCap = opts.generalCap === "none" ? null : parseMaxPrice(opts.generalCap, void 0);
581
+ }
582
+ if (opts.orderType !== void 0) {
583
+ if (lane === "sandboxes" && opts.orderType === "inherit") {
584
+ body.marketOrderType = null;
585
+ } else if (opts.orderType === "limit" || opts.orderType === "market") {
586
+ body.marketOrderType = opts.orderType;
587
+ } else {
588
+ throw new Error(
589
+ lane === "sandboxes" ? "--order-type must be limit, market, or inherit." : "--order-type must be limit or market."
590
+ );
591
+ }
592
+ }
593
+ if (opts.order !== void 0) {
594
+ if (opts.order === "inherit" && lane === "sandboxes") {
595
+ body.providerOrder = [];
596
+ } else if (opts.order === "default" && lane === "actions") {
597
+ body.providerOrder = [];
598
+ } else {
599
+ body.providerOrder = opts.order.split(",").map((s) => s.trim()).filter(Boolean);
600
+ if (body.providerOrder.length === 0) {
601
+ throw new Error(
602
+ lane === "sandboxes" ? `--order "${opts.order}" names no providers \u2014 pass a comma-separated list or "inherit".` : `--order "${opts.order}" names no providers \u2014 pass a comma-separated list or "default".`
603
+ );
604
+ }
605
+ }
606
+ }
607
+ if (Object.keys(body).length === 0) {
608
+ throw new Error(
609
+ "Nothing to change \u2014 pass --cap, --general-cap, --order-type, or --order."
610
+ );
611
+ }
612
+ const c = await deps.client(opts);
613
+ const res = await c.patch(`/api/v1/${lane}/settings`, body);
614
+ deps.output(opts, res, (s) => printLaneSettings(s, lane));
615
+ } catch (e) {
616
+ settingsFail(e, opts, lane, "change", deps);
617
+ }
618
+ });
619
+ }
620
+
403
621
  // src/actions.ts
622
+ import { basename, join } from "path";
404
623
  function sanitizePathPart(name) {
405
624
  const base = basename(name);
406
625
  if (base === "" || base === "." || base === "..") return "artifact";
@@ -462,7 +681,7 @@ async function fetchRunSummary(c, runId) {
462
681
  } catch (e) {
463
682
  if (!(e instanceof ActionsApiError && e.status === 404)) {
464
683
  console.error(
465
- pc.dim(`summary unavailable: ${e instanceof Error ? e.message : String(e)}`)
684
+ pc2.dim(`summary unavailable: ${e instanceof Error ? e.message : String(e)}`)
466
685
  );
467
686
  }
468
687
  return null;
@@ -472,9 +691,9 @@ function fail(error, opts = {}) {
472
691
  if (opts.json) {
473
692
  process.stderr.write(JSON.stringify(toErrorEnvelope(error)) + "\n");
474
693
  } else if (error instanceof ActionsApiError) {
475
- console.error(pc.red(`Error (${error.status}): ${error.message}`));
694
+ console.error(pc2.red(`Error (${error.status}): ${error.message}`));
476
695
  } else {
477
- console.error(pc.red(`Error: ${error instanceof Error ? error.message : String(error)}`));
696
+ console.error(pc2.red(`Error: ${error instanceof Error ? error.message : String(error)}`));
478
697
  }
479
698
  process.exit(1);
480
699
  }
@@ -502,15 +721,15 @@ function shortSha(sha) {
502
721
  function conclusionLabel(conclusion) {
503
722
  switch (conclusion) {
504
723
  case "passed":
505
- return pc.green("passed");
724
+ return pc2.green("passed");
506
725
  case "failed":
507
- return pc.red("failed");
726
+ return pc2.red("failed");
508
727
  case "running":
509
- return pc.yellow("running");
728
+ return pc2.yellow("running");
510
729
  case "cancelled":
511
- return pc.gray("cancelled");
730
+ return pc2.gray("cancelled");
512
731
  case "none":
513
- return pc.yellow("queued");
732
+ return pc2.yellow("queued");
514
733
  default:
515
734
  return conclusion;
516
735
  }
@@ -519,10 +738,10 @@ function formatRunRow(run) {
519
738
  const num = run.runNumber === null ? "-" : `#${run.runNumber}`;
520
739
  return [
521
740
  run.id,
522
- pc.dim(num),
741
+ pc2.dim(num),
523
742
  run.workflowName || run.workflowPath,
524
743
  conclusionLabel(run.conclusion),
525
- pc.dim(`${run.repoFullName}@${run.ref}`),
744
+ pc2.dim(`${run.repoFullName}@${run.ref}`),
526
745
  shortSha(run.headSha),
527
746
  formatDuration(run.durationMs),
528
747
  run.startedAt
@@ -530,8 +749,8 @@ function formatRunRow(run) {
530
749
  }
531
750
  function formatRunDetail(run, runUrl) {
532
751
  const lines = [];
533
- lines.push(`${pc.bold(run.workflowName || run.workflowPath)} ${conclusionLabel(run.conclusion)}`);
534
- lines.push(pc.dim(`run ${run.id}${run.runNumber === null ? "" : ` #${run.runNumber}`}`));
752
+ lines.push(`${pc2.bold(run.workflowName || run.workflowPath)} ${conclusionLabel(run.conclusion)}`);
753
+ lines.push(pc2.dim(`run ${run.id}${run.runNumber === null ? "" : ` #${run.runNumber}`}`));
535
754
  lines.push(`${run.repoFullName} @ ${run.ref} ${shortSha(run.headSha)} ${run.event}${run.prNumber ? ` PR #${run.prNumber}` : ""}`);
536
755
  lines.push(`title: ${run.title}`);
537
756
  lines.push(`started: ${run.startedAt} duration: ${formatDuration(run.durationMs)}`);
@@ -541,16 +760,16 @@ function formatRunDetail(run, runUrl) {
541
760
  if (runUrl) lines.push(`url: ${runUrl}`);
542
761
  if (run.jobs.length > 0) {
543
762
  lines.push("");
544
- lines.push(pc.bold("jobs"));
763
+ lines.push(pc2.bold("jobs"));
545
764
  for (const job of run.jobs) {
546
765
  const placement = job.provider ? `${job.provider}${job.region ? `:${job.region}` : ""}` : "-";
547
766
  lines.push(` ${job.id} ${job.name} ${conclusionLabel(job.state)} ${placement} ${formatDuration(job.durationMs)}`);
548
767
  for (const attempt of job.placementAttempts) {
549
- lines.push(pc.dim(` placement failed on ${attempt.provider}${attempt.region ? `:${attempt.region}` : ""}: ${attempt.error}`));
768
+ lines.push(pc2.dim(` placement failed on ${attempt.provider}${attempt.region ? `:${attempt.region}` : ""}: ${attempt.error}`));
550
769
  }
551
770
  for (const step of job.steps) {
552
771
  const exit = step.exitCode === null ? "" : ` (exit ${step.exitCode})`;
553
- lines.push(pc.dim(` ${step.name} ${step.state}${exit} ${formatDuration(step.durationMs)}`));
772
+ lines.push(pc2.dim(` ${step.name} ${step.state}${exit} ${formatDuration(step.durationMs)}`));
554
773
  }
555
774
  }
556
775
  }
@@ -558,18 +777,18 @@ function formatRunDetail(run, runUrl) {
558
777
  }
559
778
  function formatRunInspection(run) {
560
779
  const lines = [];
561
- lines.push(`${pc.bold("run")} ${conclusionLabel(run.conclusion)}${run.runNumber === null ? "" : ` #${run.runNumber}`}`);
562
- lines.push(pc.dim(run.id));
780
+ lines.push(`${pc2.bold("run")} ${conclusionLabel(run.conclusion)}${run.runNumber === null ? "" : ` #${run.runNumber}`}`);
781
+ lines.push(pc2.dim(run.id));
563
782
  lines.push(`${safeTerm(run.ref)} ${shortSha(run.headSha)} ${safeTerm(run.event)}`);
564
783
  lines.push(`queued: ${run.queuedAt} started: ${run.startedAt} finished: ${run.finishedAt}`);
565
784
  if (run.cancellationReason) lines.push(`cancelled: ${run.cancellationReason}`);
566
785
  if (run.supersededByRunId) lines.push(`superseded by: ${run.supersededByRunId}`);
567
- if (run.blockedReason) lines.push(pc.red(`blocked: ${safeTerm(run.blockedReason)}`));
786
+ if (run.blockedReason) lines.push(pc2.red(`blocked: ${safeTerm(run.blockedReason)}`));
568
787
  if (run.concurrencyGroup) lines.push(`concurrency: ${safeTerm(run.concurrencyGroup)}`);
569
788
  if (run.providerOverride) lines.push(`dispatched to: ${safeTerm(run.providerOverride)}`);
570
789
  if (run.definitionStale) {
571
790
  const parsed = run.workflowParsedFromSha ? shortSha(run.workflowParsedFromSha) : "unknown";
572
- lines.push(pc.yellow(`definition: stored parse is from ${parsed}, not this head \u2014 context may be newer than the run`));
791
+ lines.push(pc2.yellow(`definition: stored parse is from ${parsed}, not this head \u2014 context may be newer than the run`));
573
792
  }
574
793
  if (run.dispatchInputs && Object.keys(run.dispatchInputs).length > 0) {
575
794
  lines.push(`inputs: ${Object.entries(run.dispatchInputs).map(([k, v]) => `${safeTerm(k)}=${safeTerm(v)}`).join(" ")}`);
@@ -580,24 +799,24 @@ function formatRunInspection(run) {
580
799
  }
581
800
  if (run.caches.length > 0) {
582
801
  lines.push("");
583
- lines.push(pc.bold("caches"));
802
+ lines.push(pc2.bold("caches"));
584
803
  for (const cache of run.caches) {
585
804
  const action = [cache.restoredAt ? "restored" : null, cache.savedAt ? "saved" : null].filter(Boolean).join("+");
586
- lines.push(` ${safeTerm(cache.key)} ${pc.dim(`${action} ${safeTerm(cache.scopeRef)} ${cache.sizeBytes}B`)}`);
805
+ lines.push(` ${safeTerm(cache.key)} ${pc2.dim(`${action} ${safeTerm(cache.scopeRef)} ${cache.sizeBytes}B`)}`);
587
806
  }
588
807
  }
589
808
  if (run.jobs.length > 0) {
590
809
  lines.push("");
591
- lines.push(pc.bold("jobs"));
810
+ lines.push(pc2.bold("jobs"));
592
811
  for (const job of run.jobs) {
593
812
  const placement = job.provider ? `${safeTerm(job.provider)}${job.region ? `:${safeTerm(job.region)}` : ""}` : "-";
594
813
  lines.push(` ${safeTerm(job.name)} ${conclusionLabel(job.state)} ${placement}`);
595
- lines.push(pc.dim(` ${job.id}`));
814
+ lines.push(pc2.dim(` ${job.id}`));
596
815
  if (job.runsOn.length > 0 || job.resolvedRunsOn !== null) {
597
816
  const resolved = job.resolvedRunsOn !== null && job.resolvedRunsOn.join(",") !== job.runsOn.join(",") ? ` \u2192 ${job.resolvedRunsOn.map(safeTerm).join(", ")}` : "";
598
817
  lines.push(` runs-on: ${job.runsOn.map(safeTerm).join(", ") || "(none)"}${resolved}`);
599
818
  }
600
- if (job.runsOnHasExpression) lines.push(pc.dim(" runs-on resolves at runtime (expression)"));
819
+ if (job.runsOnHasExpression) lines.push(pc2.dim(" runs-on resolves at runtime (expression)"));
601
820
  if (job.container) lines.push(` container: ${safeTerm(job.container)}`);
602
821
  if (job.runnerImage) lines.push(` image: ${safeTerm(job.runnerImage)}`);
603
822
  if (job.placementHint) {
@@ -614,9 +833,9 @@ function formatRunInspection(run) {
614
833
  if (job.matrix) {
615
834
  lines.push(` matrix: ${Object.entries(job.matrix).map(([k, v]) => `${safeTerm(k)}=${safeTerm(v)}`).join(" ")}`);
616
835
  }
617
- if (job.failureReason) lines.push(pc.red(` failed: ${safeTerm(job.failureReason)}`));
836
+ if (job.failureReason) lines.push(pc2.red(` failed: ${safeTerm(job.failureReason)}`));
618
837
  for (const attempt of job.placementAttempts) {
619
- lines.push(pc.dim(` placement failed on ${safeTerm(attempt.provider)}${attempt.region ? `:${safeTerm(attempt.region)}` : ""}: ${safeTerm(attempt.error)}`));
838
+ lines.push(pc2.dim(` placement failed on ${safeTerm(attempt.provider)}${attempt.region ? `:${safeTerm(attempt.region)}` : ""}: ${safeTerm(attempt.error)}`));
620
839
  }
621
840
  }
622
841
  }
@@ -624,7 +843,7 @@ function formatRunInspection(run) {
624
843
  }
625
844
  function formatRunSummary(summary) {
626
845
  const lines = [];
627
- lines.push(pc.bold(`failures \u2014 run ${summary.runId} ${conclusionLabel(summary.conclusion)}`));
846
+ lines.push(pc2.bold(`failures \u2014 run ${summary.runId} ${conclusionLabel(summary.conclusion)}`));
628
847
  if (summary.failures.length === 0) {
629
848
  lines.push(" no failed jobs");
630
849
  return lines.join("\n");
@@ -632,7 +851,7 @@ function formatRunSummary(summary) {
632
851
  for (const job of summary.failures) {
633
852
  const placement = job.provider ? `${safeTerm(job.provider)}${job.region ? `:${safeTerm(job.region)}` : ""}` : "-";
634
853
  lines.push(` ${job.id} ${safeTerm(job.name)} ${conclusionLabel(job.conclusion)} ${placement}`);
635
- if (job.failureReason) lines.push(pc.dim(` ${safeTerm(job.failureReason)}`));
854
+ if (job.failureReason) lines.push(pc2.dim(` ${safeTerm(job.failureReason)}`));
636
855
  for (const step of job.failedSteps) {
637
856
  const exit = step.exitCode === null ? "" : ` (exit ${step.exitCode})`;
638
857
  lines.push(` step ${step.ordinal} ${safeTerm(step.name)}${exit}`);
@@ -640,7 +859,7 @@ function formatRunSummary(summary) {
640
859
  if (job.excerpt) {
641
860
  const scope = job.excerpt.stepOrdinal === null ? "job log" : `step ${job.excerpt.stepOrdinal}`;
642
861
  const cut = job.excerpt.truncated ? ", truncated" : "";
643
- lines.push(pc.dim(` \u2500\u2500 ${scope} tail${cut} \u2500\u2500`));
862
+ lines.push(pc2.dim(` \u2500\u2500 ${scope} tail${cut} \u2500\u2500`));
644
863
  for (const line of job.excerpt.text.split("\n")) lines.push(` ${safeTerm(line)}`);
645
864
  }
646
865
  }
@@ -742,15 +961,15 @@ function formatRunHistory(history) {
742
961
  lines.push(`last ${history.runCount} runs: ${parts || "none"}`);
743
962
  if (history.jobs.length > 0) {
744
963
  lines.push("");
745
- lines.push(pc.bold("jobs"));
964
+ lines.push(pc2.bold("jobs"));
746
965
  for (const job of history.jobs) {
747
966
  const rate = job.runs > 0 ? Math.round(job.failedRuns / job.runs * 100) : 0;
748
- const platform = job.failedBeforeSteps > 0 ? pc.dim(` (${job.failedBeforeSteps} failed before steps)`) : "";
967
+ const platform = job.failedBeforeSteps > 0 ? pc2.dim(` (${job.failedBeforeSteps} failed before steps)`) : "";
749
968
  const count = `${job.failedRuns}/${job.runs} runs failed`;
750
- const label = job.failedRuns > 0 ? pc.red(count) : pc.green(count);
969
+ const label = job.failedRuns > 0 ? pc2.red(count) : pc2.green(count);
751
970
  lines.push(` ${safeTerm(job.job)} ${label} ${rate}%${platform}`);
752
971
  for (const step of job.steps) {
753
- lines.push(pc.dim(` step "${safeTerm(step.step)}" failed in ${step.failedRuns} run${step.failedRuns === 1 ? "" : "s"}`));
972
+ lines.push(pc2.dim(` step "${safeTerm(step.step)}" failed in ${step.failedRuns} run${step.failedRuns === 1 ? "" : "s"}`));
754
973
  }
755
974
  }
756
975
  }
@@ -759,45 +978,45 @@ function formatRunHistory(history) {
759
978
  );
760
979
  if (failed.length > 0) {
761
980
  lines.push("");
762
- lines.push(pc.bold("failed runs"));
981
+ lines.push(pc2.bold("failed runs"));
763
982
  for (const run of failed) {
764
- const blame = run.failedJobs.length > 0 ? run.failedJobs.map((j) => safeTerm(j.step === null ? j.job : `${j.job}:${j.step}`)).join(", ") : pc.dim("(no failed job recorded)");
765
- lines.push(` ${shortSha(run.headSha)} ${pc.dim(run.startedAt)} ${blame}`);
983
+ const blame = run.failedJobs.length > 0 ? run.failedJobs.map((j) => safeTerm(j.step === null ? j.job : `${j.job}:${j.step}`)).join(", ") : pc2.dim("(no failed job recorded)");
984
+ lines.push(` ${shortSha(run.headSha)} ${pc2.dim(run.startedAt)} ${blame}`);
766
985
  }
767
986
  }
768
987
  return lines.join("\n");
769
988
  }
770
989
  function formatProviderRow(p2) {
771
- const icon = p2.usable ? pc.green("\u25CF") : pc.gray("\u25CB");
772
- const name = p2.usable ? pc.white(p2.provider) : pc.gray(p2.provider);
990
+ const icon = p2.usable ? pc2.green("\u25CF") : pc2.gray("\u25CB");
991
+ const name = p2.usable ? pc2.white(p2.provider) : pc2.gray(p2.provider);
773
992
  const flags = [
774
993
  p2.credential,
775
- p2.actCapable ? pc.green("act") : pc.gray("no-act"),
994
+ p2.actCapable ? pc2.green("act") : pc2.gray("no-act"),
776
995
  p2.regions.length > 0 ? `regions: ${p2.regions.join(",")}` : "no region choice",
777
- p2.position === null ? pc.gray("not in provider order") : `order #${p2.position}`
996
+ p2.position === null ? pc2.gray("not in provider order") : `order #${p2.position}`
778
997
  ].join(" ");
779
998
  return ` ${icon} ${name} ${flags}`;
780
999
  }
781
1000
  function formatVerifyResult(r) {
782
1001
  const ok = r.verified === true;
783
- const head = ok ? pc.green("verified") : pc.red("not verified");
784
- const detail = r.key.statusDetail ? pc.dim(` ${r.key.statusDetail}`) : "";
785
- const act = r.key.actCapable ? pc.green(" act-capable") : "";
1002
+ const head = ok ? pc2.green("verified") : pc2.red("not verified");
1003
+ const detail = r.key.statusDetail ? pc2.dim(` ${r.key.statusDetail}`) : "";
1004
+ const act = r.key.actCapable ? pc2.green(" act-capable") : "";
786
1005
  return `${head} ${r.key.provider}${act}${detail}`;
787
1006
  }
788
1007
  function formatRepoRow(r) {
789
- const head = r.enabled ? pc.green("enabled") : pc.dim("disabled");
1008
+ const head = r.enabled ? pc2.green("enabled") : pc2.dim("disabled");
790
1009
  const via = r.authType === "github_app" ? "github-app" : r.authType;
791
1010
  const workflows = r.workflowPaths.length > 0 ? `${r.workflowPaths.length} workflow${r.workflowPaths.length === 1 ? "" : "s"}` : "no workflows yet";
792
- const error = r.lastPollError ? pc.red(` poll error: ${safeTerm(r.lastPollError)}`) : "";
793
- return `${head} ${safeTerm(r.fullName)} ${pc.dim(`${safeTerm(via)} \xB7 ${safeTerm(r.defaultBranch)} \xB7 ${workflows}`)}${error}`;
1011
+ const error = r.lastPollError ? pc2.red(` poll error: ${safeTerm(r.lastPollError)}`) : "";
1012
+ return `${head} ${safeTerm(r.fullName)} ${pc2.dim(`${safeTerm(via)} \xB7 ${safeTerm(r.defaultBranch)} \xB7 ${workflows}`)}${error}`;
794
1013
  }
795
1014
  function printDiscovery(d) {
796
1015
  if (d.error) {
797
- console.log(pc.yellow(`discovery: ${safeTerm(d.error)} (the poll cron retries)`));
1016
+ console.log(pc2.yellow(`discovery: ${safeTerm(d.error)} (the poll cron retries)`));
798
1017
  return;
799
1018
  }
800
- console.log(pc.dim(`discovery: ${d.workflowsFound ? "workflows found" : "no workflows yet"}${d.seeded ? ", cursors seeded" : ""}`));
1019
+ console.log(pc2.dim(`discovery: ${d.workflowsFound ? "workflows found" : "no workflows yet"}${d.seeded ? ", cursors seeded" : ""}`));
801
1020
  }
802
1021
  function dispatchBody(workflow, opts) {
803
1022
  if (!workflow.dispatchable && !opts.manual) {
@@ -913,7 +1132,7 @@ function formatVaultRow(item) {
913
1132
  ...item.source === "organization" ? ["inherited"] : [],
914
1133
  ...item.overridesOrganization ? ["overrides org"] : []
915
1134
  ];
916
- return `${pc.cyan(safeTerm(item.name))} ${pc.dim(flags.join(", "))} ${pc.dim(`updated ${safeTerm(item.updatedAt)}`)}`;
1135
+ return `${pc2.cyan(safeTerm(item.name))} ${pc2.dim(flags.join(", "))} ${pc2.dim(`updated ${safeTerm(item.updatedAt)}`)}`;
917
1136
  }
918
1137
  function registerActionsCommands(program2) {
919
1138
  const actions = program2.command("actions").alias("ci").description("Drive the benchmarks-platform Actions API").configureOutput({ outputError: usageErrorOutput });
@@ -943,7 +1162,7 @@ function registerActionsCommands(program2) {
943
1162
  const org2 = await c.org();
944
1163
  const url = `${c.baseUrl}/${org2.slug}/actions/runs/${result.runId}`;
945
1164
  output(opts, { ...result, url }, (r) => {
946
- console.log(`${r.created ? "dispatched" : "already running"} ${pc.cyan(r.runId)}`);
1165
+ console.log(`${r.created ? "dispatched" : "already running"} ${pc2.cyan(r.runId)}`);
947
1166
  console.log(`sha: ${r.headSha}`);
948
1167
  console.log(`url: ${r.url}`);
949
1168
  });
@@ -1063,7 +1282,7 @@ function registerActionsCommands(program2) {
1063
1282
  if (opts.json) {
1064
1283
  process.stdout.write(JSON.stringify({ jobId: job.id, name: job.name, slice }) + "\n");
1065
1284
  } else {
1066
- if (jobs.length > 1) console.log(pc.bold(`\u2500\u2500 ${job.name} \u2500\u2500`));
1285
+ if (jobs.length > 1) console.log(pc2.bold(`\u2500\u2500 ${job.name} \u2500\u2500`));
1067
1286
  for (const seg of slice.segments) process.stdout.write(seg.text);
1068
1287
  }
1069
1288
  }
@@ -1127,7 +1346,7 @@ function registerActionsCommands(program2) {
1127
1346
  `/api/v1/actions/providers/${provider}/verify`
1128
1347
  ) : void 0;
1129
1348
  output(opts, verification ? { key: saved.key, verification } : saved, () => {
1130
- console.log(`saved ${saved.key.provider} ${pc.dim(saved.key.keyHint)} ${saved.key.status}`);
1349
+ console.log(`saved ${saved.key.provider} ${pc2.dim(saved.key.keyHint)} ${saved.key.status}`);
1131
1350
  if (verification) console.log(formatVerifyResult(verification));
1132
1351
  });
1133
1352
  if (verification?.verified === false) process.exitCode = 1;
@@ -1207,7 +1426,7 @@ function registerActionsCommands(program2) {
1207
1426
  ...opts.branch !== void 0 && { defaultBranch: opts.branch }
1208
1427
  });
1209
1428
  output(opts, result, (r) => {
1210
- console.log(`connected ${pc.cyan(safeTerm(r.fullName))} ${pc.dim(`(${safeTerm(r.authType)}, ${safeTerm(r.defaultBranch)})`)}`);
1429
+ console.log(`connected ${pc2.cyan(safeTerm(r.fullName))} ${pc2.dim(`(${safeTerm(r.authType)}, ${safeTerm(r.defaultBranch)})`)}`);
1211
1430
  printDiscovery(r.discovery);
1212
1431
  });
1213
1432
  } catch (e) {
@@ -1224,7 +1443,7 @@ function registerActionsCommands(program2) {
1224
1443
  ...opts.repoId !== void 0 && { repoId: opts.repoId }
1225
1444
  });
1226
1445
  output(opts, result, (r) => {
1227
- console.log(`enabled ${pc.cyan(safeTerm(r.fullName))}`);
1446
+ console.log(`enabled ${pc2.cyan(safeTerm(r.fullName))}`);
1228
1447
  if (r.discovery) printDiscovery(r.discovery);
1229
1448
  });
1230
1449
  } catch (e) {
@@ -1240,7 +1459,7 @@ function registerActionsCommands(program2) {
1240
1459
  enabled: false,
1241
1460
  ...opts.repoId !== void 0 && { repoId: opts.repoId }
1242
1461
  });
1243
- output(opts, result, (r) => console.log(`disabled ${pc.cyan(safeTerm(r.fullName))}`));
1462
+ output(opts, result, (r) => console.log(`disabled ${pc2.cyan(safeTerm(r.fullName))}`));
1244
1463
  } catch (e) {
1245
1464
  fail(e, opts);
1246
1465
  }
@@ -1280,9 +1499,9 @@ function registerActionsCommands(program2) {
1280
1499
  );
1281
1500
  output(opts, result, (r) => {
1282
1501
  const where = opts.repo ? safeTerm(opts.repo) : "org";
1283
- console.log(`saved ${pc.cyan(safeTerm(r.item.name))} ${pc.dim(`(${r.item.kind}, v${r.item.version}, ${where})`)}`);
1502
+ console.log(`saved ${pc2.cyan(safeTerm(r.item.name))} ${pc2.dim(`(${r.item.kind}, v${r.item.version}, ${where})`)}`);
1284
1503
  if (/\r?\n$/.test(value)) {
1285
- console.error(pc.yellow("note: the stored value ends with a newline; use printf %s rather than echo to avoid one."));
1504
+ console.error(pc2.yellow("note: the stored value ends with a newline; use printf %s rather than echo to avoid one."));
1286
1505
  }
1287
1506
  });
1288
1507
  } catch (e) {
@@ -1316,7 +1535,7 @@ function registerActionsCommands(program2) {
1316
1535
  output(opts, result, (r) => {
1317
1536
  const where = opts.repo ? safeTerm(opts.repo) : "org";
1318
1537
  console.log(
1319
- `reclassified ${pc.cyan(safeTerm(r.item.name))} ${pc.dim(`(labels: ${r.item.labels.join(", ") || "none"}, v${r.item.version}, ${where})`)}`
1538
+ `reclassified ${pc2.cyan(safeTerm(r.item.name))} ${pc2.dim(`(labels: ${r.item.labels.join(", ") || "none"}, v${r.item.version}, ${where})`)}`
1320
1539
  );
1321
1540
  });
1322
1541
  } catch (e) {
@@ -1329,7 +1548,7 @@ function registerActionsCommands(program2) {
1329
1548
  try {
1330
1549
  const path = vaultPath("/api/v1/vault", { repo: opts.repo, kind: parseVaultKind(opts.kind), name });
1331
1550
  const result = await (await client(opts)).del(path);
1332
- output(opts, result, (r) => console.log(`deleted ${pc.cyan(safeTerm(r.name))} ${pc.dim(`(${r.kind})`)}`));
1551
+ output(opts, result, (r) => console.log(`deleted ${pc2.cyan(safeTerm(r.name))} ${pc2.dim(`(${r.kind})`)}`));
1333
1552
  } catch (e) {
1334
1553
  fail(e, opts);
1335
1554
  }
@@ -1359,7 +1578,7 @@ function registerActionsCommands(program2) {
1359
1578
  const org2 = await c.org();
1360
1579
  const url = `${c.baseUrl}/${org2.slug}/actions/runs/${result.runId}`;
1361
1580
  output(opts, { ...result, url }, (r) => {
1362
- console.log(`${r.created ? "rerun dispatched" : "rerun already running"} ${pc.cyan(r.runId)}`);
1581
+ console.log(`${r.created ? "rerun dispatched" : "rerun already running"} ${pc2.cyan(r.runId)}`);
1363
1582
  console.log(`url: ${r.url}`);
1364
1583
  });
1365
1584
  } catch (e) {
@@ -1422,51 +1641,16 @@ function registerActionsCommands(program2) {
1422
1641
  fail(e, opts);
1423
1642
  }
1424
1643
  });
1425
- }
1426
-
1427
- // src/market.ts
1428
- import pc2 from "picocolors";
1429
-
1430
- // src/rate-display.ts
1431
- var SECONDS_PER_MINUTE = 60;
1432
- var SECONDS_PER_HOUR = 3600;
1433
- function rateAllUnits(rate) {
1434
- const perSecond = rate.per === "second" ? rate.usd : rate.per === "minute" ? rate.usd / SECONDS_PER_MINUTE : rate.usd / SECONDS_PER_HOUR;
1435
- return {
1436
- perSecond,
1437
- perMinute: perSecond * SECONDS_PER_MINUTE,
1438
- perHour: perSecond * SECONDS_PER_HOUR
1439
- };
1440
- }
1441
- function formatUsd(usd) {
1442
- if (!Number.isFinite(usd)) return "$\u2014";
1443
- if (usd === 0) return "$0";
1444
- const decimals = Math.min(100, Math.max(0, 3 - Math.floor(Math.log10(Math.abs(usd)))));
1445
- const fixed = usd.toFixed(decimals);
1446
- const trimmed = fixed.includes(".") ? fixed.replace(/0+$/, "").replace(/\.$/, "") : fixed;
1447
- return `$${trimmed}`;
1448
- }
1449
- function formatMoney(usd) {
1450
- if (!Number.isFinite(usd)) return "$\u2014";
1451
- const sign = usd < 0 ? "-" : "";
1452
- const abs = Math.abs(usd);
1453
- if (abs !== 0 && abs < 0.01) {
1454
- return `${sign}${formatUsd(abs)}`;
1455
- }
1456
- const s = abs.toLocaleString("en-US", {
1457
- minimumFractionDigits: 2,
1458
- maximumFractionDigits: 2
1644
+ registerSettingsCommands(actions, "actions", common, {
1645
+ client,
1646
+ fail,
1647
+ output,
1648
+ usageErrorOutput
1459
1649
  });
1460
- return `${sign}$${s}`;
1461
- }
1462
- function formatRateAllUnits(rate) {
1463
- return `${formatUsd(rate.perHour)}/hr \xB7 ${formatUsd(rate.perMinute)}/min \xB7 ${formatUsd(rate.perSecond)}/s`;
1464
- }
1465
- function formatUsdPer(rate) {
1466
- return formatRateAllUnits(rateAllUnits(rate));
1467
1650
  }
1468
1651
 
1469
1652
  // src/market.ts
1653
+ import pc3 from "picocolors";
1470
1654
  var USD_RE = /^\d+(\.\d+)?([eE][+-]?\d+)?$/;
1471
1655
  var RATE_UNITS = ["second", "minute", "hour"];
1472
1656
  var MARKET_LANES = ["actions", "sandbox"];
@@ -1625,12 +1809,12 @@ function formatRate(usd, per) {
1625
1809
  }
1626
1810
  function formatListingStatus(ask) {
1627
1811
  let label;
1628
- if (ask.status === "withdrawn") label = pc2.gray("withdrawn");
1629
- else if (ask.status === "paused") label = pc2.yellow("paused");
1630
- else if (!ask.live) label = pc2.gray("expired");
1631
- else label = pc2.green("live");
1812
+ if (ask.status === "withdrawn") label = pc3.gray("withdrawn");
1813
+ else if (ask.status === "paused") label = pc3.yellow("paused");
1814
+ else if (!ask.live) label = pc3.gray("expired");
1815
+ else label = pc3.green("live");
1632
1816
  if (ask.pendingUsd !== null && ask.pendingPer !== null) {
1633
- label += pc2.dim(` \u2192 ${formatRate(ask.pendingUsd, ask.pendingPer)} next window`);
1817
+ label += pc3.dim(` \u2192 ${formatRate(ask.pendingUsd, ask.pendingPer)} next window`);
1634
1818
  }
1635
1819
  return label;
1636
1820
  }
@@ -1639,22 +1823,22 @@ function formatListingRow(ask) {
1639
1823
  return [
1640
1824
  ask.id,
1641
1825
  formatListingStatus(ask),
1642
- pc2.dim(ask.useCase === "sandbox" ? "sandbox" : "actions"),
1826
+ pc3.dim(ask.useCase === "sandbox" ? "sandbox" : "actions"),
1643
1827
  safeTerm(ask.size),
1644
1828
  safeTerm(ask.region ?? "-"),
1645
1829
  formatRate(ask.usd, ask.per),
1646
- pc2.dim(`\xD7${ask.maxConcurrent}`),
1647
- pc2.dim(expiry)
1830
+ pc3.dim(`\xD7${ask.maxConcurrent}`),
1831
+ pc3.dim(expiry)
1648
1832
  ].join(" ");
1649
1833
  }
1650
1834
  function formatProviderStatus(p2) {
1651
1835
  const lines = [];
1652
- lines.push(`${pc2.bold(safeTerm(p2.name))} ${pc2.dim(`selling ${safeTerm(p2.provider)}`)}`);
1836
+ lines.push(`${pc3.bold(safeTerm(p2.name))} ${pc3.dim(`selling ${safeTerm(p2.provider)}`)}`);
1653
1837
  lines.push(`id: ${p2.id}`);
1654
1838
  lines.push(
1655
- `credential: ${p2.executorCredentialConnected ? pc2.green("connected") : pc2.yellow("not connected \u2014 your listings cannot fill until `compute market credential connect`")}`
1839
+ `credential: ${p2.executorCredentialConnected ? pc3.green("connected") : pc3.yellow("not connected \u2014 your listings cannot fill until `compute market credential connect`")}`
1656
1840
  );
1657
- if (p2.revokedAt) lines.push(pc2.red(`revoked: ${p2.revokedAt}`));
1841
+ if (p2.revokedAt) lines.push(pc3.red(`revoked: ${p2.revokedAt}`));
1658
1842
  lines.push(
1659
1843
  `lanes: ${(p2.useCases ?? ["actions"]).join(", ")}`
1660
1844
  );
@@ -1672,41 +1856,41 @@ function formatProviderStatus(p2) {
1672
1856
  }
1673
1857
  function formatBook(book) {
1674
1858
  const lines = [];
1675
- const lane = (useCase) => pc2.dim(useCase === "sandbox" ? "sandbox" : "actions");
1676
- lines.push(pc2.bold("sellers' asking prices"));
1677
- if (book.asks.length === 0) lines.push(pc2.dim(" no listings are live"));
1859
+ const lane = (useCase) => pc3.dim(useCase === "sandbox" ? "sandbox" : "actions");
1860
+ lines.push(pc3.bold("sellers' asking prices"));
1861
+ if (book.asks.length === 0) lines.push(pc3.dim(" no listings are live"));
1678
1862
  for (const ask of book.asks) {
1679
1863
  const where = ask.region ? safeTerm(ask.region) : "any region";
1680
- const expiry = ask.expiresAt ? pc2.dim(ask.rollover ? ` renews ${ask.expiresAt}` : ` until ${ask.expiresAt}`) : "";
1864
+ const expiry = ask.expiresAt ? pc3.dim(ask.rollover ? ` renews ${ask.expiresAt}` : ` until ${ask.expiresAt}`) : "";
1681
1865
  lines.push(
1682
1866
  ` ${lane(ask.useCase)} ${formatRate(ask.usd, ask.per)} ${safeTerm(ask.providerName)} ${safeTerm(ask.size)} ${where} up to ${ask.maxConcurrent} at once${expiry}`
1683
1867
  );
1684
1868
  }
1685
1869
  lines.push("");
1686
- lines.push(pc2.bold("buyer offers"));
1687
- if (book.bids.length === 0) lines.push(pc2.dim(" no open offers"));
1870
+ lines.push(pc3.bold("buyer offers"));
1871
+ if (book.bids.length === 0) lines.push(pc3.dim(" no open offers"));
1688
1872
  for (const bid of book.bids) {
1689
1873
  const where = bid.region ? safeTerm(bid.region) : "anywhere";
1690
- const yours = bid.mine ? pc2.cyan(" (yours)") : "";
1874
+ const yours = bid.mine ? pc3.cyan(" (yours)") : "";
1691
1875
  lines.push(
1692
- ` ${lane(bid.useCase)} pays up to ${formatRate(bid.maxUsd, bid.per)} ${safeTerm(bid.size)} ${where} ${pc2.dim(`posted ${bid.createdAt}`)}${yours}`
1876
+ ` ${lane(bid.useCase)} pays up to ${formatRate(bid.maxUsd, bid.per)} ${safeTerm(bid.size)} ${where} ${pc3.dim(`posted ${bid.createdAt}`)}${yours}`
1693
1877
  );
1694
1878
  }
1695
1879
  lines.push("");
1696
- lines.push(pc2.bold("recent sales"));
1697
- if (book.fills.length === 0) lines.push(pc2.dim(" nothing has sold yet"));
1880
+ lines.push(pc3.bold("recent sales"));
1881
+ if (book.fills.length === 0) lines.push(pc3.dim(" nothing has sold yet"));
1698
1882
  for (const fill of book.fills) {
1699
- const statusNote = fill.status === "replaced" ? pc2.yellow(" replaced") : fill.status === "closed" ? pc2.gray(" closed") : "";
1883
+ const statusNote = fill.status === "replaced" ? pc3.yellow(" replaced") : fill.status === "closed" ? pc3.gray(" closed") : "";
1700
1884
  lines.push(
1701
- ` ${pc2.dim(fill.id)} ${lane(fill.useCase)} ${formatRate(fill.usd, fill.per)} ${safeTerm(fill.provider)} ${safeTerm(fill.size)} ${safeTerm(fill.region ?? "-")} ${pc2.dim(fill.createdAt)}${statusNote}`
1885
+ ` ${pc3.dim(fill.id)} ${lane(fill.useCase)} ${formatRate(fill.usd, fill.per)} ${safeTerm(fill.provider)} ${safeTerm(fill.size)} ${safeTerm(fill.region ?? "-")} ${pc3.dim(fill.createdAt)}${statusNote}`
1702
1886
  );
1703
1887
  }
1704
1888
  return lines.join("\n");
1705
1889
  }
1706
1890
  function formatReplacedFill(fill) {
1707
1891
  const settled = formatMoney(fill.settledMicroUsd / 1e6);
1708
- const job = fill.jobRequeued ? pc2.dim(" \u2014 job re-places on the buyer's next provider") : "";
1709
- return `replaced ${pc2.cyan(fill.fillId)} settled ${settled}${job}`;
1892
+ const job = fill.jobRequeued ? pc3.dim(" \u2014 job re-places on the buyer's next provider") : "";
1893
+ return `replaced ${pc3.cyan(fill.fillId)} settled ${settled}${job}`;
1710
1894
  }
1711
1895
  function replaceTarget(listingId, fillId) {
1712
1896
  if (fillId !== void 0) {
@@ -1728,9 +1912,9 @@ function replaceTarget(listingId, fillId) {
1728
1912
  }
1729
1913
  function formatSettlementRow(s) {
1730
1914
  const period = `${s.periodStart.slice(0, 10)} \u2192 ${s.periodEnd.slice(0, 10)}`;
1731
- const paid = s.paidAt ? pc2.green(`paid ${s.paidAt.slice(0, 10)}`) : s.invoiceRef ? pc2.yellow(`invoiced ${safeTerm(s.invoiceRef)}`) : pc2.dim("unpaid");
1915
+ const paid = s.paidAt ? pc3.green(`paid ${s.paidAt.slice(0, 10)}`) : s.invoiceRef ? pc3.yellow(`invoiced ${safeTerm(s.invoiceRef)}`) : pc3.dim("unpaid");
1732
1916
  return [
1733
- pc2.dim(period),
1917
+ pc3.dim(period),
1734
1918
  `${s.vcpuSeconds.toLocaleString("en-US")} vCPU\xB7s`,
1735
1919
  `gross ${formatMoney(s.grossUsd)}`,
1736
1920
  `net ${formatMoney(s.netUsd)}`,
@@ -1777,14 +1961,14 @@ function registerMarketCommands(program2) {
1777
1961
  );
1778
1962
  }
1779
1963
  size = preset.name;
1780
- console.error(pc2.dim(`no --size given \u2014 listing at "${size}"`));
1964
+ console.error(pc3.dim(`no --size given \u2014 listing at "${size}"`));
1781
1965
  }
1782
1966
  const result = await c.post(
1783
1967
  "/api/v1/market/asks",
1784
1968
  sellBody({ ...opts, size, useCase })
1785
1969
  );
1786
1970
  output(opts, result, (r) => {
1787
- console.log(`listed ${pc2.cyan(r.ask.id)}`);
1971
+ console.log(`listed ${pc3.cyan(r.ask.id)}`);
1788
1972
  console.log(formatListingRow(r.ask));
1789
1973
  });
1790
1974
  } catch (e) {
@@ -1800,8 +1984,8 @@ function registerMarketCommands(program2) {
1800
1984
  listingPatchBody(listingId, { price: opts.price, per: opts.per })
1801
1985
  );
1802
1986
  output(opts, result, (r) => {
1803
- const rate = r.ask.pendingUsd !== null && r.ask.pendingPer !== null ? `${formatRate(r.ask.pendingUsd, r.ask.pendingPer)} ${pc2.dim("(applies next window)")}` : formatRate(r.ask.usd, r.ask.per);
1804
- console.log(`repriced ${pc2.cyan(r.ask.id)} ${rate}`);
1987
+ const rate = r.ask.pendingUsd !== null && r.ask.pendingPer !== null ? `${formatRate(r.ask.pendingUsd, r.ask.pendingPer)} ${pc3.dim("(applies next window)")}` : formatRate(r.ask.usd, r.ask.per);
1988
+ console.log(`repriced ${pc3.cyan(r.ask.id)} ${rate}`);
1805
1989
  });
1806
1990
  } catch (e) {
1807
1991
  fail(e, opts);
@@ -1814,7 +1998,7 @@ function registerMarketCommands(program2) {
1814
1998
  listingPatchBody(listingId, { status })
1815
1999
  );
1816
2000
  output(opts, result, (r) => {
1817
- console.log(`${status === "live" ? "resumed" : "paused"} ${pc2.cyan(r.ask.id)}`);
2001
+ console.log(`${status === "live" ? "resumed" : "paused"} ${pc3.cyan(r.ask.id)}`);
1818
2002
  });
1819
2003
  } catch (e) {
1820
2004
  fail(e, opts);
@@ -1834,7 +2018,7 @@ function registerMarketCommands(program2) {
1834
2018
  `/api/v1/market/asks?id=${encodeURIComponent(listingId)}`
1835
2019
  );
1836
2020
  output(opts, result, (r) => {
1837
- console.log(`withdrew ${pc2.cyan(r.ask.id)}`);
2021
+ console.log(`withdrew ${pc3.cyan(r.ask.id)}`);
1838
2022
  });
1839
2023
  } catch (e) {
1840
2024
  fail(e, opts);
@@ -1855,14 +2039,14 @@ function registerMarketCommands(program2) {
1855
2039
  } else {
1856
2040
  const result = await c.post(target.path, {});
1857
2041
  output(opts, result, (r) => {
1858
- console.log(`paused ${pc2.cyan(r.listing.id)}`);
2042
+ console.log(`paused ${pc3.cyan(r.listing.id)}`);
1859
2043
  if (r.fills.length === 0) {
1860
- console.log(pc2.dim(" no live sales to evict"));
2044
+ console.log(pc3.dim(" no live sales to evict"));
1861
2045
  return;
1862
2046
  }
1863
2047
  for (const f of r.fills) {
1864
2048
  if (f.ok) console.log(formatReplacedFill(f.fill));
1865
- else console.log(pc2.red(` could not evict a sale \u2014 ${f.error}`));
2049
+ else console.log(pc3.red(` could not evict a sale \u2014 ${f.error}`));
1866
2050
  }
1867
2051
  });
1868
2052
  if (result.fills.some((f) => !f.ok)) process.exitCode = 1;
@@ -1943,7 +2127,7 @@ ${hints}`
1943
2127
  }
1944
2128
  if (resolved.fromFlag.some((name) => provider.credentialFields.find((f) => f.name === name)?.secret)) {
1945
2129
  console.error(
1946
- pc2.yellow("note: a secret passed via --field stays in your shell history \u2014 prefer the env vars.")
2130
+ pc3.yellow("note: a secret passed via --field stays in your shell history \u2014 prefer the env vars.")
1947
2131
  );
1948
2132
  }
1949
2133
  const result = await c.post(
@@ -1951,7 +2135,7 @@ ${hints}`
1951
2135
  credentialBody(provider.credentialFields, resolved.values)
1952
2136
  );
1953
2137
  output(opts, result, (r) => {
1954
- console.log(`connected ${pc2.cyan(safeTerm(r.provider.name))} credential saved`);
2138
+ console.log(`connected ${pc3.cyan(safeTerm(r.provider.name))} credential saved`);
1955
2139
  });
1956
2140
  } catch (e) {
1957
2141
  fail(e, opts);
@@ -1965,7 +2149,7 @@ ${hints}`
1965
2149
  "/api/v1/market/provider/credential"
1966
2150
  );
1967
2151
  output(opts, result, (r) => {
1968
- console.log(`disconnected ${pc2.cyan(safeTerm(r.provider.name))} credential removed`);
2152
+ console.log(`disconnected ${pc3.cyan(safeTerm(r.provider.name))} credential removed`);
1969
2153
  });
1970
2154
  } catch (e) {
1971
2155
  fail(e, opts);
@@ -1974,45 +2158,18 @@ ${hints}`
1974
2158
  }
1975
2159
 
1976
2160
  // src/sandboxes.ts
1977
- import pc3 from "picocolors";
1978
- function parseMaxPrice(value, per) {
1979
- if (value === void 0) {
1980
- if (per !== void 0) throw new Error("--max-price-per requires --max-price.");
1981
- return void 0;
1982
- }
1983
- let usdText = value;
1984
- let unit = per;
1985
- const slash = value.indexOf("/");
1986
- if (slash !== -1) {
1987
- usdText = value.slice(0, slash);
1988
- const inline = value.slice(slash + 1);
1989
- if (per !== void 0 && per !== inline) {
1990
- throw new Error(`--max-price "${value}" conflicts with --max-price-per "${per}".`);
1991
- }
1992
- unit = inline;
1993
- }
1994
- const usd = Number(usdText);
1995
- if (!/^\d+(\.\d+)?([eE][+-]?\d+)?$/.test(usdText) || !Number.isFinite(usd) || usd <= 0) {
1996
- throw new Error(`Invalid --max-price "${value}". Expected a positive dollar amount like 0.12/hour.`);
1997
- }
1998
- if (unit !== "second" && unit !== "minute" && unit !== "hour") {
1999
- throw new Error(
2000
- "--max-price needs a unit \u2014 write it as <usd>/<unit> (e.g. --max-price 0.12/hour) or pass --max-price-per hour."
2001
- );
2002
- }
2003
- return { usd, per: unit };
2004
- }
2161
+ import pc4 from "picocolors";
2005
2162
  function shellQuote(arg) {
2006
2163
  return `'${arg.replace(/'/g, `'\\''`)}'`;
2007
2164
  }
2008
2165
  function printSandbox(s) {
2009
2166
  const attach = "attach" in s ? s.attach : void 0;
2010
- console.log(`${pc3.cyan(s.id)} ${s.status} ${s.provider ?? "\u2014"} ${s.providerSandboxId ?? "\u2014"}`);
2167
+ console.log(`${pc4.cyan(s.id)} ${s.status} ${s.provider ?? "\u2014"} ${s.providerSandboxId ?? "\u2014"}`);
2011
2168
  console.log(` label: ${s.label ?? "\u2014"} commands: ${s.commandCount} created: ${s.createdAt}`);
2012
2169
  if (s.image !== void 0) {
2013
- console.log(` image: ${s.image ?? "\u2014"}${s.requestedImage !== null && s.requestedImage !== s.image ? ` ${pc3.dim(`(requested: ${s.requestedImage})`)}` : ""}`);
2170
+ console.log(` image: ${s.image ?? "\u2014"}${s.requestedImage !== null && s.requestedImage !== s.image ? ` ${pc4.dim(`(requested: ${s.requestedImage})`)}` : ""}`);
2014
2171
  }
2015
- if (s.destroyError) console.log(` destroyError: ${pc3.red(s.destroyError)}`);
2172
+ if (s.destroyError) console.log(` destroyError: ${pc4.red(s.destroyError)}`);
2016
2173
  if (s.placement) {
2017
2174
  const p2 = s.placement;
2018
2175
  const box = p2.box ? ` / ${p2.box.sizeName ?? "custom"}${p2.box.resources ? ` (${p2.box.resources.cpus ?? "?"} vCPU / ${p2.box.resources.memoryMb ?? "?"} MB)` : ""}` : "";
@@ -2029,7 +2186,7 @@ function printSandbox(s) {
2029
2186
  var perHour = (n) => n === void 0 ? "\u2014" : formatRateAllUnits(rateAllUnits({ usd: n, per: "hour" }));
2030
2187
  var usdAmount = (n) => n === void 0 ? "\u2014" : formatMoney(n);
2031
2188
  function printQuote(q, timeoutMs) {
2032
- console.log(`quote: ${q.ok ? pc3.green("ok") : pc3.red(q.reason ?? "unfillable")}`);
2189
+ console.log(`quote: ${q.ok ? pc4.green("ok") : pc4.red(q.reason ?? "unfillable")}`);
2033
2190
  const box = q.placement?.box;
2034
2191
  console.log(
2035
2192
  ` size: ${q.placement?.size ?? "\u2014"} provider: ${q.placement?.provider ?? "\u2014"}` + (box ? ` box: ${box.sizeName ?? "custom"} (${box.provider}${box.resources ? `, ${box.resources.cpus ?? "?"} vCPU / ${box.resources.memoryMb ?? "?"} MB` : ""})` : "")
@@ -2048,17 +2205,17 @@ function printQuote(q, timeoutMs) {
2048
2205
  );
2049
2206
  console.log(` cap: ${q.maxPrice ? formatUsdPer(q.maxPrice) : perHour(q.marketCapUsdPerHour)}`);
2050
2207
  console.log(` protection limit: ${perHour(q.protectionLimitUsdPerHour)}`);
2051
- if (!q.ok && q.topUpPath) console.log(` ${pc3.dim(`\u2192 ${q.topUpPath}`)}`);
2052
- if (q.liveAskDepth !== void 0) console.log(` ${pc3.dim(`live asks: ${q.liveAskDepth}`)}`);
2208
+ if (!q.ok && q.topUpPath) console.log(` ${pc4.dim(`\u2192 ${q.topUpPath}`)}`);
2209
+ if (q.liveAskDepth !== void 0) console.log(` ${pc4.dim(`live asks: ${q.liveAskDepth}`)}`);
2053
2210
  }
2054
2211
  function printProcess(p2) {
2055
2212
  const exit = p2.status === "exited" ? `exit=${p2.exitCode ?? "?"}${p2.signal ? ` (${p2.signal})` : ""}` : "";
2056
2213
  const stdin = p2.stdin && p2.status === "running" ? " [stdin open]" : "";
2057
- console.log(`${pc3.cyan(p2.jobId)} ${p2.status}${exit ? " " + exit : ""}${stdin} ${p2.command}`);
2214
+ console.log(`${pc4.cyan(p2.jobId)} ${p2.status}${exit ? " " + exit : ""}${stdin} ${p2.command}`);
2058
2215
  }
2059
2216
  function printSnapshot(s) {
2060
- const state = s.deletedAt !== null ? ` ${pc3.dim(`(deleted ${s.deletedAt})`)}` : "";
2061
- console.log(`${pc3.cyan(s.id)} ${s.providerSnapshotId}${state}`);
2217
+ const state = s.deletedAt !== null ? ` ${pc4.dim(`(deleted ${s.deletedAt})`)}` : "";
2218
+ console.log(`${pc4.cyan(s.id)} ${s.providerSnapshotId}${state}`);
2062
2219
  console.log(
2063
2220
  ` provider: ${s.provider}${s.region ? ` (${s.region})` : ""} label: ${s.label ?? "\u2014"} created: ${s.createdAt}${s.expiresAt ? ` expires: ${s.expiresAt}` : ""}`
2064
2221
  );
@@ -2139,7 +2296,7 @@ function mergeLeadOpts(opts, inline) {
2139
2296
  }
2140
2297
  function registerSandboxesCommands(program2) {
2141
2298
  const cmd = program2.command("sandboxes").alias("sbx").description("Create and drive sandboxes through the platform").enablePositionalOptions().configureOutput({ outputError: usageErrorOutput });
2142
- cmd.command("create").description('Place a sandbox (provider order walks 1,2,3; "market" bids first)').option("--order <providers>", 'provider order, comma-separated (e.g. "market,blaxel,vercel")').option("--size <size>", "platform size: small (1 vCPU/2 GB), medium, large, xlarge (8/16 GB); default medium").option("--label <label>", "label for the sandbox").option("--image <image>", "container image to boot").option("--snapshot-id <id>", "provider snapshot to resume").option("--cpus <n>", "CPU cores (raw resources \u2014 mutually exclusive with --size)").option("--memory-mb <n>", "memory in MB (raw resources)").option("--disk-mb <n>", "ephemeral disk in MB (raw resources)").option("--max-price <usd/unit>", "max price for a market fill (e.g. 0.12/hour); makes the create a limit order").option("--max-price-per <unit>", "unit for a bare --max-price usd (second, minute, or hour)").option("--market", 'place the create on the compute market (order type "market")').option("--order-type <type>", "explicit market order type: market or limit").option("--timeout-ms <ms>", "sandbox timeout in ms").option("--secret <name>", "vault secret name to inject (repeatable)", (v, a) => a.concat(v), []).option("--api-key <key>", "platform API key (or COMPUTE_API_KEY)").option("--base-url <url>", "platform base URL").option("--allow-untrusted-host", "allow non-computesdk.com base URLs").option("--json", "print the raw response").action(async (opts) => {
2299
+ cmd.command("create").description('Place a sandbox (provider order walks 1,2,3; "market" bids first)').option("--order <providers>", 'provider order, comma-separated (e.g. "market,blaxel,vercel")').option("--size <size>", "platform size: small (1 vCPU/2 GB), medium, large, xlarge (8/16 GB); default medium").option("--label <label>", "label for the sandbox").option("--image <image>", "container image to boot").option("--snapshot-id <id>", "provider snapshot to resume").option("--cpus <n>", "CPU cores (raw resources \u2014 mutually exclusive with --size)").option("--memory-mb <n>", "memory in MB (raw resources)").option("--disk-mb <n>", "ephemeral disk in MB (raw resources)").option("--max-price <usd/unit>", "max price for a market fill (e.g. 0.12/hour); makes the create a limit order").option("--max-price-per <unit>", "unit for a bare --max-price usd (second, minute, or hour)").option("--market", 'place the create on the compute market (order type "market")').option("--order-type <type>", "explicit market order type: market or limit").option("--timeout-ms <ms>", "sandbox timeout in ms (provider minimums apply, e.g. blaxel \u22655m)").option("--secret <name>", "vault secret name to inject (repeatable)", (v, a) => a.concat(v), []).option("--api-key <key>", "platform API key (or COMPUTE_API_KEY)").option("--base-url <url>", "platform base URL").option("--allow-untrusted-host", "allow non-computesdk.com base URLs").option("--json", "print the raw response").action(async (opts) => {
2143
2300
  try {
2144
2301
  const c = await client(opts);
2145
2302
  const resources = {};
@@ -2168,7 +2325,7 @@ function registerSandboxesCommands(program2) {
2168
2325
  fail(e, opts);
2169
2326
  }
2170
2327
  });
2171
- cmd.command("quote").description("Quote a sandbox create: placement, rate, caps and credits \u2014 creates nothing").option("--size <size>", "platform size (or raw resource flags; default medium)").option("--cpus <n>", "CPU cores").option("--memory-mb <n>", "memory in MB").option("--disk-mb <n>", "ephemeral disk in MB").option("--region <region>", "pin the placement region").option("--timeout-ms <ms>", "sandbox timeout in ms").option("--order-type <type>", "market order type: market or limit").option("--market", "quote a market order (fills at the live price, protection-bounded)").option("--max-price <usd/unit>", "max price for a market fill (e.g. 0.12/hour)").option("--max-price-per <unit>", "unit for a bare --max-price usd (second, minute, or hour)").option("--api-key <key>").option("--base-url <url>").option("--allow-untrusted-host").option("--json", "print the raw response").action(async (opts) => {
2328
+ cmd.command("quote").description("Quote a sandbox create: placement, rate, caps and credits \u2014 creates nothing").option("--size <size>", "platform size (or raw resource flags; default medium)").option("--cpus <n>", "CPU cores").option("--memory-mb <n>", "memory in MB").option("--disk-mb <n>", "ephemeral disk in MB").option("--region <region>", "pin the placement region").option("--timeout-ms <ms>", "sandbox timeout in ms (provider minimums apply, e.g. blaxel \u22655m)").option("--order-type <type>", "market order type: market or limit").option("--market", "quote a market order (fills at the live price, protection-bounded)").option("--max-price <usd/unit>", "max price for a market fill (e.g. 0.12/hour)").option("--max-price-per <unit>", "unit for a bare --max-price usd (second, minute, or hour)").option("--api-key <key>").option("--base-url <url>").option("--allow-untrusted-host").option("--json", "print the raw response").action(async (opts) => {
2172
2329
  try {
2173
2330
  const c = await client(opts);
2174
2331
  const params = {
@@ -2206,7 +2363,7 @@ function registerSandboxesCommands(program2) {
2206
2363
  );
2207
2364
  output(opts, res, (page) => {
2208
2365
  page.sandboxes.forEach(printSandbox);
2209
- if (page.nextCursor) console.log(pc3.dim(`nextCursor: ${page.nextCursor}`));
2366
+ if (page.nextCursor) console.log(pc4.dim(`nextCursor: ${page.nextCursor}`));
2210
2367
  });
2211
2368
  } catch (e) {
2212
2369
  fail(e, opts);
@@ -2350,7 +2507,7 @@ function registerSandboxesCommands(program2) {
2350
2507
  data = opts.base64 ? piped.toString("base64") : piped.toString("utf8");
2351
2508
  }
2352
2509
  if (data === void 0 || data === "") {
2353
- console.error(pc3.red("Pass --data, --file, or pipe stdin"));
2510
+ console.error(pc4.red("Pass --data, --file, or pipe stdin"));
2354
2511
  process.exit(1);
2355
2512
  }
2356
2513
  if (opts.base64 && opts.data !== void 0) {
@@ -2387,7 +2544,7 @@ function registerSandboxesCommands(program2) {
2387
2544
  output(opts, res, (view) => {
2388
2545
  if (view.type === "directory") {
2389
2546
  for (const e of view.entries) {
2390
- console.log(`${e.type === "directory" ? pc3.blue("d") : " "} ${e.name}${e.size !== void 0 ? ` ${pc3.dim(String(e.size))}` : ""}`);
2547
+ console.log(`${e.type === "directory" ? pc4.blue("d") : " "} ${e.name}${e.size !== void 0 ? ` ${pc4.dim(String(e.size))}` : ""}`);
2391
2548
  }
2392
2549
  } else {
2393
2550
  console.log(`${view.path} file ${view.content.length} chars`);
@@ -2403,7 +2560,7 @@ function registerSandboxesCommands(program2) {
2403
2560
  const res = await c.get(`/api/v1/sandboxes/${sandboxId}/files`, { path });
2404
2561
  output(opts, res, (view) => {
2405
2562
  if (view.type !== "file") {
2406
- console.error(pc3.red(`${view.path} is a directory`));
2563
+ console.error(pc4.red(`${view.path} is a directory`));
2407
2564
  process.exit(1);
2408
2565
  }
2409
2566
  process.stdout.write(view.content);
@@ -2429,7 +2586,7 @@ function registerSandboxesCommands(program2) {
2429
2586
  });
2430
2587
  }
2431
2588
  if (content === void 0) {
2432
- console.error(pc3.red("Pass --content, --file, or pipe stdin"));
2589
+ console.error(pc4.red("Pass --content, --file, or pipe stdin"));
2433
2590
  process.exit(1);
2434
2591
  }
2435
2592
  const c = await client(opts);
@@ -2514,6 +2671,12 @@ function registerSandboxesCommands(program2) {
2514
2671
  for (const sub of cmd.commands) {
2515
2672
  sub.option("--org <slug>", "organization slug for this command (or $COMPUTE_ORG)");
2516
2673
  }
2674
+ registerSettingsCommands(
2675
+ cmd,
2676
+ "sandboxes",
2677
+ (sub) => sub.option("--api-key <key>", "platform API key (or COMPUTE_API_KEY)").option("--base-url <url>", "platform base URL").option("--org <slug>", "organization slug for this command (or $COMPUTE_ORG)").option("--allow-untrusted-host", "allow non-computesdk.com base URLs").option("--json", "print the raw response"),
2678
+ { client, fail, output, usageErrorOutput }
2679
+ );
2517
2680
  }
2518
2681
  async function followProcess(c, sandboxId, jobId) {
2519
2682
  let exitCode = 0;
@@ -2527,11 +2690,11 @@ async function followProcess(c, sandboxId, jobId) {
2527
2690
  exitCode = typeof payload.exitCode === "number" ? payload.exitCode : 128;
2528
2691
  return finish();
2529
2692
  } else if (event === "error") {
2530
- console.error(pc3.red(`Error: ${String(payload.error ?? "stream error")}`));
2693
+ console.error(pc4.red(`Error: ${String(payload.error ?? "stream error")}`));
2531
2694
  return finish(1);
2532
2695
  }
2533
2696
  }
2534
- console.error(pc3.yellow("stream ended before the process exited"));
2697
+ console.error(pc4.yellow("stream ended before the process exited"));
2535
2698
  return finish(2);
2536
2699
  function finish(code) {
2537
2700
  if (code !== void 0) exitCode = code;
@@ -2594,18 +2757,18 @@ async function runLogout() {
2594
2757
  program.option("--login", "force re-authentication").option("--logout", "clear stored credentials").option("--org <slug>", "organization slug override for this invocation (or $COMPUTE_ORG)").action(async (opts) => {
2595
2758
  if (opts.logout) {
2596
2759
  console.log();
2597
- p.intro(pc4.cyan(`@computesdk/cli v${VERSION}`));
2760
+ p.intro(pc5.cyan(`@computesdk/cli v${VERSION}`));
2598
2761
  await runLogout();
2599
2762
  p.log.success("Logged out. Stored credentials removed.");
2600
- p.outro(pc4.green("Done!"));
2763
+ p.outro(pc5.green("Done!"));
2601
2764
  process.exit(0);
2602
2765
  }
2603
2766
  if (opts.login) {
2604
2767
  console.log();
2605
- p.intro(pc4.cyan(`@computesdk/cli v${VERSION}`));
2768
+ p.intro(pc5.cyan(`@computesdk/cli v${VERSION}`));
2606
2769
  await runLogin();
2607
2770
  await printSessionLine();
2608
- p.outro(pc4.green("Authenticated!"));
2771
+ p.outro(pc5.green("Authenticated!"));
2609
2772
  process.exit(0);
2610
2773
  }
2611
2774
  program.help();
@@ -2616,23 +2779,23 @@ program.hook("preAction", (thisCommand) => {
2616
2779
  });
2617
2780
  program.command("providers").description("List all providers and their configuration status").action(async () => {
2618
2781
  console.log();
2619
- p.intro(pc4.cyan(`@computesdk/cli v${VERSION}`));
2782
+ p.intro(pc5.cyan(`@computesdk/cli v${VERSION}`));
2620
2783
  const statuses = getProviderStatus();
2621
2784
  console.log();
2622
2785
  for (const status of statuses) {
2623
- const icon = status.ready ? pc4.green("\u25CF") : pc4.gray("\u25CB");
2624
- const name = status.ready ? pc4.white(status.name) : pc4.gray(status.name);
2625
- const detail = status.ready ? pc4.green("ready") : pc4.gray(`missing: ${status.missing.join(", ")}`);
2786
+ const icon = status.ready ? pc5.green("\u25CF") : pc5.gray("\u25CB");
2787
+ const name = status.ready ? pc5.white(status.name) : pc5.gray(status.name);
2788
+ const detail = status.ready ? pc5.green("ready") : pc5.gray(`missing: ${status.missing.join(", ")}`);
2626
2789
  console.log(` ${icon} ${name} ${detail}`);
2627
2790
  }
2628
2791
  console.log();
2629
2792
  });
2630
2793
  program.command("login").description("Authenticate with ComputeSDK (OAuth device flow)").option("--base-url <url>", "platform URL to authenticate against").action(async (opts) => {
2631
2794
  console.log();
2632
- p.intro(pc4.cyan(`@computesdk/cli v${VERSION}`));
2795
+ p.intro(pc5.cyan(`@computesdk/cli v${VERSION}`));
2633
2796
  await runLogin({ baseUrl: opts.baseUrl });
2634
2797
  await printSessionLine({ baseUrl: opts.baseUrl });
2635
- p.outro(pc4.green("Authenticated!"));
2798
+ p.outro(pc5.green("Authenticated!"));
2636
2799
  });
2637
2800
  program.command("logout").description("Clear stored credentials").option("--json", "print machine-readable JSON").action(async (opts) => {
2638
2801
  await runLogout();
@@ -2641,9 +2804,9 @@ program.command("logout").description("Clear stored credentials").option("--json
2641
2804
  return;
2642
2805
  }
2643
2806
  console.log();
2644
- p.intro(pc4.cyan(`@computesdk/cli v${VERSION}`));
2807
+ p.intro(pc5.cyan(`@computesdk/cli v${VERSION}`));
2645
2808
  p.log.success("Logged out. Stored credentials removed.");
2646
- p.outro(pc4.green("Done!"));
2809
+ p.outro(pc5.green("Done!"));
2647
2810
  });
2648
2811
  async function printWhoami(options = {}) {
2649
2812
  const { getMe } = await import("@benchsdk/cli");
@@ -2668,8 +2831,8 @@ org.command("list").description("List your organizations").option("--json", "pri
2668
2831
  return;
2669
2832
  }
2670
2833
  for (const o of organizations) {
2671
- const marker = o.id === me.activeOrganizationId ? pc4.green("*") : " ";
2672
- console.log(`${marker} ${pc4.cyan(o.slug)} ${o.name ?? ""} ${pc4.dim(o.id)}`);
2834
+ const marker = o.id === me.activeOrganizationId ? pc5.green("*") : " ";
2835
+ console.log(`${marker} ${pc5.cyan(o.slug)} ${o.name ?? ""} ${pc5.dim(o.id)}`);
2673
2836
  }
2674
2837
  });
2675
2838
  org.command("use <slug>").description("Set the active organization (persisted to the stored login)").action(async (slug) => {
@@ -2714,7 +2877,7 @@ async function main() {
2714
2877
  await program.parseAsync(process.argv);
2715
2878
  }
2716
2879
  main().catch((error) => {
2717
- console.error(pc4.red(`
2880
+ console.error(pc5.red(`
2718
2881
  Error: ${error.message}`));
2719
2882
  process.exit(1);
2720
2883
  });