@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.js
CHANGED
|
@@ -431,7 +431,9 @@ var WidgetApi = {
|
|
|
431
431
|
append = _ref$append === void 0 ? true : _ref$append,
|
|
432
432
|
_ref$returnEmpty = _ref.returnEmpty,
|
|
433
433
|
returnEmpty = _ref$returnEmpty === void 0 ? {} : _ref$returnEmpty,
|
|
434
|
-
uuid = _ref.uuid
|
|
434
|
+
uuid = _ref.uuid,
|
|
435
|
+
_ref$widgetId = _ref.widgetId,
|
|
436
|
+
widgetId = _ref$widgetId === void 0 ? null : _ref$widgetId;
|
|
435
437
|
try {
|
|
436
438
|
// set the filename
|
|
437
439
|
var toFilename = filename !== null ? filename : "".concat(uuid, ".json");
|
|
@@ -454,7 +456,7 @@ var WidgetApi = {
|
|
|
454
456
|
});
|
|
455
457
|
}
|
|
456
458
|
// request.
|
|
457
|
-
eApi.data.saveData(data, toFilename, append, returnEmpty);
|
|
459
|
+
eApi.data.saveData(data, toFilename, append, returnEmpty, widgetId);
|
|
458
460
|
}
|
|
459
461
|
}
|
|
460
462
|
} catch (e) {
|
|
@@ -482,7 +484,9 @@ var WidgetApi = {
|
|
|
482
484
|
callbackComplete = _ref2$callbackComplet === void 0 ? null : _ref2$callbackComplet,
|
|
483
485
|
_ref2$callbackError = _ref2.callbackError,
|
|
484
486
|
callbackError = _ref2$callbackError === void 0 ? null : _ref2$callbackError,
|
|
485
|
-
uuid = _ref2.uuid
|
|
487
|
+
uuid = _ref2.uuid,
|
|
488
|
+
_ref2$widgetId = _ref2.widgetId,
|
|
489
|
+
widgetId = _ref2$widgetId === void 0 ? null : _ref2$widgetId;
|
|
486
490
|
try {
|
|
487
491
|
var toFilename = filename !== null ? filename : "".concat(uuid, ".json");
|
|
488
492
|
var eApi = this.electronApi();
|
|
@@ -509,7 +513,7 @@ var WidgetApi = {
|
|
|
509
513
|
return callbackError(response);
|
|
510
514
|
});
|
|
511
515
|
}
|
|
512
|
-
eApi.data.readData(toFilename);
|
|
516
|
+
eApi.data.readData(toFilename, [], widgetId);
|
|
513
517
|
}
|
|
514
518
|
} catch (e) {
|
|
515
519
|
}
|
|
@@ -49187,6 +49191,27 @@ var EnforcementToggles = function EnforcementToggles() {
|
|
|
49187
49191
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
49188
49192
|
pendingDisable = _useState10[0],
|
|
49189
49193
|
setPendingDisable = _useState10[1];
|
|
49194
|
+
|
|
49195
|
+
// lastTestResult: feedback for the "Test prompt" button. Tells the
|
|
49196
|
+
// user whether their JIT response was actually persisted, so they
|
|
49197
|
+
// don't have to interpret the post-grant "server not connected"
|
|
49198
|
+
// error as failure.
|
|
49199
|
+
var _useState11 = React.useState(null),
|
|
49200
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
49201
|
+
lastTestResult = _useState12[0],
|
|
49202
|
+
setLastTestResult = _useState12[1];
|
|
49203
|
+
|
|
49204
|
+
// Auto-clear the test result after 30 seconds so it doesn't linger
|
|
49205
|
+
// forever after a successful test.
|
|
49206
|
+
React.useEffect(function () {
|
|
49207
|
+
if (!lastTestResult) return;
|
|
49208
|
+
var timer = setTimeout(function () {
|
|
49209
|
+
return setLastTestResult(null);
|
|
49210
|
+
}, 30000);
|
|
49211
|
+
return function () {
|
|
49212
|
+
return clearTimeout(timer);
|
|
49213
|
+
};
|
|
49214
|
+
}, [lastTestResult]);
|
|
49190
49215
|
var writeSecurity = function writeSecurity(updates) {
|
|
49191
49216
|
if (!(appContext !== null && appContext !== void 0 && appContext.changeSettings)) return;
|
|
49192
49217
|
var next = _objectSpread$g(_objectSpread$g({}, settings), {}, {
|
|
@@ -49232,37 +49257,84 @@ var EnforcementToggles = function EnforcementToggles() {
|
|
|
49232
49257
|
|
|
49233
49258
|
// One-click JIT trigger for testing. Calls the gate via a fake widget
|
|
49234
49259
|
// identity that has no grant — the gate denies, JIT escalates, the
|
|
49235
|
-
// modal pops.
|
|
49236
|
-
//
|
|
49237
|
-
//
|
|
49238
|
-
//
|
|
49260
|
+
// modal pops. We classify the outcome so the user knows whether their
|
|
49261
|
+
// JIT response was actually persisted (vs whether the test ran at all).
|
|
49262
|
+
//
|
|
49263
|
+
// Outcome classification:
|
|
49264
|
+
// message includes "Server not connected" → granted
|
|
49265
|
+
// (gate passed, post-gate server lookup expectedly failed because
|
|
49266
|
+
// "test-server" doesn't exist — the goal is the consent flow, not
|
|
49267
|
+
// the server response)
|
|
49268
|
+
// message includes "user declined" → denied
|
|
49269
|
+
// message includes "JIT consent timed out" → timeout
|
|
49270
|
+
// anything else → unknown error
|
|
49239
49271
|
var triggerTestJitPrompt = /*#__PURE__*/function () {
|
|
49240
49272
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
49241
|
-
var _window$mainApi3, _window$mainApi3$call;
|
|
49273
|
+
var _window$mainApi3, _window$mainApi3$call, result, msg, _t5;
|
|
49242
49274
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
49243
49275
|
while (1) switch (_context5.prev = _context5.next) {
|
|
49244
49276
|
case 0:
|
|
49245
|
-
|
|
49246
|
-
|
|
49277
|
+
setLastTestResult({
|
|
49278
|
+
status: "pending",
|
|
49279
|
+
message: "Waiting for response…"
|
|
49280
|
+
});
|
|
49281
|
+
_context5.prev = 1;
|
|
49282
|
+
_context5.next = 2;
|
|
49247
49283
|
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
49284
|
path: "/tmp/jit-probe.txt"
|
|
49249
49285
|
}, null, "@test/jit-probe");
|
|
49250
|
-
case 1:
|
|
49251
|
-
_context5.next = 3;
|
|
49252
|
-
break;
|
|
49253
49286
|
case 2:
|
|
49254
|
-
|
|
49255
|
-
|
|
49287
|
+
result = _context5.sent;
|
|
49288
|
+
// callTool resolves to { error, message } on the main side; classify.
|
|
49289
|
+
msg = (result === null || result === void 0 ? void 0 : result.message) || JSON.stringify(result || {});
|
|
49290
|
+
if (/server not connected/i.test(msg)) {
|
|
49291
|
+
setLastTestResult({
|
|
49292
|
+
status: "granted",
|
|
49293
|
+
message: "Granted — your response was saved as a 'live' grant for @test/jit-probe."
|
|
49294
|
+
});
|
|
49295
|
+
} else if (/user declined/i.test(msg)) {
|
|
49296
|
+
setLastTestResult({
|
|
49297
|
+
status: "denied",
|
|
49298
|
+
message: "Denied — no grant written."
|
|
49299
|
+
});
|
|
49300
|
+
} else if (/timed out/i.test(msg)) {
|
|
49301
|
+
setLastTestResult({
|
|
49302
|
+
status: "timeout",
|
|
49303
|
+
message: "Timed out — no response within 60s."
|
|
49304
|
+
});
|
|
49305
|
+
} else {
|
|
49306
|
+
setLastTestResult({
|
|
49307
|
+
status: "unknown",
|
|
49308
|
+
message: "Unexpected: " + msg
|
|
49309
|
+
});
|
|
49310
|
+
}
|
|
49311
|
+
_context5.next = 4;
|
|
49312
|
+
break;
|
|
49256
49313
|
case 3:
|
|
49314
|
+
_context5.prev = 3;
|
|
49315
|
+
_t5 = _context5["catch"](1);
|
|
49316
|
+
setLastTestResult({
|
|
49317
|
+
status: "error",
|
|
49318
|
+
message: "Test threw: " + ((_t5 === null || _t5 === void 0 ? void 0 : _t5.message) || String(_t5))
|
|
49319
|
+
});
|
|
49320
|
+
case 4:
|
|
49257
49321
|
case "end":
|
|
49258
49322
|
return _context5.stop();
|
|
49259
49323
|
}
|
|
49260
|
-
}, _callee5, null, [[
|
|
49324
|
+
}, _callee5, null, [[1, 3]]);
|
|
49261
49325
|
}));
|
|
49262
49326
|
return function triggerTestJitPrompt() {
|
|
49263
49327
|
return _ref6.apply(this, arguments);
|
|
49264
49328
|
};
|
|
49265
49329
|
}();
|
|
49330
|
+
var TEST_RESULT_STYLE = {
|
|
49331
|
+
pending: "text-gray-400",
|
|
49332
|
+
granted: "text-green-400",
|
|
49333
|
+
denied: "text-amber-400",
|
|
49334
|
+
timeout: "text-amber-400",
|
|
49335
|
+
unknown: "text-red-400",
|
|
49336
|
+
error: "text-red-400"
|
|
49337
|
+
};
|
|
49266
49338
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49267
49339
|
className: "flex flex-col space-y-4 border border-gray-700 rounded p-4",
|
|
49268
49340
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -49303,23 +49375,29 @@ var EnforcementToggles = function EnforcementToggles() {
|
|
|
49303
49375
|
},
|
|
49304
49376
|
onConfirm: confirmDisable
|
|
49305
49377
|
}), enforceEnabled && jitEnabled && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49306
|
-
className: "flex flex-
|
|
49378
|
+
className: "flex flex-col gap-2 border-t border-gray-800 pt-4",
|
|
49307
49379
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49308
|
-
className: "flex flex-
|
|
49309
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
49310
|
-
className: "
|
|
49311
|
-
children: "
|
|
49312
|
-
|
|
49313
|
-
|
|
49314
|
-
|
|
49315
|
-
|
|
49316
|
-
|
|
49317
|
-
|
|
49318
|
-
|
|
49380
|
+
className: "flex flex-row items-center justify-between gap-4",
|
|
49381
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49382
|
+
className: "flex flex-col",
|
|
49383
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
49384
|
+
className: "text-sm font-medium text-gray-200",
|
|
49385
|
+
children: "Test JIT consent prompt"
|
|
49386
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
49387
|
+
className: "text-xs text-gray-400 mt-1",
|
|
49388
|
+
children: ["Fires a fake tool call from ", /*#__PURE__*/jsxRuntime.jsx("code", {
|
|
49389
|
+
children: "@test/jit-probe"
|
|
49390
|
+
}), " to", " ", /*#__PURE__*/jsxRuntime.jsx("code", {
|
|
49391
|
+
children: "test-server"
|
|
49392
|
+
}), ". 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."]
|
|
49393
|
+
})]
|
|
49394
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
49395
|
+
title: "Test prompt",
|
|
49396
|
+
onClick: triggerTestJitPrompt
|
|
49319
49397
|
})]
|
|
49320
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
49321
|
-
|
|
49322
|
-
|
|
49398
|
+
}), lastTestResult && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49399
|
+
className: "text-xs font-medium ".concat(TEST_RESULT_STYLE[lastTestResult.status] || "text-gray-400"),
|
|
49400
|
+
children: ["Last test (", lastTestResult.status, "): ", lastTestResult.message]
|
|
49323
49401
|
})]
|
|
49324
49402
|
})]
|
|
49325
49403
|
});
|
|
@@ -49381,6 +49459,7 @@ var ConfirmDisableInline = function ConfirmDisableInline(_ref7) {
|
|
|
49381
49459
|
});
|
|
49382
49460
|
};
|
|
49383
49461
|
var WidgetGrantRow = function WidgetGrantRow(_ref8) {
|
|
49462
|
+
var _granted$domains;
|
|
49384
49463
|
var widgetId = _ref8.widgetId,
|
|
49385
49464
|
declared = _ref8.declared,
|
|
49386
49465
|
granted = _ref8.granted,
|
|
@@ -49457,6 +49536,20 @@ var WidgetGrantRow = function WidgetGrantRow(_ref8) {
|
|
|
49457
49536
|
grantedItems: (grant === null || grant === void 0 ? void 0 : grant.writePaths) || []
|
|
49458
49537
|
})]
|
|
49459
49538
|
}, serverName);
|
|
49539
|
+
}), (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__*/jsxRuntime.jsxs("div", {
|
|
49540
|
+
className: "flex flex-col space-y-2 border-t border-gray-800 pt-2",
|
|
49541
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
49542
|
+
className: "text-xs uppercase tracking-wider opacity-70",
|
|
49543
|
+
children: "filesystem"
|
|
49544
|
+
}), /*#__PURE__*/jsxRuntime.jsx(PermsList, {
|
|
49545
|
+
label: "Read filenames",
|
|
49546
|
+
declaredItems: [],
|
|
49547
|
+
grantedItems: granted.domains.fs.readPaths || []
|
|
49548
|
+
}), /*#__PURE__*/jsxRuntime.jsx(PermsList, {
|
|
49549
|
+
label: "Write filenames",
|
|
49550
|
+
declaredItems: [],
|
|
49551
|
+
grantedItems: granted.domains.fs.writePaths || []
|
|
49552
|
+
})]
|
|
49460
49553
|
})]
|
|
49461
49554
|
});
|
|
49462
49555
|
};
|
|
@@ -49637,6 +49730,22 @@ var EXAMPLE_FIXTURES = [{
|
|
|
49637
49730
|
}
|
|
49638
49731
|
}
|
|
49639
49732
|
}
|
|
49733
|
+
}, {
|
|
49734
|
+
caption: "Phase 2 fs grant — widget granted access to a specific data file via JIT consent on saveData/readData.",
|
|
49735
|
+
widgetId: "@example/fs-domain-widget",
|
|
49736
|
+
hasManifest: false,
|
|
49737
|
+
grantOrigin: "live",
|
|
49738
|
+
declared: null,
|
|
49739
|
+
granted: {
|
|
49740
|
+
grantOrigin: "live",
|
|
49741
|
+
servers: {},
|
|
49742
|
+
domains: {
|
|
49743
|
+
fs: {
|
|
49744
|
+
readPaths: ["notes-state.json"],
|
|
49745
|
+
writePaths: ["notes-state.json"]
|
|
49746
|
+
}
|
|
49747
|
+
}
|
|
49748
|
+
}
|
|
49640
49749
|
}, {
|
|
49641
49750
|
caption: "Stale grant — the widget upgraded and dropped readPaths from its manifest, but the user's grant is still present.",
|
|
49642
49751
|
widgetId: "@example/upgraded-widget",
|
|
@@ -49673,10 +49782,10 @@ var noop = function noop() {};
|
|
|
49673
49782
|
* users who don't want the wall of text collapse manually.
|
|
49674
49783
|
*/
|
|
49675
49784
|
var HowThisWorksPanel = function HowThisWorksPanel() {
|
|
49676
|
-
var
|
|
49677
|
-
|
|
49678
|
-
open =
|
|
49679
|
-
setOpen =
|
|
49785
|
+
var _useState13 = React.useState(true),
|
|
49786
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
49787
|
+
open = _useState14[0],
|
|
49788
|
+
setOpen = _useState14[1];
|
|
49680
49789
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49681
49790
|
className: "border border-gray-700 rounded",
|
|
49682
49791
|
children: [/*#__PURE__*/jsxRuntime.jsxs("button", {
|