bruce-models 7.1.91 → 7.1.93
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/bruce-models.es5.js +171 -17
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +171 -17
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account-invite.js +98 -10
- package/dist/lib/account/account-invite.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/plugin/ai-tool-validation.js +65 -5
- package/dist/lib/plugin/ai-tool-validation.js.map +1 -1
- package/dist/lib/plugin/plugin.js +7 -1
- package/dist/lib/plugin/plugin.js.map +1 -1
- package/dist/types/account/account-invite.d.ts +58 -5
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/custom-form/custom-form-content.d.ts +11 -4
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -2905,9 +2905,22 @@
|
|
|
2905
2905
|
EStatus["Denied"] = "Denied";
|
|
2906
2906
|
EStatus["Cancelled"] = "Cancelled";
|
|
2907
2907
|
EStatus["Sent"] = "Sent";
|
|
2908
|
-
EStatus["NotSent"] = "
|
|
2908
|
+
EStatus["NotSent"] = "Not sent";
|
|
2909
2909
|
EStatus["Accepted"] = "Accepted";
|
|
2910
2910
|
})(EStatus = AccountInvite.EStatus || (AccountInvite.EStatus = {}));
|
|
2911
|
+
/**
|
|
2912
|
+
* Returns whether an invite is still awaiting a response from its recipient.
|
|
2913
|
+
* Expiry is held as a timestamp rather than a status, so it is checked separately.
|
|
2914
|
+
* @param invite
|
|
2915
|
+
* @returns
|
|
2916
|
+
*/
|
|
2917
|
+
function IsPending(invite) {
|
|
2918
|
+
if (!invite || invite.IsExpired) {
|
|
2919
|
+
return false;
|
|
2920
|
+
}
|
|
2921
|
+
return invite.Status === EStatus.Sent || invite.Status === EStatus.NotSent;
|
|
2922
|
+
}
|
|
2923
|
+
AccountInvite.IsPending = IsPending;
|
|
2911
2924
|
/**
|
|
2912
2925
|
* Possible invite methods.
|
|
2913
2926
|
*/
|
|
@@ -2952,22 +2965,61 @@
|
|
|
2952
2965
|
*/
|
|
2953
2966
|
function GetList(params) {
|
|
2954
2967
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2955
|
-
let { api, accountId, userId, req } = params;
|
|
2968
|
+
let { api, accountId, userId, status, expired, expandUsers, expandGroups, pageSize, pageIndex, req } = params;
|
|
2956
2969
|
if (!api) {
|
|
2957
2970
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
2958
2971
|
}
|
|
2959
2972
|
const urlParams = new URLSearchParams();
|
|
2960
2973
|
if (accountId) {
|
|
2961
|
-
urlParams.append("
|
|
2974
|
+
urlParams.append("Account", accountId);
|
|
2962
2975
|
}
|
|
2963
2976
|
if (userId) {
|
|
2964
|
-
urlParams.append("
|
|
2977
|
+
urlParams.append("User", userId);
|
|
2965
2978
|
}
|
|
2966
|
-
|
|
2967
|
-
|
|
2979
|
+
if (status === null || status === void 0 ? void 0 : status.length) {
|
|
2980
|
+
urlParams.append("Status", status.join(","));
|
|
2981
|
+
}
|
|
2982
|
+
if (expired !== undefined && expired !== null) {
|
|
2983
|
+
urlParams.append("Expired", expired ? "true" : "false");
|
|
2984
|
+
}
|
|
2985
|
+
const expand = [];
|
|
2986
|
+
if (expandUsers) {
|
|
2987
|
+
expand.push("user");
|
|
2988
|
+
}
|
|
2989
|
+
if (expandGroups) {
|
|
2990
|
+
expand.push("group");
|
|
2991
|
+
}
|
|
2992
|
+
if (expand.length) {
|
|
2993
|
+
urlParams.append("Expand", expand.join(","));
|
|
2994
|
+
}
|
|
2995
|
+
if (pageSize !== undefined && pageSize !== null) {
|
|
2996
|
+
urlParams.append("PageSize", String(pageSize));
|
|
2997
|
+
}
|
|
2998
|
+
if (pageIndex !== undefined && pageIndex !== null) {
|
|
2999
|
+
urlParams.append("PageIndex", String(pageIndex));
|
|
3000
|
+
}
|
|
3001
|
+
const res = yield api.GET("v3/accountInvites?" + urlParams.toString(), exports.Api.PrepReqParams(req));
|
|
3002
|
+
return {
|
|
3003
|
+
invites: res.Items || [],
|
|
3004
|
+
totalCount: res.TotalCount,
|
|
3005
|
+
hasNextPage: res.HasNextPage,
|
|
3006
|
+
userGroups: res.UserGroup
|
|
3007
|
+
};
|
|
2968
3008
|
});
|
|
2969
3009
|
}
|
|
2970
3010
|
AccountInvite.GetList = GetList;
|
|
3011
|
+
/**
|
|
3012
|
+
* Returns the number of invites matching the criteria, without fetching any.
|
|
3013
|
+
* @param params
|
|
3014
|
+
* @returns
|
|
3015
|
+
*/
|
|
3016
|
+
function GetCount(params) {
|
|
3017
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3018
|
+
const res = yield GetList(Object.assign(Object.assign({}, params), { pageSize: -1, pageIndex: -1 }));
|
|
3019
|
+
return res.totalCount || 0;
|
|
3020
|
+
});
|
|
3021
|
+
}
|
|
3022
|
+
AccountInvite.GetCount = GetCount;
|
|
2971
3023
|
/**
|
|
2972
3024
|
* Updates an invite's status.
|
|
2973
3025
|
* Once an invite is accepted or denied it cannot be changed.
|
|
@@ -2976,19 +3028,37 @@
|
|
|
2976
3028
|
*/
|
|
2977
3029
|
function Update(params) {
|
|
2978
3030
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2979
|
-
let { api, code, status, user, req } = params;
|
|
3031
|
+
let { api, code, id, status, groupIds, user, req } = params;
|
|
2980
3032
|
if (!api) {
|
|
2981
3033
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
2982
3034
|
}
|
|
2983
|
-
|
|
3035
|
+
if (!code && !id) {
|
|
3036
|
+
throw new Error("Either an invite ID or InviteCode must be provided.");
|
|
3037
|
+
}
|
|
3038
|
+
const invite = yield api.POST("v3/accountInvite", {
|
|
3039
|
+
ID: id,
|
|
2984
3040
|
InviteCode: code,
|
|
2985
3041
|
Status: status,
|
|
3042
|
+
"UserGroup.ID": groupIds,
|
|
2986
3043
|
User: user
|
|
2987
3044
|
}, exports.Api.PrepReqParams(req));
|
|
2988
|
-
return
|
|
3045
|
+
return {
|
|
3046
|
+
invite: invite
|
|
3047
|
+
};
|
|
2989
3048
|
});
|
|
2990
3049
|
}
|
|
2991
3050
|
AccountInvite.Update = Update;
|
|
3051
|
+
/**
|
|
3052
|
+
* Cancels a pending invite. Requires the session to be an account owner or admin.
|
|
3053
|
+
* @param params
|
|
3054
|
+
* @returns
|
|
3055
|
+
*/
|
|
3056
|
+
function Cancel(params) {
|
|
3057
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3058
|
+
return Update(Object.assign(Object.assign({}, params), { status: EStatus.Cancelled }));
|
|
3059
|
+
});
|
|
3060
|
+
}
|
|
3061
|
+
AccountInvite.Cancel = Cancel;
|
|
2992
3062
|
/**
|
|
2993
3063
|
* Creates a new invite.
|
|
2994
3064
|
* Please validate the response invitation records to ensure the desired contact method was used and worked.
|
|
@@ -2998,13 +3068,31 @@
|
|
|
2998
3068
|
*/
|
|
2999
3069
|
function Create(params) {
|
|
3000
3070
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3001
|
-
let { api, accountId, login, userId, email, mobile, emailTemplateKey, groupIds, req, inviteMethod } = params;
|
|
3071
|
+
let { api, accountId, login, userId, email, mobile, emailTemplateKey, groupIds, req, inviteMethod, pending } = params;
|
|
3002
3072
|
if (!api) {
|
|
3003
3073
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
3004
3074
|
}
|
|
3005
3075
|
if (!(groupIds === null || groupIds === void 0 ? void 0 : groupIds.length)) {
|
|
3006
3076
|
throw new Error("At least one User Group ID must be provided.");
|
|
3007
3077
|
}
|
|
3078
|
+
if (pending) {
|
|
3079
|
+
const res = yield api.POST("v3/createAccountInvite", {
|
|
3080
|
+
Account: accountId,
|
|
3081
|
+
Username: login,
|
|
3082
|
+
Email: email,
|
|
3083
|
+
Mobile: mobile,
|
|
3084
|
+
"User.ID": userId,
|
|
3085
|
+
"UserGroup.ID": groupIds,
|
|
3086
|
+
"Email.Template": emailTemplateKey,
|
|
3087
|
+
Method: inviteMethod
|
|
3088
|
+
}, exports.Api.PrepReqParams(req));
|
|
3089
|
+
return {
|
|
3090
|
+
warnings: res.Warning,
|
|
3091
|
+
user: res["Invited.User"],
|
|
3092
|
+
invite: res,
|
|
3093
|
+
manualInviteCode: res.InviteCode
|
|
3094
|
+
};
|
|
3095
|
+
}
|
|
3008
3096
|
const res = yield api.POST("invite/new", {
|
|
3009
3097
|
accountId,
|
|
3010
3098
|
login,
|
|
@@ -18803,7 +18891,13 @@
|
|
|
18803
18891
|
|
|
18804
18892
|
window["${resultId}"] = Invoke(window["${argsId}"], window["${contextId}"]);
|
|
18805
18893
|
}
|
|
18806
|
-
|
|
18894
|
+
// Called with a receiver, not bare. The API builds index.jsc by
|
|
18895
|
+
// wrapping the plugin's index.js in a controller shell that
|
|
18896
|
+
// assigns 'this.Init = ...', and under "use strict" a bare call
|
|
18897
|
+
// leaves 'this' undefined, so every plugin would die on that
|
|
18898
|
+
// line before its own code ran. A throwaway object satisfies
|
|
18899
|
+
// the shell without giving the plugin the global scope back.
|
|
18900
|
+
invoke.call({});
|
|
18807
18901
|
`;
|
|
18808
18902
|
try {
|
|
18809
18903
|
// 'eval2 = eval' stops the linter from complaining about using eval.
|
|
@@ -18882,6 +18976,24 @@
|
|
|
18882
18976
|
* and nothing downstream reports that it happened.
|
|
18883
18977
|
*/
|
|
18884
18978
|
const STRICT_INCOMPATIBLE_KEYWORDS = ["$ref", "$defs", "allOf", "not"];
|
|
18979
|
+
/** Depth beyond which a schema is refused as unverifiable rather than assumed clean. */
|
|
18980
|
+
const MAX_SCHEMA_DEPTH = 32;
|
|
18981
|
+
/**
|
|
18982
|
+
* Keys whose values are author-named property maps rather than schemas.
|
|
18983
|
+
*
|
|
18984
|
+
* Everything under them is a name the author chose, so a property legitimately
|
|
18985
|
+
* called "not" or "allOf" is not a keyword and must not be matched as one.
|
|
18986
|
+
*/
|
|
18987
|
+
const PROPERTY_NAME_HOLDERS = ["properties", "patternProperties", "definitions", "dependentSchemas"];
|
|
18988
|
+
/**
|
|
18989
|
+
* Shortest timeout the host can actually apply.
|
|
18990
|
+
*
|
|
18991
|
+
* It converts the declared value to seconds by integer division, so anything
|
|
18992
|
+
* below this truncates to zero.
|
|
18993
|
+
*/
|
|
18994
|
+
const MIN_TIMEOUT_MS = 1000;
|
|
18995
|
+
/** Longest timeout an account may declare. */
|
|
18996
|
+
const MAX_TIMEOUT_MS = 120000;
|
|
18885
18997
|
/**
|
|
18886
18998
|
* Side effects an AI Tool may declare.
|
|
18887
18999
|
*
|
|
@@ -18897,9 +19009,14 @@
|
|
|
18897
19009
|
* @returns the offending keyword, or null
|
|
18898
19010
|
*/
|
|
18899
19011
|
function findStrictModeViolation(node, depth = 0) {
|
|
18900
|
-
if (!node || typeof node !== "object"
|
|
19012
|
+
if (!node || typeof node !== "object") {
|
|
18901
19013
|
return null;
|
|
18902
19014
|
}
|
|
19015
|
+
if (depth > MAX_SCHEMA_DEPTH) {
|
|
19016
|
+
// Returning "clean" here would let a $ref nested past the cap through
|
|
19017
|
+
// as verified, which is the exact thing this walk exists to catch.
|
|
19018
|
+
return `a schema nested deeper than ${MAX_SCHEMA_DEPTH} levels, which cannot be checked`;
|
|
19019
|
+
}
|
|
18903
19020
|
if (Array.isArray(node)) {
|
|
18904
19021
|
for (const child of node) {
|
|
18905
19022
|
const nested = findStrictModeViolation(child, depth + 1);
|
|
@@ -18909,11 +19026,28 @@
|
|
|
18909
19026
|
}
|
|
18910
19027
|
return null;
|
|
18911
19028
|
}
|
|
19029
|
+
// A keyword only counts at a schema position. Under "properties" and
|
|
19030
|
+
// friends the field names are chosen by the author, so a property
|
|
19031
|
+
// legitimately called "not" or "allOf" is a name, not a keyword.
|
|
18912
19032
|
for (const key of Object.keys(node)) {
|
|
18913
19033
|
if (STRICT_INCOMPATIBLE_KEYWORDS.includes(key)) {
|
|
18914
19034
|
return key;
|
|
18915
19035
|
}
|
|
18916
|
-
|
|
19036
|
+
}
|
|
19037
|
+
for (const key of Object.keys(node)) {
|
|
19038
|
+
const child = node[key];
|
|
19039
|
+
if (PROPERTY_NAME_HOLDERS.includes(key)) {
|
|
19040
|
+
if (child && typeof child === "object" && !Array.isArray(child)) {
|
|
19041
|
+
for (const name of Object.keys(child)) {
|
|
19042
|
+
const nested = findStrictModeViolation(child[name], depth + 2);
|
|
19043
|
+
if (nested) {
|
|
19044
|
+
return nested;
|
|
19045
|
+
}
|
|
19046
|
+
}
|
|
19047
|
+
}
|
|
19048
|
+
continue;
|
|
19049
|
+
}
|
|
19050
|
+
const nested = findStrictModeViolation(child, depth + 1);
|
|
18917
19051
|
if (nested) {
|
|
18918
19052
|
return nested;
|
|
18919
19053
|
}
|
|
@@ -18953,9 +19087,14 @@
|
|
|
18953
19087
|
// tool does. The description is the only thing the agent can select on:
|
|
18954
19088
|
// without one it is registered but never chosen, and nothing reports that.
|
|
18955
19089
|
const description = typeof tool.description === "string" ? tool.description.trim() : "";
|
|
18956
|
-
|
|
18957
|
-
|
|
18958
|
-
|
|
19090
|
+
// The fallback is "Name: Description", so a plugin with only a Name yields
|
|
19091
|
+
// a description of a few words. That satisfied the old check while leaving
|
|
19092
|
+
// the agent almost nothing to select on -- and since Save is disabled while
|
|
19093
|
+
// Name is empty, the old check could never fire at all.
|
|
19094
|
+
if (!description && !((_c = plugin.Description) !== null && _c !== void 0 ? _c : "").trim()) {
|
|
19095
|
+
return "An AI Tool needs a description saying what it does and when to use it. Set "
|
|
19096
|
+
+ "Settings.tool.description, or fill in the plugin's Description — the tool name is "
|
|
19097
|
+
+ "an opaque ID, so this is the only thing the agent can choose it on.";
|
|
18959
19098
|
}
|
|
18960
19099
|
if (!isPlainObject(tool.inputSchema)) {
|
|
18961
19100
|
return "Settings.tool.inputSchema is missing or is not an object.";
|
|
@@ -18980,6 +19119,21 @@
|
|
|
18980
19119
|
}
|
|
18981
19120
|
}
|
|
18982
19121
|
if (annotations.timeoutMs !== undefined) {
|
|
19122
|
+
if (typeof annotations.timeoutMs === "number"
|
|
19123
|
+
&& isFinite(annotations.timeoutMs)
|
|
19124
|
+
&& annotations.timeoutMs > 0
|
|
19125
|
+
&& annotations.timeoutMs < MIN_TIMEOUT_MS) {
|
|
19126
|
+
// The host converts this to seconds by integer division, so
|
|
19127
|
+
// anything under a second becomes no wait at all -- the opposite
|
|
19128
|
+
// of a short timeout, and the tool then fails on every call.
|
|
19129
|
+
return `timeoutMs is ${annotations.timeoutMs}ms, but the shortest timeout the host can `
|
|
19130
|
+
+ `apply is ${MIN_TIMEOUT_MS}ms. A smaller value would be rounded down to no wait at all.`;
|
|
19131
|
+
}
|
|
19132
|
+
if (typeof annotations.timeoutMs === "number"
|
|
19133
|
+
&& isFinite(annotations.timeoutMs)
|
|
19134
|
+
&& annotations.timeoutMs > MAX_TIMEOUT_MS) {
|
|
19135
|
+
return `timeoutMs is ${annotations.timeoutMs}ms, above the maximum of ${MAX_TIMEOUT_MS}ms.`;
|
|
19136
|
+
}
|
|
18983
19137
|
if (typeof annotations.timeoutMs !== "number"
|
|
18984
19138
|
|| !isFinite(annotations.timeoutMs)
|
|
18985
19139
|
|| annotations.timeoutMs <= 0) {
|
|
@@ -22983,7 +23137,7 @@
|
|
|
22983
23137
|
})(exports.UrlUtils || (exports.UrlUtils = {}));
|
|
22984
23138
|
|
|
22985
23139
|
// This is updated with the package.json version on build.
|
|
22986
|
-
const VERSION = "7.1.
|
|
23140
|
+
const VERSION = "7.1.93";
|
|
22987
23141
|
|
|
22988
23142
|
exports.VERSION = VERSION;
|
|
22989
23143
|
exports.AbstractApi = AbstractApi;
|