@topolo/cli 0.8.5 → 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.
- package/dist/index.js +33 -11
- 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
|
-
//
|
|
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 ??
|
|
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
|
-
|
|
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
|
}
|
|
@@ -2010,11 +2023,12 @@ function compactExample(input2) {
|
|
|
2010
2023
|
function compactActionValidation(actionId, validation) {
|
|
2011
2024
|
return { actionId, valid: validation.valid, errors: validation.errors };
|
|
2012
2025
|
}
|
|
2013
|
-
var ACTION_RESULT_MAX_DEPTH =
|
|
2014
|
-
var ACTION_RESULT_MAX_KEYS =
|
|
2015
|
-
var
|
|
2016
|
-
var
|
|
2017
|
-
var
|
|
2026
|
+
var ACTION_RESULT_MAX_DEPTH = 3;
|
|
2027
|
+
var ACTION_RESULT_MAX_KEYS = 12;
|
|
2028
|
+
var ACTION_RESULT_MAX_ORDINARY_KEYS = 5;
|
|
2029
|
+
var ACTION_RESULT_MAX_ITEMS = 3;
|
|
2030
|
+
var ACTION_RESULT_MAX_SCALARS = 60;
|
|
2031
|
+
var ACTION_RESULT_MAX_STRING = 256;
|
|
2018
2032
|
function resultKeyPriority(key) {
|
|
2019
2033
|
if (/^(id|requestId|status|state|url|slug|name|title|version)$/i.test(key)) return 0;
|
|
2020
2034
|
if (/(Id|Ids|Url|Uri|Status|State|Count|Total|Version|CreatedAt|UpdatedAt)$/i.test(key)) return 1;
|
|
@@ -2040,7 +2054,14 @@ function compactResultValue(value, depth, budget) {
|
|
|
2040
2054
|
if (typeof value === "object") {
|
|
2041
2055
|
const record = value;
|
|
2042
2056
|
const allKeys = Object.keys(record);
|
|
2043
|
-
const
|
|
2057
|
+
const ranked = allKeys.sort((left, right) => resultKeyPriority(left) - resultKeyPriority(right));
|
|
2058
|
+
const prioritized = ranked.filter((key) => resultKeyPriority(key) < 2);
|
|
2059
|
+
const ordinary = ranked.filter((key) => resultKeyPriority(key) === 2);
|
|
2060
|
+
const ordinaryLimit = depth === 0 ? ACTION_RESULT_MAX_ORDINARY_KEYS : prioritized.length ? 1 : ACTION_RESULT_MAX_ORDINARY_KEYS;
|
|
2061
|
+
const keys = [
|
|
2062
|
+
...prioritized,
|
|
2063
|
+
...ordinary.slice(0, ordinaryLimit)
|
|
2064
|
+
].slice(0, ACTION_RESULT_MAX_KEYS);
|
|
2044
2065
|
const compact = Object.fromEntries(keys.map((key) => [key, compactResultValue(record[key], depth + 1, budget)]));
|
|
2045
2066
|
if (allKeys.length > keys.length) compact["_omittedKeys"] = allKeys.length - keys.length;
|
|
2046
2067
|
return compact;
|
|
@@ -2350,7 +2371,7 @@ function createTopolo(options) {
|
|
|
2350
2371
|
};
|
|
2351
2372
|
}
|
|
2352
2373
|
|
|
2353
|
-
//
|
|
2374
|
+
// node_modules/@topolo/sdk/dist/node/credential-store.js
|
|
2354
2375
|
import { mkdir, readFile, writeFile, chmod, rm, stat } from "fs/promises";
|
|
2355
2376
|
import { existsSync } from "fs";
|
|
2356
2377
|
import { homedir, platform } from "os";
|
|
@@ -2399,6 +2420,7 @@ var PUBLIC_ERROR_CODES2 = /* @__PURE__ */ new Set([
|
|
|
2399
2420
|
"permission_denied",
|
|
2400
2421
|
"rate_limited",
|
|
2401
2422
|
"request_failed",
|
|
2423
|
+
"request_timeout",
|
|
2402
2424
|
"service_catalog_unavailable",
|
|
2403
2425
|
"service_path_origin_mismatch",
|
|
2404
2426
|
"service_required",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/cli",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"topoloPublishedVersion": "0.8.
|
|
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.
|
|
29
|
-
"@topolo/sdk": "0.11.
|
|
28
|
+
"@topolo/mcp": "0.11.5",
|
|
29
|
+
"@topolo/sdk": "0.11.5",
|
|
30
30
|
"commander": "^12.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|