@topolo/cli 0.12.17 → 0.12.19
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 -5
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -463,9 +463,13 @@ 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
|
+
return options.preserveAgentGuidance === true && key === "agentGuidance" && isRecord(item) && item.schemaVersion === 1 && typeof item.kind === "string" && ["action-guide", "product-guide", "concept"].includes(item.kind);
|
|
470
|
+
}
|
|
468
471
|
async function protect(item, key = "") {
|
|
472
|
+
if (documentation(item, key)) return item;
|
|
469
473
|
if (isActionSecretReference(item)) return item;
|
|
470
474
|
if (Array.isArray(item) && /(?:backup|recovery)codes$/.test(key.toLowerCase().replace(/[^a-z0-9]/g, ""))) {
|
|
471
475
|
return Promise.all(item.map((child) => protect(child, key)));
|
|
@@ -480,13 +484,14 @@ async function protectActionResult(value, store) {
|
|
|
480
484
|
return Object.fromEntries(await Promise.all(Object.entries(item).map(async ([name, child]) => [name, await protect(child, name)])));
|
|
481
485
|
}
|
|
482
486
|
const protectedValue = await protect(value);
|
|
483
|
-
async function protectEmbedded(item) {
|
|
487
|
+
async function protectEmbedded(item, key = "") {
|
|
488
|
+
if (documentation(item, key)) return item;
|
|
484
489
|
if (typeof item === "string" && !isActionSecretReference(item) && maskActionSecrets(item, secrets) !== item) {
|
|
485
490
|
return store ? store.save(item) : maskActionSecrets(item, secrets);
|
|
486
491
|
}
|
|
487
|
-
if (Array.isArray(item)) return Promise.all(item.map(protectEmbedded));
|
|
492
|
+
if (Array.isArray(item)) return Promise.all(item.map((child) => protectEmbedded(child)));
|
|
488
493
|
if (!isRecord(item)) return item;
|
|
489
|
-
return Object.fromEntries(await Promise.all(Object.entries(item).map(async ([
|
|
494
|
+
return Object.fromEntries(await Promise.all(Object.entries(item).map(async ([key2, child]) => [key2, await protectEmbedded(child, key2)])));
|
|
490
495
|
}
|
|
491
496
|
return protectEmbedded(protectedValue);
|
|
492
497
|
}
|
|
@@ -692,6 +697,9 @@ var SUPPORTED_SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
692
697
|
"allOf",
|
|
693
698
|
"anyOf",
|
|
694
699
|
"oneOf",
|
|
700
|
+
"if",
|
|
701
|
+
"then",
|
|
702
|
+
"else",
|
|
695
703
|
"properties",
|
|
696
704
|
"required",
|
|
697
705
|
"additionalProperties",
|
|
@@ -731,6 +739,11 @@ function inspectSchema(schema, path, root, depth) {
|
|
|
731
739
|
if (typeof schema.$ref === "string" && !resolveLocalReference(root, schema.$ref)) {
|
|
732
740
|
return { path, code: "unsupported_schema_ref", message: `Cannot resolve schema reference ${schema.$ref}.` };
|
|
733
741
|
}
|
|
742
|
+
for (const keyword of ["if", "then", "else"]) {
|
|
743
|
+
if (Object.prototype.hasOwnProperty.call(schema, keyword) && typeof schema[keyword] !== "boolean" && !isRecord2(schema[keyword])) {
|
|
744
|
+
return { path: `${path}.${keyword}`, code: "invalid_conditional_schema", message: "Conditional schemas must be objects or booleans." };
|
|
745
|
+
}
|
|
746
|
+
}
|
|
734
747
|
const children = [];
|
|
735
748
|
if (isRecord2(schema.properties)) children.push(...Object.entries(schema.properties));
|
|
736
749
|
if (isRecord2(schema.$defs)) children.push(...Object.entries(schema.$defs));
|
|
@@ -739,6 +752,9 @@ function inspectSchema(schema, path, root, depth) {
|
|
|
739
752
|
["additionalProperties", schema.additionalProperties],
|
|
740
753
|
["propertyNames", schema.propertyNames],
|
|
741
754
|
["items", schema.items],
|
|
755
|
+
["if", schema.if],
|
|
756
|
+
["then", schema.then],
|
|
757
|
+
["else", schema.else],
|
|
742
758
|
...arraySchemaEntries("allOf", schema.allOf),
|
|
743
759
|
...arraySchemaEntries("anyOf", schema.anyOf),
|
|
744
760
|
...arraySchemaEntries("oneOf", schema.oneOf)
|
|
@@ -771,6 +787,15 @@ function validateNode(schema, value, path, root, errors, depth) {
|
|
|
771
787
|
if (isRecord2(candidate)) validateNode(candidate, value, path, root, errors, depth + 1);
|
|
772
788
|
}
|
|
773
789
|
}
|
|
790
|
+
if (Object.prototype.hasOwnProperty.call(schema, "if")) {
|
|
791
|
+
const matches = schema.if === true || isRecord2(schema.if) && candidateMatches(schema.if, value, root, depth);
|
|
792
|
+
const selected = matches ? schema.then : schema.else;
|
|
793
|
+
if (selected === false) {
|
|
794
|
+
errors.push({ path, code: "conditional_schema", message: "Value is rejected by the selected conditional schema." });
|
|
795
|
+
} else if (isRecord2(selected)) {
|
|
796
|
+
validateNode(selected, value, path, root, errors, depth + 1);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
774
799
|
if (Array.isArray(schema.anyOf) && !schema.anyOf.some((candidate) => candidateMatches(candidate, value, root, depth))) {
|
|
775
800
|
errors.push({ path, code: "any_of", message: "Value does not match any allowed schema." });
|
|
776
801
|
return;
|
|
@@ -2174,7 +2199,9 @@ var TopoloClient = class _TopoloClient {
|
|
|
2174
2199
|
} catch (error) {
|
|
2175
2200
|
throw maskActionSecretError(error, this.actionSecrets);
|
|
2176
2201
|
}
|
|
2177
|
-
return preserveSensitiveResult ? result : await protectActionResult(result, this.actionSecretStore
|
|
2202
|
+
return preserveSensitiveResult ? result : await protectActionResult(result, this.actionSecretStore, {
|
|
2203
|
+
preserveAgentGuidance: entry.appId === "app_topolo_docs"
|
|
2204
|
+
});
|
|
2178
2205
|
}
|
|
2179
2206
|
async releaseActionSecret(reference) {
|
|
2180
2207
|
if (!this.actionSecretStore) throw new TopoloSdkError("action_secret_store_required", "Protected action references require a secret store.");
|
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.
|
|
5
|
-
"topoloPublishedVersion": "0.12.
|
|
4
|
+
"version": "0.12.19",
|
|
5
|
+
"topoloPublishedVersion": "0.12.19",
|
|
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.
|
|
32
|
-
"@topolo/sdk": "0.23.
|
|
31
|
+
"@topolo/mcp": "0.14.11",
|
|
32
|
+
"@topolo/sdk": "0.23.6",
|
|
33
33
|
"commander": "^12.1.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|