@trops/dash-core 0.1.498 → 0.1.500

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.
@@ -22933,11 +22933,6 @@ const mcpController$3 = {
22933
22933
  ) => {
22934
22934
  const key = serverKey(workspaceId, serverName);
22935
22935
  try {
22936
- const server = activeServers.get(key);
22937
- if (!server || !server.client) {
22938
- throw new Error(`Server not connected: ${key}`);
22939
- }
22940
-
22941
22936
  // Per-widget manifest gate. Activated by the
22942
22937
  // security.enforceWidgetMcpPermissions setting. When enabled
22943
22938
  // and a widgetId is supplied, the widget's persisted grant
@@ -22948,6 +22943,16 @@ const mcpController$3 = {
22948
22943
  // (jitConsent.requestApproval → renderer modal → grant write +
22949
22944
  // re-evaluate). Other denial reasons (path traversal, malformed
22950
22945
  // args, etc.) stay synchronous.
22946
+ //
22947
+ // **Order: gate runs BEFORE the server-connected check.** A
22948
+ // permission denial is a semantic answer ("you can't ask for
22949
+ // this"); a server-not-connected error is operational state
22950
+ // ("we couldn't reach the thing"). Running the gate first
22951
+ // (a) lets JIT prompt even when the server isn't started yet —
22952
+ // critical for testability and for first-call scenarios where
22953
+ // startServer happens after the gate decides — and (b) avoids
22954
+ // leaking server-running state through error timing to a
22955
+ // probing widget that doesn't have permission anyway.
22951
22956
  if (isWidgetPermissionEnforcementEnabled() && widgetId) {
22952
22957
  const gateReq = { widgetId, serverName, toolName, args };
22953
22958
  const gate = isJitConsentEnabled()
@@ -22958,6 +22963,11 @@ const mcpController$3 = {
22958
22963
  }
22959
22964
  }
22960
22965
 
22966
+ const server = activeServers.get(key);
22967
+ if (!server || !server.client) {
22968
+ throw new Error(`Server not connected: ${key}`);
22969
+ }
22970
+
22961
22971
  // Legacy renderer-supplied allowedTools whitelist. Kept for
22962
22972
  // backward compatibility with callers that pre-date the
22963
22973
  // manifest-based gate. Once the manifest gate is enforced