@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.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), {}, {
|
|
@@ -49214,37 +49235,84 @@ var EnforcementToggles = function EnforcementToggles() {
|
|
|
49214
49235
|
|
|
49215
49236
|
// One-click JIT trigger for testing. Calls the gate via a fake widget
|
|
49216
49237
|
// identity that has no grant — the gate denies, JIT escalates, the
|
|
49217
|
-
// modal pops.
|
|
49218
|
-
//
|
|
49219
|
-
//
|
|
49220
|
-
//
|
|
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
|
|
49221
49249
|
var triggerTestJitPrompt = /*#__PURE__*/function () {
|
|
49222
49250
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
49223
|
-
var _window$mainApi3, _window$mainApi3$call;
|
|
49251
|
+
var _window$mainApi3, _window$mainApi3$call, result, msg, _t5;
|
|
49224
49252
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
49225
49253
|
while (1) switch (_context5.prev = _context5.next) {
|
|
49226
49254
|
case 0:
|
|
49227
|
-
|
|
49228
|
-
|
|
49255
|
+
setLastTestResult({
|
|
49256
|
+
status: "pending",
|
|
49257
|
+
message: "Waiting for response…"
|
|
49258
|
+
});
|
|
49259
|
+
_context5.prev = 1;
|
|
49260
|
+
_context5.next = 2;
|
|
49229
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", {
|
|
49230
49262
|
path: "/tmp/jit-probe.txt"
|
|
49231
49263
|
}, null, "@test/jit-probe");
|
|
49232
|
-
case 1:
|
|
49233
|
-
_context5.next = 3;
|
|
49234
|
-
break;
|
|
49235
49264
|
case 2:
|
|
49236
|
-
|
|
49237
|
-
|
|
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;
|
|
49238
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:
|
|
49239
49299
|
case "end":
|
|
49240
49300
|
return _context5.stop();
|
|
49241
49301
|
}
|
|
49242
|
-
}, _callee5, null, [[
|
|
49302
|
+
}, _callee5, null, [[1, 3]]);
|
|
49243
49303
|
}));
|
|
49244
49304
|
return function triggerTestJitPrompt() {
|
|
49245
49305
|
return _ref6.apply(this, arguments);
|
|
49246
49306
|
};
|
|
49247
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
|
+
};
|
|
49248
49316
|
return /*#__PURE__*/jsxs("div", {
|
|
49249
49317
|
className: "flex flex-col space-y-4 border border-gray-700 rounded p-4",
|
|
49250
49318
|
children: [/*#__PURE__*/jsxs("div", {
|
|
@@ -49285,23 +49353,29 @@ var EnforcementToggles = function EnforcementToggles() {
|
|
|
49285
49353
|
},
|
|
49286
49354
|
onConfirm: confirmDisable
|
|
49287
49355
|
}), enforceEnabled && jitEnabled && /*#__PURE__*/jsxs("div", {
|
|
49288
|
-
className: "flex flex-
|
|
49356
|
+
className: "flex flex-col gap-2 border-t border-gray-800 pt-4",
|
|
49289
49357
|
children: [/*#__PURE__*/jsxs("div", {
|
|
49290
|
-
className: "flex flex-
|
|
49291
|
-
children: [/*#__PURE__*/
|
|
49292
|
-
className: "
|
|
49293
|
-
children: "
|
|
49294
|
-
|
|
49295
|
-
|
|
49296
|
-
|
|
49297
|
-
|
|
49298
|
-
|
|
49299
|
-
|
|
49300
|
-
|
|
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
|
|
49301
49375
|
})]
|
|
49302
|
-
}), /*#__PURE__*/
|
|
49303
|
-
|
|
49304
|
-
|
|
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]
|
|
49305
49379
|
})]
|
|
49306
49380
|
})]
|
|
49307
49381
|
});
|
|
@@ -49655,10 +49729,10 @@ var noop = function noop() {};
|
|
|
49655
49729
|
* users who don't want the wall of text collapse manually.
|
|
49656
49730
|
*/
|
|
49657
49731
|
var HowThisWorksPanel = function HowThisWorksPanel() {
|
|
49658
|
-
var
|
|
49659
|
-
|
|
49660
|
-
open =
|
|
49661
|
-
setOpen =
|
|
49732
|
+
var _useState13 = useState(true),
|
|
49733
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
49734
|
+
open = _useState14[0],
|
|
49735
|
+
setOpen = _useState14[1];
|
|
49662
49736
|
return /*#__PURE__*/jsxs("div", {
|
|
49663
49737
|
className: "border border-gray-700 rounded",
|
|
49664
49738
|
children: [/*#__PURE__*/jsxs("button", {
|