@topolo/cli 0.8.6 → 0.8.7

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 (2) hide show
  1. package/dist/index.js +19 -5
  2. package/package.json +4 -4
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/.pnpm/@topolo+sdk@0.11.4/node_modules/@topolo/sdk/dist/index.js
12
+ // node_modules/@topolo/sdk/dist/index.js
13
13
  function applyAuthHeaders(headers, credential) {
14
14
  if (credential.kind === "api_key") {
15
15
  headers.set("X-Api-Key", credential.apiKey);
@@ -72,6 +72,7 @@ var PUBLIC_ERROR_CODES = /* @__PURE__ */ new Set([
72
72
  "permission_denied",
73
73
  "rate_limited",
74
74
  "request_failed",
75
+ "request_timeout",
75
76
  "service_catalog_unavailable",
76
77
  "service_path_origin_mismatch",
77
78
  "service_required",
@@ -920,7 +921,7 @@ var TopoloClient = class _TopoloClient {
920
921
  this.serviceUrls = options.environment ? topoloServiceOrigins(options.serviceUrls, options.environment) : options.serviceUrls;
921
922
  this.appIds = options.appIds;
922
923
  this.requireConfirmForWrites = options.requireConfirmForWrites !== false;
923
- this.timeoutMs = options.timeoutMs ?? 3e4;
924
+ this.timeoutMs = options.timeoutMs ?? 12e4;
924
925
  this.fetchImpl = options.fetch ?? fetch;
925
926
  this.credentialProvider = options.credentialProvider;
926
927
  this.refreshCredential = options.refreshCredential;
@@ -991,7 +992,11 @@ var TopoloClient = class _TopoloClient {
991
992
  this.emit({ phase: "request", method, service: resolvedService.serviceKey, path: opts.path, url: urlStr, requestId });
992
993
  const fetchOnce = async () => {
993
994
  const controller = new AbortController();
994
- const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
995
+ let timedOut = false;
996
+ const timeoutId = setTimeout(() => {
997
+ timedOut = true;
998
+ controller.abort();
999
+ }, this.timeoutMs);
995
1000
  const signal = opts.signal ? mergeSignals(opts.signal, controller.signal) : controller.signal;
996
1001
  try {
997
1002
  return await this.fetchImpl(urlStr, {
@@ -1000,6 +1005,14 @@ var TopoloClient = class _TopoloClient {
1000
1005
  body: opts.rawBody ?? (opts.body !== void 0 ? JSON.stringify(opts.body) : null),
1001
1006
  signal
1002
1007
  });
1008
+ } catch (error) {
1009
+ if (timedOut) {
1010
+ throw new TopoloSdkError(
1011
+ "request_timeout",
1012
+ `Topolo request timed out after ${this.timeoutMs}ms. Verify current state before retrying a mutation.`
1013
+ );
1014
+ }
1015
+ throw error;
1003
1016
  } finally {
1004
1017
  clearTimeout(timeoutId);
1005
1018
  }
@@ -1025,7 +1038,7 @@ var TopoloClient = class _TopoloClient {
1025
1038
  url: urlStr,
1026
1039
  requestId,
1027
1040
  durationMs: Date.now() - startedAt,
1028
- error: "network_error"
1041
+ error: err instanceof TopoloSdkError ? err.code : "network_error"
1029
1042
  });
1030
1043
  throw err;
1031
1044
  }
@@ -2358,7 +2371,7 @@ function createTopolo(options) {
2358
2371
  };
2359
2372
  }
2360
2373
 
2361
- // ../../node_modules/.pnpm/@topolo+sdk@0.11.4/node_modules/@topolo/sdk/dist/node/credential-store.js
2374
+ // node_modules/@topolo/sdk/dist/node/credential-store.js
2362
2375
  import { mkdir, readFile, writeFile, chmod, rm, stat } from "fs/promises";
2363
2376
  import { existsSync } from "fs";
2364
2377
  import { homedir, platform } from "os";
@@ -2407,6 +2420,7 @@ var PUBLIC_ERROR_CODES2 = /* @__PURE__ */ new Set([
2407
2420
  "permission_denied",
2408
2421
  "rate_limited",
2409
2422
  "request_failed",
2423
+ "request_timeout",
2410
2424
  "service_catalog_unavailable",
2411
2425
  "service_path_origin_mismatch",
2412
2426
  "service_required",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@topolo/cli",
3
- "version": "0.8.6",
4
- "topoloPublishedVersion": "0.8.6",
3
+ "version": "0.8.7",
4
+ "topoloPublishedVersion": "0.8.7",
5
5
  "description": "Public command-line interface for Topolo customer organizations, developers, and agents.",
6
6
  "license": "UNLICENSED",
7
7
  "author": "Topolo",
@@ -25,8 +25,8 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@modelcontextprotocol/sdk": "^1.0.0",
28
- "@topolo/mcp": "0.11.4",
29
- "@topolo/sdk": "0.11.4",
28
+ "@topolo/mcp": "0.11.5",
29
+ "@topolo/sdk": "0.11.5",
30
30
  "commander": "^12.1.0"
31
31
  },
32
32
  "devDependencies": {