@pollinations/cli 0.1.92 → 0.1.94
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.d.ts +1 -1
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __esm = (fn, res) => function __init() {
|
|
4
|
-
|
|
3
|
+
var __esm = (fn, res, err) => function __init() {
|
|
4
|
+
if (err) throw err[0];
|
|
5
|
+
try {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
} catch (e) {
|
|
8
|
+
throw err = [e], e;
|
|
9
|
+
}
|
|
5
10
|
};
|
|
6
11
|
var __export = (target, all) => {
|
|
7
12
|
for (var name in all)
|
|
@@ -14,7 +19,7 @@ var init_package = __esm({
|
|
|
14
19
|
"package.json"() {
|
|
15
20
|
package_default = {
|
|
16
21
|
name: "@pollinations/cli",
|
|
17
|
-
version: "0.1.
|
|
22
|
+
version: "0.1.94",
|
|
18
23
|
description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
|
|
19
24
|
type: "module",
|
|
20
25
|
bin: {
|
|
@@ -89,7 +94,7 @@ var init_package = __esm({
|
|
|
89
94
|
"@types/cross-spawn": "^6.0.6",
|
|
90
95
|
"@types/node": "^22.20.1",
|
|
91
96
|
"@types/update-notifier": "^6.0.8",
|
|
92
|
-
tsup: "^
|
|
97
|
+
tsup: "^9.0.0",
|
|
93
98
|
typescript: "^5.7.0",
|
|
94
99
|
vitest: "^4.1.12"
|
|
95
100
|
}
|
|
@@ -415,8 +420,8 @@ function profileName(profile) {
|
|
|
415
420
|
}
|
|
416
421
|
async function pollForToken(deviceCode, interval, expiresIn) {
|
|
417
422
|
const deadline = Date.now() + expiresIn * 1e3;
|
|
418
|
-
|
|
419
|
-
while (Date.now() < deadline) {
|
|
423
|
+
let pollMs = Math.max(interval, 5) * 1e3;
|
|
424
|
+
while (Date.now() + pollMs < deadline) {
|
|
420
425
|
await new Promise((r) => setTimeout(r, pollMs));
|
|
421
426
|
const res = await fetch(`${ENTER_URL}/api/device/token`, {
|
|
422
427
|
method: "POST",
|
|
@@ -428,8 +433,11 @@ async function pollForToken(deviceCode, interval, expiresIn) {
|
|
|
428
433
|
});
|
|
429
434
|
const body = await res.json();
|
|
430
435
|
if (res.ok && body.access_token) return body;
|
|
431
|
-
if (body.error === "
|
|
436
|
+
if (body.error === "slow_down") {
|
|
437
|
+
pollMs += 5e3;
|
|
432
438
|
continue;
|
|
439
|
+
}
|
|
440
|
+
if (body.error === "authorization_pending") continue;
|
|
433
441
|
return body;
|
|
434
442
|
}
|
|
435
443
|
return { error: "expired_token", error_description: "Device code expired" };
|