@trops/dash-core 0.1.500 → 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 +106 -32
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +106 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49187,6 +49187,27 @@ var EnforcementToggles = function EnforcementToggles() {
|
|
|
49187
49187
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
49188
49188
|
pendingDisable = _useState10[0],
|
|
49189
49189
|
setPendingDisable = _useState10[1];
|
|
49190
|
+
|
|
49191
|
+
// lastTestResult: feedback for the "Test prompt" button. Tells the
|
|
49192
|
+
// user whether their JIT response was actually persisted, so they
|
|
49193
|
+
// don't have to interpret the post-grant "server not connected"
|
|
49194
|
+
// error as failure.
|
|
49195
|
+
var _useState11 = React.useState(null),
|
|
49196
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
49197
|
+
lastTestResult = _useState12[0],
|
|
49198
|
+
setLastTestResult = _useState12[1];
|
|
49199
|
+
|
|
49200
|
+
// Auto-clear the test result after 30 seconds so it doesn't linger
|
|
49201
|
+
// forever after a successful test.
|
|
49202
|
+
React.useEffect(function () {
|
|
49203
|
+
if (!lastTestResult) return;
|
|
49204
|
+
var timer = setTimeout(function () {
|
|
49205
|
+
return setLastTestResult(null);
|
|
49206
|
+
}, 30000);
|
|
49207
|
+
return function () {
|
|
49208
|
+
return clearTimeout(timer);
|
|
49209
|
+
};
|
|
49210
|
+
}, [lastTestResult]);
|
|
49190
49211
|
var writeSecurity = function writeSecurity(updates) {
|
|
49191
49212
|
if (!(appContext !== null && appContext !== void 0 && appContext.changeSettings)) return;
|
|
49192
49213
|
var next = _objectSpread$g(_objectSpread$g({}, settings), {}, {
|
|
@@ -49232,37 +49253,84 @@ var EnforcementToggles = function EnforcementToggles() {
|
|
|
49232
49253
|
|
|
49233
49254
|
// One-click JIT trigger for testing. Calls the gate via a fake widget
|
|
49234
49255
|
// identity that has no grant — the gate denies, JIT escalates, the
|
|
49235
|
-
// modal pops.
|
|
49236
|
-
//
|
|
49237
|
-
//
|
|
49238
|
-
//
|
|
49256
|
+
// modal pops. We classify the outcome so the user knows whether their
|
|
49257
|
+
// JIT response was actually persisted (vs whether the test ran at all).
|
|
49258
|
+
//
|
|
49259
|
+
// Outcome classification:
|
|
49260
|
+
// message includes "Server not connected" → granted
|
|
49261
|
+
// (gate passed, post-gate server lookup expectedly failed because
|
|
49262
|
+
// "test-server" doesn't exist — the goal is the consent flow, not
|
|
49263
|
+
// the server response)
|
|
49264
|
+
// message includes "user declined" → denied
|
|
49265
|
+
// message includes "JIT consent timed out" → timeout
|
|
49266
|
+
// anything else → unknown error
|
|
49239
49267
|
var triggerTestJitPrompt = /*#__PURE__*/function () {
|
|
49240
49268
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
49241
|
-
var _window$mainApi3, _window$mainApi3$call;
|
|
49269
|
+
var _window$mainApi3, _window$mainApi3$call, result, msg, _t5;
|
|
49242
49270
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
49243
49271
|
while (1) switch (_context5.prev = _context5.next) {
|
|
49244
49272
|
case 0:
|
|
49245
|
-
|
|
49246
|
-
|
|
49273
|
+
setLastTestResult({
|
|
49274
|
+
status: "pending",
|
|
49275
|
+
message: "Waiting for response…"
|
|
49276
|
+
});
|
|
49277
|
+
_context5.prev = 1;
|
|
49278
|
+
_context5.next = 2;
|
|
49247
49279
|
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
49280
|
path: "/tmp/jit-probe.txt"
|
|
49249
49281
|
}, null, "@test/jit-probe");
|
|
49250
|
-
case 1:
|
|
49251
|
-
_context5.next = 3;
|
|
49252
|
-
break;
|
|
49253
49282
|
case 2:
|
|
49254
|
-
|
|
49255
|
-
|
|
49283
|
+
result = _context5.sent;
|
|
49284
|
+
// callTool resolves to { error, message } on the main side; classify.
|
|
49285
|
+
msg = (result === null || result === void 0 ? void 0 : result.message) || JSON.stringify(result || {});
|
|
49286
|
+
if (/server not connected/i.test(msg)) {
|
|
49287
|
+
setLastTestResult({
|
|
49288
|
+
status: "granted",
|
|
49289
|
+
message: "Granted — your response was saved as a 'live' grant for @test/jit-probe."
|
|
49290
|
+
});
|
|
49291
|
+
} else if (/user declined/i.test(msg)) {
|
|
49292
|
+
setLastTestResult({
|
|
49293
|
+
status: "denied",
|
|
49294
|
+
message: "Denied — no grant written."
|
|
49295
|
+
});
|
|
49296
|
+
} else if (/timed out/i.test(msg)) {
|
|
49297
|
+
setLastTestResult({
|
|
49298
|
+
status: "timeout",
|
|
49299
|
+
message: "Timed out — no response within 60s."
|
|
49300
|
+
});
|
|
49301
|
+
} else {
|
|
49302
|
+
setLastTestResult({
|
|
49303
|
+
status: "unknown",
|
|
49304
|
+
message: "Unexpected: " + msg
|
|
49305
|
+
});
|
|
49306
|
+
}
|
|
49307
|
+
_context5.next = 4;
|
|
49308
|
+
break;
|
|
49256
49309
|
case 3:
|
|
49310
|
+
_context5.prev = 3;
|
|
49311
|
+
_t5 = _context5["catch"](1);
|
|
49312
|
+
setLastTestResult({
|
|
49313
|
+
status: "error",
|
|
49314
|
+
message: "Test threw: " + ((_t5 === null || _t5 === void 0 ? void 0 : _t5.message) || String(_t5))
|
|
49315
|
+
});
|
|
49316
|
+
case 4:
|
|
49257
49317
|
case "end":
|
|
49258
49318
|
return _context5.stop();
|
|
49259
49319
|
}
|
|
49260
|
-
}, _callee5, null, [[
|
|
49320
|
+
}, _callee5, null, [[1, 3]]);
|
|
49261
49321
|
}));
|
|
49262
49322
|
return function triggerTestJitPrompt() {
|
|
49263
49323
|
return _ref6.apply(this, arguments);
|
|
49264
49324
|
};
|
|
49265
49325
|
}();
|
|
49326
|
+
var TEST_RESULT_STYLE = {
|
|
49327
|
+
pending: "text-gray-400",
|
|
49328
|
+
granted: "text-green-400",
|
|
49329
|
+
denied: "text-amber-400",
|
|
49330
|
+
timeout: "text-amber-400",
|
|
49331
|
+
unknown: "text-red-400",
|
|
49332
|
+
error: "text-red-400"
|
|
49333
|
+
};
|
|
49266
49334
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49267
49335
|
className: "flex flex-col space-y-4 border border-gray-700 rounded p-4",
|
|
49268
49336
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -49303,23 +49371,29 @@ var EnforcementToggles = function EnforcementToggles() {
|
|
|
49303
49371
|
},
|
|
49304
49372
|
onConfirm: confirmDisable
|
|
49305
49373
|
}), enforceEnabled && jitEnabled && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49306
|
-
className: "flex flex-
|
|
49374
|
+
className: "flex flex-col gap-2 border-t border-gray-800 pt-4",
|
|
49307
49375
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49308
|
-
className: "flex flex-
|
|
49309
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
49310
|
-
className: "
|
|
49311
|
-
children: "
|
|
49312
|
-
|
|
49313
|
-
|
|
49314
|
-
|
|
49315
|
-
|
|
49316
|
-
|
|
49317
|
-
|
|
49318
|
-
|
|
49376
|
+
className: "flex flex-row items-center justify-between gap-4",
|
|
49377
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49378
|
+
className: "flex flex-col",
|
|
49379
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
49380
|
+
className: "text-sm font-medium text-gray-200",
|
|
49381
|
+
children: "Test JIT consent prompt"
|
|
49382
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
49383
|
+
className: "text-xs text-gray-400 mt-1",
|
|
49384
|
+
children: ["Fires a fake tool call from ", /*#__PURE__*/jsxRuntime.jsx("code", {
|
|
49385
|
+
children: "@test/jit-probe"
|
|
49386
|
+
}), " to", " ", /*#__PURE__*/jsxRuntime.jsx("code", {
|
|
49387
|
+
children: "test-server"
|
|
49388
|
+
}), ". 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."]
|
|
49389
|
+
})]
|
|
49390
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
49391
|
+
title: "Test prompt",
|
|
49392
|
+
onClick: triggerTestJitPrompt
|
|
49319
49393
|
})]
|
|
49320
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
49321
|
-
|
|
49322
|
-
|
|
49394
|
+
}), lastTestResult && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49395
|
+
className: "text-xs font-medium ".concat(TEST_RESULT_STYLE[lastTestResult.status] || "text-gray-400"),
|
|
49396
|
+
children: ["Last test (", lastTestResult.status, "): ", lastTestResult.message]
|
|
49323
49397
|
})]
|
|
49324
49398
|
})]
|
|
49325
49399
|
});
|
|
@@ -49673,10 +49747,10 @@ var noop = function noop() {};
|
|
|
49673
49747
|
* users who don't want the wall of text collapse manually.
|
|
49674
49748
|
*/
|
|
49675
49749
|
var HowThisWorksPanel = function HowThisWorksPanel() {
|
|
49676
|
-
var
|
|
49677
|
-
|
|
49678
|
-
open =
|
|
49679
|
-
setOpen =
|
|
49750
|
+
var _useState13 = React.useState(true),
|
|
49751
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
49752
|
+
open = _useState14[0],
|
|
49753
|
+
setOpen = _useState14[1];
|
|
49680
49754
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49681
49755
|
className: "border border-gray-700 rounded",
|
|
49682
49756
|
children: [/*#__PURE__*/jsxRuntime.jsxs("button", {
|