@topolo/cli 0.12.21 → 0.12.23

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 +37 -35
  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
@@ -9,7 +9,7 @@ import { platform as platform2 } from "os";
9
9
  import { createInterface } from "readline/promises";
10
10
  import { stdin as input } from "process";
11
11
 
12
- // node_modules/@topolo/sdk/dist/index.js
12
+ // node_modules/.pnpm/@topolo+sdk@0.23.10/node_modules/@topolo/sdk/dist/index.js
13
13
  function record(value) {
14
14
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15
15
  }
@@ -484,6 +484,7 @@ async function protectActionResult(value, store, options = {}) {
484
484
  const secrets = /* @__PURE__ */ new Map();
485
485
  function documentation(item, key) {
486
486
  if (options.preserveActionSchemas === true && ["inputSchema", "outputSchema", "input_schema", "output_schema"].includes(key) && isRecord(item)) return true;
487
+ if (options.preserveActionContracts === true && ["agentContract", "agent_contract"].includes(key) && isRecord(item)) return true;
487
488
  return options.preserveAgentGuidance === true && key === "agentGuidance" && isRecord(item) && item.schemaVersion === 1 && typeof item.kind === "string" && ["action-guide", "product-guide", "concept"].includes(item.kind);
488
489
  }
489
490
  async function protect(item, key = "") {
@@ -2242,7 +2243,8 @@ var TopoloClient = class _TopoloClient {
2242
2243
  }
2243
2244
  return preserveSensitiveResult ? result : await protectActionResult(result, this.actionSecretStore, {
2244
2245
  preserveAgentGuidance: entry.appId === "app_topolo_docs",
2245
- preserveActionSchemas: entry.appId === "app_topolo_developers" && entry.name === "apps.actions.list"
2246
+ preserveActionSchemas: entry.appId === "app_topolo_developers" && entry.name === "apps.actions.list",
2247
+ preserveActionContracts: entry.appId === "app_topolo_developers" && entry.name === "apps.actions.list"
2246
2248
  });
2247
2249
  }
2248
2250
  async releaseActionSecret(reference) {
@@ -3569,7 +3571,39 @@ function createTopolo(options) {
3569
3571
  };
3570
3572
  }
3571
3573
 
3572
- // node_modules/@topolo/sdk/dist/node/credential-store.js
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
+
3606
+ // node_modules/.pnpm/@topolo+sdk@0.23.10/node_modules/@topolo/sdk/dist/node/credential-store.js
3573
3607
  import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2, chmod as chmod2, rm as rm2, stat } from "fs/promises";
3574
3608
  import { existsSync as existsSync2 } from "fs";
3575
3609
  import { homedir as homedir2, platform } from "os";
@@ -4971,38 +5005,6 @@ function startSpinner() {
4971
5005
  }
4972
5006
  };
4973
5007
  }
4974
- async function pollUntilApproved(params) {
4975
- let interval = Math.max(params.intervalSeconds, 1);
4976
- while (Date.now() < params.expiresAtMs) {
4977
- await sleep(interval * 1e3);
4978
- try {
4979
- const token = await params.oauth.pollDeviceToken({
4980
- clientId: params.clientId,
4981
- deviceCode: params.deviceCode
4982
- });
4983
- return token;
4984
- } catch (err) {
4985
- if (err instanceof TopoloAuthError) {
4986
- if (err.code === "authorization_pending") continue;
4987
- if (err.code === "slow_down") {
4988
- interval += 2;
4989
- continue;
4990
- }
4991
- if (err.code === "access_denied") {
4992
- throw new Error("Authorization was denied.");
4993
- }
4994
- if (err.code === "expired_token") {
4995
- throw new Error("Device code expired. Run `topolo auth login` again.");
4996
- }
4997
- }
4998
- throw err;
4999
- }
5000
- }
5001
- throw new Error("Device code expired. Run `topolo auth login` again.");
5002
- }
5003
- function sleep(ms) {
5004
- return new Promise((resolve3) => setTimeout(resolve3, ms));
5005
- }
5006
5008
 
5007
5009
  // src/client.ts
5008
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.21",
5
- "topoloPublishedVersion": "0.12.21",
4
+ "version": "0.12.23",
5
+ "topoloPublishedVersion": "0.12.23",
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.13",
32
- "@topolo/sdk": "0.23.9",
31
+ "@topolo/mcp": "0.14.14",
32
+ "@topolo/sdk": "0.23.10",
33
33
  "commander": "^12.1.0"
34
34
  },
35
35
  "devDependencies": {