@trops/dash-core 0.1.525 → 0.1.526
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 +55 -0
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -4000,11 +4000,39 @@ function requireScanWidgetPackagePermissions () {
|
|
|
4000
4000
|
return merged;
|
|
4001
4001
|
}
|
|
4002
4002
|
|
|
4003
|
+
/**
|
|
4004
|
+
* Run `applyScanToPackageJson` over a list of widget package paths.
|
|
4005
|
+
* Used at registry boot to backfill `dash.permissions.mcp` for widgets
|
|
4006
|
+
* installed before the publish/install scanner hooks existed (or that
|
|
4007
|
+
* have since updated their tool set without re-publishing). Idempotent
|
|
4008
|
+
* — additive merge means repeated boots produce no further writes.
|
|
4009
|
+
*
|
|
4010
|
+
* @param {string[]} packagePaths
|
|
4011
|
+
* @returns {{scanned: number, modified: number, errors: Array<{path: string, error: string}>}}
|
|
4012
|
+
*/
|
|
4013
|
+
function backfillPackagePermissions(packagePaths) {
|
|
4014
|
+
const summary = { scanned: 0, modified: 0, errors: [] };
|
|
4015
|
+
if (!Array.isArray(packagePaths)) return summary;
|
|
4016
|
+
for (const pkgPath of packagePaths) {
|
|
4017
|
+
if (typeof pkgPath !== "string" || !pkgPath) continue;
|
|
4018
|
+
if (!fs.existsSync(pkgPath)) continue;
|
|
4019
|
+
summary.scanned += 1;
|
|
4020
|
+
try {
|
|
4021
|
+
const merged = applyScanToPackageJson(pkgPath);
|
|
4022
|
+
if (merged) summary.modified += 1;
|
|
4023
|
+
} catch (e) {
|
|
4024
|
+
summary.errors.push({ path: pkgPath, error: e.message });
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
return summary;
|
|
4028
|
+
}
|
|
4029
|
+
|
|
4003
4030
|
scanWidgetPackagePermissions_1 = {
|
|
4004
4031
|
scanFileForMcpUsage,
|
|
4005
4032
|
scanWidgetPackagePermissions,
|
|
4006
4033
|
mergePermissions,
|
|
4007
4034
|
applyScanToPackageJson,
|
|
4035
|
+
backfillPackagePermissions,
|
|
4008
4036
|
};
|
|
4009
4037
|
return scanWidgetPackagePermissions_1;
|
|
4010
4038
|
}
|
|
@@ -4795,6 +4823,33 @@ var schedulerController_1 = schedulerController$2;
|
|
|
4795
4823
|
|
|
4796
4824
|
// Reconcile: re-register orphaned widget packages found on disk
|
|
4797
4825
|
this.reconcileWithDisk();
|
|
4826
|
+
|
|
4827
|
+
// Slice 13b: backfill `dash.permissions.mcp` for any registered
|
|
4828
|
+
// widget that was installed before the publish/install scanner
|
|
4829
|
+
// hooks existed (or that has since updated tools without
|
|
4830
|
+
// re-publishing). Additive merge — idempotent across boots.
|
|
4831
|
+
try {
|
|
4832
|
+
const {
|
|
4833
|
+
backfillPackagePermissions,
|
|
4834
|
+
} = requireScanWidgetPackagePermissions();
|
|
4835
|
+
const paths = Array.from(this.widgets.values())
|
|
4836
|
+
.map((w) => w.path)
|
|
4837
|
+
.filter(Boolean);
|
|
4838
|
+
const summary = backfillPackagePermissions(paths);
|
|
4839
|
+
if (summary.modified > 0) {
|
|
4840
|
+
console.log(
|
|
4841
|
+
`[WidgetRegistry] Backfilled MCP permissions for ${summary.modified}/${summary.scanned} widget(s)`,
|
|
4842
|
+
);
|
|
4843
|
+
}
|
|
4844
|
+
if (summary.errors.length) {
|
|
4845
|
+
console.warn(`[WidgetRegistry] MCP backfill errors:`, summary.errors);
|
|
4846
|
+
}
|
|
4847
|
+
} catch (e) {
|
|
4848
|
+
console.warn(
|
|
4849
|
+
"[WidgetRegistry] MCP permissions backfill failed:",
|
|
4850
|
+
e.message,
|
|
4851
|
+
);
|
|
4852
|
+
}
|
|
4798
4853
|
}
|
|
4799
4854
|
|
|
4800
4855
|
/**
|