@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.
package/dist/index.js CHANGED
@@ -49229,6 +49229,40 @@ var EnforcementToggles = function EnforcementToggles() {
49229
49229
  }
49230
49230
  setPendingDisable(null);
49231
49231
  };
49232
+
49233
+ // One-click JIT trigger for testing. Calls the gate via a fake widget
49234
+ // identity that has no grant — the gate denies, JIT escalates, the
49235
+ // modal pops. After approval, the call proceeds to the (nonexistent)
49236
+ // "test-server" and errors with "server not connected"; that's the
49237
+ // expected response since the goal is to exercise the consent flow,
49238
+ // not the server's response.
49239
+ var triggerTestJitPrompt = /*#__PURE__*/function () {
49240
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
49241
+ var _window$mainApi3, _window$mainApi3$call;
49242
+ return _regeneratorRuntime.wrap(function (_context5) {
49243
+ while (1) switch (_context5.prev = _context5.next) {
49244
+ case 0:
49245
+ _context5.prev = 0;
49246
+ _context5.next = 1;
49247
+ return (_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.mcp) === null || _window$mainApi3 === void 0 || (_window$mainApi3$call = _window$mainApi3.callTool) === null || _window$mainApi3$call === void 0 ? void 0 : _window$mainApi3$call.call(_window$mainApi3, "test-server", "test_tool", {
49248
+ path: "/tmp/jit-probe.txt"
49249
+ }, null, "@test/jit-probe");
49250
+ case 1:
49251
+ _context5.next = 3;
49252
+ break;
49253
+ case 2:
49254
+ _context5.prev = 2;
49255
+ _context5["catch"](0);
49256
+ case 3:
49257
+ case "end":
49258
+ return _context5.stop();
49259
+ }
49260
+ }, _callee5, null, [[0, 2]]);
49261
+ }));
49262
+ return function triggerTestJitPrompt() {
49263
+ return _ref6.apply(this, arguments);
49264
+ };
49265
+ }();
49232
49266
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
49233
49267
  className: "flex flex-col space-y-4 border border-gray-700 rounded p-4",
49234
49268
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -49262,12 +49296,31 @@ var EnforcementToggles = function EnforcementToggles() {
49262
49296
  onChange: handleJitToggle,
49263
49297
  disabled: !enforceEnabled
49264
49298
  })]
49265
- }), /*#__PURE__*/jsxRuntime.jsx(ConfirmDisableModal, {
49299
+ }), /*#__PURE__*/jsxRuntime.jsx(ConfirmDisableInline, {
49266
49300
  pending: pendingDisable,
49267
49301
  onCancel: function onCancel() {
49268
49302
  return setPendingDisable(null);
49269
49303
  },
49270
49304
  onConfirm: confirmDisable
49305
+ }), enforceEnabled && jitEnabled && /*#__PURE__*/jsxRuntime.jsxs("div", {
49306
+ className: "flex flex-row items-center justify-between gap-4 border-t border-gray-800 pt-4",
49307
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
49308
+ className: "flex flex-col",
49309
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
49310
+ className: "text-sm font-medium text-gray-200",
49311
+ children: "Test JIT consent prompt"
49312
+ }), /*#__PURE__*/jsxRuntime.jsxs("span", {
49313
+ className: "text-xs text-gray-400 mt-1",
49314
+ children: ["Fires a fake tool call from ", /*#__PURE__*/jsxRuntime.jsx("code", {
49315
+ children: "@test/jit-probe"
49316
+ }), " to", " ", /*#__PURE__*/jsxRuntime.jsx("code", {
49317
+ children: "test-server"
49318
+ }), ". The gate runs first (no real server needed), so you'll see the JIT modal exactly as it appears in production. Approve and the call proceeds \u2014 the fake server isn't running, so a \"server not connected\" error follows in the console. That's the expected response; the goal is to validate the consent flow."]
49319
+ })]
49320
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
49321
+ title: "Test prompt",
49322
+ onClick: triggerTestJitPrompt
49323
+ })]
49271
49324
  })]
49272
49325
  });
49273
49326
  };
@@ -49283,57 +49336,59 @@ var DISABLE_COPY = {
49283
49336
  confirmLabel: "Disable prompts"
49284
49337
  }
49285
49338
  };
