@topolo/cli 0.12.19 → 0.12.21
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 +109 -64
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -10,6 +10,23 @@ 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
|
+
function record(value) {
|
|
14
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
function strings(value) {
|
|
17
|
+
return Array.isArray(value) && value.length > 0 && value.every((entry) => typeof entry === "string" && entry.trim().length > 0) && new Set(value).size === value.length;
|
|
18
|
+
}
|
|
19
|
+
function validTopoloActionAccessPolicy(value) {
|
|
20
|
+
if (!record(value) || Object.keys(value).some((key) => key !== "human" && key !== "service") || !value.human && !value.service) return false;
|
|
21
|
+
if (value.human !== void 0) {
|
|
22
|
+
const human = value.human;
|
|
23
|
+
if (!record(human) || Object.keys(human).some((key) => !["organizationId", "permissionAnyOf", "platformAccess"].includes(key)) || Object.keys(human).length === 0 || human.organizationId !== void 0 && (typeof human.organizationId !== "string" || !human.organizationId.trim()) || human.permissionAnyOf !== void 0 && !strings(human.permissionAnyOf) || human.platformAccess !== void 0 && !["platform_admin", "platform_super_admin"].includes(String(human.platformAccess))) return false;
|
|
24
|
+
}
|
|
25
|
+
if (value.service !== void 0) {
|
|
26
|
+
if (!record(value.service) || Object.keys(value.service).some((key) => key !== "scopeAnyOf") || !strings(value.service.scopeAnyOf)) return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
13
30
|
function applyAuthHeaders(headers, credential) {
|
|
14
31
|
if (credential.kind === "api_key") {
|
|
15
32
|
headers.set("X-Api-Key", credential.apiKey);
|
|
@@ -194,10 +211,10 @@ var TopoloPermissionError = class extends TopoloSdkError {
|
|
|
194
211
|
};
|
|
195
212
|
function extractTopoloServiceErrorCode(body) {
|
|
196
213
|
if (!body || typeof body !== "object" || Array.isArray(body)) return null;
|
|
197
|
-
const
|
|
198
|
-
const topLevel = canonicalTopoloServiceErrorCode(
|
|
214
|
+
const record4 = body;
|
|
215
|
+
const topLevel = canonicalTopoloServiceErrorCode(record4.code);
|
|
199
216
|
if (topLevel) return topLevel;
|
|
200
|
-
const nested =
|
|
217
|
+
const nested = record4.error;
|
|
201
218
|
const nestedString = canonicalTopoloServiceErrorCode(nested);
|
|
202
219
|
if (nestedString) return nestedString;
|
|
203
220
|
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
@@ -209,13 +226,13 @@ function extractTopoloServiceErrorCode(body) {
|
|
|
209
226
|
}
|
|
210
227
|
function extractTopoloServiceErrorMessage(body) {
|
|
211
228
|
if (!body || typeof body !== "object" || Array.isArray(body)) return void 0;
|
|
212
|
-
const
|
|
213
|
-
const nested =
|
|
229
|
+
const record4 = body;
|
|
230
|
+
const nested = record4.error;
|
|
214
231
|
const candidates = [];
|
|
215
232
|
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
216
233
|
candidates.push(nested.message);
|
|
217
234
|
}
|
|
218
|
-
candidates.push(
|
|
235
|
+
candidates.push(record4.message, record4.error_description);
|
|
219
236
|
if (typeof nested === "string" && !canonicalTopoloServiceErrorCode(nested)) candidates.push(nested);
|
|
220
237
|
for (const candidate of candidates) {
|
|
221
238
|
const message2 = sanitizeTopoloServiceMessage(candidate);
|
|
@@ -228,14 +245,14 @@ function serviceErrorCode(body, fallback) {
|
|
|
228
245
|
}
|
|
229
246
|
function extractTopoloServiceErrorDetails(body) {
|
|
230
247
|
if (!body || typeof body !== "object" || Array.isArray(body)) return void 0;
|
|
231
|
-
const
|
|
232
|
-
let candidate =
|
|
233
|
-
const nested =
|
|
248
|
+
const record4 = body;
|
|
249
|
+
let candidate = record4.details;
|
|
250
|
+
const nested = record4.error;
|
|
234
251
|
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
235
252
|
const nestedRecord = nested;
|
|
236
253
|
if (candidate === void 0) candidate = nestedRecord.details ?? nestedRecord;
|
|
237
254
|
}
|
|
238
|
-
if (candidate === void 0) candidate =
|
|
255
|
+
if (candidate === void 0) candidate = record4;
|
|
239
256
|
if (Array.isArray(candidate)) return validationIssueDetails(canonicalTopoloValidationIssues(candidate)) ?? void 0;
|
|
240
257
|
if (!candidate || typeof candidate !== "object") return void 0;
|
|
241
258
|
const source = candidate;
|
|
@@ -302,10 +319,10 @@ function canonicalTopoloValidationIssues(values) {
|
|
|
302
319
|
const issues = [];
|
|
303
320
|
for (const value of values) {
|
|
304
321
|
if (!value || typeof value !== "object" || Array.isArray(value)) continue;
|
|
305
|
-
const
|
|
306
|
-
const path = canonicalTopoloValidationPath(
|
|
322
|
+
const record4 = value;
|
|
323
|
+
const path = canonicalTopoloValidationPath(record4.field) ?? canonicalTopoloValidationPath(record4.path);
|
|
307
324
|
if (!path) continue;
|
|
308
|
-
const projected = issue(path,
|
|
325
|
+
const projected = issue(path, record4.message);
|
|
309
326
|
if (projected) issues.push(projected);
|
|
310
327
|
if (issues.length === SERVICE_ISSUE_LIMIT) break;
|
|
311
328
|
}
|
|
@@ -466,6 +483,7 @@ async function resolveActionSecrets(value, store, secrets) {
|
|
|
466
483
|
async function protectActionResult(value, store, options = {}) {
|
|
467
484
|
const secrets = /* @__PURE__ */ new Map();
|
|
468
485
|
function documentation(item, key) {
|
|
486
|
+
if (options.preserveActionSchemas === true && ["inputSchema", "outputSchema", "input_schema", "output_schema"].includes(key) && isRecord(item)) return true;
|
|
469
487
|
return options.preserveAgentGuidance === true && key === "agentGuidance" && isRecord(item) && item.schemaVersion === 1 && typeof item.kind === "string" && ["action-guide", "product-guide", "concept"].includes(item.kind);
|
|
470
488
|
}
|
|
471
489
|
async function protect(item, key = "") {
|
|
@@ -796,14 +814,25 @@ function validateNode(schema, value, path, root, errors, depth) {
|
|
|
796
814
|
validateNode(selected, value, path, root, errors, depth + 1);
|
|
797
815
|
}
|
|
798
816
|
}
|
|
799
|
-
if (Array.isArray(schema.anyOf)
|
|
800
|
-
|
|
801
|
-
|
|
817
|
+
if (Array.isArray(schema.anyOf)) {
|
|
818
|
+
const alternatives = [];
|
|
819
|
+
const matches = schema.anyOf.some((candidate) => {
|
|
820
|
+
const issues = candidateIssues(candidate, value, path, root, depth);
|
|
821
|
+
alternatives.push(issues);
|
|
822
|
+
return issues?.length === 0;
|
|
823
|
+
});
|
|
824
|
+
if (!matches) {
|
|
825
|
+
errors.push({ path, code: "any_of", message: "Value does not match any allowed schema." });
|
|
826
|
+
appendAlternativeIssues(alternatives, errors);
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
802
829
|
}
|
|
803
830
|
if (Array.isArray(schema.oneOf)) {
|
|
804
|
-
const
|
|
831
|
+
const alternatives = schema.oneOf.map((candidate) => candidateIssues(candidate, value, path, root, depth));
|
|
832
|
+
const matches = alternatives.filter((issues) => issues?.length === 0).length;
|
|
805
833
|
if (matches !== 1) {
|
|
806
834
|
errors.push({ path, code: "one_of", message: "Value must match exactly one allowed schema." });
|
|
835
|
+
if (matches === 0) appendAlternativeIssues(alternatives, errors);
|
|
807
836
|
return;
|
|
808
837
|
}
|
|
809
838
|
}
|
|
@@ -905,10 +934,22 @@ function validateNumber(schema, value, path, errors) {
|
|
|
905
934
|
}
|
|
906
935
|
}
|
|
907
936
|
function candidateMatches(candidate, value, root, depth) {
|
|
908
|
-
|
|
937
|
+
return candidateIssues(candidate, value, "$", root, depth)?.length === 0;
|
|
938
|
+
}
|
|
939
|
+
function candidateIssues(candidate, value, path, root, depth) {
|
|
940
|
+
if (!isRecord2(candidate)) return null;
|
|
909
941
|
const issues = [];
|
|
910
|
-
validateNode(candidate, value,
|
|
911
|
-
return issues
|
|
942
|
+
validateNode(candidate, value, path, root, issues, depth + 1);
|
|
943
|
+
return issues;
|
|
944
|
+
}
|
|
945
|
+
function appendAlternativeIssues(alternatives, errors) {
|
|
946
|
+
const seen = /* @__PURE__ */ new Set();
|
|
947
|
+
for (const issue22 of alternatives.flatMap((issues) => issues ?? [])) {
|
|
948
|
+
const key = JSON.stringify(issue22);
|
|
949
|
+
if (seen.has(key)) continue;
|
|
950
|
+
seen.add(key);
|
|
951
|
+
errors.push(issue22);
|
|
952
|
+
}
|
|
912
953
|
}
|
|
913
954
|
function resolveLocalReference(root, reference) {
|
|
914
955
|
if (!reference.startsWith("#/")) return null;
|
|
@@ -976,7 +1017,7 @@ var ActorEnvelopeValidationError = class extends Error {
|
|
|
976
1017
|
}
|
|
977
1018
|
};
|
|
978
1019
|
function parseActorEnvelope(value) {
|
|
979
|
-
const envelope =
|
|
1020
|
+
const envelope = record2(value, "actorEnvelope");
|
|
980
1021
|
exactKeys(envelope, [
|
|
981
1022
|
"schemaVersion",
|
|
982
1023
|
"organizationId",
|
|
@@ -1001,13 +1042,13 @@ function parseActorEnvelope(value) {
|
|
|
1001
1042
|
if (expiresAt && Date.parse(expiresAt) <= Date.parse(issuedAt)) {
|
|
1002
1043
|
fail("actorEnvelope.expiresAt", "must be later than issuedAt");
|
|
1003
1044
|
}
|
|
1004
|
-
const assuranceValue =
|
|
1045
|
+
const assuranceValue = record2(envelope.assurance, "actorEnvelope.assurance");
|
|
1005
1046
|
exactKeys(assuranceValue, ["level", "methods"], "actorEnvelope.assurance");
|
|
1006
1047
|
const assurance = {
|
|
1007
1048
|
level: member(assuranceValue.level, ASSURANCE_LEVELS, "actorEnvelope.assurance.level"),
|
|
1008
1049
|
methods: textArray(assuranceValue.methods, "actorEnvelope.assurance.methods")
|
|
1009
1050
|
};
|
|
1010
|
-
const actionValue =
|
|
1051
|
+
const actionValue = record2(envelope.action, "actorEnvelope.action");
|
|
1011
1052
|
exactKeys(actionValue, ["requestId", "actionId", "resourceType", "resourceId", "inputHash"], "actorEnvelope.action");
|
|
1012
1053
|
const inputHash = text(actionValue.inputHash, "actorEnvelope.action.inputHash");
|
|
1013
1054
|
if (!HASH_PATTERN.test(inputHash)) fail("actorEnvelope.action.inputHash", "must be a lowercase sha256 digest");
|
|
@@ -1077,7 +1118,7 @@ function canonicalJson(value) {
|
|
|
1077
1118
|
}
|
|
1078
1119
|
function parseAccountableSubject(value) {
|
|
1079
1120
|
const path = "actorEnvelope.accountableSubject";
|
|
1080
|
-
const subject =
|
|
1121
|
+
const subject = record2(value, path);
|
|
1081
1122
|
exactKeys(subject, ["principalType", "principalId", "displayName"], path);
|
|
1082
1123
|
return {
|
|
1083
1124
|
principalType: member(subject.principalType, ACCOUNTABLE_SUBJECT_TYPES, `${path}.principalType`),
|
|
@@ -1091,7 +1132,7 @@ async function sha256CanonicalValue(value) {
|
|
|
1091
1132
|
return `sha256:${Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
1092
1133
|
}
|
|
1093
1134
|
function parseIdentity(value, path) {
|
|
1094
|
-
const identity =
|
|
1135
|
+
const identity = record2(value, path);
|
|
1095
1136
|
exactKeys(identity, [
|
|
1096
1137
|
"principalType",
|
|
1097
1138
|
"principalId",
|
|
@@ -1117,7 +1158,7 @@ function parseIdentity(value, path) {
|
|
|
1117
1158
|
}
|
|
1118
1159
|
function parseDelegation(value) {
|
|
1119
1160
|
if (value === null) return null;
|
|
1120
|
-
const delegation =
|
|
1161
|
+
const delegation = record2(value, "actorEnvelope.delegation");
|
|
1121
1162
|
exactKeys(delegation, ["taskId", "runId", "lineage"], "actorEnvelope.delegation");
|
|
1122
1163
|
if (!Array.isArray(delegation.lineage) || delegation.lineage.length === 0 || delegation.lineage.length > 16) {
|
|
1123
1164
|
fail("actorEnvelope.delegation.lineage", "must contain between 1 and 16 hops");
|
|
@@ -1126,7 +1167,7 @@ function parseDelegation(value) {
|
|
|
1126
1167
|
taskId: text(delegation.taskId, "actorEnvelope.delegation.taskId"),
|
|
1127
1168
|
runId: text(delegation.runId, "actorEnvelope.delegation.runId"),
|
|
1128
1169
|
lineage: delegation.lineage.map((value2, index) => {
|
|
1129
|
-
const hop =
|
|
1170
|
+
const hop = record2(value2, `actorEnvelope.delegation.lineage[${index}]`);
|
|
1130
1171
|
exactKeys(hop, ["principalType", "principalId"], `actorEnvelope.delegation.lineage[${index}]`);
|
|
1131
1172
|
return {
|
|
1132
1173
|
principalType: member(hop.principalType, PRINCIPAL_TYPES, `actorEnvelope.delegation.lineage[${index}].principalType`),
|
|
@@ -1135,7 +1176,7 @@ function parseDelegation(value) {
|
|
|
1135
1176
|
})
|
|
1136
1177
|
};
|
|
1137
1178
|
}
|
|
1138
|
-
function
|
|
1179
|
+
function record2(value, path) {
|
|
1139
1180
|
if (!value || typeof value !== "object" || Array.isArray(value)) fail(path, "must be an object");
|
|
1140
1181
|
return value;
|
|
1141
1182
|
}
|
|
@@ -1945,14 +1986,14 @@ var TopoloClient = class _TopoloClient {
|
|
|
1945
1986
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
1946
1987
|
throw new TopoloSdkError("action_catalog_summary_unavailable", "Action catalog summary is unavailable.");
|
|
1947
1988
|
}
|
|
1948
|
-
const
|
|
1949
|
-
if (
|
|
1989
|
+
const record4 = raw;
|
|
1990
|
+
if (record4.algorithm !== "sha256-v1" || typeof record4.digest !== "string" || !/^[a-f0-9]{64}$/.test(record4.digest) || !Number.isSafeInteger(record4.actionCount) || Number(record4.actionCount) < 0) {
|
|
1950
1991
|
throw new TopoloSdkError("action_catalog_summary_unavailable", "Action catalog summary is invalid.");
|
|
1951
1992
|
}
|
|
1952
1993
|
return {
|
|
1953
1994
|
algorithm: "sha256-v1",
|
|
1954
|
-
digest:
|
|
1955
|
-
actionCount: Number(
|
|
1995
|
+
digest: record4.digest,
|
|
1996
|
+
actionCount: Number(record4.actionCount)
|
|
1956
1997
|
};
|
|
1957
1998
|
}
|
|
1958
1999
|
/** @deprecated Prefer searchActions() so callers retain the continuation cursor. */
|
|
@@ -2200,7 +2241,8 @@ var TopoloClient = class _TopoloClient {
|
|
|
2200
2241
|
throw maskActionSecretError(error, this.actionSecrets);
|
|
2201
2242
|
}
|
|
2202
2243
|
return preserveSensitiveResult ? result : await protectActionResult(result, this.actionSecretStore, {
|
|
2203
|
-
preserveAgentGuidance: entry.appId === "app_topolo_docs"
|
|
2244
|
+
preserveAgentGuidance: entry.appId === "app_topolo_docs",
|
|
2245
|
+
preserveActionSchemas: entry.appId === "app_topolo_developers" && entry.name === "apps.actions.list"
|
|
2204
2246
|
});
|
|
2205
2247
|
}
|
|
2206
2248
|
async releaseActionSecret(reference) {
|
|
@@ -2548,6 +2590,7 @@ function normalizeActionCatalogEntry(item) {
|
|
|
2548
2590
|
permissionName: pickActionString(a.permission_name) ?? pickActionString(a.permissionName) ?? "",
|
|
2549
2591
|
requiredPermission: pickActionString(a.required_permission) ?? pickActionString(a.requiredPermission) ?? "",
|
|
2550
2592
|
principalAccess: pickPrincipalAccess(a.principal_access ?? a.principalAccess),
|
|
2593
|
+
...validTopoloActionAccessPolicy(a.access_policy ?? a.accessPolicy) ? { accessPolicy: a.access_policy ?? a.accessPolicy } : {},
|
|
2551
2594
|
authorizationMode: pickAuthorizationMode(a.authorization_mode ?? a.authorizationMode),
|
|
2552
2595
|
allowedServices: stringArray(a.allowed_services ?? a.allowedServices),
|
|
2553
2596
|
inputSchema: plainObject(a.input_schema ?? a.inputSchema),
|
|
@@ -2565,7 +2608,7 @@ function isHttpMethod(value) {
|
|
|
2565
2608
|
return value === "GET" || value === "POST" || value === "PUT" || value === "PATCH" || value === "DELETE";
|
|
2566
2609
|
}
|
|
2567
2610
|
function pickPrincipalAccess(value) {
|
|
2568
|
-
return value === "platform_admin" || value === "platform_super_admin" ? value : null;
|
|
2611
|
+
return value === "platform_admin" || value === "platform_super_admin" || value === "platform_admin_or_service" || value === "platform_super_admin_or_service" ? value : null;
|
|
2569
2612
|
}
|
|
2570
2613
|
function pickActionString(value) {
|
|
2571
2614
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
@@ -2672,10 +2715,10 @@ function extractRequired(body) {
|
|
|
2672
2715
|
if (Array.isArray(maybe.required)) return canonicalTopoloRequired(maybe.required);
|
|
2673
2716
|
for (const nested of [maybe.details, maybe.error]) {
|
|
2674
2717
|
if (!nested || typeof nested !== "object" || Array.isArray(nested)) continue;
|
|
2675
|
-
const
|
|
2676
|
-
if (Array.isArray(
|
|
2677
|
-
if (
|
|
2678
|
-
const required =
|
|
2718
|
+
const record4 = nested;
|
|
2719
|
+
if (Array.isArray(record4.required)) return canonicalTopoloRequired(record4.required);
|
|
2720
|
+
if (record4.details && typeof record4.details === "object" && !Array.isArray(record4.details)) {
|
|
2721
|
+
const required = record4.details.required;
|
|
2679
2722
|
if (Array.isArray(required)) return canonicalTopoloRequired(required);
|
|
2680
2723
|
}
|
|
2681
2724
|
}
|
|
@@ -2704,6 +2747,8 @@ function compactActionCatalogEntry(action) {
|
|
|
2704
2747
|
requiresConfirmation: action.requiresConfirmation,
|
|
2705
2748
|
agentAccess: action.agentAccess ?? (action.requiresConfirmation ? "confirm" : action.readOnly ? "auto" : "confirm"),
|
|
2706
2749
|
requiredPermission: action.requiredPermission,
|
|
2750
|
+
...action.principalAccess ? { principalAccess: action.principalAccess } : {},
|
|
2751
|
+
...action.accessPolicy ? { accessPolicy: action.accessPolicy } : {},
|
|
2707
2752
|
requiredInput: required,
|
|
2708
2753
|
resourceType: action.agentContract?.resourceContext?.kind ?? (action.permissionName.startsWith("workspace:") ? "workspace" : null),
|
|
2709
2754
|
resultResourceType: action.agentContract?.resource?.kind ?? null,
|
|
@@ -2750,8 +2795,8 @@ function compactResultValue(value, depth, budget) {
|
|
|
2750
2795
|
return value.length > ACTION_RESULT_MAX_ITEMS ? { count: value.length, items, omittedItems: value.length - ACTION_RESULT_MAX_ITEMS } : items;
|
|
2751
2796
|
}
|
|
2752
2797
|
if (typeof value === "object") {
|
|
2753
|
-
const
|
|
2754
|
-
const allKeys = Object.keys(
|
|
2798
|
+
const record4 = value;
|
|
2799
|
+
const allKeys = Object.keys(record4);
|
|
2755
2800
|
const ranked = allKeys.sort((left, right) => resultKeyPriority(left) - resultKeyPriority(right));
|
|
2756
2801
|
const prioritized = ranked.filter((key) => resultKeyPriority(key) < 2);
|
|
2757
2802
|
const ordinary = ranked.filter((key) => resultKeyPriority(key) === 2);
|
|
@@ -2760,7 +2805,7 @@ function compactResultValue(value, depth, budget) {
|
|
|
2760
2805
|
...prioritized,
|
|
2761
2806
|
...ordinary.slice(0, ordinaryLimit)
|
|
2762
2807
|
].slice(0, ACTION_RESULT_MAX_KEYS);
|
|
2763
|
-
const compact = Object.fromEntries(keys.map((key) => [key, compactResultValue(
|
|
2808
|
+
const compact = Object.fromEntries(keys.map((key) => [key, compactResultValue(record4[key], depth + 1, budget)]));
|
|
2764
2809
|
if (allKeys.length > keys.length) compact["_omittedKeys"] = allKeys.length - keys.length;
|
|
2765
2810
|
return compact;
|
|
2766
2811
|
}
|
|
@@ -3675,10 +3720,10 @@ var TopoloAuthError2 = class extends TopoloSdkError2 {
|
|
|
3675
3720
|
};
|
|
3676
3721
|
function extractTopoloServiceErrorCode2(body) {
|
|
3677
3722
|
if (!body || typeof body !== "object" || Array.isArray(body)) return null;
|
|
3678
|
-
const
|
|
3679
|
-
const topLevel = canonicalTopoloServiceErrorCode2(
|
|
3723
|
+
const record3 = body;
|
|
3724
|
+
const topLevel = canonicalTopoloServiceErrorCode2(record3.code);
|
|
3680
3725
|
if (topLevel) return topLevel;
|
|
3681
|
-
const nested =
|
|
3726
|
+
const nested = record3.error;
|
|
3682
3727
|
const nestedString = canonicalTopoloServiceErrorCode2(nested);
|
|
3683
3728
|
if (nestedString) return nestedString;
|
|
3684
3729
|
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
@@ -3693,14 +3738,14 @@ function serviceErrorCode2(body, fallback) {
|
|
|
3693
3738
|
}
|
|
3694
3739
|
function extractTopoloServiceErrorDetails2(body) {
|
|
3695
3740
|
if (!body || typeof body !== "object" || Array.isArray(body)) return void 0;
|
|
3696
|
-
const
|
|
3697
|
-
let candidate =
|
|
3698
|
-
const nested =
|
|
3741
|
+
const record3 = body;
|
|
3742
|
+
let candidate = record3.details;
|
|
3743
|
+
const nested = record3.error;
|
|
3699
3744
|
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
3700
3745
|
const nestedRecord = nested;
|
|
3701
3746
|
if (candidate === void 0) candidate = nestedRecord.details ?? nestedRecord;
|
|
3702
3747
|
}
|
|
3703
|
-
if (candidate === void 0) candidate =
|
|
3748
|
+
if (candidate === void 0) candidate = record3;
|
|
3704
3749
|
if (Array.isArray(candidate)) return validationIssueDetails2(canonicalTopoloValidationIssues2(candidate)) ?? void 0;
|
|
3705
3750
|
if (!candidate || typeof candidate !== "object") return void 0;
|
|
3706
3751
|
const source = candidate;
|
|
@@ -3767,10 +3812,10 @@ function canonicalTopoloValidationIssues2(values) {
|
|
|
3767
3812
|
const issues = [];
|
|
3768
3813
|
for (const value of values) {
|
|
3769
3814
|
if (!value || typeof value !== "object" || Array.isArray(value)) continue;
|
|
3770
|
-
const
|
|
3771
|
-
const path = canonicalTopoloValidationPath2(
|
|
3815
|
+
const record3 = value;
|
|
3816
|
+
const path = canonicalTopoloValidationPath2(record3.field) ?? canonicalTopoloValidationPath2(record3.path);
|
|
3772
3817
|
if (!path) continue;
|
|
3773
|
-
const projected = issue2(path,
|
|
3818
|
+
const projected = issue2(path, record3.message);
|
|
3774
3819
|
if (projected) issues.push(projected);
|
|
3775
3820
|
if (issues.length === SERVICE_ISSUE_LIMIT2) break;
|
|
3776
3821
|
}
|
|
@@ -4174,18 +4219,18 @@ function createProtectedActionSecretStore(options) {
|
|
|
4174
4219
|
const key = await account(reference);
|
|
4175
4220
|
const encoded = await backend.get(key);
|
|
4176
4221
|
if (!encoded) throw new TopoloSdkError2("action_secret_unavailable", "Protected action reference is missing or belongs to another identity or environment.");
|
|
4177
|
-
let
|
|
4222
|
+
let record3;
|
|
4178
4223
|
try {
|
|
4179
|
-
|
|
4224
|
+
record3 = JSON.parse(encoded);
|
|
4180
4225
|
} catch {
|
|
4181
4226
|
throw new TopoloSdkError2("action_secret_invalid", "Protected action reference is corrupt.");
|
|
4182
4227
|
}
|
|
4183
|
-
if (!Number.isFinite(
|
|
4184
|
-
if (
|
|
4228
|
+
if (!Number.isFinite(record3?.expiresAt) || !Object.hasOwn(record3, "value")) throw new TopoloSdkError2("action_secret_invalid", "Protected action reference is corrupt.");
|
|
4229
|
+
if (record3.expiresAt <= now()) {
|
|
4185
4230
|
await backend.delete(key);
|
|
4186
4231
|
throw new TopoloSdkError2("action_secret_expired", "Protected action reference expired. Repeat the originating action if its contract permits.");
|
|
4187
4232
|
}
|
|
4188
|
-
return
|
|
4233
|
+
return record3.value;
|
|
4189
4234
|
},
|
|
4190
4235
|
async delete(reference) {
|
|
4191
4236
|
await backend.delete(await account(reference));
|
|
@@ -5373,9 +5418,9 @@ function externalApprovalHandoff(action, result) {
|
|
|
5373
5418
|
if (!result || typeof result !== "object" || Array.isArray(result)) return null;
|
|
5374
5419
|
const invocation = result.invocation;
|
|
5375
5420
|
if (!invocation || typeof invocation !== "object" || Array.isArray(invocation)) return null;
|
|
5376
|
-
const
|
|
5377
|
-
if (
|
|
5378
|
-
const approval =
|
|
5421
|
+
const record3 = invocation;
|
|
5422
|
+
if (record3.status !== "awaiting_approval") return null;
|
|
5423
|
+
const approval = record3.approval;
|
|
5379
5424
|
if (!approval || typeof approval !== "object" || Array.isArray(approval)) return null;
|
|
5380
5425
|
const handoff = approval;
|
|
5381
5426
|
if (typeof handoff.requestId !== "string" || typeof handoff.verificationUrl !== "string") return null;
|
|
@@ -7435,16 +7480,16 @@ var REVOKE_CREDENTIAL = "app_topolo_auth.principal_credentials.revoke";
|
|
|
7435
7480
|
var INSTALLATION_BOOTSTRAP_GRANT = "app_topolo_auth:identity";
|
|
7436
7481
|
function actionData(value) {
|
|
7437
7482
|
if (!value || typeof value !== "object") throw new Error("Topolo returned an invalid action response.");
|
|
7438
|
-
const
|
|
7439
|
-
const data =
|
|
7440
|
-
return data && typeof data === "object" ? data :
|
|
7483
|
+
const record3 = value;
|
|
7484
|
+
const data = record3.data;
|
|
7485
|
+
return data && typeof data === "object" ? data : record3;
|
|
7441
7486
|
}
|
|
7442
7487
|
function requiredRecord(value, name) {
|
|
7443
7488
|
if (!value || typeof value !== "object") throw new Error(`Topolo did not return ${name}.`);
|
|
7444
7489
|
return value;
|
|
7445
7490
|
}
|
|
7446
|
-
function requiredString(
|
|
7447
|
-
const value =
|
|
7491
|
+
function requiredString(record3, key) {
|
|
7492
|
+
const value = record3[key];
|
|
7448
7493
|
if (typeof value !== "string" || !value.trim()) throw new Error(`Topolo did not return ${key}.`);
|
|
7449
7494
|
return value;
|
|
7450
7495
|
}
|
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.21",
|
|
5
|
+
"topoloPublishedVersion": "0.12.21",
|
|
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.13",
|
|
32
|
+
"@topolo/sdk": "0.23.9",
|
|
33
33
|
"commander": "^12.1.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|