@pollinations/cli 0.1.60 → 0.1.61

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.60",
17
+ version: "0.1.61",
18
18
  description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
19
19
  type: "module",
20
20
  bin: {
@@ -2391,21 +2391,25 @@ import spawn2 from "cross-spawn";
2391
2391
  init_api();
2392
2392
  var fetchHarnessModels = async (selectedModel) => {
2393
2393
  const { data } = await gen("/v1/models");
2394
- const models2 = data.filter(
2394
+ const usable = data.filter(
2395
2395
  (m) => m.tools === true && m.output_modalities?.includes("text") && m.supported_endpoints?.includes("/v1/chat/completions") && m.context_length && !m.agent && m.community !== true
2396
- ).map((m) => ({
2397
- id: m.id,
2398
- contextWindow: m.context_length,
2399
- input: (m.input_modalities ?? ["text"]).filter(
2400
- (modality) => modality === "text" || modality === "image"
2401
- )
2402
- }));
2403
- if (!models2.some((model) => model.id === selectedModel)) {
2396
+ );
2397
+ const selected = usable.find((m) => m.id === selectedModel) ?? usable.find((m) => m.aliases?.includes(selectedModel));
2398
+ if (!selected) {
2404
2399
  throw new Error(
2405
2400
  `Model "${selectedModel}" is not a tool-calling text model. Run: polli models`
2406
2401
  );
2407
2402
  }
2408
- return models2;
2403
+ return {
2404
+ model: selected.id,
2405
+ models: usable.map((m) => ({
2406
+ id: m.id,
2407
+ contextWindow: m.context_length,
2408
+ input: (m.input_modalities ?? ["text"]).filter(
2409
+ (modality) => modality === "text" || modality === "image"
2410
+ )
2411
+ }))
2412
+ };
2409
2413
  };
2410
2414
 
2411
2415
  // src/harnesses/claude-code.ts
@@ -2496,8 +2500,9 @@ var claudeCode = {
2496
2500
  if (!commandExists("claude", ctx.env)) {
2497
2501
  throw new Error(`Claude Code was not found. ${INSTALL}`);
2498
2502
  }
2499
- const model = options.model ?? DEFAULT_MODEL;
2500
- await fetchHarnessModels(model);
2503
+ const { model } = await fetchHarnessModels(
2504
+ options.model ?? DEFAULT_MODEL
2505
+ );
2501
2506
  const apiKey = await resolveHarnessKey(
2502
2507
  {
2503
2508
  id: ID2,
@@ -2813,8 +2818,9 @@ var codex = {
2813
2818
  "Codex was not found. Install it first: https://github.com/openai/codex"
2814
2819
  );
2815
2820
  }
2816
- const model = options.model ?? DEFAULT_MODEL2;
2817
- await fetchHarnessModels(model);
2821
+ const { model } = await fetchHarnessModels(
2822
+ options.model ?? DEFAULT_MODEL2
2823
+ );
2818
2824
  return configureCodex(ctx, model, { browser: options.browser });
2819
2825
  },
2820
2826
  off(ctx) {
@@ -3058,8 +3064,9 @@ var dsh = {
3058
3064
  "DeepSeek Harness requires npx. Install Node.js, then run: npx @deepseek-ai/dsh@latest web"
3059
3065
  );
3060
3066
  }
3061
- const model = options.model ?? DEFAULT_MODEL3;
3062
- const models2 = await fetchHarnessModels(model);
3067
+ const { model, models: models2 } = await fetchHarnessModels(
3068
+ options.model ?? DEFAULT_MODEL3
3069
+ );
3063
3070
  const apiKey = await resolveHarnessKey(
3064
3071
  { id: ID4, label: LABEL4, existingKey: readKey2(ctx) },
3065
3072
  { browser: options.browser }
@@ -3248,8 +3255,9 @@ var hermes = {
3248
3255
  `Hermes Agent was not found. Install it first: ${INSTALL_HINT}`
3249
3256
  );
3250
3257
  }
3251
- const model = options.model ?? DEFAULT_MODEL4;
3252
- await fetchHarnessModels(model);
3258
+ const { model } = await fetchHarnessModels(
3259
+ options.model ?? DEFAULT_MODEL4
3260
+ );
3253
3261
  const apiKey = await resolveHarnessKey(
3254
3262
  { id: ID5, label: LABEL5, existingKey: readKey3(ctx) },
3255
3263
  { browser: options.browser }
@@ -3410,8 +3418,9 @@ var openclaw = {
3410
3418
  "OpenClaw was not found. Install it from: https://openclaw.ai/install"
3411
3419
  );
3412
3420
  }
3413
- const model = options.model ?? DEFAULT_MODEL5;
3414
- const models2 = await fetchHarnessModels(model);
3421
+ const { model, models: models2 } = await fetchHarnessModels(
3422
+ options.model ?? DEFAULT_MODEL5
3423
+ );
3415
3424
  initializeOpenClaw(ctx);
3416
3425
  const apiKey = await resolveHarnessKey(
3417
3426
  { id: ID6, label: LABEL6, existingKey: readKey4(ctx) },
@@ -3607,8 +3616,9 @@ var opencode = {
3607
3616
  "OpenCode was not found. Install it first: curl -fsSL https://opencode.ai/install | bash"
3608
3617
  );
3609
3618
  }
3610
- const model = options.model ?? DEFAULT_MODEL6;
3611
- const models2 = await fetchHarnessModels(model);
3619
+ const { model, models: models2 } = await fetchHarnessModels(
3620
+ options.model ?? DEFAULT_MODEL6
3621
+ );
3612
3622
  const apiKey = await resolveHarnessKey(
3613
3623
  {
3614
3624
  id: ID7,
@@ -3772,8 +3782,9 @@ var pi = {
3772
3782
  "Pi was not found. Install it first: npm install -g --ignore-scripts @earendil-works/pi-coding-agent"
3773
3783
  );
3774
3784
  }
3775
- const model = options.model ?? DEFAULT_MODEL7;
3776
- const models2 = await fetchHarnessModels(model);
3785
+ const { model, models: models2 } = await fetchHarnessModels(
3786
+ options.model ?? DEFAULT_MODEL7
3787
+ );
3777
3788
  const apiKey = await resolveHarnessKey(
3778
3789
  { id: ID8, label: LABEL8, existingKey: readKey6(ctx) },
3779
3790
  { browser: options.browser }
@@ -3929,8 +3940,9 @@ var prime = {
3929
3940
  "Prime Agent was not found. Install it first: curl -fsSL https://app.primeintellect.ai/prime-agent/install.sh | sh"
3930
3941
  );
3931
3942
  }
3932
- const model = options.model ?? DEFAULT_MODEL8;
3933
- const models2 = await fetchHarnessModels(model);
3943
+ const { model, models: models2 } = await fetchHarnessModels(
3944
+ options.model ?? DEFAULT_MODEL8
3945
+ );
3934
3946
  const apiKey = await resolveHarnessKey(
3935
3947
  { id: ID9, label: LABEL9, existingKey: readKey7(ctx) },
3936
3948
  { browser: options.browser }