@topolo/cli 0.12.18 → 0.12.20

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 +46 -14
  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/@topolo/sdk/dist/index.js
12
+ // node_modules/.pnpm/@topolo+sdk@0.23.8/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);
@@ -463,9 +463,14 @@ async function resolveActionSecrets(value, store, secrets) {
463
463
  if (!isRecord(value)) return value;
464
464
  return Object.fromEntries(await Promise.all(Object.entries(value).map(async ([key, item]) => [key, await resolveActionSecrets(item, store, secrets)])));
465
465
  }
466
- async function protectActionResult(value, store) {
466
+ async function protectActionResult(value, store, options = {}) {
467
467
  const secrets = /* @__PURE__ */ new Map();
468
+ function documentation(item, key) {
469
+ if (options.preserveActionSchemas === true && ["inputSchema", "outputSchema", "input_schema", "output_schema"].includes(key) && isRecord(item)) return true;
470
+ return options.preserveAgentGuidance === true && key === "agentGuidance" && isRecord(item) && item.schemaVersion === 1 && typeof item.kind === "string" && ["action-guide", "product-guide", "concept"].includes(item.kind);
471
+ }
468
472
  async function protect(item, key = "") {
473
+ if (documentation(item, key)) return item;
469
474
  if (isActionSecretReference(item)) return item;
470
475
  if (Array.isArray(item) && /(?:backup|recovery)codes$/.test(key.toLowerCase().replace(/[^a-z0-9]/g, ""))) {
471
476
  return Promise.all(item.map((child) => protect(child, key)));
@@ -480,13 +485,14 @@ async function protectActionResult(value, store) {
480
485
  return Object.fromEntries(await Promise.all(Object.entries(item).map(async ([name, child]) => [name, await protect(child, name)])));
481
486
  }
482
487
  const protectedValue = await protect(value);
483
- async function protectEmbedded(item) {
488
+ async function protectEmbedded(item, key = "") {
489
+ if (documentation(item, key)) return item;
484
490
  if (typeof item === "string" && !isActionSecretReference(item) && maskActionSecrets(item, secrets) !== item) {
485
491
  return store ? store.save(item) : maskActionSecrets(item, secrets);
486
492
  }
487
- if (Array.isArray(item)) return Promise.all(item.map(protectEmbedded));
493
+ if (Array.isArray(item)) return Promise.all(item.map((child) => protectEmbedded(child)));
488
494
  if (!isRecord(item)) return item;
489
- return Object.fromEntries(await Promise.all(Object.entries(item).map(async ([key, child]) => [key, await protectEmbedded(child)])));
495
+ return Object.fromEntries(await Promise.all(Object.entries(item).map(async ([key2, child]) => [key2, await protectEmbedded(child, key2)])));
490
496
  }
491
497
  return protectEmbedded(protectedValue);
492
498
  }
@@ -791,14 +797,25 @@ function validateNode(schema, value, path, root, errors, depth) {
791
797
  validateNode(selected, value, path, root, errors, depth + 1);
792
798
  }
793
799
  }
794
- if (Array.isArray(schema.anyOf) && !schema.anyOf.some((candidate) => candidateMatches(candidate, value, root, depth))) {
795
- errors.push({ path, code: "any_of", message: "Value does not match any allowed schema." });
796
- return;
800
+ if (Array.isArray(schema.anyOf)) {
801
+ const alternatives = [];
802
+ const matches = schema.anyOf.some((candidate) => {
803
+ const issues = candidateIssues(candidate, value, path, root, depth);
804
+ alternatives.push(issues);
805
+ return issues?.length === 0;
806
+ });
807
+ if (!matches) {
808
+ errors.push({ path, code: "any_of", message: "Value does not match any allowed schema." });
809
+ appendAlternativeIssues(alternatives, errors);
810
+ return;
811
+ }
797
812
  }
798
813
  if (Array.isArray(schema.oneOf)) {
799
- const matches = schema.oneOf.filter((candidate) => candidateMatches(candidate, value, root, depth)).length;
814
+ const alternatives = schema.oneOf.map((candidate) => candidateIssues(candidate, value, path, root, depth));
815
+ const matches = alternatives.filter((issues) => issues?.length === 0).length;
800
816
  if (matches !== 1) {
801
817
  errors.push({ path, code: "one_of", message: "Value must match exactly one allowed schema." });
818
+ if (matches === 0) appendAlternativeIssues(alternatives, errors);
802
819
  return;
803
820
  }
804
821
  }
@@ -900,10 +917,22 @@ function validateNumber(schema, value, path, errors) {
900
917
  }
901
918
  }
902
919
  function candidateMatches(candidate, value, root, depth) {
903
- if (!isRecord2(candidate)) return false;
920
+ return candidateIssues(candidate, value, "$", root, depth)?.length === 0;
921
+ }
922
+ function candidateIssues(candidate, value, path, root, depth) {
923
+ if (!isRecord2(candidate)) return null;
904
924
  const issues = [];
905
- validateNode(candidate, value, "$", root, issues, depth + 1);
906
- return issues.length === 0;
925
+ validateNode(candidate, value, path, root, issues, depth + 1);
926
+ return issues;
927
+ }
928
+ function appendAlternativeIssues(alternatives, errors) {
929
+ const seen = /* @__PURE__ */ new Set();
930
+ for (const issue22 of alternatives.flatMap((issues) => issues ?? [])) {
931
+ const key = JSON.stringify(issue22);
932
+ if (seen.has(key)) continue;
933
+ seen.add(key);
934
+ errors.push(issue22);
935
+ }
907
936
  }
908
937
  function resolveLocalReference(root, reference) {
909
938
  if (!reference.startsWith("#/")) return null;
@@ -2194,7 +2223,10 @@ var TopoloClient = class _TopoloClient {
2194
2223
  } catch (error) {
2195
2224
  throw maskActionSecretError(error, this.actionSecrets);
2196
2225
  }
2197
- return preserveSensitiveResult ? result : await protectActionResult(result, this.actionSecretStore);
2226
+ return preserveSensitiveResult ? result : await protectActionResult(result, this.actionSecretStore, {
2227
+ preserveAgentGuidance: entry.appId === "app_topolo_docs",
2228
+ preserveActionSchemas: entry.appId === "app_topolo_developers" && entry.name === "apps.actions.list"
2229
+ });
2198
2230
  }
2199
2231
  async releaseActionSecret(reference) {
2200
2232
  if (!this.actionSecretStore) throw new TopoloSdkError("action_secret_store_required", "Protected action references require a secret store.");
@@ -3517,7 +3549,7 @@ function createTopolo(options) {
3517
3549
  };
3518
3550
  }
3519
3551
 
3520
- // node_modules/@topolo/sdk/dist/node/credential-store.js
3552
+ // node_modules/.pnpm/@topolo+sdk@0.23.8/node_modules/@topolo/sdk/dist/node/credential-store.js
3521
3553
  import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2, chmod as chmod2, rm as rm2, stat } from "fs/promises";
3522
3554
  import { existsSync as existsSync2 } from "fs";
3523
3555
  import { homedir as homedir2, platform } from "os";
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.18",
5
- "topoloPublishedVersion": "0.12.18",
4
+ "version": "0.12.20",
5
+ "topoloPublishedVersion": "0.12.20",
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.10",
32
- "@topolo/sdk": "0.23.5",
31
+ "@topolo/mcp": "0.14.12",
32
+ "@topolo/sdk": "0.23.8",
33
33
  "commander": "^12.1.0"
34
34
  },
35
35
  "devDependencies": {