@topolo/sdk 0.9.2 → 0.9.3
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.cjs +19 -13
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +19 -13
- package/package.json +5 -8
package/dist/index.cjs
CHANGED
|
@@ -3309,6 +3309,7 @@ function normalizeActionCatalogEntry(item) {
|
|
|
3309
3309
|
permissionName: pickActionString(a.permission_name) ?? pickActionString(a.permissionName) ?? "",
|
|
3310
3310
|
requiredPermission: pickActionString(a.required_permission) ?? pickActionString(a.requiredPermission) ?? "",
|
|
3311
3311
|
authorizationMode: pickAuthorizationMode(a.authorization_mode ?? a.authorizationMode),
|
|
3312
|
+
allowedServices: stringArray(a.allowed_services ?? a.allowedServices),
|
|
3312
3313
|
inputSchema: plainObject(a.input_schema ?? a.inputSchema),
|
|
3313
3314
|
outputSchema: plainObject(a.output_schema ?? a.outputSchema),
|
|
3314
3315
|
agentContract: plainObject(a.agent_contract ?? a.agentContract),
|
|
@@ -3330,7 +3331,7 @@ function pickAgentAccess(value) {
|
|
|
3330
3331
|
return value === "auto" || value === "confirm" || value === "off" ? value : null;
|
|
3331
3332
|
}
|
|
3332
3333
|
function pickAuthorizationMode(value) {
|
|
3333
|
-
return value === "runtime"
|
|
3334
|
+
return value === "runtime" || value === "public" || value === "service" ? value : "static";
|
|
3334
3335
|
}
|
|
3335
3336
|
function plainObject(value) {
|
|
3336
3337
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
@@ -3438,18 +3439,23 @@ function stableJson(value) {
|
|
|
3438
3439
|
return JSON.stringify(value);
|
|
3439
3440
|
}
|
|
3440
3441
|
async function digestTopoloActionCatalog(actions, appId) {
|
|
3441
|
-
const canonical = actions.filter((action) => action.agentAccess !== "off").map((action) =>
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3442
|
+
const canonical = actions.filter((action) => action.agentAccess !== "off").map((action) => {
|
|
3443
|
+
const authorizationMode = ["runtime", "public", "service"].includes(action.authorizationMode || "") ? action.authorizationMode : "static";
|
|
3444
|
+
const allowedServices = [...action.allowedServices || []].map((service) => service.trim()).filter(Boolean).sort();
|
|
3445
|
+
return {
|
|
3446
|
+
actionId: action.actionId || `${appId}.${action.name}`,
|
|
3447
|
+
authorizationMode,
|
|
3448
|
+
...authorizationMode === "service" ? { allowedServices } : {},
|
|
3449
|
+
inputSchema: action.inputSchema,
|
|
3450
|
+
method: action.method,
|
|
3451
|
+
outputSchema: action.outputSchema,
|
|
3452
|
+
path: action.path,
|
|
3453
|
+
permission: canonicalPermission(action.permission ?? action.permissionName ?? "", appId),
|
|
3454
|
+
readOnly: action.readOnly,
|
|
3455
|
+
requiresConfirmation: action.requiresConfirmation,
|
|
3456
|
+
target: action.target ?? ""
|
|
3457
|
+
};
|
|
3458
|
+
}).sort((left, right) => left.actionId.localeCompare(right.actionId));
|
|
3453
3459
|
const bytes = new TextEncoder().encode(canonical.map(stableJson).join("\n"));
|
|
3454
3460
|
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
3455
3461
|
return [...new Uint8Array(digest)].map((value) => value.toString(16).padStart(2, "0")).join("");
|
package/dist/index.d.cts
CHANGED
|
@@ -188,8 +188,9 @@ interface TopoloActionCatalogEntry {
|
|
|
188
188
|
path: string;
|
|
189
189
|
permissionName: string;
|
|
190
190
|
requiredPermission: string;
|
|
191
|
-
/** Static
|
|
192
|
-
authorizationMode?: 'static' | 'runtime';
|
|
191
|
+
/** Static RBAC, contextual runtime policy, or an explicit public/service exception. */
|
|
192
|
+
authorizationMode?: 'static' | 'runtime' | 'public' | 'service';
|
|
193
|
+
allowedServices?: string[];
|
|
193
194
|
inputSchema: Record<string, unknown>;
|
|
194
195
|
outputSchema: Record<string, unknown>;
|
|
195
196
|
agentContract?: TopoloActionAgentContract;
|
|
@@ -425,6 +426,7 @@ interface TopoloActionDigestInput {
|
|
|
425
426
|
permission?: string | null;
|
|
426
427
|
permissionName?: string | null;
|
|
427
428
|
authorizationMode?: string | null;
|
|
429
|
+
allowedServices?: string[] | null;
|
|
428
430
|
target?: string | null;
|
|
429
431
|
readOnly: boolean;
|
|
430
432
|
requiresConfirmation: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -188,8 +188,9 @@ interface TopoloActionCatalogEntry {
|
|
|
188
188
|
path: string;
|
|
189
189
|
permissionName: string;
|
|
190
190
|
requiredPermission: string;
|
|
191
|
-
/** Static
|
|
192
|
-
authorizationMode?: 'static' | 'runtime';
|
|
191
|
+
/** Static RBAC, contextual runtime policy, or an explicit public/service exception. */
|
|
192
|
+
authorizationMode?: 'static' | 'runtime' | 'public' | 'service';
|
|
193
|
+
allowedServices?: string[];
|
|
193
194
|
inputSchema: Record<string, unknown>;
|
|
194
195
|
outputSchema: Record<string, unknown>;
|
|
195
196
|
agentContract?: TopoloActionAgentContract;
|
|
@@ -425,6 +426,7 @@ interface TopoloActionDigestInput {
|
|
|
425
426
|
permission?: string | null;
|
|
426
427
|
permissionName?: string | null;
|
|
427
428
|
authorizationMode?: string | null;
|
|
429
|
+
allowedServices?: string[] | null;
|
|
428
430
|
target?: string | null;
|
|
429
431
|
readOnly: boolean;
|
|
430
432
|
requiresConfirmation: boolean;
|
package/dist/index.js
CHANGED
|
@@ -3250,6 +3250,7 @@ function normalizeActionCatalogEntry(item) {
|
|
|
3250
3250
|
permissionName: pickActionString(a.permission_name) ?? pickActionString(a.permissionName) ?? "",
|
|
3251
3251
|
requiredPermission: pickActionString(a.required_permission) ?? pickActionString(a.requiredPermission) ?? "",
|
|
3252
3252
|
authorizationMode: pickAuthorizationMode(a.authorization_mode ?? a.authorizationMode),
|
|
3253
|
+
allowedServices: stringArray(a.allowed_services ?? a.allowedServices),
|
|
3253
3254
|
inputSchema: plainObject(a.input_schema ?? a.inputSchema),
|
|
3254
3255
|
outputSchema: plainObject(a.output_schema ?? a.outputSchema),
|
|
3255
3256
|
agentContract: plainObject(a.agent_contract ?? a.agentContract),
|
|
@@ -3271,7 +3272,7 @@ function pickAgentAccess(value) {
|
|
|
3271
3272
|
return value === "auto" || value === "confirm" || value === "off" ? value : null;
|
|
3272
3273
|
}
|
|
3273
3274
|
function pickAuthorizationMode(value) {
|
|
3274
|
-
return value === "runtime"
|
|
3275
|
+
return value === "runtime" || value === "public" || value === "service" ? value : "static";
|
|
3275
3276
|
}
|
|
3276
3277
|
function plainObject(value) {
|
|
3277
3278
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
@@ -3379,18 +3380,23 @@ function stableJson(value) {
|
|
|
3379
3380
|
return JSON.stringify(value);
|
|
3380
3381
|
}
|
|
3381
3382
|
async function digestTopoloActionCatalog(actions, appId) {
|
|
3382
|
-
const canonical = actions.filter((action) => action.agentAccess !== "off").map((action) =>
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3383
|
+
const canonical = actions.filter((action) => action.agentAccess !== "off").map((action) => {
|
|
3384
|
+
const authorizationMode = ["runtime", "public", "service"].includes(action.authorizationMode || "") ? action.authorizationMode : "static";
|
|
3385
|
+
const allowedServices = [...action.allowedServices || []].map((service) => service.trim()).filter(Boolean).sort();
|
|
3386
|
+
return {
|
|
3387
|
+
actionId: action.actionId || `${appId}.${action.name}`,
|
|
3388
|
+
authorizationMode,
|
|
3389
|
+
...authorizationMode === "service" ? { allowedServices } : {},
|
|
3390
|
+
inputSchema: action.inputSchema,
|
|
3391
|
+
method: action.method,
|
|
3392
|
+
outputSchema: action.outputSchema,
|
|
3393
|
+
path: action.path,
|
|
3394
|
+
permission: canonicalPermission(action.permission ?? action.permissionName ?? "", appId),
|
|
3395
|
+
readOnly: action.readOnly,
|
|
3396
|
+
requiresConfirmation: action.requiresConfirmation,
|
|
3397
|
+
target: action.target ?? ""
|
|
3398
|
+
};
|
|
3399
|
+
}).sort((left, right) => left.actionId.localeCompare(right.actionId));
|
|
3394
3400
|
const bytes = new TextEncoder().encode(canonical.map(stableJson).join("\n"));
|
|
3395
3401
|
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
3396
3402
|
return [...new Uint8Array(digest)].map((value) => value.toString(16).padStart(2, "0")).join("");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/sdk",
|
|
3
|
-
"version": "0.9.
|
|
4
|
-
"topoloPublishedVersion": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
|
+
"topoloPublishedVersion": "0.9.3",
|
|
5
5
|
"description": "Typed client SDK for the Topolo platform. Used by TopoloCli, TopoloMCP, and third-party agents.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -23,16 +23,13 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"
|
|
27
|
-
"check:generated": "node scripts/check-generated.mjs",
|
|
28
|
-
"prebuild": "node scripts/generate-services.mjs",
|
|
26
|
+
"check:generated": "git diff --exit-code -- src/services.generated.ts src/applications.generated.ts",
|
|
29
27
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean && tsup src/node/credential-store.ts --format esm,cjs --dts --out-dir dist/node",
|
|
30
28
|
"dev": "tsup src/index.ts --format esm,cjs --dts --watch",
|
|
31
|
-
"typecheck": "
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
32
30
|
"test": "vitest run",
|
|
33
31
|
"test:watch": "vitest",
|
|
34
|
-
"prepublishOnly": "npm run build
|
|
35
|
-
"verify:package": "node ../../tooling/verify-npm-package.mjs .",
|
|
32
|
+
"prepublishOnly": "npm run build",
|
|
36
33
|
"coverage": "vitest run --coverage"
|
|
37
34
|
},
|
|
38
35
|
"devDependencies": {
|