@topolo/cli 0.12.20 → 0.12.22
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 +81 -59
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -9,7 +9,24 @@ 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
|
|
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
|
}
|
|
@@ -467,6 +484,7 @@ async function protectActionResult(value, store, options = {}) {
|
|
|
467
484
|
const secrets = /* @__PURE__ */ new Map();
|
|
468
485
|
function documentation(item, key) {
|
|
469
486
|
if (options.preserveActionSchemas === true && ["inputSchema", "outputSchema", "input_schema", "output_schema"].includes(key) && isRecord(item)) return true;
|
|
487
|
+
if (options.preserveActionContracts === true && ["agentContract", "agent_contract"].includes(key) && isRecord(item)) return true;
|
|
470
488
|
return options.preserveAgentGuidance === true && key === "agentGuidance" && isRecord(item) && item.schemaVersion === 1 && typeof item.kind === "string" && ["action-guide", "product-guide", "concept"].includes(item.kind);
|
|
471
489
|
}
|
|
472
490
|
async function protect(item, key = "") {
|
|
@@ -1000,7 +1018,7 @@ var ActorEnvelopeValidationError = class extends Error {
|
|
|
1000
1018
|
}
|
|
1001
1019
|
};
|
|
1002
1020
|
function parseActorEnvelope(value) {
|
|
1003
|
-
const envelope =
|
|
1021
|
+
const envelope = record2(value, "actorEnvelope");
|
|
1004
1022
|
exactKeys(envelope, [
|
|
1005
1023
|
"schemaVersion",
|
|
1006
1024
|
"organizationId",
|
|
@@ -1025,13 +1043,13 @@ function parseActorEnvelope(value) {
|
|
|
1025
1043
|
if (expiresAt && Date.parse(expiresAt) <= Date.parse(issuedAt)) {
|
|
1026
1044
|
fail("actorEnvelope.expiresAt", "must be later than issuedAt");
|
|
1027
1045
|
}
|
|
1028
|
-
const assuranceValue =
|
|
1046
|
+
const assuranceValue = record2(envelope.assurance, "actorEnvelope.assurance");
|
|
1029
1047
|
exactKeys(assuranceValue, ["level", "methods"], "actorEnvelope.assurance");
|
|
1030
1048
|
const assurance = {
|
|
1031
1049
|
level: member(assuranceValue.level, ASSURANCE_LEVELS, "actorEnvelope.assurance.level"),
|
|
1032
1050
|
methods: textArray(assuranceValue.methods, "actorEnvelope.assurance.methods")
|
|
1033
1051
|
};
|
|
1034
|
-
const actionValue =
|
|
1052
|
+
const actionValue = record2(envelope.action, "actorEnvelope.action");
|
|
1035
1053
|
exactKeys(actionValue, ["requestId", "actionId", "resourceType", "resourceId", "inputHash"], "actorEnvelope.action");
|
|
1036
1054
|
const inputHash = text(actionValue.inputHash, "actorEnvelope.action.inputHash");
|
|
1037
1055
|
if (!HASH_PATTERN.test(inputHash)) fail("actorEnvelope.action.inputHash", "must be a lowercase sha256 digest");
|
|
@@ -1101,7 +1119,7 @@ function canonicalJson(value) {
|
|
|
1101
1119
|
}
|
|
1102
1120
|
function parseAccountableSubject(value) {
|
|
1103
1121
|
const path = "actorEnvelope.accountableSubject";
|
|
1104
|
-
const subject =
|
|
1122
|
+
const subject = record2(value, path);
|
|
1105
1123
|
exactKeys(subject, ["principalType", "principalId", "displayName"], path);
|
|
1106
1124
|
return {
|
|
1107
1125
|
principalType: member(subject.principalType, ACCOUNTABLE_SUBJECT_TYPES, `${path}.principalType`),
|
|
@@ -1115,7 +1133,7 @@ async function sha256CanonicalValue(value) {
|
|
|
1115
1133
|
return `sha256:${Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
1116
1134
|
}
|
|
1117
1135
|
function parseIdentity(value, path) {
|
|
1118
|
-
const identity =
|
|
1136
|
+
const identity = record2(value, path);
|
|
1119
1137
|
exactKeys(identity, [
|
|
1120
1138
|
"principalType",
|
|
1121
1139
|
"principalId",
|
|
@@ -1141,7 +1159,7 @@ function parseIdentity(value, path) {
|
|
|
1141
1159
|
}
|
|
1142
1160
|
function parseDelegation(value) {
|
|
1143
1161
|
if (value === null) return null;
|
|
1144
|
-
const delegation =
|
|
1162
|
+
const delegation = record2(value, "actorEnvelope.delegation");
|
|
1145
1163
|
exactKeys(delegation, ["taskId", "runId", "lineage"], "actorEnvelope.delegation");
|
|
1146
1164
|
if (!Array.isArray(delegation.lineage) || delegation.lineage.length === 0 || delegation.lineage.length > 16) {
|
|
1147
1165
|
fail("actorEnvelope.delegation.lineage", "must contain between 1 and 16 hops");
|
|
@@ -1150,7 +1168,7 @@ function parseDelegation(value) {
|
|
|
1150
1168
|
taskId: text(delegation.taskId, "actorEnvelope.delegation.taskId"),
|
|
1151
1169
|
runId: text(delegation.runId, "actorEnvelope.delegation.runId"),
|
|
1152
1170
|
lineage: delegation.lineage.map((value2, index) => {
|
|
1153
|
-
const hop =
|
|
1171
|
+
const hop = record2(value2, `actorEnvelope.delegation.lineage[${index}]`);
|
|
1154
1172
|
exactKeys(hop, ["principalType", "principalId"], `actorEnvelope.delegation.lineage[${index}]`);
|
|
1155
1173
|
return {
|
|
1156
1174
|
principalType: member(hop.principalType, PRINCIPAL_TYPES, `actorEnvelope.delegation.lineage[${index}].principalType`),
|
|
@@ -1159,7 +1177,7 @@ function parseDelegation(value) {
|
|
|
1159
1177
|
})
|
|
1160
1178
|
};
|
|
1161
1179
|
}
|
|
1162
|
-
function
|
|
1180
|
+
function record2(value, path) {
|
|
1163
1181
|
if (!value || typeof value !== "object" || Array.isArray(value)) fail(path, "must be an object");
|
|
1164
1182
|
return value;
|
|
1165
1183
|
}
|
|
@@ -1969,14 +1987,14 @@ var TopoloClient = class _TopoloClient {
|
|
|
1969
1987
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
1970
1988
|
throw new TopoloSdkError("action_catalog_summary_unavailable", "Action catalog summary is unavailable.");
|
|
1971
1989
|
}
|
|
1972
|
-
const
|
|
1973
|
-
if (
|
|
1990
|
+
const record4 = raw;
|
|
1991
|
+
if (record4.algorithm !== "sha256-v1" || typeof record4.digest !== "string" || !/^[a-f0-9]{64}$/.test(record4.digest) || !Number.isSafeInteger(record4.actionCount) || Number(record4.actionCount) < 0) {
|
|
1974
1992
|
throw new TopoloSdkError("action_catalog_summary_unavailable", "Action catalog summary is invalid.");
|
|
1975
1993
|
}
|
|
1976
1994
|
return {
|
|
1977
1995
|
algorithm: "sha256-v1",
|
|
1978
|
-
digest:
|
|
1979
|
-
actionCount: Number(
|
|
1996
|
+
digest: record4.digest,
|
|
1997
|
+
actionCount: Number(record4.actionCount)
|
|
1980
1998
|
};
|
|
1981
1999
|
}
|
|
1982
2000
|
/** @deprecated Prefer searchActions() so callers retain the continuation cursor. */
|
|
@@ -2225,7 +2243,8 @@ var TopoloClient = class _TopoloClient {
|
|
|
2225
2243
|
}
|
|
2226
2244
|
return preserveSensitiveResult ? result : await protectActionResult(result, this.actionSecretStore, {
|
|
2227
2245
|
preserveAgentGuidance: entry.appId === "app_topolo_docs",
|
|
2228
|
-
preserveActionSchemas: entry.appId === "app_topolo_developers" && entry.name === "apps.actions.list"
|
|
2246
|
+
preserveActionSchemas: entry.appId === "app_topolo_developers" && entry.name === "apps.actions.list",
|
|
2247
|
+
preserveActionContracts: entry.appId === "app_topolo_developers" && entry.name === "apps.actions.list"
|
|
2229
2248
|
});
|
|
2230
2249
|
}
|
|
2231
2250
|
async releaseActionSecret(reference) {
|
|
@@ -2573,6 +2592,7 @@ function normalizeActionCatalogEntry(item) {
|
|
|
2573
2592
|
permissionName: pickActionString(a.permission_name) ?? pickActionString(a.permissionName) ?? "",
|
|
2574
2593
|
requiredPermission: pickActionString(a.required_permission) ?? pickActionString(a.requiredPermission) ?? "",
|
|
2575
2594
|
principalAccess: pickPrincipalAccess(a.principal_access ?? a.principalAccess),
|
|
2595
|
+
...validTopoloActionAccessPolicy(a.access_policy ?? a.accessPolicy) ? { accessPolicy: a.access_policy ?? a.accessPolicy } : {},
|
|
2576
2596
|
authorizationMode: pickAuthorizationMode(a.authorization_mode ?? a.authorizationMode),
|
|
2577
2597
|
allowedServices: stringArray(a.allowed_services ?? a.allowedServices),
|
|
2578
2598
|
inputSchema: plainObject(a.input_schema ?? a.inputSchema),
|
|
@@ -2590,7 +2610,7 @@ function isHttpMethod(value) {
|
|
|
2590
2610
|
return value === "GET" || value === "POST" || value === "PUT" || value === "PATCH" || value === "DELETE";
|
|
2591
2611
|
}
|
|
2592
2612
|
function pickPrincipalAccess(value) {
|
|
2593
|
-
return value === "platform_admin" || value === "platform_super_admin" ? value : null;
|
|
2613
|
+
return value === "platform_admin" || value === "platform_super_admin" || value === "platform_admin_or_service" || value === "platform_super_admin_or_service" ? value : null;
|
|
2594
2614
|
}
|
|
2595
2615
|
function pickActionString(value) {
|
|
2596
2616
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
@@ -2697,10 +2717,10 @@ function extractRequired(body) {
|
|
|
2697
2717
|
if (Array.isArray(maybe.required)) return canonicalTopoloRequired(maybe.required);
|
|
2698
2718
|
for (const nested of [maybe.details, maybe.error]) {
|
|
2699
2719
|
if (!nested || typeof nested !== "object" || Array.isArray(nested)) continue;
|
|
2700
|
-
const
|
|
2701
|
-
if (Array.isArray(
|
|
2702
|
-
if (
|
|
2703
|
-
const required =
|
|
2720
|
+
const record4 = nested;
|
|
2721
|
+
if (Array.isArray(record4.required)) return canonicalTopoloRequired(record4.required);
|
|
2722
|
+
if (record4.details && typeof record4.details === "object" && !Array.isArray(record4.details)) {
|
|
2723
|
+
const required = record4.details.required;
|
|
2704
2724
|
if (Array.isArray(required)) return canonicalTopoloRequired(required);
|
|
2705
2725
|
}
|
|
2706
2726
|
}
|
|
@@ -2729,6 +2749,8 @@ function compactActionCatalogEntry(action) {
|
|
|
2729
2749
|
requiresConfirmation: action.requiresConfirmation,
|
|
2730
2750
|
agentAccess: action.agentAccess ?? (action.requiresConfirmation ? "confirm" : action.readOnly ? "auto" : "confirm"),
|
|
2731
2751
|
requiredPermission: action.requiredPermission,
|
|
2752
|
+
...action.principalAccess ? { principalAccess: action.principalAccess } : {},
|
|
2753
|
+
...action.accessPolicy ? { accessPolicy: action.accessPolicy } : {},
|
|
2732
2754
|
requiredInput: required,
|
|
2733
2755
|
resourceType: action.agentContract?.resourceContext?.kind ?? (action.permissionName.startsWith("workspace:") ? "workspace" : null),
|
|
2734
2756
|
resultResourceType: action.agentContract?.resource?.kind ?? null,
|
|
@@ -2775,8 +2797,8 @@ function compactResultValue(value, depth, budget) {
|
|
|
2775
2797
|
return value.length > ACTION_RESULT_MAX_ITEMS ? { count: value.length, items, omittedItems: value.length - ACTION_RESULT_MAX_ITEMS } : items;
|
|
2776
2798
|
}
|
|
2777
2799
|
if (typeof value === "object") {
|
|
2778
|
-
const
|
|
2779
|
-
const allKeys = Object.keys(
|
|
2800
|
+
const record4 = value;
|
|
2801
|
+
const allKeys = Object.keys(record4);
|
|
2780
2802
|
const ranked = allKeys.sort((left, right) => resultKeyPriority(left) - resultKeyPriority(right));
|
|
2781
2803
|
const prioritized = ranked.filter((key) => resultKeyPriority(key) < 2);
|
|
2782
2804
|
const ordinary = ranked.filter((key) => resultKeyPriority(key) === 2);
|
|
@@ -2785,7 +2807,7 @@ function compactResultValue(value, depth, budget) {
|
|
|
2785
2807
|
...prioritized,
|
|
2786
2808
|
...ordinary.slice(0, ordinaryLimit)
|
|
2787
2809
|
].slice(0, ACTION_RESULT_MAX_KEYS);
|
|
2788
|
-
const compact = Object.fromEntries(keys.map((key) => [key, compactResultValue(
|
|
2810
|
+
const compact = Object.fromEntries(keys.map((key) => [key, compactResultValue(record4[key], depth + 1, budget)]));
|
|
2789
2811
|
if (allKeys.length > keys.length) compact["_omittedKeys"] = allKeys.length - keys.length;
|
|
2790
2812
|
return compact;
|
|
2791
2813
|
}
|
|
@@ -3549,7 +3571,7 @@ function createTopolo(options) {
|
|
|
3549
3571
|
};
|
|
3550
3572
|
}
|
|
3551
3573
|
|
|
3552
|
-
// node_modules
|
|
3574
|
+
// node_modules/@topolo/sdk/dist/node/credential-store.js
|
|
3553
3575
|
import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2, chmod as chmod2, rm as rm2, stat } from "fs/promises";
|
|
3554
3576
|
import { existsSync as existsSync2 } from "fs";
|
|
3555
3577
|
import { homedir as homedir2, platform } from "os";
|
|
@@ -3700,10 +3722,10 @@ var TopoloAuthError2 = class extends TopoloSdkError2 {
|
|
|
3700
3722
|
};
|
|
3701
3723
|
function extractTopoloServiceErrorCode2(body) {
|
|
3702
3724
|
if (!body || typeof body !== "object" || Array.isArray(body)) return null;
|
|
3703
|
-
const
|
|
3704
|
-
const topLevel = canonicalTopoloServiceErrorCode2(
|
|
3725
|
+
const record3 = body;
|
|
3726
|
+
const topLevel = canonicalTopoloServiceErrorCode2(record3.code);
|
|
3705
3727
|
if (topLevel) return topLevel;
|
|
3706
|
-
const nested =
|
|
3728
|
+
const nested = record3.error;
|
|
3707
3729
|
const nestedString = canonicalTopoloServiceErrorCode2(nested);
|
|
3708
3730
|
if (nestedString) return nestedString;
|
|
3709
3731
|
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
@@ -3718,14 +3740,14 @@ function serviceErrorCode2(body, fallback) {
|
|
|
3718
3740
|
}
|
|
3719
3741
|
function extractTopoloServiceErrorDetails2(body) {
|
|
3720
3742
|
if (!body || typeof body !== "object" || Array.isArray(body)) return void 0;
|
|
3721
|
-
const
|
|
3722
|
-
let candidate =
|
|
3723
|
-
const nested =
|
|
3743
|
+
const record3 = body;
|
|
3744
|
+
let candidate = record3.details;
|
|
3745
|
+
const nested = record3.error;
|
|
3724
3746
|
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
3725
3747
|
const nestedRecord = nested;
|
|
3726
3748
|
if (candidate === void 0) candidate = nestedRecord.details ?? nestedRecord;
|
|
3727
3749
|
}
|
|
3728
|
-
if (candidate === void 0) candidate =
|
|
3750
|
+
if (candidate === void 0) candidate = record3;
|
|
3729
3751
|
if (Array.isArray(candidate)) return validationIssueDetails2(canonicalTopoloValidationIssues2(candidate)) ?? void 0;
|
|
3730
3752
|
if (!candidate || typeof candidate !== "object") return void 0;
|
|
3731
3753
|
const source = candidate;
|
|
@@ -3792,10 +3814,10 @@ function canonicalTopoloValidationIssues2(values) {
|
|
|
3792
3814
|
const issues = [];
|
|
3793
3815
|
for (const value of values) {
|
|
3794
3816
|
if (!value || typeof value !== "object" || Array.isArray(value)) continue;
|
|
3795
|
-
const
|
|
3796
|
-
const path = canonicalTopoloValidationPath2(
|
|
3817
|
+
const record3 = value;
|
|
3818
|
+
const path = canonicalTopoloValidationPath2(record3.field) ?? canonicalTopoloValidationPath2(record3.path);
|
|
3797
3819
|
if (!path) continue;
|
|
3798
|
-
const projected = issue2(path,
|
|
3820
|
+
const projected = issue2(path, record3.message);
|
|
3799
3821
|
if (projected) issues.push(projected);
|
|
3800
3822
|
if (issues.length === SERVICE_ISSUE_LIMIT2) break;
|
|
3801
3823
|
}
|
|
@@ -4199,18 +4221,18 @@ function createProtectedActionSecretStore(options) {
|
|
|
4199
4221
|
const key = await account(reference);
|
|
4200
4222
|
const encoded = await backend.get(key);
|
|
4201
4223
|
if (!encoded) throw new TopoloSdkError2("action_secret_unavailable", "Protected action reference is missing or belongs to another identity or environment.");
|
|
4202
|
-
let
|
|
4224
|
+
let record3;
|
|
4203
4225
|
try {
|
|
4204
|
-
|
|
4226
|
+
record3 = JSON.parse(encoded);
|
|
4205
4227
|
} catch {
|
|
4206
4228
|
throw new TopoloSdkError2("action_secret_invalid", "Protected action reference is corrupt.");
|
|
4207
4229
|
}
|
|
4208
|
-
if (!Number.isFinite(
|
|
4209
|
-
if (
|
|
4230
|
+
if (!Number.isFinite(record3?.expiresAt) || !Object.hasOwn(record3, "value")) throw new TopoloSdkError2("action_secret_invalid", "Protected action reference is corrupt.");
|
|
4231
|
+
if (record3.expiresAt <= now()) {
|
|
4210
4232
|
await backend.delete(key);
|
|
4211
4233
|
throw new TopoloSdkError2("action_secret_expired", "Protected action reference expired. Repeat the originating action if its contract permits.");
|
|
4212
4234
|
}
|
|
4213
|
-
return
|
|
4235
|
+
return record3.value;
|
|
4214
4236
|
},
|
|
4215
4237
|
async delete(reference) {
|
|
4216
4238
|
await backend.delete(await account(reference));
|
|
@@ -5398,9 +5420,9 @@ function externalApprovalHandoff(action, result) {
|
|
|
5398
5420
|
if (!result || typeof result !== "object" || Array.isArray(result)) return null;
|
|
5399
5421
|
const invocation = result.invocation;
|
|
5400
5422
|
if (!invocation || typeof invocation !== "object" || Array.isArray(invocation)) return null;
|
|
5401
|
-
const
|
|
5402
|
-
if (
|
|
5403
|
-
const approval =
|
|
5423
|
+
const record3 = invocation;
|
|
5424
|
+
if (record3.status !== "awaiting_approval") return null;
|
|
5425
|
+
const approval = record3.approval;
|
|
5404
5426
|
if (!approval || typeof approval !== "object" || Array.isArray(approval)) return null;
|
|
5405
5427
|
const handoff = approval;
|
|
5406
5428
|
if (typeof handoff.requestId !== "string" || typeof handoff.verificationUrl !== "string") return null;
|
|
@@ -7460,16 +7482,16 @@ var REVOKE_CREDENTIAL = "app_topolo_auth.principal_credentials.revoke";
|
|
|
7460
7482
|
var INSTALLATION_BOOTSTRAP_GRANT = "app_topolo_auth:identity";
|
|
7461
7483
|
function actionData(value) {
|
|
7462
7484
|
if (!value || typeof value !== "object") throw new Error("Topolo returned an invalid action response.");
|
|
7463
|
-
const
|
|
7464
|
-
const data =
|
|
7465
|
-
return data && typeof data === "object" ? data :
|
|
7485
|
+
const record3 = value;
|
|
7486
|
+
const data = record3.data;
|
|
7487
|
+
return data && typeof data === "object" ? data : record3;
|
|
7466
7488
|
}
|
|
7467
7489
|
function requiredRecord(value, name) {
|
|
7468
7490
|
if (!value || typeof value !== "object") throw new Error(`Topolo did not return ${name}.`);
|
|
7469
7491
|
return value;
|
|
7470
7492
|
}
|
|
7471
|
-
function requiredString(
|
|
7472
|
-
const value =
|
|
7493
|
+
function requiredString(record3, key) {
|
|
7494
|
+
const value = record3[key];
|
|
7473
7495
|
if (typeof value !== "string" || !value.trim()) throw new Error(`Topolo did not return ${key}.`);
|
|
7474
7496
|
return value;
|
|
7475
7497
|
}
|
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.22",
|
|
5
|
+
"topoloPublishedVersion": "0.12.22",
|
|
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.14",
|
|
32
|
+
"@topolo/sdk": "0.23.10",
|
|
33
33
|
"commander": "^12.1.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|