@sparkelf/dsh-dataops-managed 0.3.45 → 0.3.47
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/lib/client.js +153 -160
- package/lib/client.js.map +1 -1
- package/lib/index.js +17 -1
- package/lib/types/tool-scope.d.ts +9 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1005,8 +1005,23 @@ function isScopeActor(actor) {
|
|
|
1005
1005
|
* @param workspaceScope - the scope the registration set was built from.
|
|
1006
1006
|
* @returns true to hide the tool for this Session.
|
|
1007
1007
|
*/
|
|
1008
|
+
/**
|
|
1009
|
+
* Whether a tool's access is declared at all.
|
|
1010
|
+
*
|
|
1011
|
+
* A tool without a policy was written for the workspace principal; a Session acting for a member
|
|
1012
|
+
* must not inherit it, so the disclosure rule treats "no declaration" as "not for visitors".
|
|
1013
|
+
* @param name - the registered tool name.
|
|
1014
|
+
* @returns true when the catalog states who may use the tool.
|
|
1015
|
+
*/
|
|
1016
|
+
function declaresAccessPolicy(name) {
|
|
1017
|
+
const policy = AI_TOOL_ACCESS[name];
|
|
1018
|
+
return policy.superAdminOnly === true || policy.adminOnly === true || policy.reviewer === true || policy.permission !== void 0;
|
|
1019
|
+
}
|
|
1008
1020
|
function sessionHidesTool(name, actor, workspaceScope) {
|
|
1009
|
-
if (actor !== void 0)
|
|
1021
|
+
if (actor !== void 0) {
|
|
1022
|
+
if (!declaresAccessPolicy(name)) return true;
|
|
1023
|
+
return !isScopeActor(actor) || !isToolVisible(name, actor);
|
|
1024
|
+
}
|
|
1010
1025
|
if (workspaceScope === void 0) return true;
|
|
1011
1026
|
return !isToolVisible(name, workspaceScope);
|
|
1012
1027
|
}
|
|
@@ -1038,6 +1053,7 @@ function skillPermissions(metadata) {
|
|
|
1038
1053
|
function sessionHidesSkill(permissions, actor, workspaceScope) {
|
|
1039
1054
|
const effective = actor !== void 0 ? isScopeActor(actor) ? actor : void 0 : workspaceScope;
|
|
1040
1055
|
if (effective === void 0) return true;
|
|
1056
|
+
if (actor !== void 0 && permissions.length === 0) return true;
|
|
1041
1057
|
const held = new Set(permissionList(effective) ?? []);
|
|
1042
1058
|
return !permissions.every((permission) => held.has(permission));
|
|
1043
1059
|
}
|
|
@@ -231,6 +231,15 @@ export declare function isScopeActor(actor: unknown): actor is DataOpsScope;
|
|
|
231
231
|
* @param workspaceScope - the scope the registration set was built from.
|
|
232
232
|
* @returns true to hide the tool for this Session.
|
|
233
233
|
*/
|
|
234
|
+
/**
|
|
235
|
+
* Whether a tool's access is declared at all.
|
|
236
|
+
*
|
|
237
|
+
* A tool without a policy was written for the workspace principal; a Session acting for a member
|
|
238
|
+
* must not inherit it, so the disclosure rule treats "no declaration" as "not for visitors".
|
|
239
|
+
* @param name - the registered tool name.
|
|
240
|
+
* @returns true when the catalog states who may use the tool.
|
|
241
|
+
*/
|
|
242
|
+
export declare function declaresAccessPolicy(name: AiToolName): boolean;
|
|
234
243
|
export declare function sessionHidesTool(name: AiToolName, actor: unknown, workspaceScope: DataOpsScope | undefined): boolean;
|
|
235
244
|
/**
|
|
236
245
|
* Whether the model must not see one skill in this Session.
|
package/package.json
CHANGED