@trops/dash-core 0.1.712 → 0.1.715
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 +73 -7
- package/dist/electron/index.js.map +1 -1
- package/dist/scanner/index.js +498 -0
- package/package.json +4 -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
|
|
|
@@ -15421,6 +15427,22 @@ var schedulerController_1 = schedulerController$2;
|
|
|
15421
15427
|
zip.extractAllTo(widgetPath, true);
|
|
15422
15428
|
console.log(`[WidgetRegistry] Extracted widget to: ${widgetPath}`);
|
|
15423
15429
|
|
|
15430
|
+
// Same scan as installFromLocalPath: record which MCP tools the
|
|
15431
|
+
// package calls in its package.json (dash.permissions.mcp). Without
|
|
15432
|
+
// it a registry install has no declared permissions until the next
|
|
15433
|
+
// app start (boot backfill), so the consent prompt and the
|
|
15434
|
+
// permission dialog's wildcard offer have nothing to go on.
|
|
15435
|
+
try {
|
|
15436
|
+
const {
|
|
15437
|
+
applyScanToPackageJson,
|
|
15438
|
+
} = requireScanWidgetPackagePermissions();
|
|
15439
|
+
applyScanToPackageJson(widgetPath);
|
|
15440
|
+
} catch (e) {
|
|
15441
|
+
console.warn(
|
|
15442
|
+
`[WidgetRegistry] Permission scan failed for ${widgetName}: ${e.message}`,
|
|
15443
|
+
);
|
|
15444
|
+
}
|
|
15445
|
+
|
|
15424
15446
|
let config = await this.loadWidgetConfig(widgetName, widgetPath);
|
|
15425
15447
|
|
|
15426
15448
|
if (dashConfigUrl) {
|
|
@@ -36836,7 +36858,7 @@ const { requestApproval } = jitConsent$1;
|
|
|
36836
36858
|
const { lookup: lookupMountToken } = mountTokenRegistry;
|
|
36837
36859
|
const { resolveSiblings } = resolveSiblings_1;
|
|
36838
36860
|
const { getWidgetMcpPermissions: getWidgetMcpPermissions$1 } = widgetPermissions;
|
|
36839
|
-
const { toolListAllows } = toolPattern;
|
|
36861
|
+
const { toolListAllows, isToolPattern, toolMatches } = toolPattern;
|
|
36840
36862
|
|
|
36841
36863
|
// Lazy default for the registry snapshot — `widgetRegistry.js` pulls
|
|
36842
36864
|
// in a lot, so we don't want to require it at module-load time. The
|
|
@@ -37056,6 +37078,42 @@ function gateBotToolCall({ botId, serverName, toolName, args }) {
|
|
|
37056
37078
|
});
|
|
37057
37079
|
}
|
|
37058
37080
|
|
|
37081
|
+
/**
|
|
37082
|
+
* The wildcard ("algolia_search_*") this widget declares that covers
|
|
37083
|
+
* `toolName`, or null. Declarations are keyed by provider type
|
|
37084
|
+
* ("algolia") while calls carry the provider instance name
|
|
37085
|
+
* ("Algolia Public HR"), so every declared server is checked, the
|
|
37086
|
+
* matching name first.
|
|
37087
|
+
*/
|
|
37088
|
+
function _declaredToolPattern(widgetId, serverName, toolName) {
|
|
37089
|
+
const servers = getWidgetMcpPermissions$1(widgetId)?.servers || {};
|
|
37090
|
+
const names = Object.keys(servers).sort((a, b) =>
|
|
37091
|
+
a === serverName ? -1 : b === serverName ? 1 : 0,
|
|
37092
|
+
);
|
|
37093
|
+
for (const name of names) {
|
|
37094
|
+
const hit = (servers[name]?.tools || []).find(
|
|
37095
|
+
(t) => isToolPattern(t) && toolMatches(t, toolName),
|
|
37096
|
+
);
|
|
37097
|
+
if (hit) return hit;
|
|
37098
|
+
}
|
|
37099
|
+
return null;
|
|
37100
|
+
}
|
|
37101
|
+
|
|
37102
|
+
/**
|
|
37103
|
+
* Keep only wildcard tools the gate offered for this request. The
|
|
37104
|
+
* renderer builds the grant, so a pattern it sends must be exactly the
|
|
37105
|
+
* declared one — anything broader is dropped.
|
|
37106
|
+
*/
|
|
37107
|
+
function _limitGrantPatterns(granted, allowedPattern) {
|
|
37108
|
+
for (const perms of Object.values(granted?.servers || {})) {
|
|
37109
|
+
if (!Array.isArray(perms?.tools)) continue;
|
|
37110
|
+
perms.tools = perms.tools.filter(
|
|
37111
|
+
(t) => !isToolPattern(t) || t === allowedPattern,
|
|
37112
|
+
);
|
|
37113
|
+
}
|
|
37114
|
+
return granted;
|
|
37115
|
+
}
|
|
37116
|
+
|
|
37059
37117
|
/**
|
|
37060
37118
|
* Filter a sibling-widget list down to widgets whose static manifest
|
|
37061
37119
|
* declares the given `serverName + toolName`. The originating widget
|
|
@@ -37225,6 +37283,12 @@ async function gateToolCallWithJit$1(req, opts = {}) {
|
|
|
37225
37283
|
req.toolName,
|
|
37226
37284
|
);
|
|
37227
37285
|
|
|
37286
|
+
const toolPattern = _declaredToolPattern(
|
|
37287
|
+
verifiedWidgetId,
|
|
37288
|
+
req.serverName,
|
|
37289
|
+
req.toolName,
|
|
37290
|
+
);
|
|
37291
|
+
|
|
37228
37292
|
let decision;
|
|
37229
37293
|
try {
|
|
37230
37294
|
decision = await requestApproval(
|
|
@@ -37239,6 +37303,7 @@ async function gateToolCallWithJit$1(req, opts = {}) {
|
|
|
37239
37303
|
},
|
|
37240
37304
|
packageId: siblingInfo.packageId,
|
|
37241
37305
|
siblingWidgetIds: applicableSiblingIds,
|
|
37306
|
+
toolPattern,
|
|
37242
37307
|
},
|
|
37243
37308
|
{ timeoutMs: opts.timeoutMs },
|
|
37244
37309
|
);
|
|
@@ -37282,6 +37347,7 @@ async function gateToolCallWithJit$1(req, opts = {}) {
|
|
|
37282
37347
|
};
|
|
37283
37348
|
// Force grantOrigin: "live" regardless of what the renderer sent.
|
|
37284
37349
|
addition.grantOrigin = "live";
|
|
37350
|
+
_limitGrantPatterns(addition, toolPattern);
|
|
37285
37351
|
|
|
37286
37352
|
// Slice 5: when the user opted into "Apply to all widgets from
|
|
37287
37353
|
// <package>", write the same merged grant for every sibling — each
|