49286
- var ConfirmDisableModal = function ConfirmDisableModal(_ref6) {
49287
- var pending = _ref6.pending,
49288
- onCancel = _ref6.onCancel,
49289
- onConfirm = _ref6.onConfirm;
49339
+
49340
+ /**
49341
+ * Inline confirmation prompt — rendered directly under the toggles
49342
+ * inside the EnforcementToggles container, NOT as a nested Modal.
49343
+ *
49344
+ * Why inline: the Settings panel itself is already a Modal, so a
49345
+ * nested Modal positions relative to the panel's content area rather
49346
+ * than the viewport, landing visibly off-center. Inline avoids the
49347
+ * nesting entirely; the user keeps context and the warning is
49348
+ * impossible to miss right where the toggle lives.
49349
+ */
49350
+ var ConfirmDisableInline = function ConfirmDisableInline(_ref7) {
49351
+ var pending = _ref7.pending,
49352
+ onCancel = _ref7.onCancel,
49353
+ onConfirm = _ref7.onConfirm;
49290
49354
  if (!pending) return null;
49291
49355
  var copy = DISABLE_COPY[pending.flag];
49292
49356
  if (!copy) return null;
49293
- return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
49294
- isOpen: !!pending,
49295
- setIsOpen: function setIsOpen(open) {
49296
- return !open && onCancel();
49297
- },
49298
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
49299
- className: "flex flex-col w-full max-w-md border-2 border-amber-500 rounded",
49300
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49301
- className: "px-5 py-4 border-b border-gray-700",
49302
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
49303
- className: "flex flex-row items-center gap-2",
49304
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
49305
- icon: "triangle-exclamation",
49306
- className: "h-4 w-4 text-amber-500"
49307
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
49308
- className: "text-base font-semibold text-gray-100",
49309
- children: copy.title
49310
- })]
49311
- })
49312
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
49313
- className: "px-5 py-4 text-xs text-gray-300 leading-relaxed",
49314
- children: copy.body
49315
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
49316
- className: "flex justify-end gap-2 px-5 py-3 border-t border-gray-700",
49317
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
49318
- title: "Cancel",
49319
- onClick: onCancel
49320
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
49321
- title: copy.confirmLabel,
49322
- onClick: onConfirm
49323
- })]
49357
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
49358
+ className: "flex flex-col gap-3 border-2 border-amber-500 rounded p-3 mt-2",
49359
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
49360
+ className: "flex flex-row items-center gap-2",
49361
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
49362
+ icon: "triangle-exclamation",
49363
+ className: "h-4 w-4 text-amber-500"
49364
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
49365
+ className: "text-sm font-semibold text-gray-100",
49366
+ children: copy.title
49324
49367
  })]
49325
- })
49368
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
49369
+ className: "text-xs text-gray-300 leading-relaxed",
49370
+ children: copy.body
49371
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
49372
+ className: "flex justify-end gap-2",
49373
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
49374
+ title: "Cancel",
49375
+ onClick: onCancel
49376
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
49377
+ title: copy.confirmLabel,
49378
+ onClick: onConfirm
49379
+ })]
49380
+ })]
49326
49381
  });
49327
49382
  };
49328
- var WidgetGrantRow = function WidgetGrantRow(_ref7) {
49329
- var widgetId = _ref7.widgetId,
49330
- declared = _ref7.declared,
49331
- granted = _ref7.granted,
49332
- hasManifest = _ref7.hasManifest,
49333
- grantOrigin = _ref7.grantOrigin,
49334
- onRevokeWidget = _ref7.onRevokeWidget,
49335
- onRevokeServer = _ref7.onRevokeServer,
49336
- onGrantManually = _ref7.onGrantManually;
49383
+ var WidgetGrantRow = function WidgetGrantRow(_ref8) {
49384
+ var widgetId = _ref8.widgetId,
49385
+ declared = _ref8.declared,
49386
+ granted = _ref8.granted,
49387
+ hasManifest = _ref8.hasManifest,
49388
+ grantOrigin = _ref8.grantOrigin,
49389
+ onRevokeWidget = _ref8.onRevokeWidget,
49390
+ onRevokeServer = _ref8.onRevokeServer,
49391
+ onGrantManually = _ref8.onGrantManually;
49337
49392
  var declaredServers = declared && declared.servers || {};
49338
49393
  var grantedServers = granted && granted.servers || {};
49339
49394
  var allServerNames = Array.from(new Set([].concat(_toConsumableArray(Object.keys(declaredServers)), _toConsumableArray(Object.keys(grantedServers)))));
@@ -49405,10 +49460,10 @@ var WidgetGrantRow = function WidgetGrantRow(_ref7) {
49405
49460
  })]
49406
49461
  });
49407
49462
  };
49408
- var PermsList = function PermsList(_ref8) {
49409
- var label = _ref8.label,
49410
- declaredItems = _ref8.declaredItems,
49411
- grantedItems = _ref8.grantedItems;
49463
+ var PermsList = function PermsList(_ref9) {
49464
+ var label = _ref9.label,
49465
+ declaredItems = _ref9.declaredItems,
49466
+ grantedItems = _ref9.grantedItems;
49412
49467
  if (declaredItems.length === 0 && grantedItems.length === 0) return null;
49413
49468
  var grantedSet = new Set(grantedItems);
49414
49469
  var declaredSet = new Set(declaredItems);
@@ -49464,8 +49519,8 @@ function isServerEntirelyStale(decl, grant) {
49464
49519
  * the user audit grants that were approved against a scanner guess
49465
49520
  * rather than the developer's explicit declaration.
49466
49521
  */
49467
- var GrantOriginBadge = function GrantOriginBadge(_ref9) {
49468
- var origin = _ref9.origin;
49522
+ var GrantOriginBadge = function GrantOriginBadge(_ref0) {
49523
+ var origin = _ref0.origin;
49469
49524
  var styles = {
49470
49525
  declared: {
49471
49526
  label: "declared",