@trops/dash-core 0.1.499 → 0.1.501

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.esm.js CHANGED
@@ -49169,6 +49169,27 @@ var EnforcementToggles = function EnforcementToggles() {
49169
49169
  _useState10 = _slicedToArray(_useState1, 2),
49170
49170
  pendingDisable = _useState10[0],
49171
49171
  setPendingDisable = _useState10[1];
49172
+
49173
+ // lastTestResult: feedback for the "Test prompt" button. Tells the
49174
+ // user whether their JIT response was actually persisted, so they
49175
+ // don't have to interpret the post-grant "server not connected"
49176
+ // error as failure.
49177
+ var _useState11 = useState(null),
49178
+ _useState12 = _slicedToArray(_useState11, 2),
49179
+ lastTestResult = _useState12[0],
49180
+ setLastTestResult = _useState12[1];
49181
+
49182
+ // Auto-clear the test result after 30 seconds so it doesn't linger
49183
+ // forever after a successful test.
49184
+ useEffect(function () {
49185
+ if (!lastTestResult) return;
49186
+ var timer = setTimeout(function () {
49187
+ return setLastTestResult(null);
49188
+ }, 30000);
49189
+ return function () {
49190
+ return clearTimeout(timer);
49191
+ };
49192
+ }, [lastTestResult]);
49172
49193
  var writeSecurity = function writeSecurity(updates) {
49173
49194
  if (!(appContext !== null && appContext !== void 0 && appContext.changeSettings)) return;
49174
49195
  var next = _objectSpread$g(_objectSpread$g({}, settings), {}, {
@@ -49211,6 +49232,87 @@ var EnforcementToggles = function EnforcementToggles() {
49211
49232
  }
49212
49233
  setPendingDisable(null);
49213
49234
  };
49235
+
49236
+ // One-click JIT trigger for testing. Calls the gate via a fake widget
49237
+ // identity that has no grant — the gate denies, JIT escalates, the
49238
+ // modal pops. We classify the outcome so the user knows whether their
49239
+ // JIT response was actually persisted (vs whether the test ran at all).
49240
+ //
49241
+ // Outcome classification:
49242
+ // message includes "Server not connected" → granted
49243
+ // (gate passed, post-gate server lookup expectedly failed because
49244
+ // "test-server" doesn't exist — the goal is the consent flow, not
49245
+ // the server response)
49246
+ // message includes "user declined" → denied
49247
+ // message includes "JIT consent timed out" → timeout
49248
+ // anything else → unknown error
49249
+ var triggerTestJitPrompt = /*#__PURE__*/function () {
49250
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
49251
+ var _window$mainApi3, _window$mainApi3$call, result, msg, _t5;
49252
+ return _regeneratorRuntime.wrap(function (_context5) {
49253
+ while (1) switch (_context5.prev = _context5.next) {
49254
+ case 0:
49255
+ setLastTestResult({
49256
+ status: "pending",
49257
+ message: "Waiting for response…"
49258
+ });
49259
+ _context5.prev = 1;
49260
+ _context5.next = 2;
49261
+ 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", {
49262
+ path: "/tmp/jit-probe.txt"
49263
+ }, null, "@test/jit-probe");
49264
+ case 2:
49265
+ result = _context5.sent;
49266
+ // callTool resolves to { error, message } on the main side; classify.
49267
+ msg = (result === null || result === void 0 ? void 0 : result.message) || JSON.stringify(result || {});
49268
+ if (/server not connected/i.test(msg)) {
49269
+ setLastTestResult({
49270
+ status: "granted",
49271
+ message: "Granted — your response was saved as a 'live' grant for @test/jit-probe."
49272
+ });
49273
+ } else if (/user declined/i.test(msg)) {
49274
+ setLastTestResult({
49275
+ status: "denied",
49276
+ message: "Denied — no grant written."
49277
+ });
49278
+ } else if (/timed out/i.test(msg)) {
49279
+ setLastTestResult({
49280
+ status: "timeout",
49281
+ message: "Timed out — no response within 60s."
49282
+ });
49283
+ } else {
49284
+ setLastTestResult({
49285
+ status: "unknown",
49286
+ message: "Unexpected: " + msg
49287
+ });
49288
+ }
49289
+ _context5.next = 4;
49290
+ break;
49291
+ case 3:
49292
+ _context5.prev = 3;
49293
+ _t5 = _context5["catch"](1);
49294
+ setLastTestResult({
49295
+ status: "error",
49296
+ message: "Test threw: " + ((_t5 === null || _t5 === void 0 ? void 0 : _t5.message) || String(_t5))
49297
+ });
49298
+ case 4:
49299
+ case "end":
49300
+ return _context5.stop();
49301
+ }
49302
+ }, _callee5, null, [[1, 3]]);
49303
+ }));
49304
+ return function triggerTestJitPrompt() {
49305
+ return _ref6.apply(this, arguments);
49306
+ };
49307
+ }();
49308
+ var TEST_RESULT_STYLE = {
49309
+ pending: "text-gray-400",
49310
+ granted: "text-green-400",
49311
+ denied: "text-amber-400",
49312
+ timeout: "text-amber-400",
49313
+ unknown: "text-red-400",
49314
+ error: "text-red-400"
49315
+ };
49214
49316
  return /*#__PURE__*/jsxs("div", {
49215
49317
  className: "flex flex-col space-y-4 border border-gray-700 rounded p-4",
49216
49318
  children: [/*#__PURE__*/jsxs("div", {
@@ -49250,6 +49352,31 @@ var EnforcementToggles = function EnforcementToggles() {
49250
49352
  return setPendingDisable(null);
49251
49353
  },
49252
49354
  onConfirm: confirmDisable
49355
+ }), enforceEnabled && jitEnabled && /*#__PURE__*/jsxs("div", {
49356
+ className: "flex flex-col gap-2 border-t border-gray-800 pt-4",
49357
+ children: [/*#__PURE__*/jsxs("div", {
49358
+ className: "flex flex-row items-center justify-between gap-4",
49359
+ children: [/*#__PURE__*/jsxs("div", {
49360
+ className: "flex flex-col",
49361
+ children: [/*#__PURE__*/jsx("span", {
49362
+ className: "text-sm font-medium text-gray-200",
49363
+ children: "Test JIT consent prompt"
49364
+ }), /*#__PURE__*/jsxs("span", {
49365
+ className: "text-xs text-gray-400 mt-1",
49366
+ children: ["Fires a fake tool call from ", /*#__PURE__*/jsx("code", {
49367
+ children: "@test/jit-probe"
49368
+ }), " to", " ", /*#__PURE__*/jsx("code", {
49369
+ children: "test-server"
49370
+ }), ". The gate runs first (no real server needed), so you'll see the JIT modal exactly as it appears in production. The post-gate server lookup expectedly fails \u2014 that's fine; the goal here is to exercise the consent flow."]
49371
+ })]
49372
+ }), /*#__PURE__*/jsx(Button, {
49373
+ title: "Test prompt",
49374
+ onClick: triggerTestJitPrompt
49375
+ })]
49376
+ }), lastTestResult && /*#__PURE__*/jsxs("div", {
49377
+ className: "text-xs font-medium ".concat(TEST_RESULT_STYLE[lastTestResult.status] || "text-gray-400"),
49378
+ children: ["Last test (", lastTestResult.status, "): ", lastTestResult.message]
49379
+ })]
49253
49380
  })]
49254
49381
  });
