@topolo/cli 0.12.22 → 0.12.24

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.
Files changed (3) hide show
  1. package/README.md +5 -0
  2. package/dist/index.js +32 -32
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -49,6 +49,11 @@ is decided by their permissions. `--client-id doac_...` (or
49
49
  `TOPOLO_CLI_CLIENT_ID` / `TOPOLO_<ENV>_CLI_CLIENT_ID`) is only for advanced /
50
50
  self-hosted setups. Headless installs use `--api-key`.
51
51
 
52
+ While approval is pending, the CLI retains the same device request across temporary
53
+ transport failures and doubles the polling interval after each failure. It honors
54
+ the server polling interval and `slow_down` responses, stops on denial or other
55
+ OAuth errors, and never extends the original device-code expiry.
56
+
52
57
  ### Contexts
53
58
 
54
59
  A user can act in their personal space or any organization they belong to. Each
package/dist/index.js CHANGED
@@ -3571,6 +3571,38 @@ function createTopolo(options) {
3571
3571
  };
3572
3572
  }
3573
3573
 
3574
+ // src/commands/device-login-poll.ts
3575
+ async function pollUntilApproved(params) {
3576
+ let interval = Math.max(params.intervalSeconds ?? 5, 1);
3577
+ while (Date.now() < params.expiresAtMs) {
3578
+ await new Promise((resolve3) => setTimeout(resolve3, Math.min(interval * 1e3, params.expiresAtMs - Date.now())));
3579
+ if (Date.now() >= params.expiresAtMs) break;
3580
+ try {
3581
+ return await params.oauth.pollDeviceToken({
3582
+ clientId: params.clientId,
3583
+ deviceCode: params.deviceCode
3584
+ });
3585
+ } catch (err) {
3586
+ if (err instanceof TopoloAuthError) {
3587
+ if (err.code === "authorization_pending") continue;
3588
+ if (err.code === "slow_down") {
3589
+ interval += 5;
3590
+ continue;
3591
+ }
3592
+ if (err.code === "access_denied") throw new Error("Authorization was denied.");
3593
+ if (err.code === "expired_token") throw new Error("Device code expired. Run `topolo auth login` again.");
3594
+ throw err;
3595
+ }
3596
+ if (err instanceof TopoloSdkError && err.code === "network_error" || err instanceof TypeError && err.message === "fetch failed") {
3597
+ interval *= 2;
3598
+ continue;
3599
+ }
3600
+ throw err;
3601
+ }
3602
+ }
3603
+ throw new Error("Device code expired. Run `topolo auth login` again.");
3604
+ }
3605
+
3574
3606
  // node_modules/@topolo/sdk/dist/node/credential-store.js
3575
3607
  import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2, chmod as chmod2, rm as rm2, stat } from "fs/promises";
3576
3608
  import { existsSync as existsSync2 } from "fs";
@@ -4973,38 +5005,6 @@ function startSpinner() {
4973
5005
  }
4974
5006
  };
4975
5007
  }
4976
- async function pollUntilApproved(params) {
4977
- let interval = Math.max(params.intervalSeconds, 1);
4978
- while (Date.now() < params.expiresAtMs) {
4979
- await sleep(interval * 1e3);
4980
- try {
4981
- const token = await params.oauth.pollDeviceToken({
4982
- clientId: params.clientId,
4983
- deviceCode: params.deviceCode
4984
- });
4985
- return token;
4986
- } catch (err) {
4987
- if (err instanceof TopoloAuthError) {
4988
- if (err.code === "authorization_pending") continue;
4989
- if (err.code === "slow_down") {
4990
- interval += 2;
4991
- continue;
4992
- }
4993
- if (err.code === "access_denied") {
4994
- throw new Error("Authorization was denied.");
4995
- }
4996
- if (err.code === "expired_token") {
4997
- throw new Error("Device code expired. Run `topolo auth login` again.");
4998
- }
4999
- }
5000
- throw err;
5001
- }
5002
- }
5003
- throw new Error("Device code expired. Run `topolo auth login` again.");
5004
- }
5005
- function sleep(ms) {
5006
- return new Promise((resolve3) => setTimeout(resolve3, ms));
5007
- }
5008
5008
 
5009
5009
  // src/client.ts
5010
5010
  async function buildClient(options) {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@topolo/cli",
3
3
  "packageManager": "pnpm@10.17.1",
4
- "version": "0.12.22",
5
- "topoloPublishedVersion": "0.12.22",
4
+ "version": "0.12.24",
5
+ "topoloPublishedVersion": "0.12.24",
6
6
  "description": "Public command-line interface for Topolo customer organizations, developers, and agents.",
7
7
  "license": "UNLICENSED",
8
8
  "author": "Topolo",
@@ -28,8 +28,8 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@modelcontextprotocol/sdk": "^1.0.0",
31
- "@topolo/mcp": "0.14.14",
32
- "@topolo/sdk": "0.23.10",
31
+ "@topolo/mcp": "0.14.15",
32
+ "@topolo/sdk": "0.23.11",
33
33
  "commander": "^12.1.0"
34
34
  },
35
35
  "devDependencies": {