@pollinations/cli 0.1.75 → 0.1.77

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
@@ -14,7 +14,7 @@ var init_package = __esm({
14
14
  "package.json"() {
15
15
  package_default = {
16
16
  name: "@pollinations/cli",
17
- version: "0.1.75",
17
+ version: "0.1.77",
18
18
  description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
19
19
  type: "module",
20
20
  bin: {
@@ -386,6 +386,9 @@ __export(auth_exports, {
386
386
  whoamiCommand: () => whoamiCommand
387
387
  });
388
388
  import { Command as Command2, Option } from "commander";
389
+ function profileName(profile) {
390
+ return profile.githubUsername ?? profile.name ?? "unknown";
391
+ }
389
392
  async function pollForToken(deviceCode, interval, expiresIn) {
390
393
  const deadline = Date.now() + expiresIn * 1e3;
391
394
  const pollMs = Math.max(interval, 5) * 1e3;
@@ -453,7 +456,7 @@ async function fetchProfileLabel(key) {
453
456
  apiKey: key
454
457
  }).catch(() => null);
455
458
  if (!profile) return null;
456
- return `Logged in as ${profile.githubUsername ?? "unknown"}`;
459
+ return `Logged in as ${profileName(profile)}`;
457
460
  }
458
461
  async function loginWithDeviceFlow(opts = {}) {
459
462
  printInfo("Requesting device code...");
@@ -559,7 +562,7 @@ async function showAuthStatus() {
559
562
  printResult({
560
563
  authenticated: true,
561
564
  key: masked,
562
- name: profile.githubUsername ?? "unknown",
565
+ name: profileName(profile),
563
566
  pollen: wallet ?? "unknown",
564
567
  key_budget: balance?.balance !== wallet ? balance?.balance : void 0
565
568
  });
@@ -4164,9 +4167,9 @@ for (const harness of HARNESSES) {
4164
4167
 
4165
4168
  // src/commands/keys.ts
4166
4169
  init_api();
4170
+ init_output();
4167
4171
  import chalk6 from "chalk";
4168
4172
  import { Command as Command17 } from "commander";
4169
- init_output();
4170
4173
  var MODELS_HELP = "Models the key can use: categories (text, image, video, audio, 3d, embedding, realtime, decision) or model IDs from `polli models`. A category includes models added later; a model ID allows only that model";
4171
4174
  var formatPerms = (p) => {
4172
4175
  if (!p) return "-";
@@ -4253,7 +4256,7 @@ var create2 = new Command17("create").description(
4253
4256
  "--type <type>",
4254
4257
  "Key type: secret or publishable app key",
4255
4258
  "secret"
4256
- ).option("--expires-in <seconds>", "Expiry in seconds (max 365 days)").option("--models <models...>", MODELS_HELP).option("--budget <pollen>", "Pollen budget cap").option(
4259
+ ).option("--expires-in <seconds>", "Expiry in seconds").option("--models <models...>", MODELS_HELP).option("--budget <pollen>", "Pollen budget cap").option(
4257
4260
  "--quest-pollen-only",
4258
4261
  "Never spend paid Pollen; requests stop when Quest Pollen runs out"
4259
4262
  ).option(
@@ -4284,13 +4287,13 @@ Examples:
4284
4287
  fail("--earnings requires --type publishable");
4285
4288
  }
4286
4289
  if (opts.expiresIn !== void 0) {
4287
- body.expiresIn = numberOption(
4288
- "--expires-in",
4289
- opts.expiresIn,
4290
- 1,
4291
- 365 * 86400,
4292
- true
4293
- );
4290
+ const expiresIn = Number(opts.expiresIn);
4291
+ if (!Number.isInteger(expiresIn) || expiresIn < 1) {
4292
+ fail(
4293
+ "--expires-in must be a whole number of seconds above 0"
4294
+ );
4295
+ }
4296
+ body.expiresIn = expiresIn;
4294
4297
  }
4295
4298
  if (opts.models) body.allowedModels = opts.models;
4296
4299
  if (opts.budget !== void 0) {