@trops/dash-core 0.1.500 → 0.1.502
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/electron/index.js +1570 -1163
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +145 -36
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +145 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -413,7 +413,9 @@ var WidgetApi = {
|
|
|
413
413
|
append = _ref$append === void 0 ? true : _ref$append,
|
|
414
414
|
_ref$returnEmpty = _ref.returnEmpty,
|
|
415
415
|
returnEmpty = _ref$returnEmpty === void 0 ? {} : _ref$returnEmpty,
|
|
416
|
-
uuid = _ref.uuid
|
|
416
|
+
uuid = _ref.uuid,
|
|
417
|
+
_ref$widgetId = _ref.widgetId,
|
|
418
|
+
widgetId = _ref$widgetId === void 0 ? null : _ref$widgetId;
|
|
417
419
|
try {
|
|
418
420
|
// set the filename
|
|
419
421
|
var toFilename = filename !== null ? filename : "".concat(uuid, ".json");
|
|
@@ -436,7 +438,7 @@ var WidgetApi = {
|
|
|
436
438
|
});
|
|
437
439
|
}
|
|
438
440
|
// request.
|
|
439
|
-
eApi.data.saveData(data, toFilename, append, returnEmpty);
|
|
441
|
+
eApi.data.saveData(data, toFilename, append, returnEmpty, widgetId);
|
|
440
442
|
}
|
|
441
443
|
}
|
|
442
444
|
} catch (e) {
|
|
@@ -464,7 +466,9 @@ var WidgetApi = {
|
|
|
464
466
|
callbackComplete = _ref2$callbackComplet === void 0 ? null : _ref2$callbackComplet,
|
|
465
467
|
_ref2$callbackError = _ref2.callbackError,
|
|
466
468
|
callbackError = _ref2$callbackError === void 0 ? null : _ref2$callbackError,
|
|
467
|
-
uuid = _ref2.uuid
|
|
469
|
+
uuid = _ref2.uuid,
|
|
470
|
+
_ref2$widgetId = _ref2.widgetId,
|
|
471
|
+
widgetId = _ref2$widgetId === void 0 ? null : _ref2$widgetId;
|
|
468
472
|
try {
|
|
469
473
|
var toFilename = filename !== null ? filename : "".concat(uuid, ".json");
|
|
470
474
|
var eApi = this.electronApi();
|
|
@@ -491,7 +495,7 @@ var WidgetApi = {
|
|
|
491
495
|
return callbackError(response);
|
|
492
496
|
});
|
|
493
497
|
}
|
|
494
|
-
eApi.data.readData(toFilename);
|
|
498
|
+
eApi.data.readData(toFilename, [], widgetId);
|
|
495
499
|
}
|
|
496
500
|
} catch (e) {
|
|
497
501
|
}
|
|
@@ -49169,6 +49173,27 @@ var EnforcementToggles = function EnforcementToggles() {
|
|
|
49169
49173
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
49170
49174
|
pendingDisable = _useState10[0],
|
|
49171
49175
|
setPendingDisable = _useState10[1];
|
|
49176
|
+
|
|
49177
|
+
// lastTestResult: feedback for the "Test prompt" button. Tells the
|
|
49178
|
+
// user whether their JIT response was actually persisted, so they
|
|
49179
|
+
// don't have to interpret the post-grant "server not connected"
|
|
49180
|
+
// error as failure.
|
|
49181
|
+
var _useState11 = useState(null),
|
|
49182
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
49183
|
+
lastTestResult = _useState12[0],
|
|
49184
|
+
setLastTestResult = _useState12[1];
|
|
49185
|
+
|
|
49186
|
+
// Auto-clear the test result after 30 seconds so it doesn't linger
|
|
49187
|
+
// forever after a successful test.
|
|
49188
|
+
useEffect(function () {
|
|
49189
|
+
if (!lastTestResult) return;
|
|
49190
|
+
var timer = setTimeout(function () {
|
|
49191
|
+
return setLastTestResult(null);
|
|
49192
|
+
}, 30000);
|
|
49193
|
+
return function () {
|
|
49194
|
+
return clearTimeout(timer);
|
|
49195
|
+
};
|
|
49196
|
+
}, [lastTestResult]);
|
|
49172
49197
|
var writeSecurity = function writeSecurity(updates) {
|
|
49173
49198
|
if (!(appContext !== null && appContext !== void 0 && appContext.changeSettings)) return;
|
|
49174
49199
|
var next = _objectSpread$g(_objectSpread$g({}, settings), {}, {
|
|
@@ -49214,37 +49239,84 @@ var EnforcementToggles = function EnforcementToggles() {
|
|
|
49214
49239
|
|
|
49215
49240
|
// One-click JIT trigger for testing. Calls the gate via a fake widget
|
|
49216
49241
|
// identity that has no grant — the gate denies, JIT escalates, the
|
|
49217
|
-
// modal pops.
|
|
49218
|
-
//
|
|
49219
|
-
//
|
|
49220
|
-
//
|
|
49242
|
+
// modal pops. We classify the outcome so the user knows whether their
|
|
49243
|
+
// JIT response was actually persisted (vs whether the test ran at all).
|
|
49244
|
+
//
|
|
49245
|
+
// Outcome classification:
|
|
49246
|
+
// message includes "Server not connected" → granted
|
|
49247
|
+
// (gate passed, post-gate server lookup expectedly failed because
|
|
49248
|
+
// "test-server" doesn't exist — the goal is the consent flow, not
|
|
49249
|
+
// the server response)
|
|
49250
|
+
// message includes "user declined" → denied
|
|
49251
|
+
// message includes "JIT consent timed out" → timeout
|
|
49252
|
+
// anything else → unknown error
|
|
49221
49253
|
var triggerTestJitPrompt = /*#__PURE__*/function () {
|
|
49222
49254
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
49223
|
-
var _window$mainApi3, _window$mainApi3$call;
|
|
49255
|
+
var _window$mainApi3, _window$mainApi3$call, result, msg, _t5;
|
|
49224
49256
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
49225
49257
|
while (1) switch (_context5.prev = _context5.next) {
|
|
49226
49258
|
case 0:
|
|
49227
|
-
|
|
49228
|
-
|
|
49259
|
+
setLastTestResult({
|
|
49260
|
+
status: "pending",
|
|
49261
|
+
message: "Waiting for response…"
|
|
49262
|
+
});
|
|
49263
|
+
_context5.prev = 1;
|
|
49264
|
+
_context5.next = 2;
|
|
49229
49265
|
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
49266
|
path: "/tmp/jit-probe.txt"
|
|
49231
49267
|
}, null, "@test/jit-probe");
|
|
49232
|
-
case 1:
|
|
49233
|
-
_context5.next = 3;
|
|
49234
|
-
break;
|
|
49235
49268
|
case 2:
|
|
49236
|
-
|
|
49237
|
-
|
|
49269
|
+
result = _context5.sent;
|
|
49270
|
+
// callTool resolves to { error, message } on the main side; classify.
|
|
49271
|
+
msg = (result === null || result === void 0 ? void 0 : result.message) || JSON.stringify(result || {});
|
|
49272
|
+
if (/server not connected/i.test(msg)) {
|
|
49273
|
+
setLastTestResult({
|
|
49274
|
+
status: "granted",
|
|
49275
|
+
message: "Granted — your response was saved as a 'live' grant for @test/jit-probe."
|
|
49276
|
+
});
|
|
49277
|
+
} else if (/user declined/i.test(msg)) {
|
|
49278
|
+
setLastTestResult({
|
|
49279
|
+
status: "denied",
|
|
49280
|
+
message: "Denied — no grant written."
|
|
49281
|
+
});
|
|
49282
|
+
} else if (/timed out/i.test(msg)) {
|
|
49283
|
+
setLastTestResult({
|
|
49284
|
+
status: "timeout",
|
|
49285
|
+
message: "Timed out — no response within 60s."
|
|
49286
|
+
});
|
|
49287
|
+
} else {
|
|
49288
|
+
setLastTestResult({
|
|
49289
|
+
status: "unknown",
|
|
49290
|
+
message: "Unexpected: " + msg
|
|
49291
|
+
});
|
|
49292
|
+
}
|
|
49293
|
+
_context5.next = 4;
|
|
49294
|
+
break;
|
|
49238
49295
|
case 3:
|
|
49296
|
+
_context5.prev = 3;
|
|
49297
|
+
_t5 = _context5["catch"](1);
|
|
49298
|
+
setLastTestResult({
|
|
49299
|
+
status: "error",
|
|
49300
|
+
message: "Test threw: " + ((_t5 === null || _t5 === void 0 ? void 0 : _t5.message) || String(_t5))
|
|
49301
|
+
});
|
|
49302
|
+
case 4:
|
|
49239
49303
|
case "end":
|
|
49240
49304
|
return _context5.stop();
|
|
49241
49305
|
}
|
|
49242
|
-
}, _callee5, null, [[
|
|
49306
|
+
}, _callee5, null, [[1, 3]]);
|
|
49243
49307
|
}));
|
|
49244
49308
|
return function triggerTestJitPrompt() {
|
|
49245
49309
|
return _ref6.apply(this, arguments);
|
|
49246
49310
|
};
|
|
49247
49311
|
}();
|
|
49312
|
+
var TEST_RESULT_STYLE = {
|
|
49313
|
+
pending: "text-gray-400",
|
|
49314
|
+
granted: "text-green-400",
|
|
49315
|
+
denied: "text-amber-400",
|
|
49316
|
+
timeout: "text-amber-400",
|
|
49317
|
+
unknown: "text-red-400",
|
|
49318
|
+
error: "text-red-400"
|
|
49319
|
+
};
|
|
49248
49320
|
return /*#__PURE__*/jsxs("div", {
|
|
49249
49321
|
className: "flex flex-col space-y-4 border border-gray-700 rounded p-4",
|
|
49250
49322
|
children: [/*#__PURE__*/jsxs("div", {
|
|
@@ -49285,23 +49357,29 @@ var EnforcementToggles = function EnforcementToggles() {
|
|
|
49285
49357
|
},
|
|
49286
49358
|
onConfirm: confirmDisable
|
|
49287
49359
|
}), enforceEnabled && jitEnabled && /*#__PURE__*/jsxs("div", {
|
|
49288
|
-
className: "flex flex-
|
|
49360
|
+
className: "flex flex-col gap-2 border-t border-gray-800 pt-4",
|
|
49289
49361
|
children: [/*#__PURE__*/jsxs("div", {
|
|
49290
|
-
className: "flex flex-
|
|
49291
|
-
children: [/*#__PURE__*/
|
|
49292
|
-
className: "
|
|
49293
|
-
children: "
|
|
49294
|
-
|
|
49295
|
-
|
|
49296
|
-
|
|
49297
|
-
|
|
49298
|
-
|
|
49299
|
-
|
|
49300
|
-
|
|
49362
|
+
className: "flex flex-row items-center justify-between gap-4",
|
|
49363
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
49364
|
+
className: "flex flex-col",
|
|
49365
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
49366
|
+
className: "text-sm font-medium text-gray-200",
|
|
49367
|
+
children: "Test JIT consent prompt"
|
|
49368
|
+
}), /*#__PURE__*/jsxs("span", {
|
|
49369
|
+
className: "text-xs text-gray-400 mt-1",
|
|
49370
|
+
children: ["Fires a fake tool call from ", /*#__PURE__*/jsx("code", {
|
|
49371
|
+
children: "@test/jit-probe"
|
|
49372
|
+
}), " to", " ", /*#__PURE__*/jsx("code", {
|
|
49373
|
+
children: "test-server"
|
|
49374
|
+
}), ". 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."]
|
|
49375
|
+
})]
|
|
49376
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
49377
|
+
title: "Test prompt",
|
|
49378
|
+
onClick: triggerTestJitPrompt
|
|
49301
49379
|
})]
|
|
49302
|
-
}), /*#__PURE__*/
|
|
49303
|
-
|
|
49304
|
-
|
|
49380
|
+
}), lastTestResult && /*#__PURE__*/jsxs("div", {
|
|
49381
|
+
className: "text-xs font-medium ".concat(TEST_RESULT_STYLE[lastTestResult.status] || "text-gray-400"),
|
|
49382
|
+
children: ["Last test (", lastTestResult.status, "): ", lastTestResult.message]
|
|
49305
49383
|
})]
|
|
49306
49384
|
})]
|
|
49307
49385
|
});
|
|
@@ -49363,6 +49441,7 @@ var ConfirmDisableInline = function ConfirmDisableInline(_ref7) {
|
|
|
49363
49441
|
});
|
|
49364
49442
|
};
|
|
49365
49443
|
var WidgetGrantRow = function WidgetGrantRow(_ref8) {
|
|
49444
|
+
var _granted$domains;
|
|
49366
49445
|
var widgetId = _ref8.widgetId,
|
|
49367
49446
|
declared = _ref8.declared,
|
|
49368
49447
|
granted = _ref8.granted,
|
|
@@ -49439,6 +49518,20 @@ var WidgetGrantRow = function WidgetGrantRow(_ref8) {
|
|
|
49439
49518
|
grantedItems: (grant === null || grant === void 0 ? void 0 : grant.writePaths) || []
|
|
49440
49519
|
})]
|
|
49441
49520
|
}, serverName);
|
|
49521
|
+
}), (granted === null || granted === void 0 || (_granted$domains = granted.domains) === null || _granted$domains === void 0 ? void 0 : _granted$domains.fs) && ((granted.domains.fs.readPaths || []).length > 0 || (granted.domains.fs.writePaths || []).length > 0) && /*#__PURE__*/jsxs("div", {
|
|
49522
|
+
className: "flex flex-col space-y-2 border-t border-gray-800 pt-2",
|
|
49523
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
49524
|
+
className: "text-xs uppercase tracking-wider opacity-70",
|
|
49525
|
+
children: "filesystem"
|
|
49526
|
+
}), /*#__PURE__*/jsx(PermsList, {
|
|
49527
|
+
label: "Read filenames",
|
|
49528
|
+
declaredItems: [],
|
|
49529
|
+
grantedItems: granted.domains.fs.readPaths || []
|
|
49530
|
+
}), /*#__PURE__*/jsx(PermsList, {
|
|
49531
|
+
label: "Write filenames",
|
|
49532
|
+
declaredItems: [],
|
|
49533
|
+
grantedItems: granted.domains.fs.writePaths || []
|
|
49534
|
+
})]
|
|
49442
49535
|
})]
|
|
49443
49536
|
});
|
|
49444
49537
|
};
|
|
@@ -49619,6 +49712,22 @@ var EXAMPLE_FIXTURES = [{
|
|
|
49619
49712
|
}
|
|
49620
49713
|
}
|
|
49621
49714
|
}
|
|
49715
|
+
}, {
|
|
49716
|
+
caption: "Phase 2 fs grant — widget granted access to a specific data file via JIT consent on saveData/readData.",
|
|
49717
|
+
widgetId: "@example/fs-domain-widget",
|
|
49718
|
+
hasManifest: false,
|
|
49719
|
+
grantOrigin: "live",
|
|
49720
|
+
declared: null,
|
|
49721
|
+
granted: {
|
|
49722
|
+
grantOrigin: "live",
|
|
49723
|
+
servers: {},
|
|
49724
|
+
domains: {
|
|
49725
|
+
fs: {
|
|
49726
|
+
readPaths: ["notes-state.json"],
|
|
49727
|
+
writePaths: ["notes-state.json"]
|
|
49728
|
+
}
|
|
49729
|
+
}
|
|
49730
|
+
}
|
|
49622
49731
|
}, {
|
|
49623
49732
|
caption: "Stale grant — the widget upgraded and dropped readPaths from its manifest, but the user's grant is still present.",
|
|
49624
49733
|
widgetId: "@example/upgraded-widget",
|
|
@@ -49655,10 +49764,10 @@ var noop = function noop() {};
|
|
|
49655
49764
|
* users who don't want the wall of text collapse manually.
|
|
49656
49765
|
*/
|
|
49657
49766
|
var HowThisWorksPanel = function HowThisWorksPanel() {
|
|
49658
|
-
var
|
|
49659
|
-
|
|
49660
|
-
open =
|
|
49661
|
-
setOpen =
|
|
49767
|
+
var _useState13 = useState(true),
|
|
49768
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
49769
|
+
open = _useState14[0],
|
|
49770
|
+
setOpen = _useState14[1];
|
|
49662
49771
|
return /*#__PURE__*/jsxs("div", {
|
|
49663
49772
|
className: "border border-gray-700 rounded",
|
|
49664
49773
|
children: [/*#__PURE__*/jsxs("button", {
|