49255
49382
  };
@@ -49276,10 +49403,10 @@ var DISABLE_COPY = {
49276
49403
  * nesting entirely; the user keeps context and the warning is
49277
49404
  * impossible to miss right where the toggle lives.
49278
49405
  */
49279
- var ConfirmDisableInline = function ConfirmDisableInline(_ref6) {
49280
- var pending = _ref6.pending,
49281
- onCancel = _ref6.onCancel,
49282
- onConfirm = _ref6.onConfirm;
49406
+ var ConfirmDisableInline = function ConfirmDisableInline(_ref7) {
49407
+ var pending = _ref7.pending,
49408
+ onCancel = _ref7.onCancel,
49409
+ onConfirm = _ref7.onConfirm;
49283
49410
  if (!pending) return null;
49284
49411
  var copy = DISABLE_COPY[pending.flag];
49285
49412
  if (!copy) return null;
@@ -49309,15 +49436,15 @@ var ConfirmDisableInline = function ConfirmDisableInline(_ref6) {
49309
49436
  })]
49310
49437
  });
49311
49438
  };
49312
- var WidgetGrantRow = function WidgetGrantRow(_ref7) {
49313
- var widgetId = _ref7.widgetId,
49314
- declared = _ref7.declared,
49315
- granted = _ref7.granted,
49316
- hasManifest = _ref7.hasManifest,
49317
- grantOrigin = _ref7.grantOrigin,
49318
- onRevokeWidget = _ref7.onRevokeWidget,
49319
- onRevokeServer = _ref7.onRevokeServer,
49320
- onGrantManually = _ref7.onGrantManually;
49439
+ var WidgetGrantRow = function WidgetGrantRow(_ref8) {
49440
+ var widgetId = _ref8.widgetId,
49441
+ declared = _ref8.declared,
49442
+ granted = _ref8.granted,
49443
+ hasManifest = _ref8.hasManifest,
49444
+ grantOrigin = _ref8.grantOrigin,
49445
+ onRevokeWidget = _ref8.onRevokeWidget,
49446
+ onRevokeServer = _ref8.onRevokeServer,
49447
+ onGrantManually = _ref8.onGrantManually;
49321
49448
  var declaredServers = declared && declared.servers || {};
49322
49449
  var grantedServers = granted && granted.servers || {};
49323
49450
  var allServerNames = Array.from(new Set([].concat(_toConsumableArray(Object.keys(declaredServers)), _toConsumableArray(Object.keys(grantedServers)))));
@@ -49389,10 +49516,10 @@ var WidgetGrantRow = function WidgetGrantRow(_ref7) {
49389
49516
  })]
