@topolo/cli 0.9.0 → 0.9.1

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 +18 -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.7/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);
@@ -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, bytesToBase64(bytes), input2, options);
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 bytesToBase64(bytes) {
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 parsed = contentType.includes("application/json") ? await res.json().catch(() => null) : await res.text().catch(() => null);
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}`);
@@ -2371,7 +2384,7 @@ function createTopolo(options) {
2371
2384
  };
2372
2385
  }
2373
2386
 
2374
- // ../../node_modules/.pnpm/@topolo+sdk@0.11.7/node_modules/@topolo/sdk/dist/node/credential-store.js
2387
+ // node_modules/@topolo/sdk/dist/node/credential-store.js
2375
2388
  import { mkdir, readFile, writeFile, chmod, rm, stat } from "fs/promises";
2376
2389
  import { existsSync } from "fs";
2377
2390
  import { homedir, platform } from "os";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@topolo/cli",
3
- "version": "0.9.0",
4
- "topoloPublishedVersion": "0.9.0",
3
+ "version": "0.9.1",
4
+ "topoloPublishedVersion": "0.9.1",
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.7",
29
- "@topolo/sdk": "0.11.7",
28
+ "@topolo/mcp": "0.11.8",
29
+ "@topolo/sdk": "0.11.8",
30
30
  "commander": "^12.1.0"
31
31
  },
32
32
  "devDependencies": {