@trops/dash-core 0.1.712 → 0.1.713
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/electron/index.js +57 -7
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -2481,6 +2481,12 @@ function requestApproval$3(req, opts = {}) {
|
|
|
2481
2481
|
siblingWidgetIds: Array.isArray(req.siblingWidgetIds)
|
|
2482
2482
|
? req.siblingWidgetIds
|
|
2483
2483
|
: [req.widgetId],
|
|
2484
|
+
// A wildcard the widget declares that covers this tool
|
|
2485
|
+
// ("algolia_search_*"). The modal offers it as a broader grant.
|
|
2486
|
+
toolPattern:
|
|
2487
|
+
typeof req.toolPattern === "string" && req.toolPattern
|
|
2488
|
+
? req.toolPattern
|
|
2489
|
+
: null,
|
|
2484
2490
|
});
|
|
2485
2491
|
});
|
|
2486
2492
|
}
|
|
@@ -11110,7 +11116,7 @@ function requireDedupeWidgetFolders () {
|
|
|
11110
11116
|
|
|
11111
11117
|
const MIN_LITERAL_CHARS = 3;
|
|
11112
11118
|
|
|
11113
|
-
function isToolPattern(name) {
|
|
11119
|
+
function isToolPattern$1(name) {
|
|
11114
11120
|
return typeof name === "string" && name.includes("*");
|
|
11115
11121
|
}
|
|
11116
11122
|
|
|
@@ -11137,21 +11143,21 @@ function _patternRegex(pattern) {
|
|
|
11137
11143
|
}
|
|
11138
11144
|
|
|
11139
11145
|
/** True when `entry` (a tool name or pattern) covers `toolName`. */
|
|
11140
|
-
function toolMatches(entry, toolName) {
|
|
11146
|
+
function toolMatches$1(entry, toolName) {
|
|
11141
11147
|
if (typeof entry !== "string" || typeof toolName !== "string") return false;
|
|
11142
11148
|
if (entry === toolName) return true;
|
|
11143
|
-
return isToolPattern(entry) && _patternRegex(entry).test(toolName);
|
|
11149
|
+
return isToolPattern$1(entry) && _patternRegex(entry).test(toolName);
|
|
11144
11150
|
}
|
|
11145
11151
|
|
|
11146
11152
|
/** True when any entry in `tools` covers `toolName`. */
|
|
11147
11153
|
function toolListAllows$1(tools, toolName) {
|
|
11148
|
-
return Array.isArray(tools) && tools.some((t) => toolMatches(t, toolName));
|
|
11154
|
+
return Array.isArray(tools) && tools.some((t) => toolMatches$1(t, toolName));
|
|
11149
11155
|
}
|
|
11150
11156
|
|
|
11151
11157
|
var toolPattern = {
|
|
11152
|
-
isToolPattern,
|
|
11158
|
+
isToolPattern: isToolPattern$1,
|
|
11153
11159
|
toolPatternFromTemplate,
|
|
11154
|
-
toolMatches,
|
|
11160
|
+
toolMatches: toolMatches$1,
|
|
11155
11161
|
toolListAllows: toolListAllows$1,
|
|
11156
11162
|
};
|
|
11157
11163
|
|
|
@@ -36836,7 +36842,7 @@ const { requestApproval } = jitConsent$1;
|
|
|
36836
36842
|
const { lookup: lookupMountToken } = mountTokenRegistry;
|
|
36837
36843
|
const { resolveSiblings } = resolveSiblings_1;
|
|
36838
36844
|
const { getWidgetMcpPermissions: getWidgetMcpPermissions$1 } = widgetPermissions;
|
|
36839
|
-
const { toolListAllows } = toolPattern;
|
|
36845
|
+
const { toolListAllows, isToolPattern, toolMatches } = toolPattern;
|
|
36840
36846
|
|
|
36841
36847
|
// Lazy default for the registry snapshot — `widgetRegistry.js` pulls
|
|
36842
36848
|
// in a lot, so we don't want to require it at module-load time. The
|
|
@@ -37056,6 +37062,42 @@ function gateBotToolCall({ botId, serverName, toolName, args }) {
|
|
|
37056
37062
|
});
|
|
37057
37063
|
}
|
|
37058
37064
|
|
|
37065
|
+
/**
|
|
37066
|
+
* The wildcard ("algolia_search_*") this widget declares that covers
|
|
37067
|
+
* `toolName`, or null. Declarations are keyed by provider type
|
|
37068
|
+
* ("algolia") while calls carry the provider instance name
|
|
37069
|
+
* ("Algolia Public HR"), so every declared server is checked, the
|
|
37070
|
+
* matching name first.
|
|
37071
|
+
*/
|
|
37072
|
+
function _declaredToolPattern(widgetId, serverName, toolName) {
|
|
37073
|
+
const servers = getWidgetMcpPermissions$1(widgetId)?.servers || {};
|
|
37074
|
+
const names = Object.keys(servers).sort((a, b) =>
|
|
37075
|
+
a === serverName ? -1 : b === serverName ? 1 : 0,
|
|
37076
|
+
);
|
|
37077
|
+
for (const name of names) {
|
|
37078
|
+
const hit = (servers[name]?.tools || []).find(
|
|
37079
|
+
(t) => isToolPattern(t) && toolMatches(t, toolName),
|
|
37080
|
+
);
|
|
37081
|
+
if (hit) return hit;
|
|
37082
|
+
}
|
|
37083
|
+
return null;
|
|
37084
|
+
}
|
|
37085
|
+
|
|
37086
|
+
/**
|
|
37087
|
+
* Keep only wildcard tools the gate offered for this request. The
|
|
37088
|
+
* renderer builds the grant, so a pattern it sends must be exactly the
|
|
37089
|
+
* declared one — anything broader is dropped.
|
|
37090
|
+
*/
|
|
37091
|
+
function _limitGrantPatterns(granted, allowedPattern) {
|
|
37092
|
+
for (const perms of Object.values(granted?.servers || {})) {
|
|
37093
|
+
if (!Array.isArray(perms?.tools)) continue;
|
|
37094
|
+
perms.tools = perms.tools.filter(
|
|
37095
|
+
(t) => !isToolPattern(t) || t === allowedPattern,
|
|
37096
|
+
);
|
|
37097
|
+
}
|
|
37098
|
+
return granted;
|
|
37099
|
+
}
|
|
37100
|
+
|
|
37059
37101
|
/**
|
|
37060
37102
|
* Filter a sibling-widget list down to widgets whose static manifest
|
|
37061
37103
|
* declares the given `serverName + toolName`. The originating widget
|
|
@@ -37225,6 +37267,12 @@ async function gateToolCallWithJit$1(req, opts = {}) {
|
|
|
37225
37267
|
req.toolName,
|
|
37226
37268
|
);
|
|
37227
37269
|
|
|
37270
|
+
const toolPattern = _declaredToolPattern(
|
|
37271
|
+
verifiedWidgetId,
|
|
37272
|
+
req.serverName,
|
|
37273
|
+
req.toolName,
|
|
37274
|
+
);
|
|
37275
|
+
|
|
37228
37276
|
let decision;
|
|
37229
37277
|
try {
|
|
37230
37278
|
decision = await requestApproval(
|
|
@@ -37239,6 +37287,7 @@ async function gateToolCallWithJit$1(req, opts = {}) {
|
|
|
37239
37287
|
},
|
|
37240
37288
|
packageId: siblingInfo.packageId,
|
|
37241
37289
|
siblingWidgetIds: applicableSiblingIds,
|
|
37290
|
+
toolPattern,
|
|
37242
37291
|
},
|
|
37243
37292
|
{ timeoutMs: opts.timeoutMs },
|
|
37244
37293
|
);
|
|
@@ -37282,6 +37331,7 @@ async function gateToolCallWithJit$1(req, opts = {}) {
|
|
|
37282
37331
|
};
|
|
37283
37332
|
// Force grantOrigin: "live" regardless of what the renderer sent.
|
|
37284
37333
|
addition.grantOrigin = "live";
|
|
37334
|
+
_limitGrantPatterns(addition, toolPattern);
|
|
37285
37335
|
|
|
37286
37336
|
// Slice 5: when the user opted into "Apply to all widgets from
|
|
37287
37337
|
// <package>", write the same merged grant for every sibling — each
|