@trops/dash-core 0.1.497 → 0.1.498

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.
@@ -17,7 +17,7 @@ var require$$0$5 = require('@modelcontextprotocol/sdk/client/index.js');
17
17
  var require$$1$4 = require('@modelcontextprotocol/sdk/client/stdio.js');
18
18
  var require$$0$4 = require('pkce-challenge');
19
19
  var require$$2$1 = require('os');
20
- var require$$11 = require('child_process');
20
+ var require$$12 = require('child_process');
21
21
  var require$$3$2 = require('adm-zip');
22
22
  var require$$4$1 = require('url');
23
23
  var require$$2$2 = require('vm');
@@ -22081,6 +22081,37 @@ var mcpScopeResolver = {
22081
22081
  applyPathScopeToCredentials: applyPathScopeToCredentials$1,
22082
22082
  };
22083
22083
 
22084
+ /**
22085
+ * securityFlags.js
22086
+ *
22087
+ * Centralized readers for the two boolean security flags that gate the
22088
+ * MCP allowlist stack:
22089
+ * - security.enforceWidgetMcpPermissions
22090
+ * - security.enableJitConsent
22091
+ *
22092
+ * **Default semantics: ON.** A missing settings.json, a missing
22093
+ * `security` block, or an undefined field all yield `true`. Only an
22094
+ * explicit `false` opts out. This is intentional — the security stack
22095
+ * is on by default; users have to actively disable it. The
22096
+ * Privacy & Security panel surfaces the toggles + a confirm-on-disable
22097
+ * dialog so the disable path is deliberate.
22098
+ *
22099
+ * The readers are pure functions of a settings object so the
22100
+ * default-on semantics are pinned by unit tests without touching the
22101
+ * filesystem. The callers in mcpController.js wrap these with
22102
+ * settings.json IO.
22103
+ */
22104
+
22105
+ function readEnforceFlag$1(settings) {
22106
+ return settings?.security?.enforceWidgetMcpPermissions !== false;
22107
+ }
22108
+
22109
+ function readJitFlag$1(settings) {
22110
+ return settings?.security?.enableJitConsent !== false;
22111
+ }
22112
+
22113
+ var securityFlags = { readEnforceFlag: readEnforceFlag$1, readJitFlag: readJitFlag$1 };
22114
+
22084
22115
  /**
22085
22116
  * mcpController.js
22086
22117
  *
@@ -22108,46 +22139,42 @@ const responseCache$2 = responseCache_1;
22108
22139
  const { gateToolCall, gateToolCallWithJit } = permissionGate;
22109
22140
  const { serverKey, parseServerKey } = mcpServerKey;
22110
22141
  const { applyPathScopeToCredentials } = mcpScopeResolver;
22142
+ const { readEnforceFlag, readJitFlag } = securityFlags;
22111
22143
  const { app: app$7 } = require$$0$1;
22112
22144
 
22113
- // Read the widget-MCP-enforcement feature flag from settings.json.
22114
- // Default is OFF flipping ON activates per-widget gating in
22115
- // permissionGate.gateToolCall(). See docs/security/ipc-filesystem-audit.md
22116
- // and electron/mcp/permissionGate.js for context.
22117
- function isWidgetPermissionEnforcementEnabled() {
22145
+ /**
22146
+ * Load the user's settings.json (or null on absence/parse error). The
22147
+ * file is small; reading it on every MCP call is acceptable. If we
22148
+ * ever care about overhead, cache + invalidate-on-change.
22149
+ */
22150
+ function loadSettingsForFlags() {
22118
22151
  try {
22119
22152
  const settingsPath = path$e.join(
22120
22153
  app$7.getPath("userData"),
22121
22154
  "Dashboard",
22122
22155
  "settings.json",
22123
22156
  );
22124
- if (!fs$a.existsSync(settingsPath)) return false;
22157
+ if (!fs$a.existsSync(settingsPath)) return null;
22125
22158
  const raw = fs$a.readFileSync(settingsPath, "utf8");
22126
- const settings = JSON.parse(raw);
22127
- return Boolean(settings?.security?.enforceWidgetMcpPermissions);
22159
+ return JSON.parse(raw);
22128
22160
  } catch (_e) {
22129
- return false;
22161
+ return null;
22130
22162
  }
22131
22163
  }
22132
22164
 
22133
- // Just-in-time consent feature flag (Phase 1 of the JIT consent slice).
22134
- // When ON and the gate would deny for "no grant", we pause the call
22135
- // and prompt the user via the JitConsentModal. Default OFF the gate
22136
- // fails closed as before until the user opts in.
22165
+ // MCP enforcement flag. **Default ON** only an explicit
22166
+ // `security.enforceWidgetMcpPermissions: false` in settings.json opts
22167
+ // out. The Privacy & Security panel surfaces a UI toggle with a
22168
+ // confirm-on-disable dialog. See electron/utils/securityFlags.js for
22169
+ // the pinned default semantics.
22170
+ function isWidgetPermissionEnforcementEnabled() {
22171
+ return readEnforceFlag(loadSettingsForFlags());
22172
+ }
22173
+
22174
+ // JIT consent flag. **Default ON.** Same semantics as the enforcement
22175
+ // flag — explicit false to opt out, otherwise on.
22137
22176
  function isJitConsentEnabled() {
22138
- try {
22139
- const settingsPath = path$e.join(
22140
- app$7.getPath("userData"),
22141
- "Dashboard",
22142
- "settings.json",
22143
- );
22144
- if (!fs$a.existsSync(settingsPath)) return false;
22145
- const raw = fs$a.readFileSync(settingsPath, "utf8");
22146
- const settings = JSON.parse(raw);
22147
- return Boolean(settings?.security?.enableJitConsent);
22148
- } catch (_e) {
22149
- return false;
22150
- }
22177
+ return readJitFlag(loadSettingsForFlags());
22151
22178
  }
22152
22179
 
22153
22180
  /**
@@ -22284,7 +22311,7 @@ function getShellPath$1() {
22284
22311
  return _shellPath$1;
22285
22312
  }
22286
22313
 
22287
- const { execSync } = require$$11;
22314
+ const { execSync } = require$$12;
22288
22315
  const fallbackDirs = ["/usr/local/bin", "/opt/homebrew/bin"];
22289
22316
 
22290
22317
  // Scan nvm versions, tracking both latest and best compatible version
@@ -23241,7 +23268,7 @@ const mcpController$3 = {
23241
23268
  * @returns {{ success } | { error, message }}
23242
23269
  */
23243
23270
  runAuth: async (win, mcpConfig, credentials, authCommand) => {
23244
- const { spawn } = require$$11;
23271
+ const { spawn } = require$$12;
23245
23272
 
23246
23273
  const env = cleanEnvForChildProcess();
23247
23274
 
@@ -48641,7 +48668,7 @@ var mcpDashServerController_1 = mcpDashServerController$4;
48641
48668
  * can use the Chat widget without a separate API key.
48642
48669
  */
48643
48670
 
48644
- const { spawn, execSync } = require$$11;
48671
+ const { spawn, execSync } = require$$12;
48645
48672
  const {
48646
48673
  LLM_STREAM_DELTA: LLM_STREAM_DELTA$2,
48647
48674
  LLM_STREAM_TOOL_CALL: LLM_STREAM_TOOL_CALL$2,