@pollinations/cli 0.1.25 → 0.1.27
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 +34 -10
- 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.27",
|
|
18
18
|
description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
|
|
19
19
|
type: "module",
|
|
20
20
|
bin: {
|
|
@@ -1163,10 +1163,7 @@ async function* streamSSE(response, onEvent) {
|
|
|
1163
1163
|
|
|
1164
1164
|
// src/commands/gen/chat.ts
|
|
1165
1165
|
function createChatCommand() {
|
|
1166
|
-
return new Command6("chat").description("Interactive multi-turn chat session").option(
|
|
1167
|
-
"--model <model>",
|
|
1168
|
-
"Text model (default: from config or 'openai')"
|
|
1169
|
-
).option("--system <msg>", "System message").option("--temperature <n>", "Randomness (0-2)").option("--max-tokens <n>", "Maximum output tokens").option("--save <path>", "Save conversation transcript on exit").action(async (opts) => {
|
|
1166
|
+
return new Command6("chat").description("Interactive multi-turn chat session").option("--model <model>", "Text model (default: API default)").option("--system <msg>", "System message").option("--temperature <n>", "Randomness (0-2)").option("--max-tokens <n>", "Maximum output tokens").option("--save <path>", "Save conversation transcript on exit").action(async (opts) => {
|
|
1170
1167
|
const temperature = opts.temperature === void 0 ? void 0 : numberOption("--temperature", opts.temperature, 0, 2);
|
|
1171
1168
|
const maxTokens = opts.maxTokens === void 0 ? void 0 : numberOption(
|
|
1172
1169
|
"--max-tokens",
|
|
@@ -1186,7 +1183,7 @@ function createChatCommand() {
|
|
|
1186
1183
|
process.stderr.write(
|
|
1187
1184
|
chalk4.green(
|
|
1188
1185
|
`
|
|
1189
|
-
Chat session started (model: ${opts.model})
|
|
1186
|
+
Chat session started (model: ${opts.model ?? "API default"})
|
|
1190
1187
|
`
|
|
1191
1188
|
) + chalk4.dim(
|
|
1192
1189
|
"Type /exit to quit, /clear to reset, /save <path> to save\n\n"
|
|
@@ -1242,7 +1239,10 @@ Chat session started (model: ${opts.model})
|
|
|
1242
1239
|
}
|
|
1243
1240
|
process.stderr.write(`${chalk4.yellow("ai")} > `);
|
|
1244
1241
|
let content = "";
|
|
1245
|
-
for await (const chunk of streamSSE(res)
|
|
1242
|
+
for await (const chunk of streamSSE(res, (event) => {
|
|
1243
|
+
if (typeof event.usage?.total_tokens === "number")
|
|
1244
|
+
totalTokens += event.usage.total_tokens;
|
|
1245
|
+
})) {
|
|
1246
1246
|
content += chunk;
|
|
1247
1247
|
process.stderr.write(chunk);
|
|
1248
1248
|
}
|
|
@@ -1259,7 +1259,15 @@ Chat session started (model: ${opts.model})
|
|
|
1259
1259
|
const transcript = messages.filter((m) => m.role !== "system").map(
|
|
1260
1260
|
(m) => `${m.role === "user" ? "You" : "AI"}: ${m.content}`
|
|
1261
1261
|
).join("\n\n");
|
|
1262
|
-
|
|
1262
|
+
try {
|
|
1263
|
+
writeFileSync3(path, transcript, "utf-8");
|
|
1264
|
+
} catch (err) {
|
|
1265
|
+
printError(
|
|
1266
|
+
err instanceof Error ? err.message : "Failed to save transcript"
|
|
1267
|
+
);
|
|
1268
|
+
if (closed) process.exitCode = 1;
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1263
1271
|
if (!isJson) {
|
|
1264
1272
|
process.stderr.write(chalk4.green(`Saved to ${path}
|
|
1265
1273
|
`));
|
|
@@ -3894,6 +3902,7 @@ var info = new Command17("info").description(
|
|
|
3894
3902
|
name: keyInfo.name ?? "-",
|
|
3895
3903
|
expires: keyInfo.expiresAt ?? "never",
|
|
3896
3904
|
budget: keyInfo.pollenBudget ?? "unlimited",
|
|
3905
|
+
quest_pollen_only: keyInfo.questPollenOnly ?? false,
|
|
3897
3906
|
rate_limited: keyInfo.rateLimitEnabled,
|
|
3898
3907
|
model_restrictions: keyInfo.permissions?.models?.join(", ") ?? "none (all models)",
|
|
3899
3908
|
account_permissions: keyInfo.permissions?.account?.join(", ") ?? "none"
|
|
@@ -3908,7 +3917,13 @@ var create2 = new Command17("create").description(
|
|
|
3908
3917
|
"--type <type>",
|
|
3909
3918
|
"Key type: secret or publishable app key",
|
|
3910
3919
|
"secret"
|
|
3911
|
-
).option("--expires-in <seconds>", "Expiry in seconds (max 365 days)").option(
|
|
3920
|
+
).option("--expires-in <seconds>", "Expiry in seconds (max 365 days)").option(
|
|
3921
|
+
"--models <models...>",
|
|
3922
|
+
"Restrict to model categories (text, image, video, audio, 3d, embedding, realtime); a model ID allows its whole category"
|
|
3923
|
+
).option("--budget <pollen>", "Pollen budget cap").option(
|
|
3924
|
+
"--quest-pollen-only",
|
|
3925
|
+
"Never spend paid Pollen; requests stop when Quest Pollen runs out"
|
|
3926
|
+
).option(
|
|
3912
3927
|
"--redirect-uri <uri...>",
|
|
3913
3928
|
"Allowed BYOP redirect URI(s) for publishable app keys"
|
|
3914
3929
|
).option("--earnings", "Enable developer earnings for publishable app keys").option(
|
|
@@ -3946,6 +3961,7 @@ Examples:
|
|
|
3946
3961
|
body.pollenBudget = budget;
|
|
3947
3962
|
}
|
|
3948
3963
|
if (opts.permissions) body.accountPermissions = opts.permissions;
|
|
3964
|
+
if (opts.questPollenOnly === true) body.questPollenOnly = true;
|
|
3949
3965
|
if (opts.redirectUri) body.redirectUris = opts.redirectUri;
|
|
3950
3966
|
if (opts.earnings === true) body.earningsEnabled = true;
|
|
3951
3967
|
const created = await gen("/account/keys", {
|
|
@@ -5742,7 +5758,15 @@ var sandboxCommand = new Command22("sandbox").description("E2B sandboxes billed
|
|
|
5742
5758
|
requireKey();
|
|
5743
5759
|
try {
|
|
5744
5760
|
const { sandboxID } = await createSandbox(template);
|
|
5745
|
-
|
|
5761
|
+
try {
|
|
5762
|
+
setupSsh();
|
|
5763
|
+
} catch (err) {
|
|
5764
|
+
printResult({ id: sandboxID });
|
|
5765
|
+
fail(
|
|
5766
|
+
`Sandbox ${sandboxID} created, but failed to set up ssh`,
|
|
5767
|
+
err
|
|
5768
|
+
);
|
|
5769
|
+
}
|
|
5746
5770
|
printSuccess(
|
|
5747
5771
|
`Sandbox ${sandboxID} created. It pauses after ${LEASE_SECONDS / 60} minutes without an ssh session.`
|
|
5748
5772
|
);
|