@pollinations/cli 0.1.60 → 0.1.62
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 +43 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
17
|
+
version: "0.1.62",
|
|
18
18
|
description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
|
|
19
19
|
type: "module",
|
|
20
20
|
bin: {
|
|
@@ -313,7 +313,7 @@ var init_api = __esm({
|
|
|
313
313
|
const key = resolveApiKey();
|
|
314
314
|
if (!key) {
|
|
315
315
|
printError("Not logged in. Run: polli auth login");
|
|
316
|
-
fail(
|
|
316
|
+
return fail(
|
|
317
317
|
"Or pipe a key: printf '%s' '<your-key>' | polli auth login --with-token"
|
|
318
318
|
);
|
|
319
319
|
}
|
|
@@ -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
|
|
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
|
-
)
|
|
2397
|
-
|
|
2398
|
-
|
|
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
|
|
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 =
|
|
2500
|
-
|
|
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 =
|
|
2817
|
-
|
|
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 =
|
|
3062
|
-
|
|
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 =
|
|
3252
|
-
|
|
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 }
|
|
@@ -3292,8 +3300,8 @@ var saveJson = (path, data) => {
|
|
|
3292
3300
|
`, 384);
|
|
3293
3301
|
};
|
|
3294
3302
|
var readKey4 = (ctx) => {
|
|
3295
|
-
const
|
|
3296
|
-
const key = env?.vars?.[KEY_ENV4];
|
|
3303
|
+
const doc = loadJson(configPath2(ctx));
|
|
3304
|
+
const key = doc.env?.vars?.[KEY_ENV4];
|
|
3297
3305
|
return typeof key === "string" && key ? key : null;
|
|
3298
3306
|
};
|
|
3299
3307
|
var providerEntry = (models2) => ({
|
|
@@ -3352,7 +3360,7 @@ var stripConfig3 = (ctx) => {
|
|
|
3352
3360
|
}
|
|
3353
3361
|
const primary = asRecord(doc.agents?.defaults?.model).primary;
|
|
3354
3362
|
if (typeof primary === "string" && primary.startsWith(`${PROVIDER4}/`)) {
|
|
3355
|
-
delete asRecord(
|
|
3363
|
+
delete asRecord(doc.agents?.defaults?.model).primary;
|
|
3356
3364
|
saveJson(configPath2(ctx), doc);
|
|
3357
3365
|
changed = true;
|
|
3358
3366
|
}
|
|
@@ -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 =
|
|
3414
|
-
|
|
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 =
|
|
3611
|
-
|
|
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 =
|
|
3776
|
-
|
|
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 =
|
|
3933
|
-
|
|
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 }
|