49390
49517
  });
49391
49518
  };
49392
- var PermsList = function PermsList(_ref8) {
49393
- var label = _ref8.label,
49394
- declaredItems = _ref8.declaredItems,
49395
- grantedItems = _ref8.grantedItems;
49519
+ var PermsList = function PermsList(_ref9) {
49520
+ var label = _ref9.label,
49521
+ declaredItems = _ref9.declaredItems,
49522
+ grantedItems = _ref9.grantedItems;
49396
49523
  if (declaredItems.length === 0 && grantedItems.length === 0) return null;
49397
49524
  var grantedSet = new Set(grantedItems);
49398
49525
  var declaredSet = new Set(declaredItems);
@@ -49448,8 +49575,8 @@ function isServerEntirelyStale(decl, grant) {
49448
49575
  * the user audit grants that were approved against a scanner guess
49449
49576
  * rather than the developer's explicit declaration.
49450
49577
  */
49451
- var GrantOriginBadge = function GrantOriginBadge(_ref9) {
49452
- var origin = _ref9.origin;
49578
+ var GrantOriginBadge = function GrantOriginBadge(_ref0) {
49579
+ var origin = _ref0.origin;
49453
49580
  var styles = {
49454
49581
  declared: {
49455
49582
  label: "declared",
@@ -49602,10 +49729,10 @@ var noop = function noop() {};
49602
49729
  * users who don't want the wall of text collapse manually.
49603
49730
  */
49604
49731
  var HowThisWorksPanel = function HowThisWorksPanel() {
49605
- var _useState11 = useState(true),
49606
- _useState12 = _slicedToArray(_useState11, 2),
49607
- open = _useState12[0],
49608
- setOpen = _useState12[1];
49732
+ var _useState13 = useState(true),
49733
+ _useState14 = _slicedToArray(_useState13, 2),
49734
+ open = _useState14[0],
49735
+ setOpen = _useState14[1];
49609
49736
  return /*#__PURE__*/jsxs("div", {
49610
49737
  className: "border border-gray-700 rounded",
49611
49738
  children: [/*#__PURE__*/jsxs("button", {