@topolo/cli 0.9.0 → 0.9.2
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 +32 -6
- 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);
|
|
@@ -730,7 +730,7 @@ function prepareTopoloActionUploadInput(contractValue, content, input2, options)
|
|
|
730
730
|
if (bytes.byteLength > contract.maxBytes) {
|
|
731
731
|
throw new TopoloSdkError("upload_too_large", `Upload content exceeds the ${contract.maxBytes}-byte action limit.`);
|
|
732
732
|
}
|
|
733
|
-
return mapUploadInput(contract,
|
|
733
|
+
return mapUploadInput(contract, encodeTopoloActionBase64(bytes), input2, options);
|
|
734
734
|
}
|
|
735
735
|
function prepareTopoloActionBase64UploadInput(contractValue, contentBase64, input2, options) {
|
|
736
736
|
const contract = parseTopoloActionUploadContract(contractValue);
|
|
@@ -866,7 +866,7 @@ function requiredField(value, name) {
|
|
|
866
866
|
function matchesContentType(contentType, accepted) {
|
|
867
867
|
return accepted.some((candidate) => candidate === "*/*" || candidate === contentType || candidate.endsWith("/*") && contentType.startsWith(candidate.slice(0, -1)));
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function encodeTopoloActionBase64(bytes) {
|
|
870
870
|
let binary = "";
|
|
871
871
|
const chunkSize = 32768;
|
|
872
872
|
for (let offset = 0; offset < bytes.length; offset += chunkSize) {
|
|
@@ -1043,7 +1043,20 @@ var TopoloClient = class _TopoloClient {
|
|
|
1043
1043
|
throw err;
|
|
1044
1044
|
}
|
|
1045
1045
|
const contentType = res.headers.get("Content-Type") ?? "";
|
|
1046
|
-
const
|
|
1046
|
+
const normalizedContentType = contentType.split(";", 1)[0]?.trim().toLowerCase() ?? "";
|
|
1047
|
+
let parsed;
|
|
1048
|
+
if (normalizedContentType === "application/json" || normalizedContentType.endsWith("+json")) {
|
|
1049
|
+
parsed = await res.json().catch(() => null);
|
|
1050
|
+
} else if (!res.ok || !normalizedContentType || normalizedContentType.startsWith("text/")) {
|
|
1051
|
+
parsed = await res.text().catch(() => null);
|
|
1052
|
+
} else {
|
|
1053
|
+
const bytes = new Uint8Array(await res.arrayBuffer());
|
|
1054
|
+
parsed = {
|
|
1055
|
+
contentType: normalizedContentType,
|
|
1056
|
+
contentLength: bytes.byteLength,
|
|
1057
|
+
contentBase64: encodeTopoloActionBase64(bytes)
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1047
1060
|
if (!res.ok) {
|
|
1048
1061
|
const durationMs = Date.now() - startedAt;
|
|
1049
1062
|
const message2 = describeError(parsed, `HTTP ${res.status}`);
|
|
@@ -1594,7 +1607,7 @@ var TopoloClient = class _TopoloClient {
|
|
|
1594
1607
|
}
|
|
1595
1608
|
const mapped = mapActionInput(entry, input2);
|
|
1596
1609
|
const service = entry.appSlug || entry.appId;
|
|
1597
|
-
|
|
1610
|
+
const result = await this.request({
|
|
1598
1611
|
service,
|
|
1599
1612
|
...entry.apiBaseUrl ? { baseUrl: entry.apiBaseUrl } : {},
|
|
1600
1613
|
method: entry.method,
|
|
@@ -1608,6 +1621,7 @@ var TopoloClient = class _TopoloClient {
|
|
|
1608
1621
|
},
|
|
1609
1622
|
confirm: options.confirm === true || entry.readOnly && !entry.destructive && !entry.requiresConfirmation
|
|
1610
1623
|
});
|
|
1624
|
+
return redactActionResult(result);
|
|
1611
1625
|
}
|
|
1612
1626
|
/**
|
|
1613
1627
|
* Introspect the current credential. Returns the caller's resolved identity,
|
|
@@ -1731,6 +1745,18 @@ function readOptionalString(value) {
|
|
|
1731
1745
|
function isRecord3(value) {
|
|
1732
1746
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1733
1747
|
}
|
|
1748
|
+
function redactActionResult(value) {
|
|
1749
|
+
if (Array.isArray(value)) return value.map(redactActionResult);
|
|
1750
|
+
if (!isRecord3(value)) return value;
|
|
1751
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
1752
|
+
key,
|
|
1753
|
+
isSensitiveActionResultKey(key) ? "[REDACTED]" : redactActionResult(item)
|
|
1754
|
+
]));
|
|
1755
|
+
}
|
|
1756
|
+
function isSensitiveActionResultKey(key) {
|
|
1757
|
+
const normalized = key.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
1758
|
+
return ["authorization", "cookie", "setcookie", "proxyauthorization", "capability"].includes(normalized) || /(token|secret|password|privatekey|apikey)$/.test(normalized);
|
|
1759
|
+
}
|
|
1734
1760
|
function resolveConfiguredServiceUrl(slug, serviceUrls) {
|
|
1735
1761
|
for (const serviceKey of serviceKeyCandidates2(slug)) {
|
|
1736
1762
|
const configured = serviceUrls?.[serviceKey];
|
|
@@ -2371,7 +2397,7 @@ function createTopolo(options) {
|
|
|
2371
2397
|
};
|
|
2372
2398
|
}
|
|
2373
2399
|
|
|
2374
|
-
//
|
|
2400
|
+
// node_modules/@topolo/sdk/dist/node/credential-store.js
|
|
2375
2401
|
import { mkdir, readFile, writeFile, chmod, rm, stat } from "fs/promises";
|
|
2376
2402
|
import { existsSync } from "fs";
|
|
2377
2403
|
import { homedir, platform } from "os";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/cli",
|
|
3
|
-
"version": "0.9.
|
|
4
|
-
"topoloPublishedVersion": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
|
+
"topoloPublishedVersion": "0.9.2",
|
|
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.9",
|
|
29
|
+
"@topolo/sdk": "0.11.9",
|
|
30
30
|
"commander": "^12.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|